1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Multiple telemtry providers can now be active at the same time on any

serial port. 
MSP telemetry can now be at any baud rate.

A pattern is emerging in each telemetry provider, code is duplicated to
get things working, refactoring can come later.
This commit is contained in:
Dominic Clifton 2015-02-18 23:10:04 +00:00
parent 3e64ce883c
commit 7dcc7b2fb5
15 changed files with 212 additions and 90 deletions

View file

@ -17,17 +17,22 @@
#pragma once
typedef enum {
PORTSHARING_UNUSED = 0,
PORTSHARING_NOT_SHARED,
PORTSHARING_SHARED
} portSharing_e;
typedef enum {
FUNCTION_NONE = 0,
FUNCTION_MSP = (1 << 0),
FUNCTION_CLI = (1 << 1),
FUNCTION_GPS = (1 << 1),
FUNCTION_FRSKY_TELEMETRY = (1 << 2),
FUNCTION_HOTT_TELEMETRY = (1 << 3),
FUNCTION_MSP_TELEMETRY = (1 << 4),
FUNCTION_SMARTPORT_TELEMETRY = (1 << 5),
FUNCTION_SERIAL_RX = (1 << 6),
FUNCTION_GPS = (1 << 7),
FUNCTION_BLACKBOX = (1 << 8)
FUNCTION_BLACKBOX = (1 << 7)
} serialPortFunction_e;
// serial port identifiers are now fixed, these values are used by MSP commands.
@ -62,7 +67,7 @@ serialPort_t *findNextSharedSerialPort(uint16_t functionMask, serialPortFunction
typedef struct serialPortConfig_s {
serialPortIdentifier_e identifier;
serialPortFunction_e functionMask;
uint16_t functionMask;
uint32_t baudrate; // not used for all functions, e.g. HoTT only works at 19200.
} serialPortConfig_t;
@ -80,6 +85,10 @@ bool doesConfigurationUsePort(serialPortIdentifier_e portIdentifier);
serialPortConfig_t *findSerialPortConfig(serialPortFunction_e function);
serialPortConfig_t *findNextSerialPortConfig(serialPortFunction_e function);
portSharing_e determinePortSharing(serialPortConfig_t *portConfig, serialPortFunction_e function);
bool isSerialPortShared(serialPortConfig_t *portConfig, uint16_t functionMask, serialPortFunction_e sharedWithFunction);
//
// runtime