SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches
ui_widget_mgr.h
Go to the documentation of this file.
1/*******************************************************************************
2 * File Name: ui_widget_mgr.h
3 *
4 * Description: Widget handle table and LVGL widget lifecycle manager.
5 * Maps handle IDs (0-31) to lv_obj_t* pointers.
6 * Creates, modifies, deletes LVGL widgets in GFX task context.
7 *
8 *******************************************************************************/
9
10#ifndef UI_WIDGET_MGR_H
11#define UI_WIDGET_MGR_H
12
13#include "ipc_ui_protocol.h"
14#include "lvgl.h"
15#include <stdbool.h>
16#include <stdint.h>
17
22void ui_widget_mgr_init(lv_obj_t *parent);
23
30void ui_widget_mgr_set_parent(lv_obj_t *parent);
31
37
43int ui_widget_mgr_create(const ipc_ui_create_t *cfg);
44
51int ui_widget_mgr_create_sprite(const lv_image_dsc_t *dsc, int16_t x, int16_t y);
52
57void ui_widget_mgr_set_sprite_image(int handle, const lv_image_dsc_t *dsc);
58
63void ui_widget_mgr_delete(int handle);
64
69
73void ui_widget_mgr_set_text(int handle, const char *text);
74
78void ui_widget_mgr_set_value(int handle, int32_t value);
79
83void ui_widget_mgr_set_position(int handle, int16_t x, int16_t y);
84
88void ui_widget_mgr_set_size(int handle, int16_t w, int16_t h);
89
93void ui_widget_mgr_set_color(int handle, uint32_t color);
94
98void ui_widget_mgr_set_visible(int handle, bool visible);
99
105
110int32_t ui_widget_mgr_get_value(int handle);
111
115void ui_widget_mgr_set_dotmatrix(int handle, const uint8_t *bitmap, uint8_t len);
116
124void ui_widget_mgr_set_image(int handle, uint16_t offset, const uint8_t *data, uint8_t len);
125
129void ui_widget_mgr_event_push(uint8_t handle, uint8_t event_type, int32_t value);
130
137int ui_widget_mgr_event_drain(ipc_ui_event_t *out, int max_events);
138
143
150int ui_widget_mgr_list(ipc_ui_widget_info_t *out, int max_items);
151
157
163void ui_widget_mgr_set_screen(int16_t width, int16_t height);
164
171int ui_widget_mgr_chart_add_series(int handle, uint32_t color);
172
179void ui_widget_mgr_chart_set_next(int handle, uint8_t series_idx, int32_t value);
180
181
182/*******************************************************************************
183 * Collections and containers (IPC_CMD_UI_ITEM_ADD / _ITEM_CLEAR / _SET_PROP)
184 *
185 * These three functions MUST exist, and behave the same way for the same widget
186 * type, in BOTH ui_widget_mgr.c implementations — claw's and game's. The two
187 * Infineon Game kits compile claw's ipc_ui.c against game's ui_widget_mgr.c, so
188 * a type served here and not there renders on some boards and returns
189 * UI_STATUS_INVALID_TYPE on others, with no build error anywhere.
190 *******************************************************************************/
191
194#define UI_ITEM_ADD_OK_NO_CHILD (-3)
195
208int ui_widget_mgr_item_add(const ipc_ui_item_add_t *it);
209
215
222void ui_widget_mgr_set_prop(int handle, uint8_t prop_id, int32_t value);
223
232lv_obj_t *ui_widget_mgr_get_object(int handle);
233
234#endif /* UI_WIDGET_MGR_H */
void ui_widget_mgr_set_prop(int handle, uint8_t prop_id, int32_t value)
Sets one UI_PROP_* property; how .listen() subscribes to events.
void ui_widget_mgr_init(lv_obj_t *parent)
Called by ipc_ui_init() itself — never call it directly.
void ui_widget_mgr_set_parent(lv_obj_t *parent)
Clears all widgets and sets the new parent; called only via ipc_ui_set_container().
int ui_widget_mgr_event_drain(ipc_ui_event_t *out, int max_events)
Drains events for POLL_EVENTS — the ui.poll() backend.
void ui_widget_mgr_item_clear(int handle)
Empties a collection widget.
int ui_widget_mgr_create_sprite(const lv_image_dsc_t *dsc, int16_t x, int16_t y)
Creates an image sprite in the same handle table.
void ui_widget_mgr_set_position(int handle, int16_t x, int16_t y)
Moves a widget; arms fast drain for gameplay frame rate.
void ui_widget_mgr_clear_all(void)
Deletes every widget and resets the handle table.
void ui_widget_mgr_set_value(int handle, int32_t value)
Sets a numeric value; arms fast drain so dashboards are not pinned to 5 FPS.
void ui_widget_mgr_set_dotmatrix(int handle, const uint8_t *bitmap, uint8_t len)
Loads a bitmap into a DotMatrix widget.
void ui_widget_mgr_set_screen(int16_t width, int16_t height)
Sets screen dimensions and resets the auto-layout grid.
void ui_widget_mgr_set_text(int handle, const char *text)
Sets a widget's text; the switch arms fast drain after it.
int ui_widget_mgr_item_add(const ipc_ui_item_add_t *it)
Appends one item; overloaded returns, dual-implementation rule.
void ui_widget_mgr_event_push(uint8_t handle, uint8_t event_type, int32_t value)
Producer side of the event ring; internal LVGL event callbacks only.
void ui_widget_mgr_set_visible(int handle, bool visible)
Shows or hides one widget.
void ui_widget_mgr_chart_set_next(int handle, uint8_t series_idx, int32_t value)
Appends the next value to one chart series.
int32_t ui_widget_mgr_get_value(int handle)
Reads the widget's current value; 0 also means bad handle.
int ui_widget_mgr_create(const ipc_ui_create_t *cfg)
Creates a widget from a config; handle 0-31, -1 table full, -2 invalid type.
void ui_widget_mgr_set_size(int handle, int16_t w, int16_t h)
Resizes a widget.
int ui_widget_mgr_chart_add_series(int handle, uint32_t color)
Adds a series to a Chart; returns index 0-3 or -1.
bool ui_widget_mgr_needs_container(void)
True while the parent is NULL; no caller anywhere.
lv_obj_t * ui_widget_mgr_get_object(int handle)
LVGL object behind a handle; the GET_TEXT route for typed text.
int ui_widget_mgr_list(ipc_ui_widget_info_t *out, int max_items)
Handle + type of every active widget — the ui.list() backend.
void ui_widget_mgr_set_color(int handle, uint32_t color)
Sets the primary colour, 0xRRGGBB.
void ui_widget_mgr_delete(int handle)
Deletes one widget and frees its handle.
void ui_widget_mgr_set_all_visible(bool visible)
Shows or hides every managed widget; the Playground console toggle's view switch.
void ui_widget_mgr_set_sprite_image(int handle, const lv_image_dsc_t *dsc)
Swaps a sprite's image; the descriptor comes from game_sprite_lookup().
lv_obj_t * ui_widget_mgr_get_parent(void)
Nullable current parent; every call site null-checks it.
void ui_widget_mgr_set_image(int handle, uint16_t offset, const uint8_t *data, uint8_t len)
Chunked RGB565 transfer into an Image widget's canvas.
int ui_widget_mgr_count(void)
Number of live handles; zero callers anywhere.