Uart.hpp

Submitted by Webbot on January 2, 2009 - 12:53am.

This class allows you to easily create a non-buffered UART. By non-buffered then I mean that when you send a character then the system will wait until the character has been transmitted before your code can continue. A more efficient Uart can be achieved via UartBuffered which allows you to pass an entire string buffer which is then sent in the background.

 

To define the UART use:- UART (uint32_t baud = 9600, FuncPtru08 rx_func = 0);

The first parameter specifies the baud rate (or 9600 if not specified) and the second parameter specifies the name of your function that is called when a character is received (if not specified then received chars are ignored).

 

So to specify a UART that is only used for logging output at 19,200 then just use:-

UART log (19200);

 

As a 'Display' class the UART supports:

void display(uint8_t c);