1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| //
| // Created by YY on 2019/12/21.
| //
|
| #ifndef RTKDRIVERTEST_MCU_IF_H
| #define RTKDRIVERTEST_MCU_IF_H
|
| #include <cstdint>
| #include "../common/apptimer.h"
| #include "../common/serial_port.h"
|
| enum parse_status_t {
| SYNC_HEAD_ONE,
| SYNC_HEAD_TWO,
| GET_ID_HI,
| GET_ID_LO,
| GET_LENGTH_HI,
| GET_LENGTH_LO,
| GET_PAYLOAD,
| GET_CRC16_HI,
| GET_CRC16_LO
| };
|
| class ParseUart {
| public:
| typedef void (*funptr)(uint16_t id, const uint8_t *data, int length);
| ParseUart(funptr fun);
| ~ParseUart();
|
| struct {
| uint16_t id;
| uint16_t length;
| uint16_t rx_len;
| uint8_t *buffer;
| uint16_t crc16;
| } McuPkt;
|
| parse_status_t parse_status;
| uint32_t sync_time = 0;
| funptr fun = nullptr;
| void ParseMcu(const uint8_t *data, int length);
| };
|
|
|
| void SendRtkToMcu(const uint8_t *data, int length);
| void SendMcuCommand(SerialPort *pClass, pSerialPortClassFun fun, uint16_t id, const uint8_t *data, int length);
|
| void ReadCard(void);
|
|
| #endif //RTKDRIVERTEST_MCU_IF_H
|
|