File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ void hal_deepsleep(void)
161
161
// Disable IRQs
162
162
core_util_critical_section_enter ();
163
163
164
+ // Save the timer counter value in order to reprogram it after deepsleep
164
165
uint32_t EnterTimeUS = us_ticker_read ();
165
166
166
167
// Request to enter STOP mode with regulator in low power mode
@@ -198,9 +199,12 @@ void hal_deepsleep(void)
198
199
* deep sleep */
199
200
wait_loop (500 );
200
201
202
+ // Reprogram the timer counter value saved before the deepsleep
201
203
TIM_HandleTypeDef TimMasterHandle ;
202
204
TimMasterHandle .Instance = TIM_MST ;
203
205
__HAL_TIM_SET_COUNTER (& TimMasterHandle , EnterTimeUS );
206
+ __HAL_TIM_CLEAR_FLAG (& TimMasterHandle , TIM_FLAG_CC1 );
207
+ __HAL_TIM_ENABLE_IT (& TimMasterHandle , TIM_IT_CC1 );
204
208
205
209
#if DEVICE_RTC
206
210
/* Wait for RTC RSF bit synchro if RTC is configured */
You can’t perform that action at this time.
0 commit comments