Skip to content

Commit 48fda18

Browse files
committed
one more edge case covered
1 parent 1c90673 commit 48fda18

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cores/nRF5/WInterrupts.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
140140
if (nrf_gpiote_te_is_enabled(NRF_GPIOTE, ch)) continue;
141141

142142
// clear any old events on this GPIOTE channel
143-
NRF_GPIOTE->EVENTS_IN[ch] = 0;
144143
uint32_t tmp = NRF_GPIOTE->CONFIG[ch];
145144
channelMap[ch] = pin;
146145
callbacksInt[ch] = callback;
@@ -151,6 +150,9 @@ int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
151150
NRF_GPIOTE->CONFIG[ch] = tmp;
152151
asm volatile ("" : : : "memory");
153152
__asm__ __volatile__ ("nop\n\tnop\n\tnop\n\tnop\n");
153+
NRF_GPIOTE->EVENTS_IN[ch] = 0;
154+
asm volatile ("" : : : "memory");
155+
__asm__ __volatile__ ("nop\n\tnop\n\tnop\n\tnop\n");
154156
NRF_GPIOTE->INTENSET = (1 << ch);
155157
return (1 << ch);
156158
}

0 commit comments

Comments
 (0)