Merge pull request #10313 from P-I-Engineer/patch-1
[inav.git] / src / main / telemetry / msp_shared.h
blobfad6b912d39b6461abfb576c4b6d309d75a75831
1 #pragma once
3 #include "common/streambuf.h"
4 #include "telemetry/crsf.h"
5 #include "telemetry/smartport.h"
7 typedef void (*mspResponseFnPtr)(uint8_t *payload);
9 struct mspPacket_s;
10 typedef struct mspPackage_s {
11 sbuf_t requestFrame;
12 uint8_t *requestBuffer;
13 uint8_t *responseBuffer;
14 struct mspPacket_s *requestPacket;
15 struct mspPacket_s *responsePacket;
16 } mspPackage_t;
18 typedef union mspRxBuffer_u {
19 uint8_t smartPortMspRxBuffer[SMARTPORT_MSP_RX_BUF_SIZE];
20 uint8_t crsfMspRxBuffer[CRSF_MSP_RX_BUF_SIZE];
21 } mspRxBuffer_t;
23 typedef union mspTxBuffer_u {
24 uint8_t smartPortMspTxBuffer[SMARTPORT_MSP_TX_BUF_SIZE];
25 uint8_t crsfMspTxBuffer[CRSF_MSP_TX_BUF_SIZE];
26 } mspTxBuffer_t;
28 void initSharedMsp(void);
29 bool handleMspFrame(uint8_t *frameStart, int frameLength);
30 bool sendMspReply(uint8_t payloadSize, mspResponseFnPtr responseFn);