30 #ifndef _serial_device_h
31 #define _serial_device_h
45 #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
46 || defined(__AVR_ATmega8515__) || defined(__AVR_ATmega8535__) \
47 || defined(__AVR_ATmega323__)
50 #define UART_REGISTERS 6
52 volatile uint8_t *serialRegisters[UART_COUNT][UART_REGISTERS] = {{
60 #define SERIALBAUDBIT 8
61 uint8_t serialBits[UART_COUNT][UART_BITS] = {{
70 #define SERIALRECIEVEINTERRUPT USART_RXC_vect
71 #define SERIALTRANSMITINTERRUPT USART_UDRE_vect
73 #elif defined(__AVR_ATmega168__)
76 #define UART_REGISTERS 5
78 volatile uint8_t *serialRegisters[UART_COUNT][UART_REGISTERS] = {{
84 #define SERIALBAUDBIT 16
85 volatile uint16_t *serialBaudRegisters[UART_COUNT] = {
88 uint8_t serialBits[UART_COUNT][UART_BITS] = {{
97 #define SERIALRECIEVEINTERRUPT USART_RX_vect
98 #define SERIALTRANSMITINTERRUPT USART_UDRE_vect
100 #elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1280__) \
101 || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega640__)
104 #define UART_REGISTERS 4
106 volatile uint8_t *serialRegisters[UART_COUNT][UART_REGISTERS] = {
132 #define SERIALBAUDBIT 16
133 volatile uint16_t *serialBaudRegisters[UART_COUNT] = {
134 &UBRR0, &UBRR1, &UBRR2, &UBRR3
136 uint8_t serialBits[UART_COUNT][UART_BITS] = {
174 #define SERIALRECIEVEINTERRUPT USART0_RX_vect
175 #define SERIALTRANSMITINTERRUPT USART0_UDRE_vect
176 #define SERIALRECIEVEINTERRUPT1 USART1_RX_vect
177 #define SERIALTRANSMITINTERRUPT1 USART1_UDRE_vect
178 #define SERIALRECIEVEINTERRUPT2 USART2_RX_vect
179 #define SERIALTRANSMITINTERRUPT2 USART2_UDRE_vect
180 #define SERIALRECIEVEINTERRUPT3 USART3_RX_vect
181 #define SERIALTRANSMITINTERRUPT3 USART3_UDRE_vect
184 #error "AvrSerialLibrary not compatible with your MCU!"
187 #endif // _serial_device_h