Force two software serial ports

This commit is contained in:
jflyper 2017-02-10 16:05:15 +09:00
parent 2dd4e84dad
commit b2ed74cd1e
18 changed files with 124 additions and 81 deletions

View File

@ -63,12 +63,11 @@
#define USE_ESCSERIAL #define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PA6 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PA7 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL2_RX_PIN PB6 // PWM 7
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
#define UART1_TX_PIN PA9 #define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10 #define UART1_RX_PIN PA10

View File

@ -70,8 +70,8 @@
#define UART3_TX_PIN PB10 #define UART3_TX_PIN PB10
#define UART3_RX_PIN PB11 #define UART3_RX_PIN PB11
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 6 // PWM 5 #define SOFTSERIAL1_RX_PIN PB0 // PWM 5
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 7 // PWM 6 #define SOFTSERIAL1_TX_PIN PB1 // PWM 6
#undef USE_I2C #undef USE_I2C

View File

@ -113,19 +113,14 @@
#define UART6_TX_PIN PC6 #define UART6_TX_PIN PC6
#define USE_SOFTSERIAL1 #define USE_SOFTSERIAL1
#define SOFTSERIAL1_RX_PIN PB0 // PWM5
#define SOFTSERIAL1_TX_PIN PB1 // PWM6
#define SERIAL_PORT_COUNT 5 #define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL #define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
#define SOFTSERIAL_1_TIMER TIM3
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0
#define USE_SPI #define USE_SPI
#define USE_SPI_DEVICE_1 #define USE_SPI_DEVICE_1

View File

@ -76,6 +76,8 @@
#define SERIAL_PORT_COUNT 3 #define SERIAL_PORT_COUNT 3
#else #else
#define USE_SOFTSERIAL1 #define USE_SOFTSERIAL1
#define SOFTSERIAL1_TX_PIN PB5 // PWM 2
#define SOFTSERIAL1_RX_PIN PB0 // PWM 3
#define SERIAL_PORT_COUNT 4 #define SERIAL_PORT_COUNT 4
#endif #endif
@ -83,10 +85,6 @@
#undef USE_UART1_RX_DMA #undef USE_UART1_RX_DMA
#endif #endif
#define SOFTSERIAL_1_TIMER TIM3
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 1 // PWM 2
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 2 // PWM 3
#define UART3_RX_PIN PB11 #define UART3_RX_PIN PB11
#define UART3_TX_PIN PB10 #define UART3_TX_PIN PB10

View File

@ -129,9 +129,8 @@
#define UART3_TX_PIN PB10 // PB10 (AF7) #define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PB0
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 1 #define SOFTSERIAL1_TX_PIN PB1
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 2
#define USE_I2C #define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // SDA (PB9/AF4), SCL (PB8/AF4) #define I2C_DEVICE (I2CDEV_1) // SDA (PB9/AF4), SCL (PB8/AF4)

View File

@ -73,12 +73,11 @@
#define UART3_TX_PIN PB10 // PB10 (AF7) #define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PB4 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PB5 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
#define USE_I2C #define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA

View File

@ -60,12 +60,11 @@
#define LED_STRIP #define LED_STRIP
#endif #endif
#define USE_SOFTSERIAL
#define USE_VCP #define USE_VCP
#define USE_UART1 #define USE_UART1
#define USE_UART2 #define USE_UART2
#define USE_UART3 #define USE_UART3
#define SERIAL_PORT_COUNT 5 #define SERIAL_PORT_COUNT 4
#define UART1_TX_PIN PA9 #define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10 #define UART1_RX_PIN PA10
@ -76,10 +75,13 @@
#define UART3_TX_PIN PB10 // PB10 (AF7) #define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
// XXX 11 is out of bound
/*
#ifdef KISSCC #ifdef KISSCC
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 11 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 11
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 11 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 11
#endif #endif
*/
#define USE_I2C #define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA

View File

@ -81,12 +81,11 @@
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
/* /*
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PB4 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PB5 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
*/ */
#define USE_I2C #define USE_I2C

View File

@ -125,12 +125,11 @@
#define USE_SOFTSERIAL2 #define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 4 #define SERIAL_PORT_COUNT 4
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PA6 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PA7 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
#define UART3_RX_PIN PB11 #define UART3_RX_PIN PB11
#define UART3_TX_PIN PB10 #define UART3_TX_PIN PB10

View File

@ -68,8 +68,7 @@
#define USE_UART1 #define USE_UART1
#define USE_UART2 #define USE_UART2
#define USE_UART3 #define USE_UART3
#define USE_SOFTSERIAL1 #define SERIAL_PORT_COUNT 4
#define SERIAL_PORT_COUNT 5
#define UART1_TX_PIN PA9 #define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10 #define UART1_RX_PIN PA10

View File

@ -125,19 +125,7 @@
#define UART6_RX_PIN PC7 #define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6 #define UART6_TX_PIN PC6
#define USE_SOFTSERIAL1 #define SERIAL_PORT_COUNT 4 //VCP, USART1, USART3, USART6
//#define SOFTSERIAL1_RX_PIN PC8 // S5_IN (TIM8 CH3)
//#define SOFTSERIAL1_TX_PIN PC9 // S6_IN (TIM8 CH4)
#define USE_SOFTSERIAL2
// Special case of using different timers for RX and TX
//#define SOFTSERIAL2_RX_PIN PA1 // PWM5, LED_STRIP
//#define SOFTSERIAL2_TX_PIN PA8 // PWM6
// Experimental (untested)
//#define SOFTSERIAL2_RX_PIN PA8 // PWM6
//#define SOFTSERIAL2_TX_PIN PB15 // S2_IN
#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIALx2
#define USE_ESCSERIAL #define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -157,10 +157,7 @@
#define UART6_RX_PIN PC7 #define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6 #define UART6_TX_PIN PC6
#define USE_SOFTSERIAL1 #define SERIAL_PORT_COUNT 4 //VCP, USART1, USART3, USART6
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIALx2
#define USE_ESCSERIAL #define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -59,10 +59,8 @@
#define UART3_TX_PIN PB10 #define UART3_TX_PIN PB10
#define UART3_RX_PIN PB11 #define UART3_RX_PIN PB11
#define SOFTSERIAL1_RX_PIN PA2 //Not connected
#define SOFTSERIAL_1_TIMER TIM15 #define SOFTSERIAL1_TX_PIN PA3
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 7 //Not connected
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 8
#define USE_I2C #define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA

View File

@ -135,12 +135,12 @@
#define USE_SOFTSERIAL2 #define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5 #define SERIAL_PORT_COUNT 5
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PB4 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PB5 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SOFTSERIAL_2_TIMER TIM3 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
#define SONAR_SOFTSERIAL2_EXCLUSIVE #define SONAR_SOFTSERIAL2_EXCLUSIVE
#endif #endif

View File

@ -92,8 +92,13 @@
#define USE_UART1 #define USE_UART1
#define USE_UART2 #define USE_UART2
#define USE_UART3 #define USE_UART3
#ifdef TINYBEEF3
#define SERIAL_PORT_COUNT 4
#else
#define USE_SOFTSERIAL1 #define USE_SOFTSERIAL1
#define SERIAL_PORT_COUNT 5 #define SERIAL_PORT_COUNT 5
#endif
#define USE_ESCSERIAL #define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
@ -107,9 +112,11 @@
#define UART3_TX_PIN PB10 // PB10 (AF7) #define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
#define SOFTSERIAL_1_TIMER TIM2 #ifndef TINYBEEF3
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 9 // PA0 / PAD3 #define SOFTSERIAL1_RX_PIN PA0 // PA0 / PAD3
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 10 // PA1 / PAD4 #define SOFTSERIAL1_TX_PIN PA1 // PA1 / PAD4
#endif
#define SONAR_SOFTSERIAL1_EXCLUSIVE #define SONAR_SOFTSERIAL1_EXCLUSIVE
#define USE_I2C #define USE_I2C

View File

@ -116,9 +116,8 @@
#define USE_SOFTSERIAL1 #define USE_SOFTSERIAL1
#define SOFTSERIAL_1_TIMER TIM1 #define SOFTSERIAL1_RX_PIN PE13 // PWM 3
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 2 // PWM 3 #define SOFTSERIAL1_TX_PIN PE11 // PWM 2
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 1 // PWM 2
#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART2, USART3, USART6, SOFTSERIAL1 #define SERIAL_PORT_COUNT 6 //VCP, USART1, USART2, USART3, USART6, SOFTSERIAL1
#define USE_ESCSERIAL #define USE_ESCSERIAL

View File

@ -68,9 +68,8 @@
#define UART3_TX_PIN PB10 // PB10 (AF7) #define UART3_TX_PIN PB10 // PB10 (AF7)
#define UART3_RX_PIN PB11 // PB11 (AF7) #define UART3_RX_PIN PB11 // PB11 (AF7)
#define SOFTSERIAL_1_TIMER TIM3 #define SOFTSERIAL1_RX_PIN PB0 // PWM 5
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5 #define SOFTSERIAL1_TX_PIN PB1 // PWM 6
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
#define SONAR_SOFTSERIAL1_EXCLUSIVE #define SONAR_SOFTSERIAL1_EXCLUSIVE
#define USE_I2C #define USE_I2C

View File

@ -26,3 +26,69 @@
# undef VTX_SMARTAUDIO # undef VTX_SMARTAUDIO
# undef VTX_TRAMP # undef VTX_TRAMP
#endif #endif
// Forced configuration of two software serials and SERIAL_PORT_COUNT recalc
#ifndef USE_SOFTSERIAL1
# define USE_SOFTSERIAL1
#endif
#ifndef USE_SOFTSERIAL2
# define USE_SOFTSERIAL2
#endif
#ifdef USE_VCP
# define N_VCP 1
#else
# define N_VCP 0
#endif
#ifdef USE_UART1
#define N_UART1 1
#else
#define N_UART1 0
#endif
#ifdef USE_UART2
#define N_UART2 1
#else
#define N_UART2 0
#endif
#ifdef USE_UART3
#define N_UART3 1
#else
#define N_UART3 0
#endif
#ifdef USE_UART4
#define N_UART4 1
#else
#define N_UART4 0
#endif
#ifdef USE_UART5
#define N_UART5 1
#else
#define N_UART5 0
#endif
#ifdef USE_UART6
#define N_UART6 1
#else
#define N_UART6 0
#endif
#ifdef USE_SOFTSERIAL1
#define N_SSERIAL1 1
#else
#define N_SSERIAL1 0
#endif
#ifdef USE_SOFTSERIAL2
#define N_SSERIAL2 1
#else
#define N_SSERIAL2 0
#endif
#undef SERIAL_PORT_COUNT
#define SERIAL_PORT_COUNT (N_VCP + N_UART1 + N_UART2 + N_UART3 + N_UART4 + N_UART5 + N_UART6 + N_SSERIAL1 + N_SSERIAL2)