Skip to content

Commit dc696bd

Browse files
facchinmfedericobriata
authored andcommitted
Use IRQ as pin
1 parent 635113e commit dc696bd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

RF12.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686
#define SPI_MOSI 5 // PA5, pin 8
8787
#define SPI_SCK 6 // PA4, pin 9
8888

89-
#elif defined(__AVR_ATmega32U4__) //Arduino Leonardo
89+
#elif defined(__AVR_ATmega32U4__) //Arduino Leonardo, YUN
9090

91-
#define RFM_IRQ 0 // PD0, INT0, Digital3
91+
#define RFM_IRQ 2 // PD1, pin 19, INT1, Digital2
9292
#define SS_DDR DDRB
9393
#define SS_PORT PORTB
9494
#define SS_BIT 6 // Dig10, PB6
@@ -294,7 +294,7 @@ uint16_t rf12_control(uint16_t cmd) {
294294
bitClear(PCICR, PCIE2);
295295
#endif
296296
#else
297-
bitClear(EIMSK, INT0);
297+
bitClear(EIMSK, INT1);
298298
#endif
299299
uint16_t r = rf12_xferSlow(cmd);
300300
#if PINCHG_IRQ
@@ -306,7 +306,7 @@ uint16_t rf12_control(uint16_t cmd) {
306306
bitSet(PCICR, PCIE2);
307307
#endif
308308
#else
309-
bitSet(EIMSK, INT0);
309+
bitSet(EIMSK, INT1);
310310
#endif
311311
#else
312312
// ATtiny
@@ -686,9 +686,9 @@ uint8_t rf12_initialize (uint8_t id, uint8_t band, uint8_t g, uint16_t f) {
686686
#endif
687687
#else
688688
if ((nodeid & NODE_ID) != 0)
689-
attachInterrupt(0, rf12_interrupt, LOW);
689+
attachInterrupt(digitalPinToInterrupt(RFM_IRQ), rf12_interrupt, LOW);
690690
else
691-
detachInterrupt(0);
691+
detachInterrupt(digitalPinToInterrupt(RFM_IRQ));
692692
#endif
693693

694694
return nodeid;

0 commit comments

Comments
 (0)