#ifndef uartH
#define uartH

class UART
{
    public:
        UART ( u08 speed )
        {
            UBRR = speed; // Set the baud rate
            UCSRB = ( (1<<RXEN) | (1<<TXEN) ); // Enable UART receiver and transmitter
        };

        u08 receiveByte( )
        {
            while ( !(UCSRA & (1<<RXC)) );  // Wait for incomming data
            return UDR;                     // Return the data
        };

        void transmitByte( u08 data )
        {
            while ( !(UCSRA & (1<<UDRE)) ); // Wait for empty transmit buffer
            UDR = data; 			           // Start transmittion
        };

        bool dataAvail()
        {
            return UCSRA & (1<<RXC);
        };
};

#endif