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.
pull/11522/head
Laurent Meunier 2019-09-19 10:03:50 +02:00
parent 030e3e1f72
commit cd3105bb83
1 changed files with 2 additions and 3 deletions

View File

@ -115,10 +115,9 @@ void SysTimer<US_IN_TICK, IRQ>::set_wake_time(uint64_t at)
sleep_manager_lock_deep_sleep();
}
/* If deep sleep is unlocked, and we have enough time, let's go for it */
/* If we have enough time for deep sleep, let's consider we may enter it */
if (MBED_CONF_TARGET_DEEP_SLEEP_LATENCY > 0 &&
ticks_to_sleep > MBED_CONF_TARGET_DEEP_SLEEP_LATENCY &&
sleep_manager_can_deep_sleep()) {
ticks_to_sleep > MBED_CONF_TARGET_DEEP_SLEEP_LATENCY) {
/* Schedule the wake up interrupt early, allowing for the deep sleep latency */
_wake_early = true;
insert_absolute(wake_time - MBED_CONF_TARGET_DEEP_SLEEP_LATENCY * US_IN_TICK);