Skip to content

Commit 054742b

Browse files
authored
fix(uart): support to any idf 5.x version
1 parent 9255202 commit 054742b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,19 @@ static bool _uartTrySetIomuxPin(uart_port_t uart_num, int io_num, uint32_t idx)
319319
// Assign the correct function to the GPIO.
320320
assert(upin->iomux_func != -1);
321321
if (uart_num < SOC_UART_HP_NUM) {
322+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
322323
if (upin->input) {
323324
gpio_iomux_input(io_num, upin->iomux_func, upin->signal);
324325
} else {
325326
gpio_iomux_output(io_num, upin->iomux_func);
326327
}
328+
#else
329+
gpio_iomux_out(io_num, upin->iomux_func, false);
330+
// If the pin is input, we also have to redirect the signal, in order to bypass the GPIO matrix.
331+
if (upin->input) {
332+
gpio_iomux_in(io_num, upin->signal);
333+
}
334+
#endif
327335
}
328336
#if (SOC_UART_LP_NUM >= 1) && (SOC_RTCIO_PIN_COUNT >= 1)
329337
else {

0 commit comments

Comments
 (0)