# ATMega USART Stack

## Introduction

This File implements a set of functions to send and receive data through the hardware USART Module of a AVR ATMega Device.

Data transfer is fully interrupt driven and fifo buffered.

## Usage

To use this USART Stack just copy uart.c and uart.h to your project directory, include uart.h wherever you want and ajust the configuration to your needs.

### Using the USART as stdout

If you want to use stdio printf functions to write formatted text to the UART you ma want to include the following code:

    #include <stdio.h>
    #include <avr/pgmspace.h>
    #include "uart0.h"

    static FILE pc_out = FDEV_SETUP_STREAM(uart0_putchar, NULL, _FDEV_SETUP_WRITE);
    #define pc_print(fmt,...) fprintf_P(&pc_out, PSTR(fmt), ##__VA_ARGS__)