Browse Source

add serial_rx msp

Conflicts:

	Makefile
	src/board.h
	src/main.c
	src/mw.h
	src/serial_cli.c
master
treymarc 11 years ago
committed by Dominic Clifton
parent
commit
9e8b05dc0e
  1. 1
      Makefile
  2. 5075
      obj/cleanflight_NAZE.hex
  3. 7
      src/rx_common.c
  4. 2
      src/rx_common.h
  5. 46
      src/rx_msp.c
  6. 4
      src/rx_msp.h
  7. 2
      src/serial_cli.c
  8. 2
      src/serial_msp.c

1
Makefile

@ -110,6 +110,7 @@ COMMON_SRC = build_config.c \
rc_controls.c \
rc_curves.c \
rx_common.c \
rx_msp.c \
rx_pwm.c \
rx_sbus.c \
rx_sumd.c \

5075
obj/cleanflight_NAZE.hex
File diff suppressed because it is too large
View File

7
src/rx_common.c

@ -14,6 +14,7 @@
#include "rx_sbus.h"
#include "rx_spektrum.h"
#include "rx_sumd.h"
#include "rx_msp.h"
#include "rx_common.h"
@ -21,6 +22,7 @@ void pwmRxInit(rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *failsafe, rcReadR
void sbusInit(rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback);
void spektrumInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback);
void sumdInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback);
void rxMspInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback);
const char rcChannelLetters[] = "AERT1234";
@ -62,6 +64,9 @@ void serialRxInit(rxConfig_t *rxConfig, failsafe_t *failsafe)
case SERIALRX_SUMD:
sumdInit(rxConfig, &rxRuntimeConfig, failsafe, &rcReadRawFunc);
break;
case SERIALRX_MSP:
rxMspInit(rxConfig, &rxRuntimeConfig, failsafe, &rcReadRawFunc);
break;
}
}
@ -75,6 +80,8 @@ bool isSerialRxFrameComplete(rxConfig_t *rxConfig)
return sbusFrameComplete();
case SERIALRX_SUMD:
return sumdFrameComplete();
case SERIALRX_MSP:
return rxMspFrameComplete();
}
return false;
}

2
src/rx_common.h

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

46
src/rx_msp.c

@ -0,0 +1,46 @@
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "drivers/system_common.h"
#include "drivers/serial_common.h"
#include "drivers/serial_uart_common.h"
#include "serial_common.h"
#include "failsafe.h"
#include "rx_common.h"
#include "rx_msp.h"
failsafe_t *failsafe;
static bool rxMspFrameDone = false;
static uint16_t rxMspReadRawRC(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)
{
return rcData[chan];
}
void rxMspFrameRecieve(void)
{
rxMspFrameDone = true;
}
bool rxMspFrameComplete(void)
{
if (rxMspFrameDone) {
failsafe->vTable->reset();
rxMspFrameDone = false;
return true;
}
return false;
}
void rxMspInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback)
{
failsafe = initialFailsafe;
if (callback)
*callback = rxMspReadRawRC;
}

4
src/rx_msp.h

@ -0,0 +1,4 @@
#pragma once
bool rxMspFrameComplete(void);
void rxMspFrameRecieve(void);

2
src/serial_cli.c

@ -174,7 +174,7 @@ const clivalue_t valueTable[] = {
{ "gps_type", VAR_UINT8, &masterConfig.gps_type, 0, GPS_HARDWARE_MAX },
{ "gps_baudrate", VAR_INT8, &masterConfig.gps_baudrate, 0, GPS_BAUD_MAX },
{ "serialrx_type", VAR_UINT8, &masterConfig.rxConfig.serialrx_type, 0, 3 },
{ "serialrx_type", VAR_UINT8, &masterConfig.rxConfig.serialrx_type, 0, SERIALRX_PROVIDER_MAX },
{ "telemetry_provider", VAR_UINT8, &masterConfig.telemetryConfig.telemetry_provider, 0, TELEMETRY_PROVIDER_MAX },
{ "telemetry_port", VAR_UINT8, &masterConfig.telemetryConfig.telemetry_port, 0, TELEMETRY_PORT_MAX },

2
src/serial_msp.c

@ -19,6 +19,7 @@
#include "boardalignment.h"
#include "gps_common.h"
#include "rx_common.h"
#include "rx_msp.h"
#include "battery.h"
#include "gimbal.h"
#include "telemetry_common.h"
@ -325,6 +326,7 @@ static void evaluateCommand(void)
for (i = 0; i < 8; i++)
rcData[i] = read16();
headSerialReply(0);
rxMspFrameRecieve();
break;
case MSP_SET_ACC_TRIM:
currentProfile.accelerometerTrims.trims.pitch = read16();

Loading…
Cancel
Save