scuffed uart print

This commit is contained in:
Priec
2025-12-13 00:55:30 +01:00
parent 2c9433cb84
commit f36a9fd9e2
4 changed files with 66 additions and 31 deletions

View File

@@ -1,22 +1,42 @@
// src/sleep/handler.rs
use embassy_time::{Duration, Timer};
use embassy_stm32::peripherals;
use embassy_stm32::Peri;
use crate::sleep::stop::StopEntry;
use crate::sleep::stop::*;
use crate::wakeup::iwdg::init_watchdog_reset;
use crate::hw_uart_pc::init::{LowPowerCmd, StopMode, StopModeConfig};
use defmt::info;
pub fn execute_low_power(cmd: LowPowerCmd) -> ! {
pub async fn execute_low_power(
cmd: LowPowerCmd,
iwdg: &mut Option<Peri<'static, peripherals::IWDG>>
) -> ! {
Timer::after(Duration::from_millis(10)).await;
match cmd {
LowPowerCmd::Standby8k => {
info!("Entering Standby with 8KB SRAM2 retention");
// call your existing standby function here
if let Some(wdg) = iwdg.take() {
init_watchdog_reset(wdg).await;
}
super::standby::enter_standby_with_sram2_8kb();
}
LowPowerCmd::StandbyFull => {
info!("Entering Standby with full SRAM2 retention");
if let Some(wdg) = iwdg.take() {
init_watchdog_reset(wdg).await;
}
super::standby::enter_standby_with_sram2_full();
}
LowPowerCmd::Standby => {
info!("Entering minimal Standby");
if let Some(wdg) = iwdg.take() {
init_watchdog_reset(wdg).await;
}
super::standby::enter_standby();
}
LowPowerCmd::Shutdown => {
@@ -25,6 +45,9 @@ pub fn execute_low_power(cmd: LowPowerCmd) -> ! {
}
LowPowerCmd::StopMode(StopModeConfig { mode, entry }) => {
info!("Entering {:?} with {:?}", mode, entry);
if let Some(wdg) = iwdg.take() {
init_watchdog_reset(wdg).await;
}
match mode {
StopMode::Stop1 => enter_stop1(entry),
StopMode::Stop2 => enter_stop2(entry),