oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::Watchdog Class Reference

RAII wrapper around an oveRTOS hardware watchdog timer. More...

#include <watchdog.hpp>

Public Member Functions

 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
 
Watchdogoperator= (const Watchdog &)=delete
 
 Watchdog (Watchdog &&other) noexcept
 Move constructor — transfers ownership of the kernel handle.
 
Watchdogoperator= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Watchdog() [1/2]

ove::Watchdog::Watchdog ( uint32_t  timeout_ms)
inlineexplicit

Constructs and initialises the watchdog with the given timeout.

Parameters
[in]timeout_msWatchdog 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
otherThe source; its handle is set to null after the move.

Member Function Documentation

◆ operator=()

Watchdog & ove::Watchdog::operator= ( Watchdog &&  other)
inlinenoexcept

Move-assignment operator — transfers ownership of the kernel handle.

Parameters
otherThe 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: