mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +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:
parent
2baf385b99
commit
a7e4c859bd
26 changed files with 209 additions and 135 deletions
15
src/main.c
15
src/main.c
|
@ -1,10 +1,12 @@
|
|||
#include "board.h"
|
||||
#include "flight_common.h"
|
||||
#include "flight_mixer.h"
|
||||
#include "serial_common.h"
|
||||
#include "mw.h"
|
||||
|
||||
#include "gps_common.h"
|
||||
#include "rx_common.h"
|
||||
#include "drivers/serial_common.h"
|
||||
#include "telemetry_common.h"
|
||||
#include "boardalignment.h"
|
||||
#include "config.h"
|
||||
|
@ -12,10 +14,11 @@
|
|||
|
||||
#include "build_config.h"
|
||||
|
||||
core_t core;
|
||||
|
||||
extern rcReadRawDataPtr rcReadRawFunc;
|
||||
|
||||
void initTelemetry(serialPorts_t *serialPorts);
|
||||
void serialInit(serialConfig_t *initialSerialConfig);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
@ -115,14 +118,14 @@ int main(void)
|
|||
if (feature(FEATURE_VBAT))
|
||||
batteryInit(&mcfg.batteryConfig);
|
||||
|
||||
serialInit(mcfg.serial_baudrate);
|
||||
serialInit(&mcfg.serialConfig);
|
||||
|
||||
#ifndef FY90Q
|
||||
if (feature(FEATURE_SOFTSERIAL)) {
|
||||
//mcfg.softserial_baudrate = 19200; // Uncomment to override config value
|
||||
|
||||
setupSoftSerialPrimary(mcfg.softserial_baudrate, mcfg.softserial_1_inverted);
|
||||
setupSoftSerialSecondary(mcfg.softserial_2_inverted);
|
||||
setupSoftSerialPrimary(mcfg.serialConfig.softserial_baudrate, mcfg.serialConfig.softserial_1_inverted);
|
||||
setupSoftSerialSecondary(mcfg.serialConfig.softserial_2_inverted);
|
||||
|
||||
#ifdef SOFTSERIAL_LOOPBACK
|
||||
loopbackPort1 = (serialPort_t*)&(softSerialPorts[0]);
|
||||
|
@ -136,7 +139,7 @@ int main(void)
|
|||
#endif
|
||||
|
||||
if (feature(FEATURE_TELEMETRY))
|
||||
initTelemetry();
|
||||
initTelemetry(&serialPorts);
|
||||
|
||||
previousTime = micros();
|
||||
if (mcfg.mixerConfiguration == MULTITYPE_GIMBAL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue