SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (ModusToolbox)
Loading...
Searching...
No Matches
ipc_sensorhub.h
Go to the documentation of this file.
1/*******************************************************************************
2 * File Name: ipc_sensorhub.h
3 *
4 * Description: CM55 IPC receiver for sensor data from CM33_NS MicroPython.
5 * Stores latest sensor samples from all sensors.
6 * Thread-safe: ISR writes volatile data, getters read snapshots.
7 *
8 *******************************************************************************/
9
10#ifndef IPC_SENSORHUB_H
11#define IPC_SENSORHUB_H
12
13#include "ipc_communication.h"
14#include <stdbool.h>
15#include <stdint.h>
16
17/* Snapshot of all sensor data with change-detection flags */
18typedef struct {
19 /* BMI270 IMU */
20 ipc_sensor_bmi270_t bmi270;
23
24 /* DPS368 Barometric Pressure (AI Kit) */
25 ipc_sensor_dps368_t dps368;
28
29 /* SHT40 Humidity + Temperature (AI Kit) */
30 ipc_sensor_sht40_t sht40;
33
34 /* BMM350 Magnetometer */
35 ipc_sensor_bmm350_t bmm350;
38
39 /* CapSense Touch (requires base board) */
40 ipc_sensor_capsense_t capsense;
43
44 /* Potentiometer (requires base board) */
45 ipc_sensor_pot_t pot;
46 bool has_pot;
48
49 /* GPIO LED State bitmask (both BSPs) */
54
63
72
73/*******************************************************************************
74 * WiFi State + Time (pushed from CM33_NS via IPC, zero I2C involvement)
75 ******************************************************************************/
76
79
81bool ipc_sensorhub_weather(weather_ipc_t *out);
82
86
89
92bool ipc_sensorhub_get_time_str(char *buf, size_t buf_size);
93
94/*******************************************************************************
95 * Local Feed API — inject sensor data directly from CM55 (Eva Kit).
96 * On Eva Kit, CM33_NS cannot access SCB0 I2C (display owns it).
97 * CM55 reads sensors locally and feeds data here instead of via IPC.
98 ******************************************************************************/
99void ipc_sensorhub_feed_bmi270(const ipc_sensor_bmi270_t *data);
100void ipc_sensorhub_feed_bmm350(const ipc_sensor_bmm350_t *data);
101
103bool ipc_sensorhub_ntp_synced(void);
104
105void ipc_sensorhub_feed_capsense(const ipc_sensor_capsense_t *data);
106void ipc_sensorhub_feed_pot(const ipc_sensor_pot_t *data);
107
108#endif /* IPC_SENSORHUB_H */
void ipc_sensorhub_feed_pot(const ipc_sensor_pot_t *data)
ค่าของ pot ที่ปรับเป็นค่ามาตรฐานแล้ว ไม่ใช่ค่านับจาก ADC; ต้องตรวจ pot_channels_ready() ก่อน
bool ipc_sensorhub_get_time_str(char *buf, size_t buf_size)
สตริงเวลาล่าสุดที่ CM33 ส่งมา; คืน false ก่อน NTP sync
void ipc_sensorhub_snapshot(sensorhub_snapshot_t *snap)
ต่อหนึ่ง tick มีผู้อ่านได้รายเดียว — การอ่านจะเคลียร์แฟล็ก changed
void ipc_sensorhub_feed_bmi270(const ipc_sensor_bmi270_t *data)
การป้อนตัวอย่างค่า IMU ที่อ่านในเครื่อง; ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอบ
bool ipc_sensorhub_ble_connected(void)
คืน true เฉพาะขณะที่ NUS host อยู่ในสถานะ CONNECTED เท่านั้น; ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอ...
void ipc_sensorhub_feed_capsense(const ipc_sensor_capsense_t *data)
การป้อนตัวอย่างค่า CapSense ที่อ่านในเครื่อง — ต้องกำหนดค่าเริ่มต้นครบทุกฟิลด์ และใช้ sequence ร่วมกั...
bool ipc_sensorhub_wifi_connected(void)
สถานะ WiFi ที่ได้จากการวนถาม — ต้อง edge-detect ก่อนแตะ LVGL
void ipc_sensorhub_feed_bmm350(const ipc_sensor_bmm350_t *data)
การป้อนตัวอย่างค่าแมกนีโตมิเตอร์ที่อ่านในเครื่อง; ไม่มีผู้เรียกที่มีอยู่จริงในของที่ส่งมอบ
bool ipc_sensorhub_init(void)
การลงทะเบียน callback ของ pipe — ลำดับที่สองใน boot prologue
bool ipc_sensorhub_ntp_synced(void)
เป็น gate ของการอ่าน RTC ทั้งหมด
bool ipc_sensorhub_weather(weather_ipc_t *out)
Definition ipc_sensorhub.h:18
bool sht40_changed
Definition ipc_sensorhub.h:32
ipc_sensor_dps368_t dps368
Definition ipc_sensorhub.h:25
ipc_sensor_bmm350_t bmm350
Definition ipc_sensorhub.h:35
ipc_sensor_sht40_t sht40
Definition ipc_sensorhub.h:30
bool led_state_changed
Definition ipc_sensorhub.h:52
ipc_sensor_pot_t pot
Definition ipc_sensorhub.h:45
bool has_led_state
Definition ipc_sensorhub.h:51
bool pot_changed
Definition ipc_sensorhub.h:47
bool has_bmi270
Definition ipc_sensorhub.h:21
bool bmi270_changed
Definition ipc_sensorhub.h:22
bool has_pot
Definition ipc_sensorhub.h:46
bool dps368_changed
Definition ipc_sensorhub.h:27
ipc_sensor_capsense_t capsense
Definition ipc_sensorhub.h:40
bool capsense_changed
Definition ipc_sensorhub.h:42
bool has_dps368
Definition ipc_sensorhub.h:26
bool has_sht40
Definition ipc_sensorhub.h:31
uint8_t led_state_bitmask
Definition ipc_sensorhub.h:50
ipc_sensor_bmi270_t bmi270
Definition ipc_sensorhub.h:20
bool bmm350_changed
Definition ipc_sensorhub.h:37
bool has_bmm350
Definition ipc_sensorhub.h:36
bool has_capsense
Definition ipc_sensorhub.h:41