diff --git a/src/LoRa.cpp b/src/LoRa.cpp index df2bea0..78eb172 100644 --- a/src/LoRa.cpp +++ b/src/LoRa.cpp @@ -304,10 +304,15 @@ void LoRaClass::onReceive(void(*callback)(int)) pinMode(_dio0, INPUT); writeRegister(REG_DIO_MAPPING_1, 0x00); - +#ifdef SPI_HAS_NOTUSINGINTERRUPT + SPI.usingInterrupt(digitalPinToInterrupt(_dio0)); +#endif attachInterrupt(digitalPinToInterrupt(_dio0), LoRaClass::onDio0Rise, RISING); } else { detachInterrupt(digitalPinToInterrupt(_dio0)); +#ifdef SPI_HAS_NOTUSINGINTERRUPT + SPI.notUsingInterrupt(digitalPinToInterrupt(_dio0)); +#endif } } diff --git a/src/LoRa.h b/src/LoRa.h index bf5fb06..a7ec8ff 100644 --- a/src/LoRa.h +++ b/src/LoRa.h @@ -85,7 +85,7 @@ private: int _ss; int _reset; int _dio0; - int _frequency; + long _frequency; int _packetIndex; int _implicitHeaderMode; void (*_onReceive)(int);