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:

  1. Disable interrupts.
  2. Set PWR.CR1.LPMS to shutdown.
  3. Set SCB.SCR.SLEEPDEEP.
  4. 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();