embassy-stm32

Crates

git

Versions

stm32l011f4

Flavors

sleep

Function sleep 

Source
pub unsafe fn sleep(cs: CriticalSection<'_>)
Expand description

Sleep with WFI, attempting to enter the deepest STOP mode possible.

If it’s not possible to enter any STOP mode due to running peripherals it will still do a WFI sleep. Therefore this function is equivalent to WFI except with lower power consumption and higher latency.

§SAFETY

Care must be taken that we have ensured that the system is ready to go to deep sleep, otherwise HAL peripherals may misbehave. HAL drivers automatically prevent sleep as needed, but you might have to do it manually if you’re using some peripherals with the PAC directly.