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,6 +62,12 @@ int main(void) { #else /* TEST_DEEPSLEEP_ENABLE */ +static void my_overflowcb(RTCDriver *rtcp){ + (void)rtcp; + palTogglePad(IOPORT3, GPIOC_LED); + rtcSetAlarm(rtcGetSec() + 10); +} + static void my_secondcb(RTCDriver *rtcp){ (void)rtcp; //palTogglePad(IOPORT3, GPIOC_LED); @@ -73,25 +79,13 @@ static void my_alarmcb(RTCDriver *rtcp){ rtcSetAlarm(rtcGetSec() + 10); } -static void my_overflowcb(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); }