Skip to main content

WindowWatchdog

Struct WindowWatchdog 

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

Window watchdog (WWDG) driver.

The watchdog is running as soon as new returns; there is no separate start step and no way to stop it short of a reset.

Implementations§

Source§

impl<'d, T: WwdgInstance> WindowWatchdog<'d, T>

Source

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

Start the watchdog with a timeout_us period and a window_us closed window.

A refresh during the closed window resets the chip; pass 0 to allow a refresh at any time. Panics if window_us >= timeout_us or if the timeout does not fit the 7-bit counter at any prescaler (the maximum is PCLK1 / 4096 / 8 * 64 ticks).

Source

pub fn pet(&mut self)

Reload the counter.

Refreshing while the live counter is at or above window resets the chip, so time the call for the open part of the period.

Source

pub fn counter(&self) -> u8

Read the live seven-bit down-counter.

Source

pub fn window(&self) -> u8

Window value the live counter must fall below before a refresh.

Source

pub fn enable_early_wakeup_interrupt(&mut self)

Enable the early-wakeup interrupt at counter value 0x40.

The caller must install and enable the WWDG interrupt handler; this bit is only cleared by a peripheral reset.

Source

pub fn early_wakeup_pending(&self) -> bool

Whether the counter has reached 0x40 since EWIF was last cleared. The flag is raised even with the early-wakeup interrupt disabled.

Source

pub fn clear_early_wakeup(&mut self)

Clear the early-wakeup flag (write zero to clear).

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'d, T> UnsafeUnpin for WindowWatchdog<'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.