Skip to content

Commit fcdd529

Browse files
committed
Re-enable IT CC1 after deepsleep
1 parent f785c23 commit fcdd529

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

targets/TARGET_STM/sleep.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ void hal_deepsleep(void)
161161
// Disable IRQs
162162
core_util_critical_section_enter();
163163

164+
// Save the timer counter value in order to reprogram it after deepsleep
164165
uint32_t EnterTimeUS = us_ticker_read();
165166

166167
// Request to enter STOP mode with regulator in low power mode
@@ -198,9 +199,12 @@ void hal_deepsleep(void)
198199
* deep sleep */
199200
wait_loop(500);
200201

202+
// Reprogram the timer counter value saved before the deepsleep
201203
TIM_HandleTypeDef TimMasterHandle;
202204
TimMasterHandle.Instance = TIM_MST;
203205
__HAL_TIM_SET_COUNTER(&TimMasterHandle, EnterTimeUS);
206+
__HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC1);
207+
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1);
204208

205209
#if DEVICE_RTC
206210
/* Wait for RTC RSF bit synchro if RTC is configured */

0 commit comments

Comments
 (0)