diff --git a/Makefile b/Makefile index 2407a58ef9..62a026806f 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/src/main/config/config.c b/src/main/config/config.c index 1ba0941ec5..197edd9d34 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -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; diff --git a/src/main/io/serial.c b/src/main/io/serial.c index b5e1226e4e..086f12152d 100644 --- a/src/main/io/serial.c +++ b/src/main/io/serial.c @@ -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; diff --git a/src/main/io/serial.h b/src/main/io/serial.h index 3cbe22737c..f4f1b9af46 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -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; diff --git a/src/main/target/CHEBUZZF3/target.h b/src/main/target/CHEBUZZF3/target.h index cbb005258f..44ab59f435 100644 --- a/src/main/target/CHEBUZZF3/target.h +++ b/src/main/target/CHEBUZZF3/target.h @@ -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) diff --git a/src/main/target/NAZE32PRO/target.h b/src/main/target/NAZE32PRO/target.h index c7b5c357e3..c6fedca4b6 100644 --- a/src/main/target/NAZE32PRO/target.h +++ b/src/main/target/NAZE32PRO/target.h @@ -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) diff --git a/src/main/target/STM32F3DISCOVERY/target.h b/src/main/target/STM32F3DISCOVERY/target.h index 06f91a6403..e22e8c6182 100644 --- a/src/main/target/STM32F3DISCOVERY/target.h +++ b/src/main/target/STM32F3DISCOVERY/target.h @@ -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