Skip to content

Commit 7cde58d

Browse files
LMESTMadbridge
authored andcommitted
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.
1 parent 4215a38 commit 7cde58d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,10 @@ int rtc_isenabled(void)
296296

297297
static void RTC_IRQHandler(void)
298298
{
299+
/* Update HAL state */
299300
HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle);
300-
}
301-
302-
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
303-
{
301+
/* In case of registered handler, call it. */
304302
if (irq_handler) {
305-
// Fire the user callback
306303
irq_handler();
307304
}
308305
}

0 commit comments

Comments
 (0)