Skip to content

Commit f8a8845

Browse files
committed
SysTimer should let deep sleep happen
When next SysTimer wake-up is scheduler far enough, always consider that deep sleep may be entered and program an early wake-up. So that even if deep sleep is only allowed some time later, it can be entered. If not doing this, then the deep sleep would be prevented by SysTimer itself and may not be entered at all. This has been proved to happen in a simple blinly example.
1 parent 0f49e95 commit f8a8845

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

platform/source/SysTimer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ void SysTimer<US_IN_TICK, IRQ>::set_wake_time(uint64_t at)
115115
sleep_manager_lock_deep_sleep();
116116
}
117117

118-
/* If deep sleep is unlocked, and we have enough time, let's go for it */
118+
/* If we have enough time for deep sleep, let's consider we may enter it */
119119
if (MBED_CONF_TARGET_DEEP_SLEEP_LATENCY > 0 &&
120-
ticks_to_sleep > MBED_CONF_TARGET_DEEP_SLEEP_LATENCY &&
121-
sleep_manager_can_deep_sleep()) {
120+
ticks_to_sleep > MBED_CONF_TARGET_DEEP_SLEEP_LATENCY) {
122121
/* Schedule the wake up interrupt early, allowing for the deep sleep latency */
123122
_wake_early = true;
124123
insert_absolute(wake_time - MBED_CONF_TARGET_DEEP_SLEEP_LATENCY * US_IN_TICK);

0 commit comments

Comments
 (0)