From 79883e9d353dc1ec633f4a3a42c93ee460397d75 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 20 Jun 2016 12:08:33 +0800 Subject: [PATCH] Fix UART pins setting (#2098) (#2141) --- cores/esp8266/uart.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cores/esp8266/uart.c b/cores/esp8266/uart.c index 9294e91709..123261aef8 100644 --- a/cores/esp8266/uart.c +++ b/cores/esp8266/uart.c @@ -162,19 +162,19 @@ uart_t* uart_init(int uart_nr, int baudrate, int config, int mode, int tx_pin) uart->rx_enabled = (mode != UART_TX_ONLY); uart->tx_enabled = (mode != UART_RX_ONLY); uart->rx_pin = (uart->rx_enabled)?3:255; - if(uart->rx_enabled) { + if(uart->tx_enabled) { if (tx_pin == 2) { uart->tx_pin = 2; - pinMode(uart->rx_pin, FUNCTION_4); + pinMode(uart->tx_pin, FUNCTION_4); } else { uart->tx_pin = 1; - pinMode(uart->rx_pin, SPECIAL); + pinMode(uart->tx_pin, FUNCTION_0); } } else { uart->tx_pin = 255; } - if(uart->tx_enabled) { - pinMode(uart->tx_pin, SPECIAL); + if(uart->rx_enabled) { + pinMode(uart->rx_pin, SPECIAL); } IOSWAP &= ~(1 << IOSWAPU0); break;