1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

decouple cli/msp from each other. relocated non-msp code into

serial_common.c/h. decouple runtime_config from serial ports.  decouple
buzzer from serial ports.  decouple opening of the main serial port from
the msp code.  decouple serial rx providers from runtime_config.  rename
core_t to serialPorts_t since it only contained serial ports.  It's now
clear which files use serial ports based on the header files they
include.
This commit is contained in:
Dominic Clifton 2014-04-19 01:01:31 +01:00
parent 2baf385b99
commit a7e4c859bd
26 changed files with 209 additions and 135 deletions

View file

@ -1,6 +1,9 @@
#include "board.h"
#include "mw.h"
#include "drivers/serial_common.h"
#include "serial_common.h"
#include "telemetry_frsky.h"
#include "telemetry_hott.h"
@ -20,7 +23,6 @@ bool isTelemetryProviderHoTT(void)
bool canUseTelemetryWithCurrentConfiguration(void)
{
if (!feature(FEATURE_TELEMETRY)) {
return false;
}
@ -42,7 +44,7 @@ bool canUseTelemetryWithCurrentConfiguration(void)
return true;
}
void initTelemetry(void)
void initTelemetry(serialPorts_t *serialPorts)
{
// Force telemetry to uart when softserial disabled
if (!feature(FEATURE_SOFTSERIAL))
@ -51,18 +53,18 @@ void initTelemetry(void)
#ifdef FY90Q
// FY90Q does not support softserial
mcfg.telemetry_port = TELEMETRY_PORT_UART;
core.telemport = core.mainport;
serialPorts->telemport = serialPorts.mainport;
#endif
isTelemetryConfigurationValid = canUseTelemetryWithCurrentConfiguration();
#ifndef FY90Q
if (mcfg.telemetry_port == TELEMETRY_PORT_SOFTSERIAL_1)
core.telemport = &(softSerialPorts[0].port);
serialPorts->telemport = &(softSerialPorts[0].port);
else if (mcfg.telemetry_port == TELEMETRY_PORT_SOFTSERIAL_2)
core.telemport = &(softSerialPorts[1].port);
serialPorts->telemport = &(softSerialPorts[1].port);
else
core.telemport = core.mainport;
serialPorts->telemport = serialPorts->mainport;
#endif
checkTelemetryState();