Skip to main content

IndependentWatchdog

Struct IndependentWatchdog 

Source
pub struct IndependentWatchdog<'d, T: Instance> { /* private fields */ }
Expand description

Independent watchdog (IWDG) driver.

new configures the timeout but leaves the watchdog stopped, so construction alone cannot reset the chip. Start it with unleash once the system can meet the deadline.

Implementations§

Source§

impl<'d, T: Instance> IndependentWatchdog<'d, T>

Source

pub fn new(inner: Peri<'d, T>, timeout_us: u32) -> Self

Configure the watchdog for a timeout_us microsecond period.

The period is (reload + 1) * prescaler / clock; the clock is the LSI, or HSI / 1024 on CH32X0. Both are RC oscillators with a tolerance, so leave margin and pet well before the nominal deadline. Panics if the timeout does not fit the 12-bit counter with the largest prescaler (32 s at 32.768 kHz, 26 s at 40 kHz).

Source

pub fn unleash(&mut self)

Start the watchdog. This is irreversible until the next reset.

Source

pub fn pet(&mut self)

Reload the counter from RLDR. Call this well inside every period.

Auto Trait Implementations§

§

impl<'d, T> !UnwindSafe for IndependentWatchdog<'d, T>

§

impl<'d, T> Freeze for IndependentWatchdog<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for IndependentWatchdog<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for IndependentWatchdog<'d, T>
where T: Send,

§

impl<'d, T> Sync for IndependentWatchdog<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for IndependentWatchdog<'d, T>
where T: Unpin,

§

impl<'d, T> UnsafeUnpin for IndependentWatchdog<'d, T>
where T: UnsafeUnpin,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.