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

Functions

bool deepcraft_task_init (void)
 Call after cm55_ipc_communication_setup(); the archived display controller already does.
void deepcraft_task_request (bool start)
 Start or stop the model link exactly as a MicroPython client would.
void deepcraft_task_select (uint32_t n)
 Activates registry model n exactly as edge_ai.select(n); zero callers workspace-wide.
void deepcraft_task_watchdog (void)
 Returns the model-link task to Ready; about 1 Hz from a context that never blocks.

Detailed Description

DEEPCRAFT™ is a trademark of Infineon Technologies. This module is the CM55 side of the model link, and TESAIoT wrote it; the models at the far end of that link are Imagimob AB's, an Infineon Technologies company — see Edge AI (libbento_edge_ai.a).

Header: deepcraft_task.h. Implementation: archived deepcraft_task.c (libbento_cm55.a). The CM55 end of the DEEPCRAFT™ model link: it owns the command queue that MicroPython's edge_ai.* and the on-screen Edge AI page both post to, so a tap and a script produce the same READY / STOPPED events and the same CM33 sensor-rate changes. All four functions are called only from inside the archive today; every example is authored.

Variant
mtb-mpy and mtb-only

Function Documentation

◆ deepcraft_task_init()

bool deepcraft_task_init ( void )

Call after cm55_ipc_communication_setup(); the archived display controller already does.

Create the model-link task + register the pipe client. Call AFTER cm55_ipc_communication_setup().

Contract
"Call AFTER \c cm55_ipc_communication_setup()" (deepcraft_task.h:24). Its single caller is the archived display controller, tesaiot_display.c:231, guarded by BENTO_HAS_MODEL_LINK, with the in-source ordering rule quoted verbatim: "model-link peer — after pipe setup (ordering rule)" — i.e. after cm55_ipc_communication_setup(), ipc_sensorhub_init() and ipc_service_init(). Creates the task and registers the pipe client. Now inside the binary; consumers using the shipped display controller never call it. The authored example documents the ordering for a custom bring-up.
Variant
mtb-mpy and mtb-only
Example (authored — no shipped call site)
static void bento_ex_deepcraft_task_init(void)
{
cm55_ipc_communication_setup(); /* FIRST — pipe endpoints */
(void)ipc_sensorhub_init(); /* sibling pipe clients next */
#if defined(BENTO_HAS_MODEL_LINK) && (BENTO_HAS_MODEL_LINK == 1)
if (!deepcraft_task_init()) { /* model-link peer — LAST */
/* AI is optional: a failed model link must not cost the screen —
* continue the bring-up. */
}
#endif
}

◆ deepcraft_task_request()

void deepcraft_task_request ( bool start)

Start or stop the model link exactly as a MicroPython client would.

Ask the model link to start or stop, exactly as a MicroPython client would. The on-screen page uses this instead of poking the inference engine directly, so the link emits its usual READY / STOPPED events and everything downstream – not least CM33 raising the accelerometer to the model's training rate – happens for a tap just as it does for a script.

Contract
"Ask the model link to start or stop, exactly as a MicroPython client would" (deepcraft_task.h) — the page uses this instead of poking the engine, so the link emits its usual events and CM33 raises the accelerometer to the model's training rate for a tap just as for a script. Both callers are archived (page_edge_ai.c:361, :367). The real pattern to model: inside an LVGL button callback, paired with ai_engine_stop() / ai_engine_start(sel), gated by ai_engine_stack_words() != 0 (0 means the engine never started).
Variant
mtb-mpy and mtb-only
Example (authored — no shipped call site)
static void bento_ex_deepcraft_task_request(void)
{
if (ai_engine_stack_words() == 0u) {
return; /* engine never started — no target */
}
uint32_t sel = 0u; /* registry index from the UI */
int active = ai_engine_active();
if (active >= 0 && (int)sel == active) {
ai_engine_stop(); /* stop the running model... */
deepcraft_task_request(false); /* ...and tell the link, so it
* emits STOPPED + rate walk-down */
} else {
ai_engine_start(sel); /* clean registry switch */
deepcraft_task_request(true); /* link emits READY + training rate */
}
}

◆ deepcraft_task_select()

void deepcraft_task_select ( uint32_t n)

Activates registry model n exactly as edge_ai.select(n); zero callers workspace-wide.

Edge AI menu: activate registry model n (clean switch, no reload) exactly as a MicroPython edge_ai.select(n) does. On-screen parity with the dropdown on the Edge AI page — posts SELECT(0x90+n) on the model link's command queue.

Contract
Activates registry model n (clean switch, no reload) exactly as edge_ai.select(n) does, by posting SELECT(0x90+n) on the link's command queue. Zero callers workspace-wide (three definitions and two host-sim stubs). Authored.
Variant
mtb-mpy and mtb-only
Example (authored — no shipped call site)
static void bento_ex_deepcraft_task_select(void)
{
if (ai_engine_stack_words() == 0u) {
return; /* engine never started */
}
uint32_t n = 1u; /* registry index to activate */
deepcraft_task_select(n); /* queued — returns immediately */
/* Confirm later via ai_engine_requested() == (int)n (the REQUESTED
* index answers immediately; ACTIVE follows after the cold-init). */
}

◆ deepcraft_task_watchdog()

void deepcraft_task_watchdog ( void )

Returns the model-link task to Ready; about 1 Hz from a context that never blocks.

Return the model-link task to Ready if it has stopped draining its command queue. Call at about 1 Hz from a context that never blocks. Does nothing on a healthy board; see the definition for what it does and does not fix.

Contract
"Return the model-link task to Ready if it has stopped draining its command queue. Call at about 1 Hz from a context that never blocks" (deepcraft_task.h). Its single caller is internal: deepcraft_task.c:1000, from a FreeRTOS software-timer callback, with WD_STRIKES = 2 — the task must be seen stalled on two consecutive ticks before the watchdog acts; one missed tick is not a strike. Does nothing on a healthy board.
Variant
mtb-mpy and mtb-only
Example (authored — no shipped call site)
static void bento_ex_dc_wd_timer_cb(TimerHandle_t t)
{
(void)t;
deepcraft_task_watchdog(); /* no-op while healthy */
}
static void bento_ex_deepcraft_task_watchdog(void)
{
TimerHandle_t wd = xTimerCreate("dc_wd",
pdMS_TO_TICKS(1000u), /* ~1 Hz */
pdTRUE, /* auto-reload */
NULL,
bento_ex_dc_wd_timer_cb);
if (wd != NULL) {
(void)xTimerStart(wd, 0);
}
}