第四版
This commit is contained in:
0
src/Radar.cpp
Normal file
0
src/Radar.cpp
Normal file
36
src/Radar.h
Normal file
36
src/Radar.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef RADAR_H
|
||||
#define RADAR_H
|
||||
// 在main.cpp顶部添加R60ABD1协议相关定义
|
||||
#define FRAME_HEADER1 0x53 // 帧头字节1
|
||||
#define FRAME_HEADER2 0x59 // 帧头字节2
|
||||
#define FRAME_TAIL1 0x54 // 帧尾字节1
|
||||
#define FRAME_TAIL2 0x43 // 帧尾字节2
|
||||
|
||||
// 控制字定义
|
||||
#define CTRL_PRESENCE 0x80 // 人体存在检测
|
||||
#define CTRL_BREATH 0x81 // 呼吸检测
|
||||
#define CTRL_SLEEP 0x84 // 睡眠监测
|
||||
#define CTRL_HEARTRATE 0x85 // 心率监测
|
||||
|
||||
// 命令字定义
|
||||
#define CMD_REPORT 0x80 // 主动上报
|
||||
#define CMD_QUERY 0x81 // 查询命令
|
||||
#define CMD_SET 0x82 // 设置命令
|
||||
|
||||
// 定义R60ABD1数据结构
|
||||
typedef struct {
|
||||
uint8_t present; // 有人/无人状态 (DP1)
|
||||
uint16_t distance; // 人体距离 (DP3) 单位cm
|
||||
uint8_t heartRate; // 心率 (DP6) 单位BPM
|
||||
uint8_t breathRate; // 呼吸率 (DP8) 单位次/分钟
|
||||
uint8_t heartWave; // 心率波形 (DP7) 数值+128
|
||||
uint8_t breathWave; // 呼吸波形 (DP10) 数值+128
|
||||
uint8_t sleepState; // 睡眠状态 (DP12)
|
||||
uint32_t sleepTime; // 睡眠时长 (DP13) 单位秒
|
||||
uint8_t sleepScore; // 睡眠质量评分 (DP14)
|
||||
uint8_t bedEntry; // 入床/离床状态 (DP11)
|
||||
uint8_t abnormal; // 异常状态 (DP18)
|
||||
} R60ABD1Data;
|
||||
|
||||
|
||||
#endif
|
||||
2406
src/main.cpp
2406
src/main.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user