mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
add serial_rx msp
This commit is contained in:
parent
8a5f424421
commit
ed46b4e4ac
7 changed files with 44 additions and 1 deletions
1
Makefile
1
Makefile
|
@ -55,6 +55,7 @@ COMMON_SRC = startup_stm32f10x_md_gcc.S \
|
||||||
sbus.c \
|
sbus.c \
|
||||||
sumd.c \
|
sumd.c \
|
||||||
spektrum.c \
|
spektrum.c \
|
||||||
|
rxmsp.c \
|
||||||
telemetry_common.c \
|
telemetry_common.c \
|
||||||
telemetry_frsky.c \
|
telemetry_frsky.c \
|
||||||
telemetry_hott.c \
|
telemetry_hott.c \
|
||||||
|
|
|
@ -82,6 +82,8 @@ typedef enum {
|
||||||
SERIALRX_SPEKTRUM2048 = 1,
|
SERIALRX_SPEKTRUM2048 = 1,
|
||||||
SERIALRX_SBUS = 2,
|
SERIALRX_SBUS = 2,
|
||||||
SERIALRX_SUMD = 3,
|
SERIALRX_SUMD = 3,
|
||||||
|
SERIALRX_MSP = 4,
|
||||||
|
SERIALRX_PROVIDER_MAX = SERIALRX_MSP,
|
||||||
} SerialRXType;
|
} SerialRXType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -136,7 +136,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "softserial_2_inverted", VAR_UINT8, &mcfg.softserial_2_inverted, 0, 1 },
|
{ "softserial_2_inverted", VAR_UINT8, &mcfg.softserial_2_inverted, 0, 1 },
|
||||||
{ "gps_type", VAR_UINT8, &mcfg.gps_type, 0, GPS_HARDWARE_MAX },
|
{ "gps_type", VAR_UINT8, &mcfg.gps_type, 0, GPS_HARDWARE_MAX },
|
||||||
{ "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, 0, GPS_BAUD_MAX },
|
{ "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, 0, GPS_BAUD_MAX },
|
||||||
{ "serialrx_type", VAR_UINT8, &mcfg.serialrx_type, 0, 3 },
|
{ "serialrx_type", VAR_UINT8, &mcfg.serialrx_type, 0, SERIALRX_PROVIDER_MAX },
|
||||||
{ "telemetry_provider", VAR_UINT8, &mcfg.telemetry_provider, 0, TELEMETRY_PROVIDER_MAX },
|
{ "telemetry_provider", VAR_UINT8, &mcfg.telemetry_provider, 0, TELEMETRY_PROVIDER_MAX },
|
||||||
{ "telemetry_port", VAR_UINT8, &mcfg.telemetry_port, 0, TELEMETRY_PORT_MAX },
|
{ "telemetry_port", VAR_UINT8, &mcfg.telemetry_port, 0, TELEMETRY_PORT_MAX },
|
||||||
{ "telemetry_switch", VAR_UINT8, &mcfg.telemetry_switch, 0, 1 },
|
{ "telemetry_switch", VAR_UINT8, &mcfg.telemetry_switch, 0, 1 },
|
||||||
|
|
|
@ -112,6 +112,9 @@ int main(void)
|
||||||
case SERIALRX_SUMD:
|
case SERIALRX_SUMD:
|
||||||
sumdInit(&rcReadRawFunc);
|
sumdInit(&rcReadRawFunc);
|
||||||
break;
|
break;
|
||||||
|
case SERIALRX_MSP:
|
||||||
|
mspInit(&rcReadRawFunc);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else { // spektrum and GPS are mutually exclusive
|
} else { // spektrum and GPS are mutually exclusive
|
||||||
// Optional GPS - available in both PPM and PWM input mode, in PWM input, reduces number of available channels by 2.
|
// Optional GPS - available in both PPM and PWM input mode, in PWM input, reduces number of available channels by 2.
|
||||||
|
|
5
src/mw.h
5
src/mw.h
|
@ -465,6 +465,11 @@ bool sbusFrameComplete(void);
|
||||||
void sumdInit(rcReadRawDataPtr *callback);
|
void sumdInit(rcReadRawDataPtr *callback);
|
||||||
bool sumdFrameComplete(void);
|
bool sumdFrameComplete(void);
|
||||||
|
|
||||||
|
// rxmsp
|
||||||
|
void mspInit(rcReadRawDataPtr *callback);
|
||||||
|
bool mspFrameComplete(void);
|
||||||
|
void mspFrameRecieve(void);
|
||||||
|
|
||||||
// buzzer
|
// buzzer
|
||||||
void buzzer(uint8_t warn_vbat);
|
void buzzer(uint8_t warn_vbat);
|
||||||
void systemBeep(bool onoff);
|
void systemBeep(bool onoff);
|
||||||
|
|
31
src/rxmsp.c
Normal file
31
src/rxmsp.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#include "board.h"
|
||||||
|
#include "mw.h"
|
||||||
|
|
||||||
|
static bool rxMspFrameDone = false;
|
||||||
|
|
||||||
|
static uint16_t mspReadRawRC(uint8_t chan);
|
||||||
|
static uint16_t mspReadRawRC(uint8_t chan)
|
||||||
|
{
|
||||||
|
return rcData[chan];
|
||||||
|
}
|
||||||
|
|
||||||
|
void mspFrameRecieve(void)
|
||||||
|
{
|
||||||
|
rxMspFrameDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mspFrameComplete(void)
|
||||||
|
{
|
||||||
|
if (rxMspFrameDone) {
|
||||||
|
failsafeCnt = 0; // clear FailSafe counter
|
||||||
|
rxMspFrameDone = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mspInit(rcReadRawDataPtr *callback)
|
||||||
|
{
|
||||||
|
if (callback)
|
||||||
|
*callback = mspReadRawRC;
|
||||||
|
}
|
|
@ -286,6 +286,7 @@ static void evaluateCommand(void)
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
rcData[i] = read16();
|
rcData[i] = read16();
|
||||||
headSerialReply(0);
|
headSerialReply(0);
|
||||||
|
mspFrameRecieve();
|
||||||
break;
|
break;
|
||||||
case MSP_SET_ACC_TRIM:
|
case MSP_SET_ACC_TRIM:
|
||||||
cfg.angleTrim[PITCH] = read16();
|
cfg.angleTrim[PITCH] = read16();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue