From 6dc00061df81b4750208996bb7dd0ec76f8f901f Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 19 Dec 2011 15:40:12 -0500 Subject: fixed attachInterrupt() on Leonardo had to define a separate block for the 32U4 since it looks like a Mega-series board based on a simple register trick. Only two useable HW interrupts though, compared to the Megas' 8, and numbering differs. --- cores/arduino/WInterrupts.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) mode change 100755 => 100644 cores/arduino/WInterrupts.c (limited to 'cores/arduino/WInterrupts.c') diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c old mode 100755 new mode 100644 index 1449cfb..2ec72a5 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -47,7 +47,19 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { // Enable the interrupt. switch (interruptNum) { -#if defined(EICRA) && defined(EICRB) && defined(EIMSK) +#if defined(__AVR_ATmega32U4__) + // I hate doing this, but the register assignment differs between the 1280/2560 + // and the 32U4. Since avrlib defines registers PCMSK1 and PCMSK2 that aren't + // even present on the 32U4 this is the only way to distinguish between them. + case 0: + EICRA = (EICRA & ~((1< Date: Mon, 2 Jan 2012 12:38:23 -0500 Subject: Fixing static is not at beginning of declaration warnings (maniacbug). --- cores/arduino/WInterrupts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cores/arduino/WInterrupts.c') diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 1449cfb..4f035eb 100755 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -32,7 +32,7 @@ #include "wiring_private.h" -volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; +static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; // volatile static voidFuncPtr twiIntFunc; void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { -- cgit v1.2.3-18-g5258 From 4fade7007fbe2049f4f7a3867c9f9a76f8c06db1 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Fri, 2 Mar 2012 18:58:53 -0500 Subject: Small changes for the ATmega1284. http://code.google.com/p/arduino/issues/detail?id=736 --- cores/arduino/WInterrupts.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'cores/arduino/WInterrupts.c') diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 4f035eb..3b9fe08 100755 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -121,8 +121,6 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { #elif defined(MCUCR) && defined(ISC20) && defined(GIMSK) && defined(GIMSK) MCUCR = (MCUCR & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20); GIMSK |= (1 << INT2); - #else - #warning attachInterrupt may need some more work for this cpu (case 1) #endif break; #endif -- cgit v1.2.3-18-g5258 From 4ed0bd2bd562ad815e62e0a2dbb34d854d2c6929 Mon Sep 17 00:00:00 2001 From: Kristian Lauszus Date: Sat, 2 Jun 2012 20:08:46 +0200 Subject: Added support for interrupt on INT2 and INT3 on the Leonardo --- cores/arduino/WInterrupts.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'cores/arduino/WInterrupts.c') diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c index 8f3ec84..62efc9c 100644 --- a/cores/arduino/WInterrupts.c +++ b/cores/arduino/WInterrupts.c @@ -59,6 +59,14 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { EICRA = (EICRA & ~((1<