EasyManua.ls Logo

Espressif ESP32-S2 - Page 481

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
OTHERS (>=0) The number of bytes pushed to the TX FIFO
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
buffer: data buffer address
len: data length to send
int uart_write_bytes(uart_port_t uart_num, const void *src, size_t size)
Send data to the UART port from a given buffer and length,.
If the UART drivers parameter tx_buffer_sizeis set to zero: This function will not return until all the
data have been sent out, or at least pushed into TX FIFO.
Otherwise, if the tx_buffer_size> 0, this function will return after copying all the data to tx ring buffer,
UART ISR will then move data from the ring buffer to TX FIFO gradually.
Return
(-1) Parameter error
OTHERS (>=0) The number of bytes pushed to the TX FIFO
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
src: data buffer address
size: data length to send
int uart_write_bytes_with_break(uart_port_t uart_num, const void *src, size_t size, int
brk_len)
Send data to the UART port from a given buffer and length,.
If the UART drivers parameter tx_buffer_sizeis set to zero: This function will not return until all the
data and the break signal have been sent out. After all data is sent out, send a break signal.
Otherwise, if the tx_buffer_size> 0, this function will return after copying all the data to tx ring buffer,
UART ISR will then move data from the ring buffer to TX FIFO gradually. After all data sent out, send a
break signal.
Return
(-1) Parameter error
OTHERS (>=0) The number of bytes pushed to the TX FIFO
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
src: data buffer address
size: data length to send
brk_len: break signal duration(unit: the time it takes to send one bit at current baudrate)
int uart_read_bytes(uart_port_t uart_num, void *buf, uint32_t length, TickType_t ticks_to_wait)
UART read bytes from UART buffer.
Return
(-1) Error
OTHERS (>=0) The number of bytes read from UART FIFO
Parameters
uart_num: UART port number, the max port number is (UART_NUM_MAX -1).
buf: pointer to the buffer.
length: data length
ticks_to_wait: sTimeout, count in RTOS ticks
esp_err_t uart_flush(uart_port_t uart_num)
Alias of uart_flush_input. UART ring buffer flush. This will discard all data in the UART RX buffer.
Note Instead of waiting the data sent out, this function will clear UART rx buffer. In order to send all the data
in tx FIFO, we can use uart_wait_tx_done function.
Return
ESP_OK Success
ESP_FAIL Parameter error
Parameters
Espressif Systems 470
Submit Document Feedback
Release v4.4

Table of Contents