pub struct Watchdog<T> where
T: WdMode, { /* private fields */ }
Expand description
An interface to the Watchdog.
Implementations
sourceimpl Watchdog<Inactive>
impl Watchdog<Inactive>
sourcepub fn try_new(wdt: WDT) -> Result<Watchdog<Inactive>, WDT>
pub fn try_new(wdt: WDT) -> Result<Watchdog<Inactive>, WDT>
Try to create a new watchdog instance from the peripheral.
This function will return an error if the watchdog has already
been activated, which may happen on a (non-watchdog) soft reset.
In this case, it may be possible to still obtain the handles with
the Watchdog::try_recover()
method.
If the watchdog has already started, configuration is no longer possible.
sourcepub fn release(self) -> WDT
pub fn release(self) -> WDT
Release the peripheral.
Note: The peripheral cannot be released after activation.
sourcepub fn activate<H>(self) -> Parts<<H as Handles>::Handles> where
H: Handles,
pub fn activate<H>(self) -> Parts<<H as Handles>::Handles> where
H: Handles,
Activate the watchdog with the given number of handles.
The watchdog cannot be deactivated after starting.
NOTE: All activated handles must be pet within the configured time interval to prevent a reset from occurring.
sourcepub fn enable_interrupt(&mut self)
pub fn enable_interrupt(&mut self)
Enable the watchdog interrupt.
NOTE: Although the interrupt will occur, there is no way to prevent the reset from occurring. From the time the event was fired, the system will reset two LFCLK ticks later (61 microseconds) if the interrupt has been enabled.
sourcepub fn disable_interrupt(&mut self)
pub fn disable_interrupt(&mut self)
Disable the watchdog interrupt.
NOTE: This has no effect on the reset caused by the Watchdog.
sourcepub fn set_lfosc_ticks(&mut self, ticks: u32)
pub fn set_lfosc_ticks(&mut self, ticks: u32)
Set the number of 32.768kHz ticks in each watchdog period.
This value defaults to 0xFFFF_FFFF (1.5 days) on reset.
Note: there is a minimum of 15 ticks (458 microseconds). If a lower number is provided, 15 ticks will be used as the configured value.
sourcepub fn run_during_sleep(&self, setting: bool)
pub fn run_during_sleep(&self, setting: bool)
Should the watchdog continue to count during sleep modes?
This value defaults to ENABLED on reset.
sourcepub fn run_during_debug_halt(&self, setting: bool)
pub fn run_during_debug_halt(&self, setting: bool)
Should the watchdog continue to count when the CPU is halted for debug?
This value defaults to DISABLED on reset.
sourceimpl Watchdog<Active>
impl Watchdog<Active>
sourcepub fn awaiting_pets(&self) -> bool
pub fn awaiting_pets(&self) -> bool
Is the watchdog still awaiting pets from any handle?
This reports whether sufficient pets have been received from all handles to prevent a reset this time period.
sourcepub fn try_recover<H>(wdt: WDT) -> Result<Parts<<H as Handles>::Handles>, WDT> where
H: Handles,
pub fn try_recover<H>(wdt: WDT) -> Result<Parts<<H as Handles>::Handles>, WDT> where
H: Handles,
Try to recover a handle to an already running watchdog. If the number of requested handles matches the activated number of handles, an activated handle will be returned. Otherwise the peripheral will be returned.
NOTE: Since the watchdog is already counting, you want to pet these dogs as soon as possible!
Auto Trait Implementations
impl<T> RefUnwindSafe for Watchdog<T> where
T: RefUnwindSafe,
impl<T> Send for Watchdog<T> where
T: Send,
impl<T> !Sync for Watchdog<T>
impl<T> Unpin for Watchdog<T> where
T: Unpin,
impl<T> UnwindSafe for Watchdog<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.