embedded_hal/
watchdog.rs

1//! Traits for interactions with a processors watchdog timer.
2
3/// Feeds an existing watchdog to ensure the processor isn't reset. Sometimes
4/// commonly referred to as "kicking" or "refreshing".
5#[cfg(feature = "unproven")]
6pub trait Watchdog {
7    /// Triggers the watchdog. This must be done once the watchdog is started
8    /// to prevent the processor being reset.
9    fn feed(&mut self);
10}
11
12/// Enables A watchdog timer to reset the processor if software is frozen or
13/// stalled.
14#[cfg(feature = "unproven")]
15pub trait WatchdogEnable {
16    /// Unit of time used by the watchdog
17    type Time;
18    /// Starts the watchdog with a given period, typically once this is done
19    /// the watchdog needs to be kicked periodically or the processor is reset.
20    fn start<T>(&mut self, period: T)
21    where
22        T: Into<Self::Time>;
23}
24
25/// Disables a running watchdog timer so the processor won't be reset.
26#[cfg(feature = "unproven")]
27pub trait WatchdogDisable {
28    /// Disables the watchdog
29    fn disable(&mut self);
30}