From a9fa694eb7904b11cfc528ea9318acc877013a1f Mon Sep 17 00:00:00 2001
From: joverbee <jo.verbeeck@ua.ac.be>
Date: Mon, 9 Jan 2017 20:44:23 +0100
Subject: [PATCH] Reset sense bits before or-writing the new sense signature

Solve #199
---
 cores/arduino/WInterrupts.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c
index 70d9acd0..5a2d8b9e 100644
--- a/cores/arduino/WInterrupts.c
+++ b/cores/arduino/WInterrupts.c
@@ -88,6 +88,7 @@ void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode)
 
   // Configure the interrupt mode
   pos = (in - (8 * config)) << 2;
+  EIC->CONFIG[config].reg &=~ (EIC_CONFIG_SENSE0_Msk << pos);//reset sense mode, important when changing trigger mode during runtime
   switch (mode)
   {
     case LOW:
-- 
GitLab