drivers: serial: uart_stm32: tx/rx swap in init()

Previously, the uart_stm32 driver was extended in #44487 to support
swapping the tx and rx pins of supported STM32 UART peripherals.
However, the original change applied this configuration during the
call to the uart_stm32_configure() function. This has now been added to
the uart_stm32_init() function to ensure this behavior on startup for
ports like the virtual com port.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
This commit is contained in:
Peter Maxwell Warasila 2022-05-09 16:28:51 -04:00 committed by Maureen Helm
commit 3c09c21fda

View file

@ -473,12 +473,6 @@ static int uart_stm32_configure(const struct device *dev,
data->baud_rate = cfg->baudrate;
}
#ifdef LL_USART_TXRX_SWAPPED
if (config->tx_rx_swap) {
LL_USART_SetTXRXSwap(config->usart, LL_USART_TXRX_SWAPPED);
}
#endif
LL_USART_Enable(config->usart);
return 0;
};
@ -1612,6 +1606,12 @@ static int uart_stm32_init(const struct device *dev)
LL_USART_EnableHalfDuplex(config->usart);
}
#ifdef LL_USART_TXRX_SWAPPED
if (config->tx_rx_swap) {
LL_USART_SetTXRXSwap(config->usart, LL_USART_TXRX_SWAPPED);
}
#endif
LL_USART_Enable(config->usart);
#ifdef USART_ISR_TEACK