Function stm32wlxx_hal::pwr::shutdown
source · pub fn shutdown() -> !
Expand description
Enter shutdown mode immediately.
Wakeup pins should be configured with setup_wakeup_pins
unless
you intend to wakeup only via reset.
This will:
- Disable interrupts.
- Set
PWR.CR1.LPMS
to shutdown. - Set
SCB.SCR.SLEEPDEEP
. - Enter WFI.
Example
use stm32wlxx_hal::{pac, pwr::shutdown};
let mut cp: pac::CorePeripherals = pac::CorePeripherals::take().unwrap();
// SLEEPDEEP is implemented with retention
// generally you will want to clear this at power-on when using shutdown
cp.SCB.clear_sleepdeep();
// ... do things
shutdown();