Skip to content

Commit

Permalink
Use IRQ as pin
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm authored and federicobriata committed Jan 28, 2022
1 parent 635113e commit dc696bd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions RF12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
#define SPI_MOSI 5 // PA5, pin 8
#define SPI_SCK 6 // PA4, pin 9

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

#define RFM_IRQ 0 // PD0, INT0, Digital3
#define RFM_IRQ 2 // PD1, pin 19, INT1, Digital2
#define SS_DDR DDRB
#define SS_PORT PORTB
#define SS_BIT 6 // Dig10, PB6
Expand Down Expand Up @@ -294,7 +294,7 @@ uint16_t rf12_control(uint16_t cmd) {
bitClear(PCICR, PCIE2);
#endif
#else
bitClear(EIMSK, INT0);
bitClear(EIMSK, INT1);
#endif
uint16_t r = rf12_xferSlow(cmd);
#if PINCHG_IRQ
Expand All @@ -306,7 +306,7 @@ uint16_t rf12_control(uint16_t cmd) {
bitSet(PCICR, PCIE2);
#endif
#else
bitSet(EIMSK, INT0);
bitSet(EIMSK, INT1);
#endif
#else
// ATtiny
Expand Down Expand Up @@ -686,9 +686,9 @@ uint8_t rf12_initialize (uint8_t id, uint8_t band, uint8_t g, uint16_t f) {
#endif
#else
if ((nodeid & NODE_ID) != 0)
attachInterrupt(0, rf12_interrupt, LOW);
attachInterrupt(digitalPinToInterrupt(RFM_IRQ), rf12_interrupt, LOW);
else
detachInterrupt(0);
detachInterrupt(digitalPinToInterrupt(RFM_IRQ));
#endif

return nodeid;
Expand Down

0 comments on commit dc696bd

Please sign in to comment.