diff --git a/semestralka_2_uart/src/bin/main.rs b/semestralka_2_uart/src/bin/main.rs index f684223..bcab76e 100644 --- a/semestralka_2_uart/src/bin/main.rs +++ b/semestralka_2_uart/src/bin/main.rs @@ -19,7 +19,7 @@ use dma_gpio::config::{ BAUD, PIPE_HW_RX, PIPE_HW_TX, }; use dma_gpio::hw_uart_pc::driver::uart_task; -use dma_gpio::wakeup::iwdg::{clear_wakeup_flags, init_watchdog}; +use dma_gpio::wakeup::iwdg::{clear_wakeup_flags, init_watchdog_reset}; use dma_gpio::sleep::shutdown; use dma_gpio::sleep::standby; use {defmt_rtt as _, panic_probe as _}; @@ -112,11 +112,15 @@ async fn main(spawner: Spawner) { [4] Shutdown — lowest power, full reset on wake", BAUD, WATCHDOG_TIMEOUT_US / 1_000_000 ); + + // disabling st-link debug + dbg.cr().modify(|w| { + w.set_dbg_standby(false); + w.set_dbg_stop(false); + }); // END OF DEBUG INFO // MAIN LOOP - Timer::after(Duration::from_millis(500)).await; - Timer::after(Duration::from_millis(10)).await; info!("ready for uart"); @@ -124,17 +128,17 @@ async fn main(spawner: Spawner) { let cmd = CMD_CH.receive().await; match cmd { LowPowerCmd::Standby8k => { - init_watchdog(p.IWDG).await; // watchdog reset at configurated time + init_watchdog_reset(p.IWDG).await; // watchdog reset at configurated time Timer::after(Duration::from_millis(10)).await; // let UART flush standby::enter_standby_with_sram2_8kb(); } LowPowerCmd::StandbyFull => { - init_watchdog(p.IWDG).await; + init_watchdog_reset(p.IWDG).await; Timer::after(Duration::from_millis(10)).await; standby::enter_standby_with_sram2_full(); } LowPowerCmd::Standby => { - init_watchdog(p.IWDG).await; + init_watchdog_reset(p.IWDG).await; Timer::after(Duration::from_millis(10)).await; standby::enter_standby(); } diff --git a/semestralka_2_uart/src/wakeup/iwdg.rs b/semestralka_2_uart/src/wakeup/iwdg.rs index bffdc3c..704eb7d 100644 --- a/semestralka_2_uart/src/wakeup/iwdg.rs +++ b/semestralka_2_uart/src/wakeup/iwdg.rs @@ -42,7 +42,7 @@ pub fn clear_wakeup_flags() { /// /// # Timing /// - Timeout value is configured in `WATCHDOG_TIMEOUT_US` from config.rs -pub async fn init_watchdog(iwdg: Peri<'_, peripherals::IWDG>) { +pub async fn init_watchdog_reset(iwdg: Peri<'_, peripherals::IWDG>) { info!("Initializing watchdog after watchdog wake..."); let mut watchdog = IndependentWatchdog::new(iwdg, WATCHDOG_TIMEOUT_US); watchdog.unleash();