stm32: doc everything else.

This commit is contained in:
Dario Nieuwenhuis
2023-12-19 18:03:20 +01:00
parent 189b15c426
commit c8c8b89104
12 changed files with 127 additions and 48 deletions

View File

@ -6,6 +6,7 @@ use stm32_metapac::iwdg::vals::{Key, Pr};
use crate::rcc::LSI_FREQ;
/// Independent watchdog (IWDG) driver.
pub struct IndependentWatchdog<'d, T: Instance> {
wdg: PhantomData<&'d mut T>,
}
@ -64,10 +65,12 @@ impl<'d, T: Instance> IndependentWatchdog<'d, T> {
IndependentWatchdog { wdg: PhantomData }
}
/// Unleash (start) the watchdog.
pub fn unleash(&mut self) {
T::regs().kr().write(|w| w.set_key(Key::START));
}
/// Pet (reload, refresh) the watchdog.
pub fn pet(&mut self) {
T::regs().kr().write(|w| w.set_key(Key::RESET));
}
@ -79,6 +82,7 @@ mod sealed {
}
}
/// IWDG instance trait.
pub trait Instance: sealed::Instance {}
foreach_peripheral!(