// // Created by YY on 2019/12/21. // #ifndef RTKDRIVERTEST_MCU_IF_H #define RTKDRIVERTEST_MCU_IF_H #include #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