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 129db4f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions RF12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 129db4f

Please sign in to comment.