/*
 * usart.h
 *
 * Created: 10.4.2012 13:36:33
 *  Author: Kain
 */


#ifndef USART_H_
#define USART_H_
#include <avr/io.h>
#include <avr/interrupt.h>
#include "rfchannel.h"

#define BAUD_RATE       800                            // Otestovat, ale max cca 1200 !!
#define BAUD_RATE_UBRR  (F_CPU/16/BAUD_RATE - 1)
#define USART_RXBUFLEN  3
#if (F_CPU/16 % BAUD_RATE > 0)  // Toto MUSI vyjit bez zbytku po deleni - cele cislo!!!!!
#error "UBRR vychazi v desetinnych cislech = error rate > 0%, je potreba zmenit BAUD RATE"
#endif


extern volatile uint8_t USART_rxbuffer[USART_RXBUFLEN];
extern volatile uint8_t USART_rxcounter;
extern volatile uint8_t USART_novaDataVBufferu;

void USART_init(void);
void USART_writeBytes(uint8_t * data, uint16_t count);
void USART_write(uint8_t );



#endif /* USART_H_ */
