one more edge case covered

This commit is contained in:
Henry Gabryjelski committed 2020-04-24 11:59:53 -07:00
1 parent 1c90673a64
commit 48fda18996
1 file changed
+3 -1
+3 -1
View File
@@ -140,7 +140,6 @@ int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
if (nrf_gpiote_te_is_enabled(NRF_GPIOTE, ch)) continue;
// clear any old events on this GPIOTE channel
NRF_GPIOTE->EVENTS_IN[ch] = 0;
uint32_t tmp = NRF_GPIOTE->CONFIG[ch];
channelMap[ch] = pin;
callbacksInt[ch] = callback;
@@ -151,6 +150,9 @@ int attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
NRF_GPIOTE->CONFIG[ch] = tmp;
asm volatile ("" : : : "memory");
__asm__ __volatile__ ("nop\n\tnop\n\tnop\n\tnop\n");
NRF_GPIOTE->EVENTS_IN[ch] = 0;
asm volatile ("" : : : "memory");
__asm__ __volatile__ ("nop\n\tnop\n\tnop\n\tnop\n");
NRF_GPIOTE->INTENSET = (1 << ch);
return (1 << ch);
}