ESPHome  2024.12.2
seeed_mr24hpc1_constants.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace esphome {
6 namespace seeed_mr24hpc1 {
7 
8 static const uint8_t FRAME_BUF_MAX_SIZE = 128;
9 static const uint8_t PRODUCT_BUF_MAX_SIZE = 32;
10 
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;
14 
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;
19 
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;
25 
26 static const uint8_t COMMAND_HEARTBEAT = 0x01;
27 static const uint8_t COMMAND_RESTART = 0x02;
28 
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;
33 
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,
37 };
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,
41 };
42 
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,
46 };
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,
50 };
51 static const uint8_t GET_HARDWARE_MODEL[] = {
52  FRAME_HEADER1_VALUE,
53  FRAME_HEADER2_VALUE,
54  CONTROL_PRODUCT_INFORMATION,
55  COMMAND_HARDWARE_MODEL,
56  0x00,
57  0x01,
58  0x0F,
59  0x61,
60  FRAME_TAIL1_VALUE,
61  FRAME_TAIL2_VALUE,
62 };
63 static const uint8_t GET_FIRMWARE_VERSION[] = {
64  FRAME_HEADER1_VALUE,
65  FRAME_HEADER2_VALUE,
66  CONTROL_PRODUCT_INFORMATION,
67  COMMAND_FIRMWARE_VERSION,
68  0x00,
69  0x01,
70  0x0F,
71  0x62,
72  FRAME_TAIL1_VALUE,
73  FRAME_TAIL2_VALUE,
74 };
75 
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,
79 };
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,
83 };
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,
87 };
88 
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,
92 };
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,
96 };
97 
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,
101 };
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,
105 };
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,
109 };
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,
113 };
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,
117 };
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,
121 };
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,
125 };
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,
129 };
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,
133 };
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,
137 };
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,
141 };
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,
145 };
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,
149 };
150 
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,
154 };
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,
158 };
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,
162 };
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,
166 };
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,
170 };
171 
172 } // namespace seeed_mr24hpc1
173 } // namespace esphome
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7