20#ifdef CONFIG_OVE_TIMER
66 Timer(F callback,
void *user_data, uint32_t period_ms,
bool one_shot =
false)
69#ifdef CONFIG_OVE_ZERO_HEAP
70 int err = ove_timer_init(&handle_, &storage_, callback, user_data, period_ms,
73 int err = ove_timer_create(&handle_, callback, user_data, period_ms,
76 OVE_STATIC_INIT_ASSERT(err == OVE_OK);
86#ifdef CONFIG_OVE_ZERO_HEAP
87 ove_timer_deinit(handle_);
89 ove_timer_destroy(handle_);
96#ifdef CONFIG_OVE_ZERO_HEAP
106 other.handle_ =
nullptr;
116 if (
this != &other) {
118 ove_timer_destroy(handle_);
119 handle_ = other.handle_;
120 other.handle_ =
nullptr;
133 return from_rc(ove_timer_start(handle_));
143 return from_rc(ove_timer_stop(handle_));
153 return from_rc(ove_timer_reset(handle_));
162 return handle_ !=
nullptr;
175 ove_timer_t handle_ =
nullptr;
176#ifdef CONFIG_OVE_ZERO_HEAP
177 ove_timer_storage_t storage_ = {};
RAII wrapper around an oveRTOS software timer.
Definition timer.hpp:49
Result< void > reset() noexcept
Restarts the timer, resetting the period countdown.
Definition timer.hpp:151
Timer & operator=(Timer &&other) noexcept
Move-assignment operator — transfers ownership of the kernel handle.
Definition timer.hpp:114
Result< void > start() noexcept
Starts the timer.
Definition timer.hpp:131
Result< void > stop() noexcept
Stops the timer without resetting its period.
Definition timer.hpp:141
Timer(F callback, void *user_data, uint32_t period_ms, bool one_shot=false)
Constructs and initialises the timer.
Definition timer.hpp:66
ove_timer_t handle() const
Returns the raw oveRTOS timer handle.
Definition timer.hpp:169
Timer(Timer &&other) noexcept
Move constructor — transfers ownership of the kernel handle.
Definition timer.hpp:104
bool valid() const
Returns true if the underlying kernel handle is non-null.
Definition timer.hpp:160
~Timer() noexcept
Destroys the timer, stopping it if running and releasing the kernel resource.
Definition timer.hpp:82
Concept satisfied by any callable convertible to ove_timer_fn.
Definition timer.hpp:34
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.