STM32F3 - Cleanup serial port usage.

This commit is contained in:
Dominic Clifton 2014-09-26 01:01:49 +01:00
parent 6b6df68fa7
commit a5d57e7b87
7 changed files with 22 additions and 8 deletions

View File

@ -345,7 +345,6 @@ STM32F30x_COMMON_SRC = startup_stm32f30x_md_gcc.S \
drivers/pwm_rx.c \
drivers/serial_uart.c \
drivers/serial_uart_stm32f30x.c \
drivers/serial_softserial.c \
drivers/serial_usb_vcp.c \
drivers/sound_beeper_stm32f30x.c \
drivers/system_stm32f30x.c \

View File

@ -208,11 +208,12 @@ void resetSerialConfig(serialConfig_t *serialConfig)
serialConfig->serial_port_scenario[1] = lookupScenarioIndex(SCENARIO_GPS_ONLY);
#if (SERIAL_PORT_COUNT > 2)
serialConfig->serial_port_scenario[2] = lookupScenarioIndex(SCENARIO_UNUSED);
#if (SERIAL_PORT_COUNT > 3)
serialConfig->serial_port_scenario[3] = lookupScenarioIndex(SCENARIO_UNUSED);
#if (SERIAL_PORT_COUNT > 4)
serialConfig->serial_port_scenario[4] = lookupScenarioIndex(SCENARIO_UNUSED);
#endif
#endif
#endif
serialConfig->msp_baudrate = 115200;

View File

@ -69,16 +69,20 @@ static serialPortFunction_t serialPortFunctions[SERIAL_PORT_COUNT] = {
{SERIAL_PORT_USB_VCP, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
{SERIAL_PORT_USART1, 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_USART4, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
{SERIAL_PORT_USART4, NULL, SCENARIO_UNUSED, FUNCTION_NONE}
#endif
};
static const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
{SERIAL_PORT_USB_VCP, 9600, 115200, SPF_NONE },
{SERIAL_PORT_USART1, 9600, 115200, SPF_NONE | 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_USART4, 9600, 19200, SPF_SUPPORTS_CALLBACK}
#endif
};
#else
@ -553,7 +557,7 @@ serialPort_t *openSerialPort(serialPortFunction_e function, serialReceiveCallbac
serialPortIdentifier_e identifier = serialPortConstraint->identifier;
switch(identifier) {
#ifdef STM32F303xC
#ifdef USE_VCP
case SERIAL_PORT_USB_VCP:
serialPort = usbVcpOpen();
break;

View File

@ -62,11 +62,13 @@ typedef enum {
SERIAL_PORT_2,
#if (SERIAL_PORT_COUNT > 2)
SERIAL_PORT_3,
#if (SERIAL_PORT_COUNT > 3)
SERIAL_PORT_4,
#if (SERIAL_PORT_COUNT > 4)
SERIAL_PORT_5
#endif
#endif
#endif
} serialPortIndex_e;

View File

@ -40,7 +40,10 @@
#define LED0
#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)

View File

@ -30,7 +30,10 @@
#define GYRO
#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)

View File

@ -42,7 +42,10 @@
#define LED0
#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)
@ -51,6 +54,5 @@
#define GPS
#define LED_STRIP
#define TELEMETRY
#define SOFT_SERIAL
#define SERIAL_RX
#define AUTOTUNE