mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 09:20:35 +08:00
px4fmu-v5:Support RX TX swap
This commit is contained in:
committed by
Lorenz Meier
parent
8076b103bc
commit
b6d01c36af
@@ -521,7 +521,10 @@
|
||||
|
||||
#define RC_UXART_BASE STM32_USART6_BASE
|
||||
#define RC_SERIAL_PORT "/dev/ttyS4"
|
||||
#define RC_SERIAL_PORT_IS_FULL_DUPLEX false
|
||||
#define BOARD_HAS_SINGLE_WIRE 1 /* HW is capable of Single Wire */
|
||||
#define BOARD_HAS_SINGLE_WIRE_ON_TX 1 /* HW default is wired as Single Wire On TX pin */
|
||||
#define BOARD_HAS_RX_TX_SWAP 1 /* HW Can swap TX and RX */
|
||||
#define RC_SERIAL_PORT_IS_SWAPED 0 /* Board wired with RC's TX is on cpu RX */
|
||||
|
||||
#define GPS_DEFAULT_UART_PORT "/dev/ttyS0" /* UART1 on FMUv5 */
|
||||
|
||||
|
||||
@@ -130,7 +130,14 @@ __EXPORT void board_rc_input(bool invert_on, uint32_t uxart_base)
|
||||
putreg32(regval, STM32_USART_CR1_OFFSET + uxart_base);
|
||||
|
||||
if (invert_on) {
|
||||
#if defined(BOARD_HAS_RX_TX_SWAP) && RC_SERIAL_PORT_IS_SWAPED == 1
|
||||
|
||||
/* This is only tuned on */
|
||||
|
||||
cr2 |= (USART_CR2_RXINV | USART_CR2_TXINV | USART_CR2_SWAP);
|
||||
#else
|
||||
cr2 |= (USART_CR2_RXINV | USART_CR2_TXINV);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
cr2 &= ~(USART_CR2_RXINV | USART_CR2_TXINV);
|
||||
|
||||
Reference in New Issue
Block a user