SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches

Functions

bool ipc_lcd_init (lv_obj_t *parent)
 Boot-time console bring-up — NULL parent, never gated on display_ok.
void ipc_lcd_set_container (lv_obj_t *parent)
 Deferred container binding; NULL on destroy is mandatory.
void ipc_lcd_toggle_panel (void)
 Blind console toggle — always guard with ipc_lcd_is_panel_visible().
bool ipc_lcd_is_panel_visible (void)
 False when hidden or not yet created — the guard that makes the toggle safe.
void ipc_lcd_reset_auto_nav (void)
 Re-arms the one-shot auto-navigate; reached via ui.clear(), not called by consumers.
bool ipc_lcd_has_unread (void)
 Pure read of the unread flag — it does not clear.
void ipc_lcd_clear_unread (void)
 Explicit clear, made only on the transition into console mode.

Detailed Description

Header: ipc_lcd.h. Implementation: archived ipc_lcd.c (libbento_ipc.a). Receives lcd.print() text from CM33_NS and renders it in a terminal-like panel inside whatever container the Playground page has bound. All seven functions run in GFX-task context; the Playground page calls them from LVGL event and render callbacks.

Variant
mtb-mpy and mtb-only

Function Documentation

◆ ipc_lcd_init()

bool ipc_lcd_init ( lv_obj_t * parent)

Boot-time console bring-up — NULL parent, never gated on display_ok.

Initialize IPC LCD receiver. Call after LVGL and display are ready. Sets up IPC pipe, registers callback, and creates an LVGL timer that polls the receive queue and updates a terminal-like renderer.

Parameters
parentPointer to LVGL parent container (Terminal tab).
Returns
true on success.
Contract
Called once, at boot, by the archived display controller — after cm55_ipc_communication_setup(), ipc_sensorhub_init() and ipc_service_init(), and not gated on display_ok: the ipc_only: label exists so that a board whose panel failed still brings up the LCD/IPC path. It takes NULL — deferred container binding; the Playground page binds a real container later with ipc_lcd_set_container(). The bool return is explicitly (void) -cast by the shipped caller: a failure must not abort boot. Do not call it a second time.
Variant
mtb-mpy and mtb-only
Origin
Lifted from TESAIoT_KIT_PSE84_AI-Micropython-BentoClaw/proj_cm55/modules/lvgl_display/controller/tesaiot_display.c:470-479 (compiled into the prebuilt archive; not shipped as source).

◆ ipc_lcd_set_container()

void ipc_lcd_set_container ( lv_obj_t * parent)

Deferred container binding; NULL on destroy is mandatory.

Update the terminal container (for page-based navigation). Called when Playground page is created/destroyed. Pass NULL to invalidate (page destroyed), non-NULL to activate.

Parameters
parentLVGL container or NULL.
Contract
The deferred-binding contract — the most important pattern in this module. ipc_lcd_init(NULL) runs at boot with no container; the page binds on create and must pass NULL on destroy, otherwise the IPC handler keeps writing into LVGL objects that lv_screen_load_anim(auto_del) has already freed — a use-after-free. Bind order is ui-then-lcd on create and identically ui-then-lcd on destroy. Void; no error path. GFX-task context.
Variant
mtb-mpy and mtb-only
Example — bind on create (template)
/* ...context: inside page_playground_create() ... */
/* Store as UX/UI container for IPC widget creation */
s_uxui_container = content;
/* Terminal container: same as content — ipc_lcd creates terminal inside */
s_terminal_container = content;
/* Bind containers to IPC handlers (deferred from boot) */
Example — unbind on destroy (template)
void page_playground_destroy(void)
{
/* Unbind containers from IPC handlers — prevents writing to stale objects.
* The actual LVGL objects are destroyed by lv_screen_load_anim(auto_del). */
s_uxui_container = NULL;
s_terminal_container = NULL;

◆ ipc_lcd_toggle_panel()

void ipc_lcd_toggle_panel ( void )

Blind console toggle — always guard with ipc_lcd_is_panel_visible().

Toggle terminal panel visibility (show/hide). If the terminal has not been created yet, force-creates it first. Used by Playground Console Log button.

Contract
A blind toggle with no idempotent "set" form — always guard it with ipc_lcd_is_panel_visible() so a redundant call cannot invert state. If the terminal has not been created yet it force-creates it first. Console and widgets are mutually exclusive, and the shipped ordering is asymmetric: hide-widgets-then-show-console, but hide-console-then-show-widgets. Void; GFX-task context (LVGL event callback).
Variant
mtb-mpy and mtb-only
static void console_toggle_cb(lv_event_t *e)
{
(void)e;
s_console_mode = !s_console_mode;
if (s_console_mode) {
/* Switch to Console view — clear unread badge */
if (s_console_badge) {
lv_obj_add_flag(s_console_badge, LV_OBJ_FLAG_HIDDEN);
}
}
} else {
/* Switch to UI view */
}
}
/* Update button icon */
if (s_console_btn_lbl) {
lv_label_set_text(s_console_btn_lbl,
s_console_mode ? LV_SYMBOL_EYE_OPEN : LV_SYMBOL_LIST);
}
}

