Skip to content

Commit 053072c

Browse files
committed
STM32 : set back US counter after deepsleep
1 parent e851941 commit 053072c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

targets/TARGET_STM/sleep.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void hal_deepsleep(void)
5353
{
5454
// Stop HAL tick
5555
HAL_SuspendTick();
56+
uint32_t EnterTimeUS = us_ticker_read();
5657

5758
// Request to enter STOP mode with regulator in low power mode
5859
#if TARGET_STM32L4
@@ -84,6 +85,10 @@ void hal_deepsleep(void)
8485
// After wake-up from STOP reconfigure the PLL
8586
SetSysClock();
8687

88+
TIM_HandleTypeDef TimMasterHandle;
89+
TimMasterHandle.Instance = TIM_MST;
90+
__HAL_TIM_SET_COUNTER(&TimMasterHandle, EnterTimeUS);
91+
8792
#if DEVICE_LOWPOWERTIMER
8893
rtc_synchronize();
8994
#endif

0 commit comments

Comments
 (0)