1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Merge branch 'master' into master

This commit is contained in:
PurpleAir 2021-04-04 15:43:19 -06:00 committed by GitHub
commit 57fbd69a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -775,17 +775,14 @@ uart_swap(uart_t* uart, int tx_pin)
{
pinMode(uart->tx_pin, INPUT);
uart->tx_pin = 15;
pinMode(uart->tx_pin, FUNCTION_4);
}
if(uart->rx_enabled) //RX
{
pinMode(uart->rx_pin, INPUT);
uart->rx_pin = 13;
pinMode(uart->rx_pin, FUNCTION_4);
}
if(uart->tx_enabled)
pinMode(uart->tx_pin, FUNCTION_4); //TX
if(uart->rx_enabled)
pinMode(uart->rx_pin, FUNCTION_4); //RX
IOSWAP |= (1 << IOSWAPU0);
return true;
@ -796,17 +793,14 @@ uart_swap(uart_t* uart, int tx_pin)
{
pinMode(uart->tx_pin, INPUT);
uart->tx_pin = (tx_pin == 2)?2:1;
pinMode(uart->tx_pin, (tx_pin == 2)?FUNCTION_4:SPECIAL);
}
if(uart->rx_enabled) //RX
{
pinMode(uart->rx_pin, INPUT);
uart->rx_pin = 3;
pinMode(3, SPECIAL);
}
if(uart->tx_enabled)
pinMode(uart->tx_pin, (tx_pin == 2)?FUNCTION_4:SPECIAL); //TX
if(uart->rx_enabled)
pinMode(3, SPECIAL); //RX
IOSWAP &= ~(1 << IOSWAPU0);
return true;
@ -832,18 +826,15 @@ uart_set_tx(uart_t* uart, int tx_pin)
case UART0:
if(uart->tx_enabled)
{
if (uart->tx_pin == 1 && tx_pin == 2)
if (uart->tx_pin == tx_pin)
{
pinMode(uart->tx_pin, INPUT);
uart->tx_pin = 2;
pinMode(uart->tx_pin, FUNCTION_4);
return true;
}
else if (uart->tx_pin == 2 && tx_pin != 2)
else if (tx_pin == 1 || tx_pin == 2)
{
pinMode(uart->tx_pin, INPUT);
uart->tx_pin = 1;
pinMode(uart->tx_pin, SPECIAL);
uart->tx_pin = tx_pin;
pinMode(uart->tx_pin, tx_pin == 1 ? SPECIAL : FUNCTION_4);
return true;
}
}