STM32 : issue to exit deepsleep when RTC has not been initialized

pull/5841/head
jeromecoutant 2017-12-21 10:50:47 +01:00 committed by adbridge
parent f42db05e55
commit fd800caced
1 changed files with 4 additions and 0 deletions

View File

@ -288,6 +288,7 @@ int rtc_isenabled(void)
void rtc_synchronize(void) void rtc_synchronize(void)
{ {
RtcHandle.Instance = RTC;
if (HAL_RTC_WaitForSynchro(&RtcHandle) != HAL_OK) { if (HAL_RTC_WaitForSynchro(&RtcHandle) != HAL_OK) {
error("rtc_synchronize error\n"); error("rtc_synchronize error\n");
} }
@ -298,6 +299,7 @@ void rtc_synchronize(void)
static void RTC_IRQHandler(void) static void RTC_IRQHandler(void)
{ {
/* Update HAL state */ /* Update HAL state */
RtcHandle.Instance = RTC;
HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle); HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle);
/* In case of registered handler, call it. */ /* In case of registered handler, call it. */
if (irq_handler) { if (irq_handler) {
@ -339,6 +341,7 @@ void rtc_set_wake_up_timer(uint32_t delta)
NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_IRQHandler); NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_IRQHandler);
NVIC_EnableIRQ(RTC_WKUP_IRQn); NVIC_EnableIRQ(RTC_WKUP_IRQn);
RtcHandle.Instance = RTC;
if (HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, 0xFFFF & WakeUpCounter, WakeUpClock[DivIndex-1]) != HAL_OK) { if (HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, 0xFFFF & WakeUpCounter, WakeUpClock[DivIndex-1]) != HAL_OK) {
error("rtc_set_wake_up_timer init error (%d)\n", DivIndex); error("rtc_set_wake_up_timer init error (%d)\n", DivIndex);
} }
@ -346,6 +349,7 @@ void rtc_set_wake_up_timer(uint32_t delta)
void rtc_deactivate_wake_up_timer(void) void rtc_deactivate_wake_up_timer(void)
{ {
RtcHandle.Instance = RTC;
HAL_RTCEx_DeactivateWakeUpTimer(&RtcHandle); HAL_RTCEx_DeactivateWakeUpTimer(&RtcHandle);
} }