shutdown added
This commit is contained in:
@@ -9,6 +9,15 @@ use embassy_stm32::pac;
|
||||
|
||||
use crate::config::WATCHDOG_TIMEOUT_US;
|
||||
|
||||
/// Clears system reset and standby flags after wakeup.
|
||||
///
|
||||
/// Call early in startup to:
|
||||
/// - Clear reset flags by setting `RMVF` in `RCC_CSR`.
|
||||
/// - If `SBF` in `PWR_SR` is set (woke from Standby), clear it.
|
||||
///
|
||||
/// # Registers
|
||||
/// - `RCC_CSR` — Reset and Clock Control / Status
|
||||
/// - `PWR_SR` — Power Control / Status
|
||||
pub fn clear_wakeup_flags() {
|
||||
info!("Clearing wakeup flags...");
|
||||
|
||||
@@ -26,6 +35,11 @@ pub fn clear_wakeup_flags() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the Independent Watchdog (IWDG) timer.
|
||||
/// Wakeup source: Can wake the system from Standby mode on timeout
|
||||
///
|
||||
/// # Timing
|
||||
/// - Timeout value is configured in `WATCHDOG_TIMEOUT_US` from config.rs
|
||||
pub async fn init_watchdog(iwdg: Peri<'_, peripherals::IWDG>) {
|
||||
info!("Initializing watchdog after watchdog wake...");
|
||||
let mut watchdog = IndependentWatchdog::new(iwdg, WATCHDOG_TIMEOUT_US);
|
||||
|
||||
Reference in New Issue
Block a user