From ab41589c2b92607bec6b830dbebbbc74c4a46b0b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 29 Mar 2013 14:41:36 +0100 Subject: [PATCH] Removed deprecated interrupt handlers Fixes #831 #881 #955 #1123 #1140 --- cores/arduino/HardwareSerial.cpp | 26 ++++++-------------------- cores/arduino/WInterrupts.c | 32 ++++++++++++++++---------------- cores/arduino/wiring.c | 4 ++-- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 794a7be..6e623d6 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -104,24 +104,16 @@ inline void store_char(unsigned char c, ring_buffer *buffer) #if !defined(USART0_RX_vect) && defined(USART1_RX_vect) // do nothing - on the 32u4 the first USART is USART1 #else -#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \ - !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \ - !defined(SIG_UART_RECV) +#if !defined(USART_RX_vect) && !defined(USART0_RX_vect) #error "Don't know what the Data Received vector is called for the first UART" #else void serialEvent() __attribute__((weak)); void serialEvent() {} #define serialEvent_implemented #if defined(USART_RX_vect) - SIGNAL(USART_RX_vect) -#elif defined(SIG_USART0_RECV) - SIGNAL(SIG_USART0_RECV) -#elif defined(SIG_UART0_RECV) - SIGNAL(SIG_UART0_RECV) + ISR(USART_RX_vect) #elif defined(USART0_RX_vect) - SIGNAL(USART0_RX_vect) -#elif defined(SIG_UART_RECV) - SIGNAL(SIG_UART_RECV) + ISR(USART0_RX_vect) #endif { #if defined(UDR0) @@ -149,7 +141,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer) void serialEvent1() __attribute__((weak)); void serialEvent1() {} #define serialEvent1_implemented - SIGNAL(USART1_RX_vect) + ISR(USART1_RX_vect) { if (bit_is_clear(UCSR1A, UPE1)) { unsigned char c = UDR1; @@ -158,15 +150,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer) unsigned char c = UDR1; }; } -#elif defined(SIG_USART1_RECV) - #error SIG_USART1_RECV #endif #if defined(USART2_RX_vect) && defined(UDR2) void serialEvent2() __attribute__((weak)); void serialEvent2() {} #define serialEvent2_implemented - SIGNAL(USART2_RX_vect) + ISR(USART2_RX_vect) { if (bit_is_clear(UCSR2A, UPE2)) { unsigned char c = UDR2; @@ -175,15 +165,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer) unsigned char c = UDR2; }; } -#elif defined(SIG_USART2_RECV) - #error SIG_USART2_RECV #endif #if defined(USART3_RX_vect) && defined(UDR3) void serialEvent3() __attribute__((weak)); void serialEvent3() {} #define serialEvent3_implemented - SIGNAL(USART3_RX_vect) + ISR(USART3_RX_vect) { if (bit_is_clear(UCSR3A, UPE3)) { unsigned char c = UDR3; @@ -192,8 +180,6 @@ inline void store_char(unsigned char c, ring_buffer *buffer) unsigned char c = UDR3; }; } -#elif defined(SIG_USART3_RECV) - #error SIG_USART3_RECV #endif void serialEventRun(void) diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 62efc9c..de49cd1 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -230,82 +230,82 @@ void attachInterruptTwi(void (*userFunc)(void) ) { */ #if defined(__AVR_ATmega32U4__) -SIGNAL(INT0_vect) { +ISR(INT0_vect) { if(intFunc[EXTERNAL_INT_0]) intFunc[EXTERNAL_INT_0](); } -SIGNAL(INT1_vect) { +ISR(INT1_vect) { if(intFunc[EXTERNAL_INT_1]) intFunc[EXTERNAL_INT_1](); } -SIGNAL(INT2_vect) { +ISR(INT2_vect) { if(intFunc[EXTERNAL_INT_2]) intFunc[EXTERNAL_INT_2](); } -SIGNAL(INT3_vect) { +ISR(INT3_vect) { if(intFunc[EXTERNAL_INT_3]) intFunc[EXTERNAL_INT_3](); } #elif defined(EICRA) && defined(EICRB) -SIGNAL(INT0_vect) { +ISR(INT0_vect) { if(intFunc[EXTERNAL_INT_2]) intFunc[EXTERNAL_INT_2](); } -SIGNAL(INT1_vect) { +ISR(INT1_vect) { if(intFunc[EXTERNAL_INT_3]) intFunc[EXTERNAL_INT_3](); } -SIGNAL(INT2_vect) { +ISR(INT2_vect) { if(intFunc[EXTERNAL_INT_4]) intFunc[EXTERNAL_INT_4](); } -SIGNAL(INT3_vect) { +ISR(INT3_vect) { if(intFunc[EXTERNAL_INT_5]) intFunc[EXTERNAL_INT_5](); } -SIGNAL(INT4_vect) { +ISR(INT4_vect) { if(intFunc[EXTERNAL_INT_0]) intFunc[EXTERNAL_INT_0](); } -SIGNAL(INT5_vect) { +ISR(INT5_vect) { if(intFunc[EXTERNAL_INT_1]) intFunc[EXTERNAL_INT_1](); } -SIGNAL(INT6_vect) { +ISR(INT6_vect) { if(intFunc[EXTERNAL_INT_6]) intFunc[EXTERNAL_INT_6](); } -SIGNAL(INT7_vect) { +ISR(INT7_vect) { if(intFunc[EXTERNAL_INT_7]) intFunc[EXTERNAL_INT_7](); } #else -SIGNAL(INT0_vect) { +ISR(INT0_vect) { if(intFunc[EXTERNAL_INT_0]) intFunc[EXTERNAL_INT_0](); } -SIGNAL(INT1_vect) { +ISR(INT1_vect) { if(intFunc[EXTERNAL_INT_1]) intFunc[EXTERNAL_INT_1](); } #if defined(EICRA) && defined(ISC20) -SIGNAL(INT2_vect) { +ISR(INT2_vect) { if(intFunc[EXTERNAL_INT_2]) intFunc[EXTERNAL_INT_2](); } @@ -314,7 +314,7 @@ SIGNAL(INT2_vect) { #endif /* -SIGNAL(SIG_2WIRE_SERIAL) { +ISR(TWI_vect) { if(twiIntFunc) twiIntFunc(); } diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c index ac8bb6f..a3c4390 100644 --- a/cores/arduino/wiring.c +++ b/cores/arduino/wiring.c @@ -42,9 +42,9 @@ volatile unsigned long timer0_millis = 0; static unsigned char timer0_fract = 0; #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) -SIGNAL(TIM0_OVF_vect) +ISR(TIM0_OVF_vect) #else -SIGNAL(TIMER0_OVF_vect) +ISR(TIMER0_OVF_vect) #endif { // copy these to local variables so they can be stored in registers