Struct nrf52832_hal::wdt::Watchdog
source · [−]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!