oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Typedefs | Functions
LVGL Internal Helpers

Internal oveRTOS abstraction layer for LVGL display integration. More...

Typedefs

typedef bool(* ove_lvgl_keypad_read_fn_t) (uint32_t *key, bool *pressed)
 Keypad read callback — the user implements this to deliver key events to LVGL via ove_lvgl_register_keypad().
 
typedef bool(* ove_lvgl_encoder_read_fn_t) (int16_t *diff, bool *pressed)
 Encoder read callback — the user implements this to deliver rotation/click events to LVGL.
 

Functions

int ove_lvgl_register_keypad (ove_lvgl_keypad_read_fn_t cb)
 Register a keypad input device with LVGL.
 
int ove_lvgl_register_encoder (ove_lvgl_encoder_read_fn_t cb)
 Register an encoder input device with LVGL.
 
void * ove_lvgl_get_keypad_indev (void)
 Returns the keypad LVGL input device handle (lv_indev_t * as void*) or NULL if none has been registered. Cast to lv_indev_t * at the call site and bind to an lv_group_t via lv_indev_set_group().
 
void * ove_lvgl_get_encoder_indev (void)
 Returns the encoder LVGL input device handle as void*, or NULL if none has been registered.
 
int ove_lvgl_init (void)
 Initialise the LVGL library and register the board's display driver.
 
void ove_lvgl_lock (void)
 Acquire the LVGL mutex before calling any LVGL API.
 
void ove_lvgl_unlock (void)
 Release the LVGL mutex after calling LVGL APIs.
 
void ove_lvgl_tick (uint32_t ms)
 Advance the LVGL internal tick counter.
 
void ove_lvgl_handler (void)
 Process pending LVGL tasks (rendering, input, animations).
 

Detailed Description

Internal oveRTOS abstraction layer for LVGL display integration.

This header declares the oveRTOS-specific LVGL lifecycle functions. Application code should include ove/lvgl.h instead, which provides both this API and the upstream LVGL headers in one include.

The backend is responsible for registering display and input drivers with LVGL during ove_lvgl_init(); the application only needs to call ove_lvgl_tick() and ove_lvgl_handler() periodically.

Note
Requires CONFIG_OVE_LVGL. When the option is disabled every function is replaced by a no-op stub.

Typedef Documentation

◆ ove_lvgl_keypad_read_fn_t

typedef bool(* ove_lvgl_keypad_read_fn_t) (uint32_t *key, bool *pressed)

Keypad read callback — the user implements this to deliver key events to LVGL via ove_lvgl_register_keypad().

Parameters
[out]keyFilled with the current LV_KEY_* code if a key is pressed.
[out]pressedFilled with true if currently pressed, false if released.
Returns
true if the callback wrote key and pressed (LVGL should use them), false to indicate no new input.

◆ ove_lvgl_encoder_read_fn_t

typedef bool(* ove_lvgl_encoder_read_fn_t) (int16_t *diff, bool *pressed)

Encoder read callback — the user implements this to deliver rotation/click events to LVGL.

Parameters
[out]diffFilled with the accumulated encoder delta since the last read (positive = clockwise).
[out]pressedFilled with true if the encoder switch is currently pressed.
Returns
true if the callback wrote diff and pressed.

Function Documentation

◆ ove_lvgl_register_keypad()

int ove_lvgl_register_keypad ( ove_lvgl_keypad_read_fn_t  cb)

Register a keypad input device with LVGL.

On first call the function creates an lv_indev_t of type keypad and installs an internal read-callback shim that dispatches to cb every refresh cycle. Subsequent calls replace the user callback without creating another indev.

Pass NULL to deregister (LVGL will still poll but the shim returns "no input").

Parameters
[in]cbCallback supplying keypad state, or NULL to deregister.
Returns
OVE_OK on success.

◆ ove_lvgl_register_encoder()

int ove_lvgl_register_encoder ( ove_lvgl_encoder_read_fn_t  cb)

Register an encoder input device with LVGL.

Same semantics as ove_lvgl_register_keypad() but for rotary encoder (+ push) input.

◆ ove_lvgl_get_keypad_indev()

void * ove_lvgl_get_keypad_indev ( void  )

Returns the keypad LVGL input device handle (lv_indev_t * as void*) or NULL if none has been registered. Cast to lv_indev_t * at the call site and bind to an lv_group_t via lv_indev_set_group().

The return type is void * so this header does not need to pull in <lvgl.h> or forward-declare LVGL types that conflict with its own typedefs.

◆ ove_lvgl_init()

int ove_lvgl_init ( void  )

Initialise the LVGL library and register the board's display driver.

Calls lv_init(), registers the backend display and (if present) the touch input driver, and starts any required background tasks.

Returns
OVE_OK on success, negative error code on failure.

◆ ove_lvgl_lock()

void ove_lvgl_lock ( void  )

Acquire the LVGL mutex before calling any LVGL API.

Must be paired with ove_lvgl_unlock(). Nesting is not supported.

◆ ove_lvgl_unlock()

void ove_lvgl_unlock ( void  )

Release the LVGL mutex after calling LVGL APIs.

Must be called after every ove_lvgl_lock().

◆ ove_lvgl_tick()

void ove_lvgl_tick ( uint32_t  ms)

Advance the LVGL internal tick counter.

Call this from a periodic timer or task every ms milliseconds. LVGL uses this counter for animations, transitions, and input debouncing.

Parameters
[in]msNumber of milliseconds elapsed since the last call.

◆ ove_lvgl_handler()

void ove_lvgl_handler ( void  )

Process pending LVGL tasks (rendering, input, animations).

Must be called regularly from the UI task — typically every LV_DEF_REFR_PERIOD milliseconds. Call ove_lvgl_lock() and ove_lvgl_unlock() around this call when sharing LVGL with other tasks.