STM32 LOW_POWER_TIMER update : sleep

RSF synchro after deepsleep is not specific to Low Power Timer feature
And we have to check if RTC is configured before synchro
pull/5738/head
jeromecoutant 2017-11-07 17:50:56 +01:00 committed by adbridge
parent 9b8ecab9a9
commit 16a7ecee58
1 changed files with 12 additions and 5 deletions

View File

@ -101,8 +101,15 @@ void hal_deepsleep(void)
TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Instance = TIM_MST;
__HAL_TIM_SET_COUNTER(&TimMasterHandle, EnterTimeUS); __HAL_TIM_SET_COUNTER(&TimMasterHandle, EnterTimeUS);
#if DEVICE_LOWPOWERTIMER #if DEVICE_RTC
/* Wait for RTC RSF bit synchro if RTC is configured */
#if (TARGET_STM32F2) || (TARGET_STM32F4) || (TARGET_STM32F7)
if (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL)) {
#else /* (TARGET_STM32F2) || (TARGET_STM32F4) || (TARGET_STM32F7) */
if (__HAL_RCC_GET_RTC_SOURCE()) {
#endif /* (TARGET_STM32F2) || (TARGET_STM32F4) || (TARGET_STM32F7) */
rtc_synchronize(); rtc_synchronize();
}
#endif #endif
} }