1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

MSPv2 implementation (#3977)

Some refactoring

Refactor CRC calculations; Unsigned type for size and offset
This commit is contained in:
Konstantin Sharlaimov 2018-03-20 11:20:07 +10:00 committed by Michael Keller
parent e3c258d65f
commit eb70859e4a
4 changed files with 321 additions and 80 deletions

View file

@ -19,6 +19,17 @@
#include "common/streambuf.h"
#define MSP_V2_FRAME_ID 255
typedef enum {
MSP_V1 = 0,
MSP_V2_OVER_V1 = 1,
MSP_V2_NATIVE = 2,
MSP_VERSION_COUNT
} mspVersion_e;
#define MSP_VERSION_MAGIC_INITIALIZER { 'M', 'M', 'X' }
// return positive for ACK, negative on error, zero for no reply
typedef enum {
MSP_RESULT_ACK = 1,
@ -35,6 +46,7 @@ typedef enum {
typedef struct mspPacket_s {
sbuf_t buf;
int16_t cmd;
uint8_t flags;
int16_t result;
uint8_t direction;
} mspPacket_t;

View file

@ -312,7 +312,7 @@
#define MSP_RESERVE_2 252 //reserved for system usage
#define MSP_DEBUGMSG 253 //out message debug string buffer
#define MSP_DEBUG 254 //out message debug1,debug2,debug3,debug4
#define MSP_RESERVE_3 255 //reserved for system usage
#define MSP_V2_FRAME 255 //MSPv2 payload indicator
// Additional commands that are not compatible with MultiWii
#define MSP_STATUS_EX 150 //out message cycletime, errors_count, CPU load, sensor present etc