pub fn configure(lpwr: LPWR<'static>) -> Sleepsleep_light_sleep only.Expand description
Creates resources for managing light/deep sleep with esp-rtos.
The returned Sleep struct contains the idle hook and a deep sleep handle,
if deep sleep is supported.
Pass the idle hook to start_with_idle_hook to enable automatic light sleep.
Each time the scheduler runs out of ready tasks, the hook (with interrupts disabled) checks that:
- no
WakeLockis held, - all cores are idle,
- the next wakeup is at least
ESP_RTOS_CONFIG_LIGHT_SLEEP_MIN_USmicroseconds away.
If all hold, it calls LowPower::sleep_light for the next wakeup; otherwise
it falls back to WFI. The minimum-residency threshold is configurable via the
ESP_RTOS_CONFIG_LIGHT_SLEEP_MIN_US build-time option (default 1000).
On multi-core chips, the core that commits to sleep hardware-stalls the other core(s) for the duration of the sleep so their CPU state is frozen and restored coherently, then thaws them on wakeup.
See WakeLock for the wake-lock contract that governs when sleeping is safe.