Search Results

Files

file  usart.h
Common USART interface, This file is derived from the Gomspace USART driver, the main difference is the assumption that only one USART will be present on a PC.
 

Data Structures

struct  usart_conf
Usart configuration, to be used with the usart_init call. More...
 

Typedefs

typedef void(* usart_callback_t) (uint8_t *buf, int len, void *pxTaskWoken)
In order to catch incoming chars use the callback. More...
 

Functions

void usart_init (struct usart_conf *conf)
Initialise UART with the usart_conf data structure. More...
 
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. More...
 
void usart_putc (char c)
Polling putchar. More...
 
void usart_putstr (char *buf, int len)
Send char buffer on UART. More...
 
char usart_getc (void)
Buffered getchar. More...
 
int usart_messages_waiting (int handle)
 

Data Structure Documentation

struct usart_conf

Usart configuration, to be used with the usart_init call.

Data Fields

const char * device
 
uint32_t baudrate
 
uint8_t databits
 
uint8_t stopbits
 
uint8_t paritysetting
 
uint8_t checkparity
 

Field Documentation

uint32_t usart_conf::baudrate
uint8_t usart_conf::checkparity
uint8_t usart_conf::databits
const char* usart_conf::device
uint8_t usart_conf::paritysetting
uint8_t usart_conf::stopbits

Typedef Documentation

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
handleusart[0,1,2,3]
callbackfunction pointer

Function Documentation

char usart_getc ( void  )

Buffered getchar.

Parameters
handleusart[0,1,2,3]
Returns
Character received
void usart_init ( struct usart_conf conf)

Initialise UART with the usart_conf data structure.

Parameters
usart_conffull configuration structure
void usart_insert ( char  c,
void *  pxTaskWoken 
)

Insert a character to the RX buffer of a usart.

Parameters
handleusart[0,1,2,3]
cCharacter to insert
int usart_messages_waiting ( int  handle)
void usart_putc ( char  c)

Polling putchar.

Parameters
handleusart[0,1,2,3]
cCharacter to transmit
void usart_putstr ( char *  buf,
int  len 
)

Send char buffer on UART.

Parameters
handleusart[0,1,2,3]
bufPointer to data
lenLength of data
void usart_set_callback ( usart_callback_t  callback)