From e15ebd3c53cbb4a775056e2e0a1519da288b21c4 Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 10 Oct 2017 17:04:29 +0200 Subject: [PATCH] STM32: RTC: Call irq_handler whenever interrupt fires lp_ticker driver is the known registered user of RTC handler API. In case, a lp_ticker is set in the past, the lp_ticker_fire_interrupt will be called which itself sets the RTC interrupt as pending by calling NVIC_SetPendingIRQ(RTC_WKUP_IRQn). This all happens without actual programing of the RTC wake-up. As a result the RTC HW and corresponding HAL layer doesn't expect an interrupt to happen and will not call HAL_RTCEx_WakeUpTimerEventCallback. To sove this situation, we will not use HAL_RTCEx_WakeUpTimerEventCallback weak definition but rather call handler whenever an RTC interrupt fires. --- targets/TARGET_STM/rtc_api.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/targets/TARGET_STM/rtc_api.c b/targets/TARGET_STM/rtc_api.c index c9e9341cf8..e592531fd2 100644 --- a/targets/TARGET_STM/rtc_api.c +++ b/targets/TARGET_STM/rtc_api.c @@ -295,13 +295,10 @@ int rtc_isenabled(void) static void RTC_IRQHandler(void) { + /* Update HAL state */ HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle); -} - -void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) -{ + /* In case of registered handler, call it. */ if (irq_handler) { - // Fire the user callback irq_handler(); } }