USART Driver

group USARTDriver

Typedefs

typedef void (*usart_callback_t)(uint8_t *buf, int len, void *pxTaskWoken)

In order to catch incoming chars use the callback.

Only one callback per interface.

Parameters
  • handle: usart[0,1,2,3]
  • callback: function pointer

Functions

void usart_init(struct usart_conf *conf)

Initialise UART with the usart_conf data structure.

Parameters

void usart_set_callback(usart_callback_t callback)
void usart_insert(char c, void *pxTaskWoken)

Insert a character to the RX buffer of a usart.

Parameters
  • handle: usart[0,1,2,3]
  • c: Character to insert

void usart_putc(char c)

Polling putchar.

Parameters
  • handle: usart[0,1,2,3]
  • c: Character to transmit

void usart_putstr(char *buf, int len)

Send char buffer on UART.

Parameters
  • handle: usart[0,1,2,3]
  • buf: Pointer to data
  • len: Length of data

char usart_getc(void)

Buffered getchar.

Return
Character received
Parameters
  • handle: usart[0,1,2,3]

int usart_messages_waiting(int handle)
static int usart_stdio_msgwaiting(void)
struct usart_conf
#include <usart.h>

Usart configuration, to be used with the usart_init call.