RAII wrapper around an oveRTOS hardware watchdog timer.
More...
#include <watchdog.hpp>
|
| | Watchdog (uint32_t timeout_ms) |
| | Constructs and initialises the watchdog with the given timeout.
|
| |
|
| ~Watchdog () |
| | Destroys the watchdog, stopping it and releasing the kernel resource.
|
| |
|
| Watchdog (const Watchdog &)=delete |
| |
|
Watchdog & | operator= (const Watchdog &)=delete |
| |
| | Watchdog (Watchdog &&other) noexcept |
| | Move constructor — transfers ownership of the kernel handle.
|
| |
| Watchdog & | operator= (Watchdog &&other) noexcept |
| | Move-assignment operator — transfers ownership of the kernel handle.
|
| |
| int | start () |
| | Arms the watchdog and starts the countdown.
|
| |
| int | stop () |
| | Disarms the watchdog, stopping the countdown.
|
| |
| int | feed () |
| | Resets the watchdog countdown, preventing a system reset.
|
| |
| bool | valid () const |
| | Returns true if the underlying kernel handle is non-null.
|
| |
| ove_watchdog_t | handle () const |
| | Returns the raw oveRTOS watchdog handle.
|
| |
RAII wrapper around an oveRTOS hardware watchdog timer.
The watchdog resets the system if feed() is not called within the configured timeout. Use start() to arm the watchdog after construction. The destructor stops and releases the underlying kernel resource.
- Note
- Not copyable. Move-only when heap allocation is enabled.
◆ Watchdog() [1/2]
| ove::Watchdog::Watchdog |
( |
uint32_t |
timeout_ms | ) |
|
|
inlineexplicit |
Constructs and initialises the watchdog with the given timeout.
- Parameters
-
| [in] | timeout_ms | Watchdog timeout in milliseconds. |
Asserts at startup if initialisation fails.
◆ Watchdog() [2/2]
| ove::Watchdog::Watchdog |
( |
Watchdog && |
other | ) |
|
|
inlinenoexcept |
Move constructor — transfers ownership of the kernel handle.
- Parameters
-
| other | The source; its handle is set to null after the move. |
◆ operator=()
Move-assignment operator — transfers ownership of the kernel handle.
- Parameters
-
| other | The source; its handle is set to null after the move. |
- Returns
- Reference to this object.
◆ start()
| int ove::Watchdog::start |
( |
| ) |
|
|
inline |
Arms the watchdog and starts the countdown.
- Returns
OVE_OK on success, or a negative error code.
◆ stop()
| int ove::Watchdog::stop |
( |
| ) |
|
|
inline |
Disarms the watchdog, stopping the countdown.
- Returns
OVE_OK on success, or a negative error code.
◆ feed()
| int ove::Watchdog::feed |
( |
| ) |
|
|
inline |
Resets the watchdog countdown, preventing a system reset.
Must be called within the configured timeout period.
- Returns
OVE_OK on success, or a negative error code.
◆ valid()
| bool ove::Watchdog::valid |
( |
| ) |
const |
|
inline |
Returns true if the underlying kernel handle is non-null.
- Returns
true when the watchdog was successfully initialised.
◆ handle()
| ove_watchdog_t ove::Watchdog::handle |
( |
| ) |
const |
|
inline |
Returns the raw oveRTOS watchdog handle.
- Returns
- The opaque
ove_watchdog_t handle.
The documentation for this class was generated from the following file: