File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ void hal_sleep(void)
158
158
}
159
159
160
160
extern int serial_is_tx_ongoing (void );
161
+ extern int mbed_sdk_inited ;
161
162
162
163
void hal_deepsleep (void )
163
164
{
@@ -200,6 +201,10 @@ void hal_deepsleep(void)
200
201
HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
201
202
#endif /* TARGET_STM32L4 */
202
203
204
+ /* Prevent HAL_GetTick() from using ticker_read_us() to read the
205
+ * us_ticker timestamp until the us_ticker context is restored. */
206
+ mbed_sdk_inited = 0 ;
207
+
203
208
// Verify Clock Out of Deep Sleep
204
209
ForceClockOutofDeepSleep ();
205
210
@@ -214,6 +219,10 @@ void hal_deepsleep(void)
214
219
215
220
restore_timer_ctx ();
216
221
222
+ /* us_ticker context restored, allow HAL_GetTick() to read the us_ticker
223
+ * timestamp via ticker_read_us() again. */
224
+ mbed_sdk_inited = 1 ;
225
+
217
226
// Enable IRQs
218
227
core_util_critical_section_exit ();
219
228
}
You can’t perform that action at this time.
0 commit comments