Removed deprecated interrupt handlers

Fixes #831 #881 #955 #1123 #1140
This commit is contained in:
Cristian Maglie 2013-03-29 14:41:36 +01:00
parent f39a246be5
commit ab41589c2b
3 changed files with 24 additions and 38 deletions

View File

@ -104,24 +104,16 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
#if !defined(USART0_RX_vect) && defined(USART1_RX_vect) #if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
// do nothing - on the 32u4 the first USART is USART1 // do nothing - on the 32u4 the first USART is USART1
#else #else
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \ #if !defined(USART_RX_vect) && !defined(USART0_RX_vect)
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
!defined(SIG_UART_RECV)
#error "Don't know what the Data Received vector is called for the first UART" #error "Don't know what the Data Received vector is called for the first UART"
#else #else
void serialEvent() __attribute__((weak)); void serialEvent() __attribute__((weak));
void serialEvent() {} void serialEvent() {}
#define serialEvent_implemented #define serialEvent_implemented
#if defined(USART_RX_vect) #if defined(USART_RX_vect)
SIGNAL(USART_RX_vect) ISR(USART_RX_vect)
#elif defined(SIG_USART0_RECV)
SIGNAL(SIG_USART0_RECV)
#elif defined(SIG_UART0_RECV)
SIGNAL(SIG_UART0_RECV)
#elif defined(USART0_RX_vect) #elif defined(USART0_RX_vect)
SIGNAL(USART0_RX_vect) ISR(USART0_RX_vect)
#elif defined(SIG_UART_RECV)
SIGNAL(SIG_UART_RECV)
#endif #endif
{ {
#if defined(UDR0) #if defined(UDR0)
@ -149,7 +141,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
void serialEvent1() __attribute__((weak)); void serialEvent1() __attribute__((weak));
void serialEvent1() {} void serialEvent1() {}
#define serialEvent1_implemented #define serialEvent1_implemented
SIGNAL(USART1_RX_vect) ISR(USART1_RX_vect)
{ {
if (bit_is_clear(UCSR1A, UPE1)) { if (bit_is_clear(UCSR1A, UPE1)) {
unsigned char c = UDR1; unsigned char c = UDR1;
@ -158,15 +150,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
unsigned char c = UDR1; unsigned char c = UDR1;
}; };
} }
#elif defined(SIG_USART1_RECV)
#error SIG_USART1_RECV
#endif #endif
#if defined(USART2_RX_vect) && defined(UDR2) #if defined(USART2_RX_vect) && defined(UDR2)
void serialEvent2() __attribute__((weak)); void serialEvent2() __attribute__((weak));
void serialEvent2() {} void serialEvent2() {}
#define serialEvent2_implemented #define serialEvent2_implemented
SIGNAL(USART2_RX_vect) ISR(USART2_RX_vect)
{ {
if (bit_is_clear(UCSR2A, UPE2)) { if (bit_is_clear(UCSR2A, UPE2)) {
unsigned char c = UDR2; unsigned char c = UDR2;
@ -175,15 +165,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
unsigned char c = UDR2; unsigned char c = UDR2;
}; };
} }
#elif defined(SIG_USART2_RECV)
#error SIG_USART2_RECV
#endif #endif
#if defined(USART3_RX_vect) && defined(UDR3) #if defined(USART3_RX_vect) && defined(UDR3)
void serialEvent3() __attribute__((weak)); void serialEvent3() __attribute__((weak));
void serialEvent3() {} void serialEvent3() {}
#define serialEvent3_implemented #define serialEvent3_implemented
SIGNAL(USART3_RX_vect) ISR(USART3_RX_vect)
{ {
if (bit_is_clear(UCSR3A, UPE3)) { if (bit_is_clear(UCSR3A, UPE3)) {
unsigned char c = UDR3; unsigned char c = UDR3;
@ -192,8 +180,6 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
unsigned char c = UDR3; unsigned char c = UDR3;
}; };
} }
#elif defined(SIG_USART3_RECV)
#error SIG_USART3_RECV
#endif #endif
void serialEventRun(void) void serialEventRun(void)

View File

@ -230,82 +230,82 @@ void attachInterruptTwi(void (*userFunc)(void) ) {
*/ */
#if defined(__AVR_ATmega32U4__) #if defined(__AVR_ATmega32U4__)
SIGNAL(INT0_vect) { ISR(INT0_vect) {
if(intFunc[EXTERNAL_INT_0]) if(intFunc[EXTERNAL_INT_0])
intFunc[EXTERNAL_INT_0](); intFunc[EXTERNAL_INT_0]();
} }
SIGNAL(INT1_vect) { ISR(INT1_vect) {
if(intFunc[EXTERNAL_INT_1]) if(intFunc[EXTERNAL_INT_1])
intFunc[EXTERNAL_INT_1](); intFunc[EXTERNAL_INT_1]();
} }
SIGNAL(INT2_vect) { ISR(INT2_vect) {
if(intFunc[EXTERNAL_INT_2]) if(intFunc[EXTERNAL_INT_2])
intFunc[EXTERNAL_INT_2](); intFunc[EXTERNAL_INT_2]();
} }
SIGNAL(INT3_vect) { ISR(INT3_vect) {
if(intFunc[EXTERNAL_INT_3]) if(intFunc[EXTERNAL_INT_3])
intFunc[EXTERNAL_INT_3](); intFunc[EXTERNAL_INT_3]();
} }
#elif defined(EICRA) && defined(EICRB) #elif defined(EICRA) && defined(EICRB)
SIGNAL(INT0_vect) { ISR(INT0_vect) {
if(intFunc[EXTERNAL_INT_2]) if(intFunc[EXTERNAL_INT_2])
intFunc[EXTERNAL_INT_2](); intFunc[EXTERNAL_INT_2]();
} }
SIGNAL(INT1_vect) { ISR(INT1_vect) {
if(intFunc[EXTERNAL_INT_3]) if(intFunc[EXTERNAL_INT_3])
intFunc[EXTERNAL_INT_3](); intFunc[EXTERNAL_INT_3]();
} }
SIGNAL(INT2_vect) { ISR(INT2_vect) {
if(intFunc[EXTERNAL_INT_4]) if(intFunc[EXTERNAL_INT_4])
intFunc[EXTERNAL_INT_4](); intFunc[EXTERNAL_INT_4]();
} }
SIGNAL(INT3_vect) { ISR(INT3_vect) {
if(intFunc[EXTERNAL_INT_5]) if(intFunc[EXTERNAL_INT_5])
intFunc[EXTERNAL_INT_5](); intFunc[EXTERNAL_INT_5]();
} }
SIGNAL(INT4_vect) { ISR(INT4_vect) {
if(intFunc[EXTERNAL_INT_0]) if(intFunc[EXTERNAL_INT_0])
intFunc[EXTERNAL_INT_0](); intFunc[EXTERNAL_INT_0]();
} }
SIGNAL(INT5_vect) { ISR(INT5_vect) {
if(intFunc[EXTERNAL_INT_1]) if(intFunc[EXTERNAL_INT_1])
intFunc[EXTERNAL_INT_1](); intFunc[EXTERNAL_INT_1]();
} }
SIGNAL(INT6_vect) { ISR(INT6_vect) {
if(intFunc[EXTERNAL_INT_6]) if(intFunc[EXTERNAL_INT_6])
intFunc[EXTERNAL_INT_6](); intFunc[EXTERNAL_INT_6]();
} }
SIGNAL(INT7_vect) { ISR(INT7_vect) {
if(intFunc[EXTERNAL_INT_7]) if(intFunc[EXTERNAL_INT_7])
intFunc[EXTERNAL_INT_7](); intFunc[EXTERNAL_INT_7]();
} }
#else #else
SIGNAL(INT0_vect) { ISR(INT0_vect) {
if(intFunc[EXTERNAL_INT_0]) if(intFunc[EXTERNAL_INT_0])
intFunc[EXTERNAL_INT_0](); intFunc[EXTERNAL_INT_0]();
} }
SIGNAL(INT1_vect) { ISR(INT1_vect) {
if(intFunc[EXTERNAL_INT_1]) if(intFunc[EXTERNAL_INT_1])
intFunc[EXTERNAL_INT_1](); intFunc[EXTERNAL_INT_1]();
} }
#if defined(EICRA) && defined(ISC20) #if defined(EICRA) && defined(ISC20)
SIGNAL(INT2_vect) { ISR(INT2_vect) {
if(intFunc[EXTERNAL_INT_2]) if(intFunc[EXTERNAL_INT_2])
intFunc[EXTERNAL_INT_2](); intFunc[EXTERNAL_INT_2]();
} }
@ -314,7 +314,7 @@ SIGNAL(INT2_vect) {
#endif #endif
/* /*
SIGNAL(SIG_2WIRE_SERIAL) { ISR(TWI_vect) {
if(twiIntFunc) if(twiIntFunc)
twiIntFunc(); twiIntFunc();
} }

View File

@ -42,9 +42,9 @@ volatile unsigned long timer0_millis = 0;
static unsigned char timer0_fract = 0; static unsigned char timer0_fract = 0;
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
SIGNAL(TIM0_OVF_vect) ISR(TIM0_OVF_vect)
#else #else
SIGNAL(TIMER0_OVF_vect) ISR(TIMER0_OVF_vect)
#endif #endif
{ {
// copy these to local variables so they can be stored in registers // copy these to local variables so they can be stored in registers