sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
UART Library

Interrupt UART library using the built-in UART with transmit and receive circular buffers. More...

Macros

#define UART_BAUD_SELECT(baudRate, xtalCpu)   ((xtalCpu + baudRate * 8L) / (baudRate * 16L) - 1)
 UART Baudrate Expression. More...
 
#define P(s)   ({static const char c[] __attribute__ ((progmem)) = s;c;})
 
#define UART_FRAME_ERROR   0x0800 /* Framing Error by UART */
 
#define UART_OVERRUN_ERROR   0x0400 /* Overrun condition by UART */
 
#define UART_BUFFER_OVERFLOW   0x0200 /* receive ringbuffer overflow */
 
#define UART_NO_DATA   0x0100 /* no receive data available */
 
#define uart_init(baud)   do {} while(0)
 
#define uart_getc()   UART_NO_DATA
 
#define uart_putc(data)   do {} while(0)
 
#define uart_puts(s)   do {} while(0)
 
#define uart_puts_p(s)   do {} while(0)
 
#define uart_puts_P(s)   do {} while(0)
 
#define uart_puti(i)   do {} while(0)
 
#define uart_putl(i)   do {} while(0)
 
#define uart_puthex_nibble(b)   do {} while(0)
 
#define uart_puthex_byte(b)   do {} while(0)
 
#define uart_puthex_byte_(b)   do {} while(0)
 
#define uart_puthex_word(b)   do {} while(0)
 
#define uart_poll()   do {} while(0)
 

Detailed Description

Interrupt UART library using the built-in UART with transmit and receive circular buffers.

#include <uart.h>

This library can be used to transmit and receive data through the built in UART.

An interrupt is generated when the UART has finished transmitting or receiving a byte. The interrupt handling routines use circular buffers for buffering received and transmitted data.

The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define the size of the circular buffers in bytes. Note that these constants must be a power of 2. You may need to adapt this size to your target and your application.

Note
Based on Atmel Application Note AVR306
Author
Peter Fleury pfleu.nosp@m.ry@g.nosp@m.mx.ch http://jump.to/fleury

Macro Definition Documentation

#define P (   s)    ({static const char c[] __attribute__ ((progmem)) = s;c;})
#define UART_BAUD_SELECT (   baudRate,
  xtalCpu 
)    ((xtalCpu + baudRate * 8L) / (baudRate * 16L) - 1)

UART Baudrate Expression.

Parameters
xtalcpusystem clock in Mhz
baudratebaudrate in bps, e.g. 1200, 2400, 9600
#define UART_BUFFER_OVERFLOW   0x0200 /* receive ringbuffer overflow */
#define UART_FRAME_ERROR   0x0800 /* Framing Error by UART */
#define uart_getc ( )    UART_NO_DATA
#define uart_init (   baud)    do {} while(0)
#define UART_NO_DATA   0x0100 /* no receive data available */
#define UART_OVERRUN_ERROR   0x0400 /* Overrun condition by UART */
#define uart_poll ( )    do {} while(0)
#define uart_putc (   data)    do {} while(0)
#define uart_puthex_byte (   b)    do {} while(0)
#define uart_puthex_byte_ (   b)    do {} while(0)
#define uart_puthex_nibble (   b)    do {} while(0)
#define uart_puthex_word (   b)    do {} while(0)
#define uart_puti (   i)    do {} while(0)
#define uart_putl (   i)    do {} while(0)
#define uart_puts (   s)    do {} while(0)
#define uart_puts_p (   s)    do {} while(0)
#define uart_puts_P (   s)    do {} while(0)