aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/WInterrupts.c
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2008-11-01 22:06:13 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2008-11-01 22:06:13 +0000
commitde4710abc813016d8a2bddcc2fb1a19be43c01de (patch)
treefa2dc220559eb9d577e2f2354c0ec02660d6ab6b /cores/arduino/WInterrupts.c
parente42b8d7ef811df7f552582c57cda66a275670fe4 (diff)
Switching tests for __AVR_ATmega168__ to tests for __AVR_ATmega8__ so that less changes are needed to support other processors.
Diffstat (limited to 'cores/arduino/WInterrupts.c')
-rwxr-xr-xcores/arduino/WInterrupts.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c
index 21ebe62..bcee7b7 100755
--- a/cores/arduino/WInterrupts.c
+++ b/cores/arduino/WInterrupts.c
@@ -35,9 +35,9 @@
volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
// volatile static voidFuncPtr twiIntFunc;
-#if defined(__AVR_ATmega168__)
-#define MCUCR EICRA
-#define GICR EIMSK
+#if defined(__AVR_ATmega8__)
+#define EICRA MCUCR
+#define EIMSK GICR
#endif
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {
@@ -49,13 +49,13 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {
// edge, or falling edge). The mode constants were chosen to correspond
// to the configuration bits in the hardware register, so we simply shift
// the mode into place.
- MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00);
+ EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00);
// Enable the interrupt.
- GICR |= (1 << INT0);
+ EIMSK |= (1 << INT0);
} else {
- MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10);
- GICR |= (1 << INT1);
+ EICRA = (EICRA & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10);
+ EIMSK |= (1 << INT1);
}
}
}
@@ -64,9 +64,9 @@ void detachInterrupt(uint8_t interruptNum) {
if(interruptNum < EXTERNAL_NUM_INTERRUPTS) {
if (interruptNum == 0)
// Disable the interrupt.
- GICR &= ~(1 << INT0);
+ EIMSK &= ~(1 << INT0);
else
- GICR &= ~(1 << INT1);
+ EIMSK &= ~(1 << INT1);
intFunc[interruptNum] = 0;
}