Skip to main content

WwdgtRunning

Struct WwdgtRunning 

Source
pub struct WwdgtRunning { /* private fields */ }
Expand description

The watchdog once it is counting down.

No way out: WDGTEN ignores a written zero and only a hardware reset clears it, so neither the peripheral nor the period comes back.

Implementations§

Source§

impl WwdgtRunning

Source

pub fn feed(&mut self)

Reloads the counter, which must happen inside the window: too early resets the chip exactly as too late does.

Source

pub fn set_period(&mut self, cnt: u8, win: u8)

Changes the period and the window, taking effect at the next feed.

The new window applies at once, so the next feed is already judged by it.

§Panics

On the same three conditions as Wwdgt::start.

Source

pub fn listen(&mut self)

Lets the counter reaching 0x40 raise an interrupt — one tick before the reset, the last moment anything can still run.

Irreversible, like the watchdog itself: EWIE ignores a written zero, so there is no unlisten. Unmasking the line in the NVIC is the caller’s.

Source

pub fn is_listening(&self) -> bool

Whether the early wakeup interrupt is enabled.

Source

pub fn is_pending(&self) -> bool

Whether the counter has reached 0x40.

Hardware sets the flag whether or not listen was called, so this doubles as a plain poll for “one tick left”.

Source

pub fn clear_interrupt(&mut self)

Clears the flag, which a handler must do before returning — the flag is the request, and hardware never drops it.

The flag rises again for as long as the counter sits at 0x40, so a handler that only clears it is entered over and over until the reset. For exactly one entry, mask the line in the NVIC inside the handler.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.