Skip to content

Commit 29f5960

Browse files
committed
Change digitalPinToInterrupt to return pin, and use g_APinDescription[pin].ulExtInt to map pin inside attachInterrupt/detachInterrupt
This brings things inline with the atachInterrupt documentation for usage: attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);
1 parent c608786 commit 29f5960

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cores/arduino/WInterrupts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
5757
uint32_t config;
5858
uint32_t pos;
5959

60-
EExt_Interrupts in = digitalPinToInterrupt(pin);
60+
EExt_Interrupts in = g_APinDescription[pin].ulExtInt;
6161
if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI)
6262
return;
6363

@@ -116,7 +116,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
116116
*/
117117
void detachInterrupt(uint32_t pin)
118118
{
119-
EExt_Interrupts in = digitalPinToInterrupt(pin);
119+
EExt_Interrupts in = g_APinDescription[pin].ulExtInt;
120120
if (in == NOT_AN_INTERRUPT || in == EXTERNAL_INT_NMI)
121121
return;
122122

variants/arduino_zero/variant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extern "C"
7676
// #define digitalPinToTimer(P)
7777

7878
// Interrupts
79-
#define digitalPinToInterrupt(P) ( g_APinDescription[P].ulExtInt )
79+
#define digitalPinToInterrupt(P) ( P )
8080

8181
// LEDs
8282
#define PIN_LED_13 (13u)

0 commit comments

Comments
 (0)