|
SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (MTB & µPython)
|
Functions | |
| bool | deepcraft_task_init (void) |
| เรียกหลัง cm55_ipc_communication_setup(); ตัวควบคุมจอแสดงผลที่อยู่ใน archive เรียกให้อยู่แล้ว | |
| void | deepcraft_task_request (bool start) |
| สั่งให้ model link เริ่มหรือหยุด เหมือนกับที่ไคลเอนต์ MicroPython สั่งทุกประการ | |
| void | deepcraft_task_select (uint32_t n) |
| เปิดใช้งานโมเดล n ใน registry เหมือน edge_ai.select(n) ทุกประการ; ไม่มีผู้เรียกเลยทั้ง workspace | |
| void | deepcraft_task_watchdog (void) |
| พา model-link task กลับสู่สถานะ Ready; เรียกที่ประมาณ 1 Hz จาก context ที่ไม่บล็อกเลย | |
DEEPCRAFT™ เป็นเครื่องหมายการค้าของ Infineon Technologies โมดูลนี้เป็น model link ฝั่ง CM55 ที่ TESAIoT เขียนขึ้น ส่วนโมเดลที่ปลายทางของ link นี้เป็นผลงานของ Imagimob AB ซึ่งเป็นบริษัทในเครือ Infineon Technologies (ดู Edge AI (libbento_edge_ai.a))
Header: deepcraft_task.h ตัวโค้ดจริง: deepcraft_task.c ที่อยู่ใน archive (libbento_cm55.a) เป็นปลายฝั่ง CM55 ของ DEEPCRAFT model link คือเป็นเจ้าของคิวคำสั่งที่ทั้ง edge_ai.* ของ MicroPython และหน้า Edge AI บนจอต่างส่งคำสั่งเข้ามา การแตะบนจอกับสคริปต์จึงให้เหตุการณ์ READY / STOPPED ชุดเดียวกัน และเปลี่ยนอัตราเซนเซอร์ที่ CM33 เหมือนกัน ทุกวันนี้ฟังก์ชันทั้ง 4 ตัวถูกเรียกจากภายใน archive เท่านั้น ตัวอย่างทุกตัวเป็นตัวอย่างที่เขียนขึ้นเอง
| bool deepcraft_task_init | ( | void | ) |
เรียกหลัง cm55_ipc_communication_setup(); ตัวควบคุมจอแสดงผลที่อยู่ใน archive เรียกให้อยู่แล้ว
Create the model-link task + register the pipe client. Call AFTER cm55_ipc_communication_setup().
deepcraft_task.h:24) ผู้เรียกเพียงรายเดียวคือตัวควบคุมจอแสดงผลที่อยู่ใน archive (.a คือไฟล์ไลบรารีแบบสแตติก) ที่ tesaiot_display.c:231 โดยมี BENTO_HAS_MODEL_LINK เป็นตัวกัน (guard) และมีกฎลำดับในซอร์สที่คัดมาตามตัวอักษรว่า "model-link peer — after pipe setup (ordering rule)" — คือหลังจาก cm55_ipc_communication_setup(), ipc_sensorhub_init() และ ipc_service_init() สร้าง task ขึ้นมาและลงทะเบียน pipe client ตอนนี้อยู่ภายในไบนารีแล้ว ผู้ใช้ไลบรารีที่ใช้ตัวควบคุมจอแสดงผลที่ส่งมอบมาจึงไม่เคยเรียกมันเอง ตัวอย่างที่เขียนขึ้นเองบันทึกลำดับนี้ไว้สำหรับการเปิดใช้งานแบบกำหนดเอง | void deepcraft_task_request | ( | bool | start | ) |
สั่งให้ model link เริ่มหรือหยุด เหมือนกับที่ไคลเอนต์ MicroPython สั่งทุกประการ
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.
deepcraft_task.h) — หน้าจอใช้ฟังก์ชันนี้แทนการไปแตะ engine โดยตรง link จึงส่งเหตุการณ์ตามปกติของมันออกมา และ CM33 ยกอัตราของ accelerometer ขึ้นไปที่อัตราที่ใช้ฝึกโมเดล ทั้งกรณีที่มาจากการแตะจอและกรณีที่มาจากสคริปต์เหมือนกัน ผู้เรียกทั้งสองรายอยู่ใน archive (page_edge_ai.c:361, :367) รูปแบบที่ควรยึดเป็นแบบจริง ๆ คือ อยู่ภายใน callback ของปุ่ม LVGL จับคู่กับ ai_engine_stop() / ai_engine_start(sel) และมี gate (ด่านกั้น) เป็นเงื่อนไข ai_engine_stack_words() != 0 (ค่า 0 หมายความว่า engine ไม่เคยเริ่มทำงานเลย) | void deepcraft_task_select | ( | uint32_t | n | ) |
เปิดใช้งานโมเดล n ใน registry เหมือน edge_ai.select(n) ทุกประการ; ไม่มีผู้เรียกเลยทั้ง workspace
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.
n ใน registry (สลับแบบสะอาด ไม่มีการโหลดใหม่) เหมือนที่ edge_ai.select(n) ทำทุกประการ ด้วยการส่ง SELECT(0x90+n) เข้าคิวคำสั่งของ link ไม่มีผู้เรียกเลยทั้ง workspace (มีนิยาม 3 ชุดและ stub ของ host-sim อีก 2 ชุด) เป็นตัวอย่างที่เขียนขึ้นเอง | void deepcraft_task_watchdog | ( | void | ) |
พา model-link task กลับสู่สถานะ Ready; เรียกที่ประมาณ 1 Hz จาก context ที่ไม่บล็อกเลย
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.
deepcraft_task.h) ผู้เรียกเพียงรายเดียวอยู่ภายใน: deepcraft_task.c:1000 จาก callback ของ software timer ของ FreeRTOS โดยมี WD_STRIKES = 2 — ต้องเห็น task ค้างติดกัน 2 tick ก่อน watchdog จึงจะลงมือ tick ที่หายไป 1 ครั้งยังไม่นับเป็น strike ไม่ทำอะไรเลยบนบอร์ดที่ปกติดี