#![no_main]
#![no_std]
#[macro_use]
mod utilities;
use stm32h7xx_hal::{
independent_watchdog::IndependentWatchdog, pac, prelude::*,
};
use cortex_m_rt::entry;
use log::info;
#[entry]
fn main() -> ! {
utilities::logger::init();
let dp = pac::Peripherals::take().unwrap();
info!("Setup PWR... ");
let pwr = dp.PWR.constrain();
let pwrcfg = example_power!(pwr).freeze();
info!("Setup RCC... ");
let rcc = dp.RCC.constrain();
let _ccdr = rcc.sys_ck(96.MHz()).freeze(pwrcfg, &dp.SYSCFG);
#[cfg(any(feature = "rm0433", feature = "rm0455"))]
let mut watchdog = IndependentWatchdog::new(dp.IWDG);
#[cfg(all(feature = "rm0399", feature = "cm7"))]
let mut watchdog = IndependentWatchdog::new(dp.IWDG1);
#[cfg(all(feature = "rm0399", feature = "cm4"))]
let mut watchdog = IndependentWatchdog::new(dp.IWDG2);
#[cfg(all(feature = "rm0468"))]
let mut watchdog = IndependentWatchdog::new(dp.IWDG1);
info!("");
info!("stm32h7xx-hal example - Watchdog");
info!("");
info!("Watchdog restarted! ");
watchdog.start(32_760.millis());
loop {
cortex_m::asm::nop()
}
}