diff --git a/embedded-mcu-hal/src/lib.rs b/embedded-mcu-hal/src/lib.rs index 0b7ae05..f148106 100644 --- a/embedded-mcu-hal/src/lib.rs +++ b/embedded-mcu-hal/src/lib.rs @@ -5,3 +5,5 @@ pub mod time; /// Traits for NVRAM (Non-Volatile Random Access Memory) storage and management. mod nvram; pub use nvram::{Nvram, NvramStorage}; + +pub mod watchdog; diff --git a/embedded-mcu-hal/src/watchdog.rs b/embedded-mcu-hal/src/watchdog.rs new file mode 100644 index 0000000..8d94be1 --- /dev/null +++ b/embedded-mcu-hal/src/watchdog.rs @@ -0,0 +1,13 @@ +//! Traits for interactions with a processor's watchdog timer. + +/// Feeds an existing watchdog to ensure the processor isn't reset. +pub trait Watchdog: Send { + /// An enumeration of `Watchdog` errors. + /// + type Error: core::fmt::Debug; + + /// Restarts the countdown on the watchdog. This must be done once the watchdog is started + /// to prevent the processor being reset. + /// + fn feed(&mut self) -> Result<(), Self::Error>; +}