除了显示驱动,其余全部测试通过
This commit is contained in:
+106
@@ -0,0 +1,106 @@
|
||||
#ifndef R60ABD1_H
|
||||
#define R60ABD1_H
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
|
||||
/*
|
||||
* R60ABD1最新状态快照。
|
||||
*
|
||||
* 该结构只表示“当前最新值”,
|
||||
* 不负责历史数据存储。
|
||||
*/
|
||||
struct radar_r60abd1_data {
|
||||
|
||||
/* 人体存在/运动 */
|
||||
u8 presence;
|
||||
u8 motion;
|
||||
u8 body_movement;
|
||||
|
||||
/* 距离 */
|
||||
u16 distance_cm;
|
||||
|
||||
/*
|
||||
* 心率/呼吸率。
|
||||
*
|
||||
* x10保存:
|
||||
* 例如 72.0 bpm -> 720
|
||||
*/
|
||||
u16 heart_rate_x10;
|
||||
u16 breath_rate_x10;
|
||||
|
||||
/* 睡眠状态 */
|
||||
u8 sleep_state;
|
||||
|
||||
/* XYZ坐标 */
|
||||
s16 pos_x_mm;
|
||||
s16 pos_y_mm;
|
||||
s16 pos_z_mm;
|
||||
|
||||
/* 最新波形采样值 */
|
||||
u8 heart_waveform;
|
||||
u8 breath_waveform;
|
||||
|
||||
/*
|
||||
* 最近一次“已识别业务数据更新”的系统时间。
|
||||
*
|
||||
* 未知但checksum正确的合法帧不会刷新该时间。
|
||||
* 单位:ms。
|
||||
*/
|
||||
u32 update_ms;
|
||||
|
||||
/* 运行统计 */
|
||||
u32 rx_bytes;
|
||||
|
||||
/*
|
||||
* checksum正确的合法帧总数。
|
||||
* 包含当前没有解析业务含义的帧。
|
||||
*/
|
||||
u32 frame_count;
|
||||
|
||||
/*
|
||||
* 当前parser真正识别并更新业务字段的帧数。
|
||||
*/
|
||||
u32 data_update_count;
|
||||
|
||||
u32 checksum_errors;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 初始化R60ABD1协议层。
|
||||
*
|
||||
* 必须在input/get_data之前调用。
|
||||
*/
|
||||
int radar_r60abd1_init(void);
|
||||
|
||||
|
||||
/*
|
||||
* 输入UART收到的原始字节流。
|
||||
*/
|
||||
int radar_r60abd1_input_bytes(
|
||||
const u8 *data,
|
||||
u16 len
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* 获取当前最新状态快照。
|
||||
*
|
||||
* 内部使用mutex保护。
|
||||
*/
|
||||
int radar_r60abd1_get_data(
|
||||
struct radar_r60abd1_data *out
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* 发送一条已经组好的R60ABD1协议命令。
|
||||
*/
|
||||
int radar_r60abd1_send_command(
|
||||
const u8 *cmd,
|
||||
u16 len
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user