Skip to content

Commit 9d9fe5c

Browse files
committed
Slightly clearer formula for interrupt config register position
1 parent 1330914 commit 9d9fe5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/arduino/WInterrupts.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
106106
// Look for right CONFIG register to be addressed
107107
if (in > EXTERNAL_INT_7) {
108108
config = 1;
109+
pos = (in - 8) << 2;
109110
} else {
110111
config = 0;
112+
pos = in << 2;
111113
}
112114

113115
// Configure the interrupt mode
114-
pos = (in - (8 * config)) << 2;
115116
EIC->CONFIG[config].reg &=~ (EIC_CONFIG_SENSE0_Msk << pos); // Reset sense mode, important when changing trigger mode during runtime
116117
switch (mode)
117118
{

0 commit comments

Comments
 (0)