HAL_ChibiOS: added support for swapping UART pins

This commit is contained in:
Andrew Tridgell 2018-11-20 18:25:35 +11:00
parent bed7939969
commit 013f1d55e8
1 changed files with 10 additions and 0 deletions

View File

@ -1117,6 +1117,13 @@ bool UARTDriver::set_options(uint8_t options)
} else {
cr2 &= ~USART_CR2_TXINV;
}
// F7 can also support swapping RX and TX pins
if (options & OPTION_SWAP) {
cr2 |= USART_CR2_SWAP;
_cr2_options |= USART_CR2_SWAP;
} else {
cr2 &= ~USART_CR2_SWAP;
}
#else // STM32F4
// F4 can do inversion by GPIO if enabled in hwdef.dat, using
// TXINV and RXINV options
@ -1134,6 +1141,9 @@ bool UARTDriver::set_options(uint8_t options)
ret = false;
}
}
if (options & OPTION_SWAP) {
ret = false;
}
#endif // STM32xx
// both F4 and F7 can do half-duplex