SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches
Weak hooks (implement, don't call)

Functions

bool cm55_controls_snapshot (ipc_controls_state_t *out)
 Implement, never call — fills the CONTROLS_STATE snapshot on boards where CM55 owns the controls bus.
lv_obj_t * game_sprite_create (lv_obj_t *parent, const lv_image_dsc_t *dsc)
 Implement, never call — materialises an image sprite for the widget manager.
const lv_image_dsc_t * game_sprite_lookup (int sprite_id)
 Implement, never call — resolves a project sprite id to a compiled descriptor.
void game_sprite_set (lv_obj_t *sprite, const lv_image_dsc_t *dsc)
 Implement, never call — swaps the image on an existing sprite object.
void ipc_ui_ext_clear_all (void)
 Implement, never call — resets whatever your extension opcodes left running.
bool ipc_ui_ext_dispatch (uint32_t cmd, const uint8_t *data)
 Implement, never call — project extension dispatch for unhandled UI-band opcodes.
uint16_t ipc_ui_platform_diag (uint32_t *out, uint16_t max_words)
 Weak hook whose strong definition ships in libbento_cm55.a — the supported ten-word display diagnostics accessor.

Detailed Description

dist/ipc_core/overridable.txt names exactly seven symbols. The archive defines each of them weak (RED-verified with nm: W symbols in libbento_ipc.a); a project supplies one strong definition and the linker takes it silently. They are things you implement, not things you call — every template "hit" for these names is a definition. A reference page teaching "call this" would be wrong, so every example below is the template's own strong-override definition, cited by file and line. None of those definition files carries snippet markers; the sites are quoted as text.

Variant
mtb-mpy and mtb-only (all seven)

Function Documentation

◆ cm55_controls_snapshot()

bool cm55_controls_snapshot ( ipc_controls_state_t * out)

Implement, never call — fills the CONTROLS_STATE snapshot on boards where CM55 owns the controls bus.

Contract
Declared in ipc_communication.h (shared include), not in the archive's own headers. Called by the archived IPC service when CM33_NS asks for IPC_CMD_CONTROLS_STATE (0xC6); the weak default reports nothing. The strong override fills out from the CM55-side sensor poll's cached capsense/pot bytes — the single-writer GFX-task fields that the ipc_sensorhub_feed_capsense entry describes — and returns false on a NULL out. Implement it only on boards where CM55 owns the controls bus.
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/cm55_sensor_poll/cm55_sensor_poll.c:349 — bool cm55_controls_snapshot(ipc_controls_state_t *out) opens with the NULL guard and copies the cached s_caps_btn0 / s_caps_btn1 / s_caps_slider / pot values into *out.

◆ game_sprite_create()

lv_obj_t * game_sprite_create ( lv_obj_t * parent,
const lv_image_dsc_t * dsc )

Implement, never call — materialises an image sprite for the widget manager.

Contract
Called by the archived ui_widget_mgr_create_sprite() to materialise an image sprite under the widget-manager parent; the weak default returns NULL, which the manager reports as -2 ("no sprite engine"). The strong override must create an LVGL image object as a child of parent, set its source to dsc and return it. GFX-task context (the IPC switch).
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/game_sprites_mpy/game_sprite_engine.c:16 — lv_image_create(parent) then lv_image_set_src(img, dsc).

◆ game_sprite_lookup()

const lv_image_dsc_t * game_sprite_lookup ( int sprite_id)

Implement, never call — resolves a project sprite id to a compiled descriptor.

Contract
Resolves a project sprite id (BENTO_SPR_*) to a compiled descriptor. The archived switch calls it at ipc_ui.c:822 inside case IPC_CMD_UI_SPRITE_FRAME: and hands the result to ui_widget_mgr_set_sprite_image(). Must return NULL for an out-of-range id; the template override bounds-checks against BENTO_SPR_COUNT and carries a _Static_assert that the registry size matches it. The template declares the prototype locally (game_sprite_registry.c:17) because no shipped header does.
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/game_sprites_mpy/game_sprite_registry.c:52.

◆ game_sprite_set()

void game_sprite_set ( lv_obj_t * sprite,
const lv_image_dsc_t * dsc )

Implement, never call — swaps the image on an existing sprite object.

Contract
Swaps the image on an existing sprite object; called by the archived ui_widget_mgr_set_sprite_image(). Must be a no-op on a NULL sprite or descriptor. GFX-task context.
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/game_sprites_mpy/game_sprite_engine.c:25 — NULL guard then lv_image_set_src(sprite, dsc).

◆ ipc_ui_ext_clear_all()

void ipc_ui_ext_clear_all ( void )

Implement, never call — resets whatever your extension opcodes left running.

Contract
An override point of the extension chain, invoked by the archived IPC_CMD_UI_CLEAR_ALL handling when a new MicroPython script starts. Not declared in any shipped header (bento_secure_undeclared.h: "WEAK. Define your own; yours wins at link time"). Implement it to reset whatever your extension opcodes left running — the template uses it to stop the DFR0522 marquee and blank the matrix so the previous student's output does not keep running under the next program. GFX-task context; void.
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/dfr0522_rgb/dfr0522_ipc.c:37 — void ipc_ui_ext_clear_all(void) { (void)dfr0522_clear(); }.

◆ ipc_ui_ext_dispatch()

bool ipc_ui_ext_dispatch ( uint32_t cmd,
const uint8_t * data )

Implement, never call — project extension dispatch for unhandled UI-band opcodes.

Project extension dispatch hook for UI-band IPC opcodes not handled by the built-in switch (weak default returns false / no-op). Called from process_ui_command() in GFX-task context, so implementations may touch the display / GFX resources (e.g. the QWA309 DFR0522 RGB matrix on display I2C).

Parameters
cmdThe IPC opcode (IPC_CMD_UI_* range).
dataPointer to the raw 128-byte IPC payload (ipc_msg_t.data).
Returns
true if the opcode was handled.
Contract
"Project extension dispatch hook for UI-band IPC opcodes not handled by the built-in switch (weak default returns false / no-op). Called from \c process_ui_command() in GFX-task context, so implementations may touch the display / GFX resources" (ipc_ui.h). data points at the raw 128-byte IPC payload. Return true when the opcode was handled. A project may override it once; when several features ride the hook, chain them from a single strong definition, as the template does.
Variant
mtb-mpy and mtb-only
Example — strong override (template)
template/proj_cm55/modules/ipc_ui_ext/ipc_ui_ext_chain.c:41 — tries dfr0522_ext_dispatch(cmd, data) first, then the audio SFX handler, returning true at the first taker.

◆ ipc_ui_platform_diag()

uint16_t ipc_ui_platform_diag ( uint32_t * out,
uint16_t max_words )

Weak hook whose strong definition ships in libbento_cm55.a — the supported ten-word display diagnostics accessor.

Contract
Requires max_words >= 10 (returns 0 otherwise) and returns 10 words: DC IRQ status, DC frame / underflow / bus-error counts, GPU recovery count, flush start / ready / timeout counters, GFX task stack high-water mark, and idle percent. This is the supported external access path for the display controller's g_tesaiot_display_diag — document and use the accessor, not the struct. Surfaced to MicroPython as ui._diag() (mtb-mpy only; mtb-only C code calls it directly). The archive holds only the weak stub; the strong definition ships inside libbento_cm55.a, so a project that uses the shipped display controller already has it.
Variant
mtb-mpy and mtb-only
Example — strong definition (archived)
TESAIoT_KIT_PSE84_AI-Micropython-BentoClaw/proj_cm55/modules/lvgl_display/controller/tesaiot_display.c:593-609 (compiled into libbento_cm55.a; not shipped as source): the max_words guard, nine g_tesaiot_display_diag fields into out[0..8], the idle percent into out[9], return 10.