From 5bb0a63462f13154b0a06189b63a41ca3f224640 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 29 Oct 2018 14:05:24 -0400 Subject: [PATCH] Still calling interrupts for SAMD boards --- src/SDI12.cpp | 36 ++++++++++++++++-------------------- src/SDI12.h | 2 +- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/SDI12.cpp b/src/SDI12.cpp index 7760252..f6b3e65 100644 --- a/src/SDI12.cpp +++ b/src/SDI12.cpp @@ -597,28 +597,24 @@ uint8_t SDI12::parity_even_bit(uint8_t v) // 5.2 - a helper function to switch pin interrupts on or off void SDI12::setPinInterrupts(bool enable) { - #ifndef SDI12_EXTERNAL_PCINT + #if defined (ARDUINO_ARCH_SAMD) + if (enable) attachInterrupt(digitalPinToInterrupt(_dataPin), handleInterrupt, CHANGE); // Merely need to attach the interrupt function to the pin + else detachInterrupt(digitalPinToInterrupt(_dataPin)); // Merely need to detach the interrupt function from the pin + + #elif defined (__AVR__) && not defined (SDI12_EXTERNAL_PCINT) if (enable) { - #if defined __AVR__ *digitalPinToPCICR(_dataPin) |= (1<