19#ifdef CONFIG_OVE_TIMER
63 Timer(F callback,
void *user_data, uint32_t period_ms,
64 bool one_shot =
false)
67#ifdef CONFIG_OVE_ZERO_HEAP
68 int err = ove_timer_init(&handle_, &storage_, callback,
72 int err = ove_timer_create(&handle_, callback, user_data,
76 OVE_STATIC_INIT_ASSERT(err == OVE_OK);
84#ifdef CONFIG_OVE_ZERO_HEAP
85 ove_timer_deinit(handle_);
87 ove_timer_destroy(handle_);
94#ifdef CONFIG_OVE_ZERO_HEAP
103 other.handle_ =
nullptr;
112 if (
this != &other) {
113 if (handle_) ove_timer_destroy(handle_);
114 handle_ = other.handle_;
115 other.handle_ =
nullptr;
126 return ove_timer_start(handle_);
134 return ove_timer_stop(handle_);
142 return ove_timer_reset(handle_);
149 bool valid()
const {
return handle_ !=
nullptr; }
155 ove_timer_t
handle()
const {
return handle_; }
158 ove_timer_t handle_ =
nullptr;
159#ifdef CONFIG_OVE_ZERO_HEAP
160 ove_timer_storage_t storage_ = {};
RAII wrapper around an oveRTOS software timer.
Definition timer.hpp:46
int stop()
Stops the timer without resetting its period.
Definition timer.hpp:133
int start()
Starts the timer.
Definition timer.hpp:125
~Timer()
Destroys the timer, stopping it if running and releasing the kernel resource.
Definition timer.hpp:82
Timer & operator=(Timer &&other) noexcept
Move-assignment operator — transfers ownership of the kernel handle.
Definition timer.hpp:111
Timer(F callback, void *user_data, uint32_t period_ms, bool one_shot=false)
Constructs and initialises the timer.
Definition timer.hpp:63
ove_timer_t handle() const
Returns the raw oveRTOS timer handle.
Definition timer.hpp:155
int reset()
Restarts the timer, resetting the period countdown.
Definition timer.hpp:141
Timer(Timer &&other) noexcept
Move constructor — transfers ownership of the kernel handle.
Definition timer.hpp:102
bool valid() const
Returns true if the underlying kernel handle is non-null.
Definition timer.hpp:149
Concept satisfied by any callable convertible to ove_timer_fn.
Definition timer.hpp:32
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:19
Common type definitions and concepts for the C++ wrapper layer.