|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
RAII wrapper for LVGL's built-in timer system. More...
#include <lvgl.hpp>
Public Member Functions | |
| Timer () | |
| Constructs a null (inactive) timer. | |
| Timer (lv_timer_cb_t cb, uint32_t period_ms, void *user_data=nullptr) | |
| Creates and starts an LVGL timer. | |
| Timer (const Timer &)=delete | |
| Timer & | operator= (const Timer &)=delete |
| Timer (Timer &&other) noexcept | |
| Move constructor — transfers ownership; source becomes empty. | |
| Timer & | operator= (Timer &&other) noexcept |
Move-assignment — deletes the current timer, then takes other's. | |
| lv_timer_t * | get () const |
Returns the raw lv_timer_t * for FFI interop. | |
| operator bool () const | |
true when this Timer holds a live LVGL timer. | |
| Timer & | period (uint32_t ms) |
| Updates the timer period in milliseconds. | |
| Timer & | pause () |
| Pauses the timer (can be resumed). | |
| Timer & | resume () |
| Resumes a paused timer. | |
| Timer & | repeat_count (int32_t count) |
| Sets the number of times the timer should fire. | |
| Timer & | reset () |
| Resets the internal elapsed-time counter. | |
| Timer & | ready () |
Makes the timer ready to fire on the next lv_timer_handler() pass. | |
RAII wrapper for LVGL's built-in timer system.
LVGL timers fire from inside lv_timer_handler() under the existing LVGL lock — callbacks do NOT need to acquire LvglGuard again. This is the preferred timer for UI updates driven by the LVGL task itself, versus ove::Timer which fires from an OS timer task and requires manual locking in the callback.
lvgl::lock() / construct LvglGuard from inside a timer callback — the LVGL mutex is not reentrant.lv_timer_t *.
|
inline |
Creates and starts an LVGL timer.
| [in] | cb | Callback invoked every period_ms milliseconds. |
| [in] | period_ms | Timer period in milliseconds. |
| [in] | user_data | Opaque pointer retrievable via lv_timer_get_user_data(). |
|
inline |
Sets the number of times the timer should fire.
| [in] | count | Remaining fires, or -1 for infinite. |