UART#

Serial UART Interface Driver.

Flexible UART driver implementation for communication with external devices.

Functions#

void
uart_init(void)

Initialize the configured USART peripheral for UART operation.

void

Disable the configured USART peripheral for UART operation.

int32_t
uart_sendBuffer(uint8_t *buffer, size_t length, bool blocking)

Write a data buffer to the UART.

int32_t
uart_sendByte(uint8_t byte)

Write one byte to the UART in a blocking fashion.

bool

Find out whether the UART can accept more data to send.

size_t

Get the number of bytes ready for reading.

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.

int32_t
uart_receiveByte(uint8_t *byte)

Get one byte from UART in a blocking fashion.

int32_t
uart_receiveByteTimeout(uint8_t *byte, uint32_t timeout)

Get one byte from UART in a blocking fashion.

int32_t
uart_flush(bool flushTx, bool flushRx)

Flush one or both UART buffers.

Function Documentation#

uart_init#

void uart_init (void )

Initialize the configured USART peripheral for UART operation.

Parameters
N/A

Also sets up GPIO settings for TX, RX, and, if configured, flow control.


Definition at line 38 of file platform/bootloader/driver/btl_serial_driver.h

uart_deinit#

void uart_deinit (void )

Disable the configured USART peripheral for UART operation.

Parameters
N/A

Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[in]byte

The byte to send

Returns

  • BOOTLOADER_OK if successful, error code otherwise


Definition at line 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.

Parameters
N/A

Returns

  • true if the UART is not currently transmitting


Definition at line 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.

Parameters
N/A

Returns


Definition at line 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.

Parameters
[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


Definition at line 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.

Parameters
[out]byte

The byte to send

Returns

  • BOOTLOADER_OK if successful, error code otherwise


Definition at line 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.

Parameters
[out]byte

The byte to send

[in]timeout

Maximum timeout before aborting transfer

Returns

  • BOOTLOADER_OK if successful, error code otherwise


Definition at line 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.

Parameters
[in]flushTx

Flush the transmit buffer when true

[in]flushRx

Flush the receive buffer when true

Returns

  • BOOTLOADER_OK


Definition at line 128 of file platform/bootloader/driver/btl_serial_driver.h