@@ -81,61 +81,32 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
81
81
}
82
82
}
83
83
84
+ #if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
85
+ !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
86
+ !defined(SIG_UART_RECV)
87
+ #error Don't know what the Data Received vector is called for the first UART
88
+ #else
84
89
#if defined(USART_RX_vect)
85
90
SIGNAL (USART_RX_vect)
86
- {
87
- #if defined(UDR0)
88
- unsigned char c = UDR0;
89
- #elif defined(UDR)
90
- unsigned char c = UDR; // atmega8535
91
- #else
92
- #error UDR not defined
93
- #endif
94
- store_char (c, &rx_buffer);
95
- }
96
- #elif defined(SIG_USART0_RECV) && defined(UDR0)
91
+ #elif defined(SIG_USART0_RECV)
97
92
SIGNAL (SIG_USART0_RECV)
98
- {
99
- unsigned char c = UDR0;
100
- store_char (c, &rx_buffer);
101
- }
102
- #elif defined(SIG_UART0_RECV) && defined(UDR0)
93
+ #elif defined(SIG_UART0_RECV)
103
94
SIGNAL (SIG_UART0_RECV)
104
- {
105
- unsigned char c = UDR0;
106
- store_char (c, &rx_buffer);
107
- }
108
- // #elif defined(SIG_USART_RECV)
109
95
#elif defined(USART0_RX_vect)
110
- // fixed by Mark Sproul this is on the 644/644p
111
- // SIGNAL(SIG_USART_RECV)
112
96
SIGNAL (USART0_RX_vect)
97
+ #elif defined(SIG_UART_RECV)
98
+ SIGNAL (SIG_UART_RECV)
99
+ #endif
113
100
{
114
101
#if defined(UDR0)
115
102
unsigned char c = UDR0;
116
103
#elif defined(UDR)
117
- unsigned char c = UDR; // atmega8, atmega32
104
+ unsigned char c = UDR;
118
105
#else
119
106
#error UDR not defined
120
107
#endif
121
108
store_char (c, &rx_buffer);
122
109
}
123
- #elif defined(SIG_UART_RECV)
124
- // this is for atmega8
125
- SIGNAL (SIG_UART_RECV)
126
- {
127
- #if defined(UDR0)
128
- unsigned char c = UDR0; // atmega645
129
- #elif defined(UDR)
130
- unsigned char c = UDR; // atmega8
131
- #endif
132
- store_char (c, &rx_buffer);
133
- }
134
- #elif defined(USBCON)
135
- #warning No interrupt handler for usart 0
136
- #warning Serial(0) is on USB interface
137
- #else
138
- #error No interrupt handler for usart 0
139
110
#endif
140
111
141
112
// #if defined(SIG_USART1_RECV)
0 commit comments