/************************************************************************/ /* */ /* Interrupt driven buffered UART */ /* */ /* Author: Peter Dannegger */ /* */ /************************************************************************/ #include "main.h" #include "uart0.h" static u8 rx_buff[RX0_SIZE]; static u8 rx_in; static u8 rx_out; static u8 tx_buff[TX0_SIZE]; static u8 tx_in; static u8 tx_out; #define ROLLOVER( x, max ) x = ++x >= max ? 0 : x // count up and wrap around void init_uart0( u16 bauddivider ) { UBRR0H = bauddivider >> 8; UBRR0L = bauddivider; // set baud rate UCSR0A = 0; // no U2X, MPCM UCSR0C = 1<