1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/esp32: GPIO init order for UART RX/TX changed

The GPIO for RX has to be initialized as input before the GPIO for TX can be initialized as output. Otherwise it could lead to creash if RX GPIO was used as output before.
This commit is contained in:
Gunar Schorcht 2019-03-26 16:16:49 +01:00
parent b42106e738
commit c0f50104b9

View File

@ -125,8 +125,8 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
}
/* try to initialize the pins as GPIOs first */
if (gpio_init (_uarts[uart].pin_txd, GPIO_OUT) ||
gpio_init (_uarts[uart].pin_rxd, GPIO_IN)) {
if (gpio_init (_uarts[uart].pin_rxd, GPIO_IN) ||
gpio_init (_uarts[uart].pin_txd, GPIO_OUT)) {
return -1;
}