Skip to content

Commit 3ec90c0

Browse files
committed
Stabilize onReceive(...) callback handling
By using SPI.usingInterrupt(…) and SPI.notUsingInterrupt(…)
1 parent b4558aa commit 3ec90c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/LoRa.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,13 @@ void LoRaClass::onReceive(void(*callback)(int))
283283

284284
writeRegister(REG_DIO_MAPPING_1, 0x00);
285285

286+
SPI.usingInterrupt(digitalPinToInterrupt(_dio0));
286287
attachInterrupt(digitalPinToInterrupt(_dio0), LoRaClass::onDio0Rise, RISING);
287288
} else {
288289
detachInterrupt(digitalPinToInterrupt(_dio0));
290+
#ifdef SPI_HAS_NOTUSINGINTERRUPT
291+
SPI.notUsingInterrupt(digitalPinToInterrupt(_dio0));
292+
#endif
289293
}
290294
}
291295

0 commit comments

Comments
 (0)