| | |
| | | #define RTKDRIVERTEST_MCU_IF_H |
| | | |
| | | #include <cstdint> |
| | | #include "../common/apptimer.h" |
| | | #include "../common/serial_port.h" |
| | | |
| | | void McuCommModeSel(int mode); |
| | | void ConfigMCU(bool ayDevice); |
| | | 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 ParseMcuInit(void); |
| | | void ParseMcu(const uint8_t *data, int length); |
| | | void SendMcuCommand(uint16_t id, const uint8_t *data, int length); |
| | | void SendMcuCommand(SerialPort *pClass, pSerialPortClassFun fun, uint16_t id, const uint8_t *data, int length); |
| | | |
| | | void UploadDfuFileEnd(void); |
| | | void UploadDfuFile(const uint8_t *file, int length); |
| | | void ReadCard(void); |
| | | void ShutdownInd(int timeout); |
| | | |
| | | |
| | | #endif //RTKDRIVERTEST_MCU_IF_H |