Function esp_idf_svc::sys::uart_set_pin
source · pub unsafe extern "C" fn uart_set_pin(
uart_num: u32,
tx_io_num: i32,
rx_io_num: i32,
rts_io_num: i32,
cts_io_num: i32,
) -> i32
Expand 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 Internal signal can be output to multiple GPIO pads. Only one GPIO pad can connect with input signal.
@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