Skip to content

Commit

Permalink
Only Arduino Leonardo use INT1 as RFM_IRQ on the same pin shield as t…
Browse files Browse the repository at this point in the history
…he other Arduino boards
  • Loading branch information
federicobriata committed Nov 14, 2024
1 parent dc696bd commit 11605ee
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions RF12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@

#elif defined(__AVR_ATmega32U4__) //Arduino Leonardo, YUN

//#define RFM_IRQ 7 // PE6, INT4, Digital7 - Adafruit Feather M0 RFM96
#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
Expand Down Expand Up @@ -294,7 +295,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
Expand All @@ -306,7 +311,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
Expand Down

0 comments on commit 11605ee

Please sign in to comment.