◆ ipc_lcd_is_panel_visible()

bool ipc_lcd_is_panel_visible ( void )

False when hidden or not yet created — the guard that makes the toggle safe.

Check if the terminal panel is currently visible.

Returns
true if visible, false if hidden or not yet created.
Contract
Returns false when hidden or not yet created. It is the guard that makes ipc_lcd_toggle_panel() safe — every shipped toggle is wrapped in it. Console and widgets are mutually exclusive: the same callback flips ui_widget_mgr_set_all_visible() the opposite way. GFX-task context.
Variant
mtb-mpy and mtb-only
static void console_toggle_cb(lv_event_t *e)
{
(void)e;
s_console_mode = !s_console_mode;
if (s_console_mode) {
/* Switch to Console view — clear unread badge */
if (s_console_badge) {
lv_obj_add_flag(s_console_badge, LV_OBJ_FLAG_HIDDEN);
}
}
} else {
/* Switch to UI view */
}
}
/* Update button icon */
if (s_console_btn_lbl) {
lv_label_set_text(s_console_btn_lbl,
s_console_mode ? LV_SYMBOL_EYE_OPEN : LV_SYMBOL_LIST);
}
}

◆ ipc_lcd_reset_auto_nav()

void ipc_lcd_reset_auto_nav ( void )

Re-arms the one-shot auto-navigate; reached via ui.clear(), not called by consumers.

Reset the one-shot auto-navigate flag. Called on UI CLEAR_ALL (new MicroPython session) so lcd.print() can auto-navigate to Playground again.

Contract
Re-arms the one-shot auto-navigate so the next lcd.print() of a new MicroPython session can jump to Playground again. Its single caller is the archived IPC switch: case IPC_CMD_UI_CLEAR_ALL: at ipc_ui.c:553 calls ui_widget_mgr_clear_all(), clears its own s_auto_nav_done flag, then calls this at ipc_ui.c:556. A consumer does not call it; MicroPython reaches it with ui.clear(). The page the auto-navigate targets is the compiled-in ordinal 7 — see the archive hazard on IPC Core (libbento_ipc.a).
Variant
mtb-mpy and mtb-only
Origin
Lifted from BENTO-TESAIoT-libraries/claw/common/modules/ipc_ui/ipc_ui.c:553-556 (compiled into the prebuilt archive; not shipped as source): the CLEAR_ALL case clears widgets, resets s_auto_nav_done, then calls ipc_lcd_reset_auto_nav(). This case is not among the four replicated in the Tier-2 excerpt; the line numbers are pinned from the source.

◆ ipc_lcd_has_unread()

bool ipc_lcd_has_unread ( void )

Pure read of the unread flag — it does not clear.

Check if new text arrived while the console panel was hidden. Used by Playground to show a notification badge on the Console button.

Returns
true if there is unread console output.
Contract
A pure read — it does not clear. Only meaningful while the console is hidden, hence the !s_console_mode guard. Polled from the page's per-tick render hook, which the 33 ms sensorhub timer drives. GFX-task context; no error path.
Variant
mtb-mpy and mtb-only
void page_playground_render(sensorhub_snapshot_t *snap)
{
(void)snap;
/* Show/hide notification badge when new console text arrives while hidden */
if (s_console_badge && !s_console_mode) {
lv_obj_remove_flag(s_console_badge, LV_OBJ_FLAG_HIDDEN);
}
}
}

◆ ipc_lcd_clear_unread()

void ipc_lcd_clear_unread ( void )

Explicit clear, made only on the transition into console mode.

Clear the unread flag. Called when the user opens the Console panel.

Contract
An explicit clear, separate from the read, made only on the transition into console mode — the first statement of the console branch in the toggle callback, before the badge is hidden and the panel shown. Void; GFX-task context.
Variant
mtb-mpy and mtb-only
static void console_toggle_cb(lv_event_t *e)
{
(void)e;
s_console_mode = !s_console_mode;
if (s_console_mode) {
/* Switch to Console view — clear unread badge */
if (s_console_badge) {
lv_obj_add_flag(s_console_badge, LV_OBJ_FLAG_HIDDEN);
}
}
} else {
/* Switch to UI view */
}
}
/* Update button icon */
if (s_console_btn_lbl) {
lv_label_set_text(s_console_btn_lbl,
s_console_mode ? LV_SYMBOL_EYE_OPEN : LV_SYMBOL_LIST);
}
}