16#ifdef CONFIG_OVE_WATCHDOG
18#include <ove/watchdog.h>
56#ifdef CONFIG_OVE_ZERO_HEAP
57 int err = ove_watchdog_init(&handle_, &storage_, timeout_ms);
59 int err = ove_watchdog_create(&handle_, timeout_ms);
73#ifdef CONFIG_OVE_ZERO_HEAP
74 ove_watchdog_deinit(handle_);
76 ove_watchdog_destroy(handle_);
83#ifdef CONFIG_OVE_ZERO_HEAP
93 other.handle_ =
nullptr;
103 if (
this != &other) {
105 ove_watchdog_destroy(handle_);
106 handle_ = other.handle_;
107 other.handle_ =
nullptr;
121 return from_rc(ove_watchdog_start(handle_));
131 return from_rc(ove_watchdog_stop(handle_));
144 return from_rc(ove_watchdog_feed(handle_));
153 return handle_ !=
nullptr;
166 ove_watchdog_t handle_ =
nullptr;
167#ifdef CONFIG_OVE_ZERO_HEAP
168 ove_watchdog_storage_t storage_ = {};
RAII wrapper around an oveRTOS hardware watchdog timer.
Definition watchdog.hpp:36
~Watchdog() noexcept
Destroys the watchdog, stopping it and releasing the kernel resource.
Definition watchdog.hpp:69
bool valid() const
Returns true if the underlying kernel handle is non-null.
Definition watchdog.hpp:151
Result< void > feed() noexcept
Resets the watchdog countdown, preventing a system reset.
Definition watchdog.hpp:142
Result< void > start() noexcept
Arms the watchdog and starts the countdown.
Definition watchdog.hpp:119
Watchdog & operator=(Watchdog &&other) noexcept
Move-assignment operator — transfers ownership of the kernel handle.
Definition watchdog.hpp:101
ove_watchdog_t handle() const
Returns the raw oveRTOS watchdog handle.
Definition watchdog.hpp:160
Watchdog(Watchdog &&other) noexcept
Move constructor — transfers ownership of the kernel handle.
Definition watchdog.hpp:91
Watchdog(uint32_t timeout_ms)
Constructs the watchdog and tries to initialise it with the given timeout.
Definition watchdog.hpp:54
Result< void > stop() noexcept
Disarms the watchdog, stopping the countdown.
Definition watchdog.hpp:129
Strong ove::Error type, Result<T> alias, and std::error_code interop for the oveRTOS C++ binding.
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:20
Result< void > from_rc(int rc) noexcept
Lifts a substrate rc-code into a Result<void>.
Definition error.hpp:254
std::expected< T, Error > Result
std::expected-based result alias.
Definition error.hpp:139
Common type definitions and concepts for the C++ wrapper layer.