px4fmu-v5:Support RX TX swap

This commit is contained in:
David Sidrane
2018-07-13 11:38:57 -07:00
committed by Lorenz Meier
parent 8076b103bc
commit b6d01c36af
2 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -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 */
+7
View File
@@ -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);