Skip to content

Commit f0b7959

Browse files
committed
add default pins for UART1 and UART2
NOTE: UART1's default pins can be used only when SPI Flash is DIO thanks @ladyada
1 parent b5e0ebf commit f0b7959

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cores/esp32/HardwareSerial.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
1515
rxPin = 3;
1616
txPin = 1;
1717
}
18+
if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
19+
rxPin = 9;
20+
txPin = 10;
21+
}
22+
if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {
23+
rxPin = 16;
24+
txPin = 17;
25+
}
1826
_uart = uartBegin(_uart_nr, baud, config, rxPin, txPin, 256, false);
1927
}
2028

0 commit comments

Comments
 (0)