UART#
Serial UART Interface Driver.
Flexible UART driver implementation for communication with external devices.
Functions#
Initialize the configured USART peripheral for UART operation.
Disable the configured USART peripheral for UART operation.
Write a data buffer to the UART.
Write one byte to the UART in a blocking fashion.
Find out whether the UART can accept more data to send.
Get the number of bytes ready for reading.
Read from the UART into a data buffer.
Get one byte from UART in a blocking fashion.
Get one byte from UART in a blocking fashion.
Flush one or both UART buffers.
Function Documentation#
uart_init#
void uart_init (void )
Initialize the configured USART peripheral for UART operation.
N/A |
Also sets up GPIO settings for TX, RX, and, if configured, flow control.
38
of file platform/bootloader/driver/btl_serial_driver.h
uart_deinit#
void uart_deinit (void )
Disable the configured USART peripheral for UART operation.
N/A |
43
of file platform/bootloader/driver/btl_serial_driver.h
uart_sendBuffer#
int32_t uart_sendBuffer (uint8_t * buffer, size_t length, bool blocking)
Write a data buffer to the UART.
[in] | buffer | The data buffer to send |
[in] | length | Number of bytes in the buffer to send |
[in] | blocking | Indicates whether this transfer can be offloaded to LDMA and return, or whether to wait on completion before returning. |
Returns
BOOTLOADER_OK if successful, error code otherwise
56
of file platform/bootloader/driver/btl_serial_driver.h
uart_sendByte#
int32_t uart_sendByte (uint8_t byte)
Write one byte to the UART in a blocking fashion.
[in] | byte | The byte to send |
Returns
BOOTLOADER_OK if successful, error code otherwise
65
of file platform/bootloader/driver/btl_serial_driver.h
uart_isTxIdle#
bool uart_isTxIdle (void )
Find out whether the UART can accept more data to send.
N/A |
Returns
true if the UART is not currently transmitting
72
of file platform/bootloader/driver/btl_serial_driver.h
uart_getRxAvailableBytes#
size_t uart_getRxAvailableBytes (void )
Get the number of bytes ready for reading.
N/A |
Returns
Number of bytes in the receive buffer available for reading with uart_receiveBuffer
80
of file platform/bootloader/driver/btl_serial_driver.h
uart_receiveBuffer#
int32_t uart_receiveBuffer (uint8_t * buffer, size_t requestedLength, size_t * receivedLength, bool blocking, uint32_t timeout)
Read from the UART into a data buffer.
[out] | buffer | The data buffer to receive into |
[in] | requestedLength | Number of bytes to read |
[out] | receivedLength | Number of bytes read |
[in] | blocking | Indicates whether to wait for requestedLength bytes to be available and read before returning, or whether to read out data currently in the buffer and return. |
[in] | timeout | Number of milliseconds to wait for data in blocking mode |
Returns
BOOTLOADER_OK if successful, error code otherwise
95
of file platform/bootloader/driver/btl_serial_driver.h
uart_receiveByte#
int32_t uart_receiveByte (uint8_t * byte)
Get one byte from UART in a blocking fashion.
[out] | byte | The byte to send |
Returns
BOOTLOADER_OK if successful, error code otherwise
108
of file platform/bootloader/driver/btl_serial_driver.h
uart_receiveByteTimeout#
int32_t uart_receiveByteTimeout (uint8_t * byte, uint32_t timeout)
Get one byte from UART in a blocking fashion.
[out] | byte | The byte to send |
[in] | timeout | Maximum timeout before aborting transfer |
Returns
BOOTLOADER_OK if successful, error code otherwise
118
of file platform/bootloader/driver/btl_serial_driver.h
uart_flush#
int32_t uart_flush (bool flushTx, bool flushRx)
Flush one or both UART buffers.
[in] | flushTx | Flush the transmit buffer when true |
[in] | flushRx | Flush the receive buffer when true |
Returns
BOOTLOADER_OK
128
of file platform/bootloader/driver/btl_serial_driver.h