Struct nrf52810_hal::wdt::Watchdog

source ·
pub struct Watchdog<T>
where T: WdMode,
{ /* private fields */ }
Expand description

An interface to the Watchdog.

Implementations§

source§

impl Watchdog<Inactive>

source

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.

source

pub fn release(self) -> WDT

Release the peripheral.

Note: The peripheral cannot be released after activation.

source

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.

source

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.

source

pub fn disable_interrupt(&mut self)

Disable the watchdog interrupt.

NOTE: This has no effect on the reset caused by the Watchdog.

source

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.

source

pub fn run_during_sleep(&self, setting: bool)

Should the watchdog continue to count during sleep modes?

This value defaults to ENABLED on reset.

source

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.

source§

impl Watchdog<Active>

source

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.

source

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!

source§

impl<T> Watchdog<T>
where T: WdMode,

source

pub fn is_active(&self) -> bool

Is the watchdog active?

Auto Trait Implementations§

§

impl<T> Freeze for Watchdog<T>
where T: Freeze,

§

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§

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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.
source§

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

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.