|
SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
|
Functions | |
| bool | ipc_sensorhub_init (void) |
| Pipe-callback registration — second in the boot prologue. | |
| void | ipc_sensorhub_snapshot (sensorhub_snapshot_t *snap) |
| One consumer per tick — reading clears the changed flags. | |
| bool | ipc_sensorhub_wifi_connected (void) |
| Polled WiFi state — edge-detect before touching LVGL. | |
| bool | ipc_sensorhub_ble_connected (void) |
| True only while a NUS host is CONNECTED; no shipped caller. | |
| bool | ipc_sensorhub_ntp_synced (void) |
| The gate on reading the RTC at all. | |
| bool | ipc_sensorhub_get_time_str (char *buf, size_t buf_size) |
| Latest CM33-pushed time string; false before NTP sync. | |
| void | ipc_sensorhub_feed_capsense (const ipc_sensor_capsense_t *data) |
| Local CapSense sample injection — every field initialised, shared sequence. | |
| void | ipc_sensorhub_feed_pot (const ipc_sensor_pot_t *data) |
| Normalised pot values, not ADC counts; check pot_channels_ready() first. | |
| void | ipc_sensorhub_feed_bmi270 (const ipc_sensor_bmi270_t *data) |
| Local IMU sample injection; no shipped caller. | |
| void | ipc_sensorhub_feed_bmm350 (const ipc_sensor_bmm350_t *data) |
| Local magnetometer sample injection; no shipped caller. | |
Header: ipc_sensorhub.h. Implementation: archived ipc_sensorhub.c (libbento_ipc.a). The ISR half stores the latest sample from every sensor CM33_NS pushes; readers take a sensorhub_snapshot_t. On boards where CM55 owns the sensor bus (Eva Kit, TESAIoT Dev Kit base board) the feed_* functions inject samples read locally on CM55 into the same store.
| bool ipc_sensorhub_init | ( | void | ) |
Pipe-callback registration — second in the boot prologue.
Initialize IPC sensorhub receiver. Registers IPC pipe callback on CM55_IPC_SENSOR_CLIENT_ID. Must be called AFTER cm55_ipc_communication_setup().
ipc_sensorhub.h). The archived display controller calls it second in the boot prologue, before ipc_service_init() and before GFXSS bring-up, so sensor IPC survives a display failure. Registers the pipe callback on CM55_IPC_SENSOR_CLIENT_ID. Consumers using the shipped display controller never call it. | void ipc_sensorhub_snapshot | ( | sensorhub_snapshot_t * | snap | ) |
One consumer per tick — reading clears the changed flags.
Take a snapshot of the latest sensor data. Clears the "changed" flags after reading. Safe to call from any task context.
| snap | Output snapshot struct. |
sensorhub_snapshot_t and passes its address. The header says "Safe to call from any task context" but also "Clears the
'changed' flags after reading" — so exactly one consumer per tick may call it. That is why the UI takes one snapshot at 33 ms and fans it out via pm_render() instead of each page snapshotting independently. Two archived callers in other contexts confirm the any-task claim: the AI inference task (ai_engine.c:795) and the IPC service task (ipc_service.c:729). Void. | bool ipc_sensorhub_wifi_connected | ( | void | ) |
Polled WiFi state — edge-detect before touching LVGL.
Returns true if CM33_NS reported WiFi connected via IPC_CMD_WIFI_STATE_PUSH
add_flag / clear_flag every tick causes visible card-row flicker. Widget-null-guarded, because the page can be destroyed between ticks. Runs at the ~6 fps topbar throttle, skipped while animating. | bool ipc_sensorhub_ble_connected | ( | void | ) |
True only while a NUS host is CONNECTED; no shipped caller.
Returns true if CM33_NS reported BLE NUS host CONNECTED via IPC_CMD_BLE_STATE_PUSH. Only true while a host is connected; advertising/idle return false.
IPC_CMD_BLE_STATE_PUSH); advertising and idle read false. No shipped caller anywhere — the authored example models it on the wifi_connected edge-detect pattern: GFX-task only, widget null-guarded, LVGL touched only on a change. | bool ipc_sensorhub_ntp_synced | ( | void | ) |
The gate on reading the RTC at all.
Returns true if CM33_NS has sent at least one IPC_CMD_TIME_PUSH (NTP synced)
Returns true after CM33_NS sends IPC_CMD_NTP_SYNCED (RTC is valid).
Cy_RTC_GetDateAndTime() is called only after CM33_NS has sent the NTP-synced notification. A true return is necessary but not sufficient — the shipped code still range-validates rtc.month and rtc.dayOfWeek before indexing its name tables. Note the strcmp before lv_label_set_text so the label is not invalidated every tick (card-row flicker). ~6 fps throttle inside pm_update_topbar, skipped while animating. | bool ipc_sensorhub_get_time_str | ( | char * | buf, |
| size_t | buf_size ) |
Latest CM33-pushed time string; false before NTP sync.
Copy the latest time string from CM33_NS (e.g. "Mon 10 Mar 14:35"). Returns false if NTP not yet synced. buf must be >= 32 bytes.
false when NTP has not synced. buf must be at least 32 bytes. No shipped caller — the topbar reads the RTC directly behind the ntp_synced gate instead. The authored example pairs it with that gate. | void ipc_sensorhub_feed_capsense | ( | const ipc_sensor_capsense_t * | data | ) |
Local CapSense sample injection — every field initialised, shared sequence.
reserved = 0, and sequence must increment monotonically from a counter shared with the pot feed — one sequence space per producer. The producer is a single writer on the GFX task; that is what makes the byte-sized cached fields readable from the CM33 IPC_CMD_CONTROLS_STATE snapshot path without a lock. Void; the wrapper's bool reports the I2C read, not the feed. | void ipc_sensorhub_feed_pot | ( | const ipc_sensor_pot_t * | data | ) |
Normalised pot values, not ADC counts; check pot_channels_ready() first.
raw rescaled to the full uint16 range and percent_x10 in per-mille, both from POT_ADC_MAX. The whole feed function sits inside BSP_HAS_POTENTIOMETER. Before any feed the shipped code runs pot_channels_ready() (cm55_sensor_poll.c:189-198): a SAR read result of 0 is not proof the channel is live, so the per-channel status bit is checked first. Same shared s_seq counter as capsense. | void ipc_sensorhub_feed_bmi270 | ( | const ipc_sensor_bmi270_t * | data | ) |
Local IMU sample injection; no shipped caller.
feed_capsense discipline exactly: full struct initialisation, monotonic sequence from the producer's own counter, single-writer GFX-task context. | void ipc_sensorhub_feed_bmm350 | ( | const ipc_sensor_bmm350_t * | data | ) |
Local magnetometer sample injection; no shipped caller.
feed_bmi270: every field set, sequence discipline, single producer.