mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
STM32F3 - Cleanup serial port usage.
This commit is contained in:
parent
6b6df68fa7
commit
a5d57e7b87
7 changed files with 22 additions and 8 deletions
1
Makefile
1
Makefile
|
@ -345,7 +345,6 @@ STM32F30x_COMMON_SRC = startup_stm32f30x_md_gcc.S \
|
||||||
drivers/pwm_rx.c \
|
drivers/pwm_rx.c \
|
||||||
drivers/serial_uart.c \
|
drivers/serial_uart.c \
|
||||||
drivers/serial_uart_stm32f30x.c \
|
drivers/serial_uart_stm32f30x.c \
|
||||||
drivers/serial_softserial.c \
|
|
||||||
drivers/serial_usb_vcp.c \
|
drivers/serial_usb_vcp.c \
|
||||||
drivers/sound_beeper_stm32f30x.c \
|
drivers/sound_beeper_stm32f30x.c \
|
||||||
drivers/system_stm32f30x.c \
|
drivers/system_stm32f30x.c \
|
||||||
|
|
|
@ -208,11 +208,12 @@ void resetSerialConfig(serialConfig_t *serialConfig)
|
||||||
serialConfig->serial_port_scenario[1] = lookupScenarioIndex(SCENARIO_GPS_ONLY);
|
serialConfig->serial_port_scenario[1] = lookupScenarioIndex(SCENARIO_GPS_ONLY);
|
||||||
#if (SERIAL_PORT_COUNT > 2)
|
#if (SERIAL_PORT_COUNT > 2)
|
||||||
serialConfig->serial_port_scenario[2] = lookupScenarioIndex(SCENARIO_UNUSED);
|
serialConfig->serial_port_scenario[2] = lookupScenarioIndex(SCENARIO_UNUSED);
|
||||||
|
#if (SERIAL_PORT_COUNT > 3)
|
||||||
serialConfig->serial_port_scenario[3] = lookupScenarioIndex(SCENARIO_UNUSED);
|
serialConfig->serial_port_scenario[3] = lookupScenarioIndex(SCENARIO_UNUSED);
|
||||||
|
|
||||||
#if (SERIAL_PORT_COUNT > 4)
|
#if (SERIAL_PORT_COUNT > 4)
|
||||||
serialConfig->serial_port_scenario[4] = lookupScenarioIndex(SCENARIO_UNUSED);
|
serialConfig->serial_port_scenario[4] = lookupScenarioIndex(SCENARIO_UNUSED);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
serialConfig->msp_baudrate = 115200;
|
serialConfig->msp_baudrate = 115200;
|
||||||
|
|
|
@ -69,16 +69,20 @@ static serialPortFunction_t serialPortFunctions[SERIAL_PORT_COUNT] = {
|
||||||
{SERIAL_PORT_USB_VCP, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
{SERIAL_PORT_USB_VCP, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||||
{SERIAL_PORT_USART1, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
{SERIAL_PORT_USART1, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||||
{SERIAL_PORT_USART2, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
{SERIAL_PORT_USART2, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||||
|
#if (SERIAL_PORT_COUNT > 3)
|
||||||
{SERIAL_PORT_USART3, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
{SERIAL_PORT_USART3, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||||
{SERIAL_PORT_USART4, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
{SERIAL_PORT_USART4, NULL, SCENARIO_UNUSED, FUNCTION_NONE}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
static const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
||||||
{SERIAL_PORT_USB_VCP, 9600, 115200, SPF_NONE },
|
{SERIAL_PORT_USB_VCP, 9600, 115200, SPF_NONE },
|
||||||
{SERIAL_PORT_USART1, 9600, 115200, SPF_NONE | SPF_SUPPORTS_SBUS_MODE },
|
{SERIAL_PORT_USART1, 9600, 115200, SPF_NONE | SPF_SUPPORTS_SBUS_MODE },
|
||||||
{SERIAL_PORT_USART2, 9600, 115200, SPF_SUPPORTS_CALLBACK | SPF_SUPPORTS_SBUS_MODE},
|
{SERIAL_PORT_USART2, 9600, 115200, SPF_SUPPORTS_CALLBACK | SPF_SUPPORTS_SBUS_MODE},
|
||||||
|
#if (SERIAL_PORT_COUNT > 3)
|
||||||
{SERIAL_PORT_USART3, 9600, 19200, SPF_SUPPORTS_CALLBACK},
|
{SERIAL_PORT_USART3, 9600, 19200, SPF_SUPPORTS_CALLBACK},
|
||||||
{SERIAL_PORT_USART4, 9600, 19200, SPF_SUPPORTS_CALLBACK}
|
{SERIAL_PORT_USART4, 9600, 19200, SPF_SUPPORTS_CALLBACK}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -553,7 +557,7 @@ serialPort_t *openSerialPort(serialPortFunction_e function, serialReceiveCallbac
|
||||||
|
|
||||||
serialPortIdentifier_e identifier = serialPortConstraint->identifier;
|
serialPortIdentifier_e identifier = serialPortConstraint->identifier;
|
||||||
switch(identifier) {
|
switch(identifier) {
|
||||||
#ifdef STM32F303xC
|
#ifdef USE_VCP
|
||||||
case SERIAL_PORT_USB_VCP:
|
case SERIAL_PORT_USB_VCP:
|
||||||
serialPort = usbVcpOpen();
|
serialPort = usbVcpOpen();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -62,11 +62,13 @@ typedef enum {
|
||||||
SERIAL_PORT_2,
|
SERIAL_PORT_2,
|
||||||
#if (SERIAL_PORT_COUNT > 2)
|
#if (SERIAL_PORT_COUNT > 2)
|
||||||
SERIAL_PORT_3,
|
SERIAL_PORT_3,
|
||||||
|
#if (SERIAL_PORT_COUNT > 3)
|
||||||
SERIAL_PORT_4,
|
SERIAL_PORT_4,
|
||||||
#if (SERIAL_PORT_COUNT > 4)
|
#if (SERIAL_PORT_COUNT > 4)
|
||||||
SERIAL_PORT_5
|
SERIAL_PORT_5
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
} serialPortIndex_e;
|
} serialPortIndex_e;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,10 @@
|
||||||
#define LED0
|
#define LED0
|
||||||
#define LED1
|
#define LED1
|
||||||
|
|
||||||
#define SERIAL_PORT_COUNT 5
|
#define USE_VCP
|
||||||
|
#define USE_USART1
|
||||||
|
#define USE_USART2
|
||||||
|
#define SERIAL_PORT_COUNT 3
|
||||||
|
|
||||||
#define I2C_DEVICE (I2CDEV_1)
|
#define I2C_DEVICE (I2CDEV_1)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
#define GYRO
|
#define GYRO
|
||||||
#define ACC
|
#define ACC
|
||||||
|
|
||||||
#define SERIAL_PORT_COUNT 5
|
#define USE_VCP
|
||||||
|
#define USE_USART1
|
||||||
|
#define USE_USART2
|
||||||
|
#define SERIAL_PORT_COUNT 3
|
||||||
|
|
||||||
#define I2C_DEVICE (I2CDEV_1)
|
#define I2C_DEVICE (I2CDEV_1)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,10 @@
|
||||||
#define LED0
|
#define LED0
|
||||||
#define LED1
|
#define LED1
|
||||||
|
|
||||||
#define SERIAL_PORT_COUNT 5
|
#define USE_VCP
|
||||||
|
#define USE_USART1
|
||||||
|
#define USE_USART2
|
||||||
|
#define SERIAL_PORT_COUNT 3
|
||||||
|
|
||||||
#define I2C_DEVICE (I2CDEV_1)
|
#define I2C_DEVICE (I2CDEV_1)
|
||||||
|
|
||||||
|
@ -51,6 +54,5 @@
|
||||||
#define GPS
|
#define GPS
|
||||||
#define LED_STRIP
|
#define LED_STRIP
|
||||||
#define TELEMETRY
|
#define TELEMETRY
|
||||||
#define SOFT_SERIAL
|
|
||||||
#define SERIAL_RX
|
#define SERIAL_RX
|
||||||
#define AUTOTUNE
|
#define AUTOTUNE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue