File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,16 @@ void hal_deepsleep(void)
68
68
#if TARGET_STM32L4
69
69
int pwrClockEnabled = __HAL_RCC_PWR_IS_CLK_ENABLED ();
70
70
int lowPowerModeEnabled = PWR -> CR1 & PWR_CR1_LPR ;
71
-
71
+
72
72
if (!pwrClockEnabled ) {
73
73
__HAL_RCC_PWR_CLK_ENABLE ();
74
74
}
75
75
if (lowPowerModeEnabled ) {
76
76
HAL_PWREx_DisableLowPowerRunMode ();
77
77
}
78
-
78
+
79
79
HAL_PWREx_EnterSTOP2Mode (PWR_STOPENTRY_WFI );
80
-
80
+
81
81
if (lowPowerModeEnabled ) {
82
82
HAL_PWREx_EnableLowPowerRunMode ();
83
83
}
@@ -101,8 +101,15 @@ void hal_deepsleep(void)
101
101
TimMasterHandle .Instance = TIM_MST ;
102
102
__HAL_TIM_SET_COUNTER (& TimMasterHandle , EnterTimeUS );
103
103
104
- #if DEVICE_LOWPOWERTIMER
105
- rtc_synchronize ();
104
+ #if DEVICE_RTC
105
+ /* Wait for RTC RSF bit synchro if RTC is configured */
106
+ #if (TARGET_STM32F2 ) || (TARGET_STM32F4 ) || (TARGET_STM32F7 )
107
+ if (READ_BIT (RCC -> BDCR , RCC_BDCR_RTCSEL )) {
108
+ #else /* (TARGET_STM32F2) || (TARGET_STM32F4) || (TARGET_STM32F7) */
109
+ if (__HAL_RCC_GET_RTC_SOURCE ()) {
110
+ #endif /* (TARGET_STM32F2) || (TARGET_STM32F4) || (TARGET_STM32F7) */
111
+ rtc_synchronize ();
112
+ }
106
113
#endif
107
114
}
108
115
You can’t perform that action at this time.
0 commit comments