stm32: Fix watchdog division by zero for 256 prescaler, add watchdog example for H7

This commit is contained in:
Matous Hybl
2022-11-09 14:10:46 +01:00
parent 059610a8de
commit cbc97758e3
2 changed files with 28 additions and 4 deletions

View File

@ -0,0 +1,24 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use defmt::*;
use embassy_executor::Spawner;
use embassy_stm32::wdg::IndependentWatchdog;
use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default());
info!("Hello World!");
let mut wdg = IndependentWatchdog::new(p.IWDG1, 20_000_000);
unsafe { wdg.unleash() };
loop {
Timer::after(Duration::from_secs(1)).await;
unsafe { wdg.pet() };
}
}