From 076c1733859a4e00b75fbf57d9faa5d437a33822 Mon Sep 17 00:00:00 2001 From: barthess Date: Wed, 7 Sep 2011 12:54:11 +0000 Subject: RTC. Test code updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3294 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F1xx/RTC/halconf.h | 2 +- testhal/STM32F1xx/RTC/main.c | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'testhal') diff --git a/testhal/STM32F1xx/RTC/halconf.h b/testhal/STM32F1xx/RTC/halconf.h index 553decda8..58023ba58 100644 --- a/testhal/STM32F1xx/RTC/halconf.h +++ b/testhal/STM32F1xx/RTC/halconf.h @@ -209,7 +209,7 @@ * @brief Switch to TRUE if you need callbacks from RTC. */ #if !defined(RTC_SUPPORTS_CALLBACKS) || defined(__DOXYGEN__) -#define RTC_SUPPORTS_CALLBACKS FALSE +#define RTC_SUPPORTS_CALLBACKS TRUE #endif /** diff --git a/testhal/STM32F1xx/RTC/main.c b/testhal/STM32F1xx/RTC/main.c index 497b7f0cf..d68919ecf 100644 --- a/testhal/STM32F1xx/RTC/main.c +++ b/testhal/STM32F1xx/RTC/main.c @@ -21,7 +21,7 @@ #include "ch.h" #include "hal.h" -#define TEST_DEEPSLEEP_ENABLE +//#define TEST_DEEPSLEEP_ENABLE #ifdef TEST_DEEPSLEEP_ENABLE @@ -62,36 +62,30 @@ int main(void) { #else /* TEST_DEEPSLEEP_ENABLE */ -static void my_secondcb(RTCDriver *rtcp){ +static void my_overflowcb(RTCDriver *rtcp){ (void)rtcp; - //palTogglePad(IOPORT3, GPIOC_LED); + palTogglePad(IOPORT3, GPIOC_LED); + rtcSetAlarm(rtcGetSec() + 10); } -static void my_alarmcb(RTCDriver *rtcp){ +static void my_secondcb(RTCDriver *rtcp){ (void)rtcp; - palTogglePad(IOPORT3, GPIOC_LED); - rtcSetAlarm(rtcGetSec() + 10); + //palTogglePad(IOPORT3, GPIOC_LED); } -static void my_overflowcb(RTCDriver *rtcp){ +static void my_alarmcb(RTCDriver *rtcp){ (void)rtcp; palTogglePad(IOPORT3, GPIOC_LED); rtcSetAlarm(rtcGetSec() + 10); } -static const RTCConfig rtccfg={ - my_overflowcb, - my_secondcb, - my_alarmcb, -}; int main(void) { halInit(); chSysInit(); rtcSetAlarm(rtcGetSec() + 10); - rtcStart(&RTCD, &rtccfg); - + rtcSetCallback(&RTCD, NULL, my_secondcb, my_alarmcb); while (TRUE){ chThdSleepMilliseconds(500); } -- cgit v1.2.3