6 namespace seeed_mr24hpc1 {
8 static const uint8_t FRAME_BUF_MAX_SIZE = 128;
9 static const uint8_t PRODUCT_BUF_MAX_SIZE = 32;
11 static const uint8_t FRAME_CONTROL_WORD_INDEX = 2;
12 static const uint8_t FRAME_COMMAND_WORD_INDEX = 3;
13 static const uint8_t FRAME_DATA_INDEX = 6;
15 static const uint8_t FRAME_HEADER1_VALUE = 0x53;
16 static const uint8_t FRAME_HEADER2_VALUE = 0x59;
17 static const uint8_t FRAME_TAIL1_VALUE = 0x54;
18 static const uint8_t FRAME_TAIL2_VALUE = 0x43;
20 static const uint8_t CONTROL_MAIN = 0x01;
21 static const uint8_t CONTROL_PRODUCT_INFORMATION = 0x02;
22 static const uint8_t CONTROL_WORK = 0x05;
23 static const uint8_t CONTROL_UNDERLYING_FUNCTION = 0x08;
24 static const uint8_t CONTROL_HUMAN_INFORMATION = 0x80;
26 static const uint8_t COMMAND_HEARTBEAT = 0x01;
27 static const uint8_t COMMAND_RESTART = 0x02;
29 static const uint8_t COMMAND_PRODUCT_MODE = 0xA1;
30 static const uint8_t COMMAND_PRODUCT_ID = 0xA2;
31 static const uint8_t COMMAND_HARDWARE_MODEL = 0xA3;
32 static const uint8_t COMMAND_FIRMWARE_VERSION = 0xA4;
34 static const uint8_t GET_HEARTBEAT[] = {
35 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_MAIN, COMMAND_HEARTBEAT, 0x00, 0x01, 0x0F, 0xBE,
36 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
38 static const uint8_t SET_RESTART[] = {
39 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_MAIN, COMMAND_RESTART, 0x00, 0x01, 0x0F, 0xBF,
40 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
43 static const uint8_t GET_PRODUCT_MODE[] = {
44 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_PRODUCT_INFORMATION, COMMAND_PRODUCT_MODE, 0x00, 0x01, 0x0F, 0x5F,
45 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
47 static const uint8_t GET_PRODUCT_ID[] = {
48 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_PRODUCT_INFORMATION, COMMAND_PRODUCT_ID, 0x00, 0x01, 0x0F, 0x60,
49 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
51 static const uint8_t GET_HARDWARE_MODEL[] = {
54 CONTROL_PRODUCT_INFORMATION,
55 COMMAND_HARDWARE_MODEL,
63 static const uint8_t GET_FIRMWARE_VERSION[] = {
66 CONTROL_PRODUCT_INFORMATION,
67 COMMAND_FIRMWARE_VERSION,
76 static const uint8_t GET_SCENE_MODE[] = {
77 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_WORK, 0x87, 0x00, 0x01, 0x0F, 0x48,
78 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
80 static const uint8_t GET_SENSITIVITY[] = {
81 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_WORK, 0x88, 0x00, 0x01, 0x0F, 0x49,
82 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
84 static const uint8_t GET_CUSTOM_MODE[] = {
85 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_WORK, 0x89, 0x00, 0x01, 0x0F, 0x4A,
86 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
89 static const uint8_t UNDERLYING_SWITCH_ON[] = {
90 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x00, 0x00, 0x01, 0x01, 0xB6,
91 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
93 static const uint8_t UNDERLYING_SWITCH_OFF[] = {
94 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x00, 0x00, 0x01, 0x00, 0xB5,
95 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
98 static const uint8_t GET_RADAR_OUTPUT_INFORMATION_SWITCH[] = {
99 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x80, 0x00, 0x01, 0x0F, 0x44,
100 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
102 static const uint8_t GET_SPATIAL_STATIC_VALUE[] = {
103 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x81, 0x00, 0x01, 0x0F, 0x45,
104 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
106 static const uint8_t GET_SPATIAL_MOTION_VALUE[] = {
107 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x82, 0x00, 0x01, 0x0F, 0x46,
108 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
110 static const uint8_t GET_DISTANCE_OF_STATIC_OBJECT[] = {
111 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x83, 0x00, 0x01, 0x0F, 0x47,
112 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
114 static const uint8_t GET_DISTANCE_OF_MOVING_OBJECT[] = {
115 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x84, 0x00, 0x01, 0x0F, 0x48,
116 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
118 static const uint8_t GET_TARGET_MOVEMENT_SPEED[] = {
119 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x85, 0x00, 0x01, 0x0F, 0x49,
120 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
122 static const uint8_t GET_EXISTENCE_THRESHOLD[] = {
123 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x88, 0x00, 0x01, 0x0F, 0x4C,
124 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
126 static const uint8_t GET_MOTION_THRESHOLD[] = {
127 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x89, 0x00, 0x01, 0x0F, 0x4D,
128 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
130 static const uint8_t GET_EXISTENCE_BOUNDARY[] = {
131 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x8A, 0x00, 0x01, 0x0F, 0x4E,
132 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
134 static const uint8_t GET_MOTION_BOUNDARY[] = {
135 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x8B, 0x00, 0x01, 0x0F, 0x4F,
136 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
138 static const uint8_t GET_MOTION_TRIGGER_TIME[] = {
139 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x8C, 0x00, 0x01, 0x0F, 0x50,
140 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
142 static const uint8_t GET_MOTION_TO_REST_TIME[] = {
143 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x8D, 0x00, 0x01, 0x0F, 0x51,
144 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
146 static const uint8_t GET_CUSTOM_UNMAN_TIME[] = {
147 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_UNDERLYING_FUNCTION, 0x8E, 0x00, 0x01, 0x0F, 0x52,
148 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
151 static const uint8_t GET_HUMAN_STATUS[] = {
152 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_HUMAN_INFORMATION, 0x81, 0x00, 0x01, 0x0F, 0xBD,
153 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
155 static const uint8_t GET_HUMAN_MOTION_INFORMATION[] = {
156 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_HUMAN_INFORMATION, 0x82, 0x00, 0x01, 0x0F, 0xBE,
157 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
159 static const uint8_t GET_BODY_MOTION_PARAMETERS[] = {
160 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_HUMAN_INFORMATION, 0x83, 0x00, 0x01, 0x0F, 0xBF,
161 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
163 static const uint8_t GET_UNMANNED_TIME[] = {
164 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_HUMAN_INFORMATION, 0x8A, 0x00, 0x01, 0x0F, 0xC6,
165 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
167 static const uint8_t GET_KEEP_AWAY[] = {
168 FRAME_HEADER1_VALUE, FRAME_HEADER2_VALUE, CONTROL_HUMAN_INFORMATION, 0x8B, 0x00, 0x01, 0x0F, 0xC7,
169 FRAME_TAIL1_VALUE, FRAME_TAIL2_VALUE,
Implementation of SPI Controller mode.