Tidied serial and telemetry files

This commit is contained in:
Martin Budden 2016-08-01 06:45:59 +01:00
parent 9a38d8a9e1
commit 168469236b
12 changed files with 48 additions and 38 deletions

View File

@ -421,13 +421,13 @@ void uartWrite(serialPort_t *instance, uint8_t ch)
const struct serialPortVTable uartVTable[] = { const struct serialPortVTable uartVTable[] = {
{ {
uartWrite, .serialWrite = uartWrite,
uartTotalRxBytesWaiting, .serialTotalRxWaiting = uartTotalRxBytesWaiting,
uartTotalTxBytesFree, .serialTotalTxFree = uartTotalTxBytesFree,
uartRead, .serialRead = uartRead,
uartSetBaudRate, .serialSetBaudRate = uartSetBaudRate,
isUartTransmitBufferEmpty, .isSerialTransmitBufferEmpty = isUartTransmitBufferEmpty,
uartSetMode, .setMode = uartSetMode,
.writeBuf = NULL, .writeBuf = NULL,
.beginWrite = NULL, .beginWrite = NULL,
.endWrite = NULL, .endWrite = NULL,

View File

@ -171,9 +171,9 @@ static const struct serialPortVTable usbVTable[] = {
.serialSetBaudRate = usbVcpSetBaudRate, .serialSetBaudRate = usbVcpSetBaudRate,
.isSerialTransmitBufferEmpty = isUsbVcpTransmitBufferEmpty, .isSerialTransmitBufferEmpty = isUsbVcpTransmitBufferEmpty,
.setMode = usbVcpSetMode, .setMode = usbVcpSetMode,
.writeBuf = usbVcpWriteBuf,
.beginWrite = usbVcpBeginWrite, .beginWrite = usbVcpBeginWrite,
.endWrite = usbVcpEndWrite, .endWrite = usbVcpEndWrite
.writeBuf = usbVcpWriteBuf
} }
}; };

View File

@ -194,7 +194,7 @@ serialPort_t *findNextSharedSerialPort(uint16_t functionMask, serialPortFunction
#ifdef TELEMETRY #ifdef TELEMETRY
#define ALL_TELEMETRY_FUNCTIONS_MASK (TELEMETRY_SHAREABLE_PORT_FUNCTIONS_MASK | FUNCTION_TELEMETRY_HOTT | FUNCTION_TELEMETRY_SMARTPORT) #define ALL_TELEMETRY_FUNCTIONS_MASK (TELEMETRY_SHAREABLE_PORT_FUNCTIONS_MASK | FUNCTION_TELEMETRY_HOTT | FUNCTION_TELEMETRY_SMARTPORT)
#else #else
#define ALL_TELEMETRY_FUNCTIONS_MASK (FUNCTION_TELEMETRY_FRSKY | FUNCTION_TELEMETRY_HOTT | FUNCTION_TELEMETRY_SMARTPORT | FUNCTION_TELEMETRY_LTM) #define ALL_TELEMETRY_FUNCTIONS_MASK (FUNCTION_TELEMETRY_FRSKY | FUNCTION_TELEMETRY_HOTT | FUNCTION_TELEMETRY_SMARTPORT | FUNCTION_TELEMETRY_LTM | FUNCTION_TELEMETRY_MAVLINK)
#endif #endif
#define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | ALL_TELEMETRY_FUNCTIONS_MASK) #define ALL_FUNCTIONS_SHARABLE_WITH_MSP (FUNCTION_BLACKBOX | ALL_TELEMETRY_FUNCTIONS_MASK)
@ -270,7 +270,7 @@ serialPort_t *openSerialPort(
portMode_t mode, portMode_t mode,
portOptions_t options) portOptions_t options)
{ {
#if (!defined(USE_VCP) && !defined(USE_UART1) && !defined(USE_UART2) && !defined(USE_UART3) && !defined(USE_SOFTSERIAL1) && !defined(USE_SOFTSERIAL1)) #if (!defined(USE_VCP) && !defined(USE_UART1) && !defined(USE_UART2) && !defined(USE_UART3) && !defined(USE_UART4) && !defined(USE_UART5) && !defined(USE_UART6) && !defined(USE_SOFTSERIAL1) && !defined(USE_SOFTSERIAL2))
UNUSED(callback); UNUSED(callback);
UNUSED(baudRate); UNUSED(baudRate);
UNUSED(mode); UNUSED(mode);

View File

@ -34,6 +34,7 @@ typedef enum {
FUNCTION_RX_SERIAL = (1 << 6), // 64 FUNCTION_RX_SERIAL = (1 << 6), // 64
FUNCTION_BLACKBOX = (1 << 7), // 128 FUNCTION_BLACKBOX = (1 << 7), // 128
FUNCTION_PASSTHROUGH = (1 << 8), // 256 FUNCTION_PASSTHROUGH = (1 << 8), // 256
FUNCTION_TELEMETRY_MAVLINK = (1 << 9), // 512
} serialPortFunction_e; } serialPortFunction_e;
typedef enum { typedef enum {

View File

@ -35,16 +35,17 @@
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include "common/utils.h"
#include "platform.h" #include "platform.h"
#include "common/utils.h"
#include "build_config.h" #include "build_config.h"
#include "drivers/system.h" #include "drivers/system.h"
#include "drivers/serial.h" #include "drivers/serial.h"
#include "drivers/serial_uart.h" #include "drivers/serial_uart.h"
#include "io/serial.h" #include "io/serial.h"
#include "rx/rx.h"
#include "rx/jetiexbus.h" #include "rx/jetiexbus.h"
@ -55,6 +56,7 @@
#include "sensors/battery.h" #include "sensors/battery.h"
#include "sensors/barometer.h" #include "sensors/barometer.h"
#include "telemetry/telemetry.h" #include "telemetry/telemetry.h"
#include "telemetry/jetiexbus.h"
#endif //TELEMETRY #endif //TELEMETRY

View File

@ -17,19 +17,6 @@
#pragma once #pragma once
#include "rx/rx.h"
bool jetiExBusInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback); bool jetiExBusInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback);
uint8_t jetiExBusFrameStatus(void); uint8_t jetiExBusFrameStatus(void);
#ifdef TELEMETRY
#include "telemetry/telemetry.h"
void initJetiExBusTelemetry(telemetryConfig_t *initialTelemetryConfig);
void checkJetiExBusTelemetryState(void);
void handleJetiExBusTelemetry(void);
#endif //TELEMETRY

View File

@ -21,7 +21,6 @@
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include "platform.h" #include "platform.h"

View File

@ -15,10 +15,9 @@
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "rx/rx.h" #pragma once
#ifndef TELEMETRY_FRSKY_H_ #include "rx/rx.h"
#define TELEMETRY_FRSKY_H_
typedef enum { typedef enum {
FRSKY_VFAS_PRECISION_LOW = 0, FRSKY_VFAS_PRECISION_LOW = 0,
@ -32,4 +31,3 @@ void initFrSkyTelemetry(telemetryConfig_t *telemetryConfig);
void configureFrSkyTelemetryPort(void); void configureFrSkyTelemetryPort(void);
void freeFrSkyTelemetryPort(void); void freeFrSkyTelemetryPort(void);
#endif /* TELEMETRY_FRSKY_H_ */

View File

@ -57,11 +57,12 @@
#include <string.h> #include <string.h>
#include "platform.h" #include "platform.h"
#include "build_config.h"
#include "debug.h"
#ifdef TELEMETRY #ifdef TELEMETRY
#include "build_config.h"
#include "debug.h"
#include "common/axis.h" #include "common/axis.h"
#include "drivers/system.h" #include "drivers/system.h"

View File

@ -0,0 +1,23 @@
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
struct telemetryConfig_s;
void initJetiExBusTelemetry(struct telemetryConfig_s *initialTelemetryConfig);
void checkJetiExBusTelemetryState(void);
void handleJetiExBusTelemetry(void);

View File

@ -33,10 +33,10 @@
#include "platform.h" #include "platform.h"
#include "build_config.h"
#ifdef TELEMETRY #ifdef TELEMETRY
#include "build_config.h"
#include "common/maths.h" #include "common/maths.h"
#include "common/axis.h" #include "common/axis.h"
#include "common/color.h" #include "common/color.h"

View File

@ -17,7 +17,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include "platform.h" #include "platform.h"
@ -40,7 +39,7 @@
#include "telemetry/hott.h" #include "telemetry/hott.h"
#include "telemetry/smartport.h" #include "telemetry/smartport.h"
#include "telemetry/ltm.h" #include "telemetry/ltm.h"
#include "rx/jetiexbus.h" #include "telemetry/jetiexbus.h"
static telemetryConfig_t *telemetryConfig; static telemetryConfig_t *telemetryConfig;