oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::lvgl::Timer Class Reference

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
 
Timeroperator= (const Timer &)=delete
 
 Timer (Timer &&other) noexcept
 Move constructor — transfers ownership; source becomes empty.
 
Timeroperator= (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.
 
Timerperiod (uint32_t ms)
 Updates the timer period in milliseconds.
 
Timerpause ()
 Pauses the timer (can be resumed).
 
Timerresume ()
 Resumes a paused timer.
 
Timerrepeat_count (int32_t count)
 Sets the number of times the timer should fire.
 
Timerreset ()
 Resets the internal elapsed-time counter.
 
Timerready ()
 Makes the timer ready to fire on the next lv_timer_handler() pass.
 

Detailed Description

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.

Warning
Do NOT call lvgl::lock() / construct LvglGuard from inside a timer callback — the LVGL mutex is not reentrant.
Note
Non-copyable, movable. Owns the underlying lv_timer_t *.

Constructor & Destructor Documentation

◆ Timer()

ove::lvgl::Timer::Timer ( lv_timer_cb_t  cb,
uint32_t  period_ms,
void *  user_data = nullptr 
)
inline

Creates and starts an LVGL timer.

Parameters
[in]cbCallback invoked every period_ms milliseconds.
[in]period_msTimer period in milliseconds.
[in]user_dataOpaque pointer retrievable via lv_timer_get_user_data().

Member Function Documentation

◆ repeat_count()

Timer & ove::lvgl::Timer::repeat_count ( int32_t  count)
inline

Sets the number of times the timer should fire.

Parameters
[in]countRemaining fires, or -1 for infinite.

The documentation for this class was generated from the following file: