Merge pull request #2369 from jflyper/bf316-forced-softserial

[SOFTSERIAL] Updates
This commit is contained in:
borisbstyle 2017-02-12 21:07:32 +01:00 committed by GitHub
commit 2cf0855745
53 changed files with 219 additions and 141 deletions

View File

@ -581,6 +581,7 @@ COMMON_SRC = \
drivers/rx_pwm.c \
drivers/serial.c \
drivers/serial_uart.c \
drivers/serial_softserial.c \
drivers/sound_beeper.c \
drivers/stack_check.c \
drivers/system.c \
@ -651,7 +652,6 @@ HIGHEND_SRC = \
drivers/display_ug2864hsweg01.c \
drivers/light_ws2811strip.c \
drivers/serial_escserial.c \
drivers/serial_softserial.c \
drivers/sonar_hcsr04.c \
drivers/vtx_common.c \
flight/navigation.c \

View File

@ -58,6 +58,9 @@ typedef enum {
TIMER_MODE_DUAL,
} timerMode_e;
#define ICPOLARITY_RISING true
#define ICPOLARITY_FALLING false
typedef struct softSerial_s {
serialPort_t port;
@ -65,8 +68,10 @@ typedef struct softSerial_s {
IO_t txIO;
const timerHardware_t *timerHardware;
#ifdef USE_HAL_DRIVER
const TIM_HandleTypeDef *timerHandle;
#endif
const timerHardware_t *exTimerHardware;
uint32_t ccEnableBit;
volatile uint8_t rxBuffer[SOFTSERIAL_BUFFER_SIZE];
volatile uint8_t txBuffer[SOFTSERIAL_BUFFER_SIZE];
@ -135,14 +140,22 @@ static void serialInputPortActivate(softSerial_t *softSerial)
// Enable input capture
#ifdef USE_HAL_DRIVER
TIM_CCxChannelCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_ENABLE);
#else
TIM_CCxCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_Enable);
#endif
}
static void serialInputPortDeActivate(softSerial_t *softSerial)
{
// Disable input capture
#ifdef USE_HAL_DRIVER
TIM_CCxChannelCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_DISABLE);
#else
TIM_CCxCmd(softSerial->timerHardware->tim, softSerial->timerHardware->channel, TIM_CCx_Disable);
#endif
IOConfigGPIO(softSerial->rxIO, IOCFG_IN_FLOATING);
softSerial->rxActive = false;
@ -186,10 +199,7 @@ static void serialTimerConfigureTimebase(const timerHardware_t *timerHardwarePtr
timerConfigure(timerHardwarePtr, timerPeriod, mhz);
}
// XXX This is almost identical to timerChConfigIC.
// XXX Expensive? Direct register manipulation?
#if 0
static void serialICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polarity)
{
TIM_ICInitTypeDef TIM_ICInitStructure;
@ -203,6 +213,7 @@ static void serialICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polarity)
TIM_ICInit(tim, &TIM_ICInitStructure);
}
#endif
static void resetBuffers(softSerial_t *softSerial)
{
@ -293,7 +304,7 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
// Configure master timer (on RX); time base and input capture
serialTimerConfigureTimebase(softSerial->timerHardware, baud);
serialICConfig(softSerial->timerHardware->tim, softSerial->timerHardware->channel, (options & SERIAL_INVERTED) ? TIM_ICPolarity_Rising : TIM_ICPolarity_Falling);
timerChConfigIC(softSerial->timerHardware, (options & SERIAL_INVERTED) ? ICPOLARITY_RISING : ICPOLARITY_FALLING, 0);
// Initialize callbacks
timerChCCHandlerInit(&softSerial->edgeCb, onSerialRxPinChange);
@ -314,6 +325,10 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
timerChConfigCallbacks(softSerial->timerHardware, &softSerial->edgeCb, &softSerial->overCb);
}
#ifdef USE_HAL_DRIVER
softSerial->timerHandle = timerFindTimerHandle(softSerial->timerHardware->tim);
#endif
if (!(options & SERIAL_BIDIR)) {
serialOutputPortActivate(softSerial);
setTxSignal(softSerial, ENABLE);
@ -398,9 +413,7 @@ void prepareForNextRxByte(softSerial_t *softSerial)
softSerial->isSearchingForStartBit = true;
if (softSerial->rxEdge == LEADING) {
softSerial->rxEdge = TRAILING;
serialICConfig(softSerial->timerHardware->tim, softSerial->timerHardware->channel,
(softSerial->port.options & SERIAL_INVERTED) ? TIM_ICPolarity_Rising : TIM_ICPolarity_Falling
);
timerChConfigIC(softSerial->timerHardware, (softSerial->port.options & SERIAL_INVERTED) ? ICPOLARITY_RISING : ICPOLARITY_FALLING, 0);
}
}
@ -482,7 +495,12 @@ void onSerialRxPinChange(timerCCHandlerRec_t *cbRec, captureCompare_t capture)
// Synchronize the bit timing so that it will interrupt at the center
// of the bit period.
#ifdef USE_HAL_DRIVER
__HAL_TIM_SetCounter(self->timerHandle, __HAL_TIM_GetAutoreload(self->timerHandle) / 2);
#else
TIM_SetCounter(self->timerHardware->tim, self->timerHardware->tim->ARR / 2);
#endif
// For a mono-timer full duplex configuration, this may clobber the
// transmission because the next callback to the onSerialTimerOverflow
// will happen too early causing transmission errors.
@ -492,7 +510,7 @@ void onSerialRxPinChange(timerCCHandlerRec_t *cbRec, captureCompare_t capture)
self->transmissionErrors++;
}
serialICConfig(self->timerHardware->tim, self->timerHardware->channel, inverted ? TIM_ICPolarity_Falling : TIM_ICPolarity_Rising);
timerChConfigIC(self->timerHardware, inverted ? ICPOLARITY_FALLING : ICPOLARITY_RISING, 0);
self->rxEdge = LEADING;
self->rxBitIndex = 0;
@ -510,10 +528,10 @@ void onSerialRxPinChange(timerCCHandlerRec_t *cbRec, captureCompare_t capture)
if (self->rxEdge == TRAILING) {
self->rxEdge = LEADING;
serialICConfig(self->timerHardware->tim, self->timerHardware->channel, inverted ? TIM_ICPolarity_Falling : TIM_ICPolarity_Rising);
timerChConfigIC(self->timerHardware, inverted ? ICPOLARITY_FALLING : ICPOLARITY_RISING, 0);
} else {
self->rxEdge = TRAILING;
serialICConfig(self->timerHardware->tim, self->timerHardware->channel, inverted ? TIM_ICPolarity_Rising : TIM_ICPolarity_Falling);
timerChConfigIC(self->timerHardware, inverted ? ICPOLARITY_RISING : ICPOLARITY_FALLING, 0);
}
}

View File

@ -60,7 +60,9 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -45,7 +45,9 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define UART3_RX_PIN PB11
#define UART3_TX_PIN PB10

View File

@ -70,7 +70,11 @@
#define USE_UART1 // Not connected - TX (PB6) RX PB7 (AF7)
#define USE_UART2 // Receiver - RX (PA3)
#define USE_UART3 // Not connected - 10/RX (PB11) 11/TX (PB10)
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define AVOID_UART2_FOR_PWM_PPM
#define USE_ESCSERIAL

View File

@ -121,7 +121,10 @@
//#define UART5_RX_PIN PD2
//#define UART5_TX_PIN PC12
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -94,7 +94,10 @@
#define UART8_RX_PIN PE0
#define UART8_TX_PIN PE1
#define SERIAL_PORT_COUNT 9 //VCP, USART1, USART2, USART3, UART4, UART5, USART6, USART7, USART8
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 11 //VCP, USART1, USART2, USART3, UART4, UART5, USART6, USART7, USART8, SOFTSERIAL x 2
#define USE_SPI
#define USE_SPI_DEVICE_1

View File

@ -56,7 +56,9 @@
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define SERIAL_PORT_COUNT 5
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -116,7 +116,9 @@
#define SOFTSERIAL1_RX_PIN PB0 // PWM5
#define SOFTSERIAL1_TX_PIN PB1 // PWM6
#define SERIAL_PORT_COUNT 5
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -71,14 +71,14 @@
#define USE_VCP
#define USE_UART1
#define USE_UART3
#ifdef CC3D_OPBL
#define SERIAL_PORT_COUNT 3
#else
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#ifndef CC3D_OPBL
#define SOFTSERIAL1_TX_PIN PB5 // PWM 2
#define SOFTSERIAL1_RX_PIN PB0 // PWM 3
#define SERIAL_PORT_COUNT 4
#endif
#ifdef USE_UART1_RX_DMA

View File

@ -91,7 +91,10 @@
#define USE_VCP
#define USE_UART1
#define USE_UART2
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -93,7 +93,10 @@
#define UART5_RX_PIN PD2
#define UART5_TX_PIN PC12
#define SERIAL_PORT_COUNT 4 //VCP, UART1, UART2, UART3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6 //VCP, UART1, UART2, UART3, SOFTSERIAL x 2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -80,7 +80,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -96,7 +96,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -76,7 +76,10 @@
//#define UART5_RX_PIN PD2
//#define UART5_TX_PIN PC12
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_SPI

View File

@ -100,7 +100,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define SERIAL_PORT_COUNT 6 //VCP, UART1, UART2, UART3, UART4, UART5, UART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 8 //VCP, UART1, UART2, UART3, UART4, UART6, SOFTSERIAL x 2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 8 // PWM 9

View File

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

View File

@ -115,7 +115,9 @@
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define SERIAL_PORT_COUNT 5
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

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

View File

@ -118,7 +118,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define SERIAL_PORT_COUNT 4 //VCP, USART1, USART3, USART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIAL x 2
#define USE_I2C
#define I2C_DEVICE (I2CDEV_1) // PB6-SCL, PB7-SDA

View File

@ -54,7 +54,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -45,7 +45,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -91,7 +91,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -64,6 +64,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10
@ -75,11 +79,7 @@
#define UART3_RX_PIN PB11 // PB11 (AF7)
#ifdef KISSCC
#define USE_SOFTSERIAL1
#define SOFTSERIAL1_TX_PIN PA13
#define SERIAL_PORT_COUNT 5
#else
#define SERIAL_PORT_COUNT 4
#endif
#define USE_I2C

View File

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

View File

@ -119,12 +119,14 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#ifdef LUXV2_RACE
#define USE_UART4
#define USE_UART5
#define SERIAL_PORT_COUNT 6
# define USE_UART4
# define USE_UART5
# define SERIAL_PORT_COUNT 8
#else
#define SERIAL_PORT_COUNT 4
# define SERIAL_PORT_COUNT 6
#endif
#define UART1_TX_PIN PC4

View File

@ -59,7 +59,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -64,9 +64,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
//#define USE_SOFTSERIAL1
//#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -88,7 +88,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
//#define USE_ESCSERIAL //TODO: make ESC serial F7 compatible
//#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -93,7 +93,10 @@
#define UART8_RX_PIN PE0
#define UART8_TX_PIN PE1
#define SERIAL_PORT_COUNT 8 //VCP, USART2, USART3, UART4, UART5, USART6, USART7, USART8
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 10 //VCP, USART2, USART3, UART4, UART5, USART6, USART7, USART8, SOFTSERIAL x 2
#define USE_SPI
#define USE_SPI_DEVICE_1

View File

@ -68,7 +68,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10

View File

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

View File

@ -51,7 +51,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -52,7 +52,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -64,7 +64,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

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

View File

@ -64,7 +64,10 @@
#define UART2_RX_PIN PA3
#define UART2_TX_PIN PA2
#define SERIAL_PORT_COUNT 3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0

View File

@ -85,7 +85,10 @@
#define USE_UART3
#define USE_UART4
#define USE_UART5
#define SERIAL_PORT_COUNT 6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 8
#define UART1_TX_PIN PC4
#define UART1_RX_PIN PC5

View File

@ -45,7 +45,9 @@
#define USE_UART2 // Input - TX (NC) RX (PA15)
#define USE_UART3 // Solder Pads - TX (PB10) RX (PB11)
#define USE_SOFTSERIAL1 // Telemetry
#define SERIAL_PORT_COUNT 5
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -59,7 +59,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -55,7 +55,11 @@
#define USE_UART1 // Conn 1 - TX (PB6) RX PB7 (AF7)
#define USE_UART2 // Input - RX (PA3)
#define USE_UART3 // Servo out - 10/RX (PB11) 11/TX (PB10)
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define AVOID_UART2_FOR_PWM_PPM
#define USE_ESCSERIAL

View File

@ -91,7 +91,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6 //inverter
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -126,15 +126,12 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#if defined(ZCOREF3)
#define SERIAL_PORT_COUNT 3
#else
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#if !defined(ZCOREF3)
#define SOFTSERIAL1_RX_PIN PB4 // PWM 5
#define SOFTSERIAL1_TX_PIN PB5 // PWM 6

View File

@ -69,7 +69,10 @@
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -97,7 +97,8 @@
#define SERIAL_PORT_COUNT 4
#else
#define USE_SOFTSERIAL1
#define SERIAL_PORT_COUNT 5
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#endif
#define USE_ESCSERIAL

View File

@ -61,7 +61,9 @@
#define USE_UART3
#define USE_UART4
#define USE_UART5
#define SERIAL_PORT_COUNT 6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 8
#define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10

View File

@ -151,6 +151,9 @@
#define USE_UART3
#define USE_UART4
#define USE_UART5
//#define USE_SOFTSERIAL1
//#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL

View File

@ -48,14 +48,16 @@
#define USE_VCP
#define USB_IO
#define USBD_PRODUCT_STRING "tinyFISH"
#define SERIAL_PORT_COUNT 4
#define SERIAL_PORT_COUNT 6
#else
#define SERIAL_PORT_COUNT 3
#define SERIAL_PORT_COUNT 5
#endif
#define USE_UART1
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define UART1_TX_PIN PB6
#define UART1_RX_PIN PB7

View File

@ -118,7 +118,10 @@
#define SOFTSERIAL1_RX_PIN PE13 // PWM 3
#define SOFTSERIAL1_TX_PIN PE11 // PWM 2
#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART2, USART3, USART6, SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 8 //VCP, USART1, USART2, USART3, USART6, SOFTSERIAL x 2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -54,7 +54,9 @@
#define USE_UART2
#define USE_UART3
#define USE_SOFTSERIAL1
#define SERIAL_PORT_COUNT 4
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 5
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -81,7 +81,10 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#define SERIAL_PORT_COUNT 4 // VCP, UART1, UART3, UART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 6 // VCP, UART1, UART3, UART6, SOFTSERIAL x 2
#define USE_ESCSERIAL
#define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1

View File

@ -71,10 +71,6 @@
#define USE_PWM
#define USE_PPM
// Force two softserials (Individual target.h may turn these off)
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#if defined(STM32F4) || defined(STM32F7)
#define TASK_GYROPID_DESIRED_PERIOD 125
#define SCHEDULER_DELAY_LIMIT 10

View File

@ -26,62 +26,3 @@
# undef VTX_SMARTAUDIO
# undef VTX_TRAMP
#endif
// Forced config of USE_SOFTSERIAL{1,2} in common.h makes SERIAL_PORT_COUNT
// defined in target.h invalid. Count them and re-define SERIAL_PORT_COUNT.
#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)