pub unsafe extern "C" fn uart_set_pin(
uart_num: uart_port_t,
tx_io_num: c_int,
rx_io_num: c_int,
rts_io_num: c_int,
cts_io_num: c_int,
) -> esp_err_tExpand description
@brief Assign signals of a UART peripheral to GPIO pins
@note If the GPIO number configured for a UART signal matches one of the
IOMUX signals for that GPIO, the signal will be connected directly
via the IOMUX. Otherwise the GPIO and signal will be connected via
the GPIO Matrix. For example, if on an ESP32 the call
uart_set_pin(0, 1, 3, -1, -1) is performed, as GPIO1 is UART0’s
default TX pin and GPIO3 is UART0’s default RX pin, both will be
connected to respectively U0TXD and U0RXD through the IOMUX, totally
bypassing the GPIO matrix.
The check is performed on a per-pin basis. Thus, it is possible to have
RX pin binded to a GPIO through the GPIO matrix, whereas TX is binded
to its GPIO through the IOMUX.
@note It is possible to configure TX and RX to share the same IO (single wire mode), but please be aware of output conflict, which could damage the pad. Apply open-drain and pull-up to the pad ahead of time as a protection, or the upper layer protocol must guarantee no output from two ends at the same time.
@param uart_num UART port number, the max port number is (UART_NUM_MAX -1). @param tx_io_num UART TX pin GPIO number. @param rx_io_num UART RX pin GPIO number. @param rts_io_num UART RTS pin GPIO number. @param cts_io_num UART CTS pin GPIO number.
@return - ESP_OK Success - ESP_FAIL Parameter error