Uart#

group bsp_uart

Control the UART peripheral.

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2022

Typedefs

typedef uint8_t uart_t#

UART peripheral index.

typedef void (*uart_rx_cb_t)(uint8_t data)#

Callback function prototype, it is called on each byte received.

Functions

void db_uart_init(uart_t uart, const gpio_t *rx_pin, const gpio_t *tx_pin, uint32_t baudrate, uart_rx_cb_t callback)#

Initialize the UART interface.

Parameters:
  • uart[in] UART peripheral to use

  • rx_pin[in] pointer to RX pin

  • tx_pin[in] pointer to TX pin

  • baudrate[in] Baudrate in bauds

  • callback[in] callback function called on each received byte

void db_uart_write(uart_t uart, uint8_t *buffer, size_t length)#

Write bytes to the UART.

Parameters:
  • uart[in] UART peripheral to use

  • buffer[in] pointer to the buffer to write to UART

  • length[in] number of bytes of the buffer to write