From 129db4f400d17bbc6ac7737cc9f4d1daa41cf3b4 Mon Sep 17 00:00:00 2001 From: Federico Briata Date: Thu, 14 Nov 2024 02:12:09 +0100 Subject: [PATCH] Only Arduino Leonardo use INT1 as RFM_IRQ on the same pin shield as the other Arduino boards --- RF12.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/RF12.cpp b/RF12.cpp index 4996a827..1360f6aa 100644 --- a/RF12.cpp +++ b/RF12.cpp @@ -91,7 +91,7 @@ #define RFM_IRQ 2 // PD1, pin 19, INT1, Digital2 #define SS_DDR DDRB #define SS_PORT PORTB -#define SS_BIT 6 // Dig10, PB6 +#define SS_BIT 6 // PB6, pin 30, Digital10 #define SPI_SS 10 // PB6, pin 30, Digital10 #define SPI_MISO 14 // PB3, pin 11, Digital14 @@ -294,7 +294,11 @@ uint16_t rf12_control(uint16_t cmd) { bitClear(PCICR, PCIE2); #endif #else - bitClear(EIMSK, INT1); + #if defined(__AVR_ATmega32U4__) //Arduino Leonardo, YUN + bitClear(EIMSK, INT1); + #else + bitClear(EIMSK, INT0); + #endif #endif uint16_t r = rf12_xferSlow(cmd); #if PINCHG_IRQ @@ -306,7 +310,11 @@ uint16_t rf12_control(uint16_t cmd) { bitSet(PCICR, PCIE2); #endif #else - bitSet(EIMSK, INT1); + #if defined(__AVR_ATmega32U4__) //Arduino Leonardo, YUN + bitSet(EIMSK, INT1); + #else + bitSet(EIMSK, INT0); + #endif #endif #else // ATtiny