USARTDriver
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
-
handle usart[0,1,2,3] callback function pointer
Function Documentation
char usart_getc | ( | void | ) |
Buffered getchar.
- Parameters
-
handle usart[0,1,2,3]
- Returns
- Character received
void usart_init | ( | struct usart_conf * | conf | ) |
Initialise UART with the usart_conf data structure.
- Parameters
-
usart_conf full configuration structure
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
int usart_messages_waiting | ( | int | handle | ) |
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
void usart_set_callback | ( | usart_callback_t | callback | ) |