add serial_rx msp

This commit is contained in:
treymarc 2014-05-01 05:06:36 +02:00
parent 8a5f424421
commit ed46b4e4ac
7 changed files with 44 additions and 1 deletions

View File

@ -55,6 +55,7 @@ COMMON_SRC = startup_stm32f10x_md_gcc.S \
sbus.c \
sumd.c \
spektrum.c \
rxmsp.c \
telemetry_common.c \
telemetry_frsky.c \
telemetry_hott.c \

View File

@ -82,6 +82,8 @@ typedef enum {
SERIALRX_SPEKTRUM2048 = 1,
SERIALRX_SBUS = 2,
SERIALRX_SUMD = 3,
SERIALRX_MSP = 4,
SERIALRX_PROVIDER_MAX = SERIALRX_MSP,
} SerialRXType;
typedef enum {

View File

@ -136,7 +136,7 @@ const clivalue_t valueTable[] = {
{ "softserial_2_inverted", VAR_UINT8, &mcfg.softserial_2_inverted, 0, 1 },
{ "gps_type", VAR_UINT8, &mcfg.gps_type, 0, GPS_HARDWARE_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_port", VAR_UINT8, &mcfg.telemetry_port, 0, TELEMETRY_PORT_MAX },
{ "telemetry_switch", VAR_UINT8, &mcfg.telemetry_switch, 0, 1 },

View File

@ -112,6 +112,9 @@ int main(void)
case SERIALRX_SUMD:
sumdInit(&rcReadRawFunc);
break;
case SERIALRX_MSP:
mspInit(&rcReadRawFunc);
break;
}
} 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.

View File

@ -465,6 +465,11 @@ bool sbusFrameComplete(void);
void sumdInit(rcReadRawDataPtr *callback);
bool sumdFrameComplete(void);
// rxmsp
void mspInit(rcReadRawDataPtr *callback);
bool mspFrameComplete(void);
void mspFrameRecieve(void);
// buzzer
void buzzer(uint8_t warn_vbat);
void systemBeep(bool onoff);

31
src/rxmsp.c Normal file
View 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;
}

View File

@ -286,6 +286,7 @@ static void evaluateCommand(void)
for (i = 0; i < 8; i++)
rcData[i] = read16();
headSerialReply(0);
mspFrameRecieve();
break;
case MSP_SET_ACC_TRIM:
cfg.angleTrim[PITCH] = read16();