shutdown added

This commit is contained in:
Priec
2025-12-03 17:57:10 +01:00
parent 33543099c2
commit 434e2b3d21
4 changed files with 32 additions and 11 deletions

View File

@@ -19,16 +19,13 @@ use dma_gpio::config::{
};
use dma_gpio::hw_uart_pc::{driver::uart_task, usart1};
use dma_gpio::wakeup::iwdg::{clear_wakeup_flags, init_watchdog};
use dma_gpio::sleep::shutdown::enter_shutdown;
use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs {
USART1 => BufferedInterruptHandler<peripherals::USART1>;
});
unsafe extern "C" {
fn HAL_PWR_EnterSTANDBYMode();
}
#[embassy_executor::main]
async fn main(spawner: Spawner) {
info!("boot");
@@ -65,18 +62,14 @@ async fn main(spawner: Spawner) {
info!("DBGMCU CR: dbg_stop={}, dbg_standby={}", cr.dbg_stop(), cr.dbg_standby());
// MAIN LOOP
info!("Preparing for standby...");
Timer::after(Duration::from_millis(500)).await;
init_watchdog(p.IWDG).await;
// init_watchdog(p.IWDG).await;
Timer::after(Duration::from_millis(10)).await;
unsafe {
info!("Standby...");
HAL_PWR_EnterSTANDBYMode();
}
loop {
info!("entering shutdown");
enter_shutdown();
cortex_m::asm::wfi();
yield_now().await;
}