16#ifdef CONFIG_OVE_WATCHDOG
18#include <ove/watchdog.h>
42#ifdef CONFIG_OVE_ZERO_HEAP
43 int err = ove_watchdog_init(&handle_, &storage_,
46 int err = ove_watchdog_create(&handle_, timeout_ms);
48 OVE_STATIC_INIT_ASSERT(err == OVE_OK);
56#ifdef CONFIG_OVE_ZERO_HEAP
57 ove_watchdog_deinit(handle_);
59 ove_watchdog_destroy(handle_);
66#ifdef CONFIG_OVE_ZERO_HEAP
75 other.handle_ =
nullptr;
85 if (handle_) ove_watchdog_destroy(handle_);
86 handle_ = other.handle_;
87 other.handle_ =
nullptr;
98 return ove_watchdog_start(handle_);
106 return ove_watchdog_stop(handle_);
117 return ove_watchdog_feed(handle_);
124 bool valid()
const {
return handle_ !=
nullptr; }
130 ove_watchdog_t
handle()
const {
return handle_; }
133 ove_watchdog_t handle_ =
nullptr;
134#ifdef CONFIG_OVE_ZERO_HEAP
135 ove_watchdog_storage_t storage_ = {};
RAII wrapper around an oveRTOS hardware watchdog timer.
Definition watchdog.hpp:33
bool valid() const
Returns true if the underlying kernel handle is non-null.
Definition watchdog.hpp:124
int feed()
Resets the watchdog countdown, preventing a system reset.
Definition watchdog.hpp:116
~Watchdog()
Destroys the watchdog, stopping it and releasing the kernel resource.
Definition watchdog.hpp:54
Watchdog & operator=(Watchdog &&other) noexcept
Move-assignment operator — transfers ownership of the kernel handle.
Definition watchdog.hpp:83
ove_watchdog_t handle() const
Returns the raw oveRTOS watchdog handle.
Definition watchdog.hpp:130
Watchdog(Watchdog &&other) noexcept
Move constructor — transfers ownership of the kernel handle.
Definition watchdog.hpp:74
int start()
Arms the watchdog and starts the countdown.
Definition watchdog.hpp:97
Watchdog(uint32_t timeout_ms)
Constructs and initialises the watchdog with the given timeout.
Definition watchdog.hpp:41
int stop()
Disarms the watchdog, stopping the countdown.
Definition watchdog.hpp:105
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19
Common type definitions and concepts for the C++ wrapper layer.