UART#

This module provides a low-level interface to two UART ports, intended for use of the display and USB communication. The implementation uses receive and transmit FIFOs, as well as receive and transmit callbacks in order to be able to send and receive longer messages without losing any data.

group BSP_UART

Enums

enum UART_t#

Values:

enumerator UART_2#
enumerator UART_3#
enumerator NUM_UART#

Functions

void BSP_UART_Init(UART_t)#

Initializes the UART peripheral.

uint32_t BSP_UART_Read(UART_t uart, char *str)#

Gets one line of ASCII text that was received from a specified UART device.

Gets one line of ASCII text that was received from a specified UART device.

Parameters:
  • uart – device selected

  • str – pointer to buffer string

  • str – : pointer to buffer to store the string. This buffer should be initialized before hand.

  • usart – : which usart to read from (2 or 3)

Pre:

str should be at least 128bytes long.

Returns:

number of bytes that was read

Pre:

str should be at least 128bytes long.

Returns:

number of bytes that was read

uint32_t BSP_UART_Write(UART_t uart, char *str, uint32_t len)#

Transmits data to through a specific UART device (represented as a line of data in csv file).

Transmits data to through a specific UART device (represented as a line of data in csv file).

Note

This function uses a fifo to buffer the write. If that fifo is full, this function may block while waiting for space to open up. Do not call from timing-critical sections of code.

Parameters:
  • uart – device selected

  • str – pointer to buffer with data to send.

  • len – size of buffer

  • str – : pointer to buffer with data to send.

  • len – : size of buffer

  • usart – : which usart to read from (2 or 3)

Returns:

number of bytes that were sent

Returns:

number of bytes that were sent