From 968d0cf6e9e8f362021e4288cd3336fe7922e00e Mon Sep 17 00:00:00 2001 From: barthess Date: Fri, 16 Dec 2011 14:42:23 +0000 Subject: RTC. High level API rolled back. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3619 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F1xx/RTC/main.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'testhal') diff --git a/testhal/STM32F1xx/RTC/main.c b/testhal/STM32F1xx/RTC/main.c index e8e3480ec..ea7155f47 100644 --- a/testhal/STM32F1xx/RTC/main.c +++ b/testhal/STM32F1xx/RTC/main.c @@ -45,9 +45,9 @@ int main(void) { chThdCreateStatic(blinkWA, sizeof(blinkWA), NORMALPRIO, blink_thd, NULL); /* set alarm in near future */ - rtcGetTime(&RTCD1, ×pec); + rtcGetTime(×pec); alarmspec.tv_sec = timespec.tv_sec + 60; - rtcSetAlarm(&RTCD1, 0, &alarmspec); + rtcSetAlarm(&alarmspec); while (TRUE){ chThdSleepSeconds(10); @@ -63,10 +63,8 @@ int main(void) { #else /* TEST_ALARM_WAKEUP */ -/** - * Callback function for RTC. - */ static void my_cb(RTCDriver *rtcp, rtcevent_t event) { + (void)rtcp; switch (event) { @@ -79,31 +77,21 @@ static void my_cb(RTCDriver *rtcp, rtcevent_t event) { case RTC_EVENT_ALARM: palTogglePad(GPIOC, GPIOC_LED); rtcGetTime(&RTCD1, ×pec); - alarmspec.tv_sec = timespec.tv_sec + 5; + alarmspec.tv_sec = timespec.tv_sec + 10; rtcSetAlarm(&RTCD1, 0, &alarmspec); break; } } -/** - * Configuration structure with all callbacks supported by platform. - */ -static RTCCallbackConfig rtc_cb_cfg = { - my_cb -}; - -/** - * Main function. - */ -int main(void){ +int main(void) { halInit(); chSysInit(); rtcGetTime(&RTCD1, ×pec); - alarmspec.tv_sec = timespec.tv_sec + 5; + alarmspec.tv_sec = timespec.tv_sec + 10; rtcSetAlarm(&RTCD1, 0, &alarmspec); - rtcSetCallback(&RTCD1, &rtc_cb_cfg); + rtcSetCallback(&RTCD1, my_cb); while (TRUE){ chThdSleepMilliseconds(500); } -- cgit v1.2.3