Skip to content

Commit dc1a9f3

Browse files
committed
feat(uart): changes the uart loopback function to work with the P4
1 parent dd75181 commit dc1a9f3

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

cores/esp32/HardwareSerial.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ void HardwareSerial::end() {
435435
if (uartGetDebug() == _uart_nr) {
436436
uartSetDebug(0);
437437
}
438-
uart_set_loop_back(_uart_nr, false); // disable loopback mode, if previously enabled
439438
_rxFIFOFull = 0;
440439
uartEnd(_uart_nr); // fully detach all pins and delete the UART driver
441440
_destroyEventTask(); // when IDF uart driver is deleted, _eventTask must finish too

cores/esp32/esp32-hal-uart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,11 @@ unsigned long uartDetectBaudrate(uart_t *uart) {
11661166
This function internally binds defined UARTs TX signal with defined RX pin of any UART (same or different).
11671167
This creates a loop that lets us receive anything we send on the UART without external wires.
11681168
*/
1169-
void uart_internal_loopback(uint8_t uartNum, int8_t rxPin) {
1170-
if (uartNum > SOC_UART_HP_NUM - 1 || !GPIO_IS_VALID_GPIO(rxPin)) {
1169+
void uart_internal_loopback(uint8_t uartNum, bool loop_back_en) {
1170+
if (uartNum > SOC_UART_HP_NUM - 1) {
11711171
return;
11721172
}
1173-
esp_rom_gpio_connect_out_signal(rxPin, UART_TX_SIGNAL(uartNum), false, false);
1173+
uart_set_loop_back(uartNum, loop_back_en);
11741174
}
11751175

11761176
/*

cores/esp32/esp32-hal-uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ unsigned long uartDetectBaudrate(uart_t *uart);
106106

107107
// Make sure UART's RX signal is connected to TX pin
108108
// This creates a loop that lets us receive anything we send on the UART
109-
void uart_internal_loopback(uint8_t uartNum, int8_t rxPin);
109+
void uart_internal_loopback(uint8_t uartNum, bool loop_back_en);
110110

111111
// Routines that generate BREAK in the UART for testing purpose
112112

0 commit comments

Comments
 (0)