Files
stm32_rust/semestralka_2_uart/src/sleep/handler.rs

36 lines
1.2 KiB
Rust

use crate::sleep::stop::StopEntry;
use crate::sleep::stop::*;
use crate::hw_uart_pc::init::{LowPowerCmd, StopMode, StopModeConfig};
use defmt::info;
pub fn execute_low_power(cmd: LowPowerCmd) -> ! {
match cmd {
LowPowerCmd::Standby8k => {
info!("Entering Standby with 8KB SRAM2 retention");
// call your existing standby function here
super::standby::enter_standby_with_sram2_8kb();
}
LowPowerCmd::StandbyFull => {
info!("Entering Standby with full SRAM2 retention");
super::standby::enter_standby_with_sram2_full();
}
LowPowerCmd::Standby => {
info!("Entering minimal Standby");
super::standby::enter_standby();
}
LowPowerCmd::Shutdown => {
info!("Entering Shutdown mode");
super::shutdown::enter_shutdown();
}
LowPowerCmd::StopMode(StopModeConfig { mode, entry }) => {
info!("Entering {:?} with {:?}", mode, entry);
match mode {
StopMode::Stop1 => enter_stop1(entry),
StopMode::Stop2 => enter_stop2(entry),
StopMode::Stop3 => enter_stop3(entry),
}
}
}
}