5 #include "crsfmsp_common.h"
9 /* Takes a CRSF(MSP) frame and converts it to raw MSP frame
10 adding the MSP header and checksum. Handles chunked MSP messages.
16 uint8_t outBuffer
[MSP_FRAME_MAX_LEN
];
17 uint32_t pktLen
; // packet length of the incomming msp frame
18 uint32_t idx
; // number of bytes received in the current msp frame
19 uint8_t seqNumberPrev
;
21 uint8_t src
; // source of the msp frame (from CRSF ext header)
22 uint8_t dest
; // destination of the msp frame (from CRSF ext header)
23 MSPframeType_e MSPvers
; // need to store the MSP version since it can only be inferred from the first frame
25 bool isNewFrame(const uint8_t *data
);
26 bool isError(const uint8_t *data
);
28 uint8_t getSeqNumber(const uint8_t *data
);
29 MSPframeType_e
getVersion(const uint8_t *data
);
30 uint8_t getHeaderDir(const uint8_t *data
);
31 uint8_t getChecksum(const uint8_t *data
, const uint32_t packetLen
, MSPframeType_e mspVersion
);
32 uint32_t getFrameLen(const uint8_t *data
, MSPframeType_e mspVersion
);
36 FIFO
<MSP_FRAME_MAX_LEN
> FIFOout
;
37 void parse(const uint8_t *data
); // accept crsf frame input
39 const uint8_t *getFrame();
40 uint32_t getFrameLen();
46 extern CROSSFIRE2MSP crsf2msp
;