From 48fda1899634a000004d221f908c5e494589cfb4 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 24 Apr 2020 11:59:53 -0700 Subject: [PATCH] one more edge case covered --- cores/nRF5/WInterrupts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/nRF5/WInterrupts.c b/cores/nRF5/WInterrupts.c index f7b53ed1..5ca36600 100644 --- a/cores/nRF5/WInterrupts.c +++ b/cores/nRF5/WInterrupts.c @@ -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); }