00001
00024 #ifndef UART_H
00025 #define UART_H
00026
00027
00028 #include<stdbool.h>
00029 #include<stdint.h>
00030
00031 #include "compiler.h"
00032
00033
00034
00035 #define ENABLE_RECEIVER ( UCSR0B |= ( 1 << RXEN0 ) )
00036 #define DISABLE_RECEIVER ( UCSR0B &= ~( 1 << RXEN0 ) )
00038 #define ENABLE_TRANSMITTER ( UCSR0B |= ( 1 << TXEN0 ) )
00039 #define DISABLE_TRANSMITTER ( UCSR0B &= ~( 1 << TXEN0 ) )
00041 #define ENABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B |= ( 1 << RXCIE0 ) )
00042 #define DISABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B &= ~( 1 << RXCIE0 ) )
00043
00044
00052 typedef enum{
00053
00054 BR_9600 = 0x33,
00055 BR_19200 = 0x19,
00056 BR_38400 = 0x0C
00057 }baudRate_t;
00058
00059
00060 void uartInitialization( const baudRate_t rate );
00061 void uartSendSymbol( const uint8_t symbol );
00062 #endif