add function to set the IRQ explicitly
This commit is contained in:
parent
561995be16
commit
5237f7420f
17
RFM69.cpp
17
RFM69.cpp
|
|
@ -549,6 +549,23 @@ void RFM69::setCS(uint8_t newSPISlaveSelect) {
|
||||||
pinMode(_slaveSelectPin, OUTPUT);
|
pinMode(_slaveSelectPin, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the IRQ pin
|
||||||
|
bool setIrq(uint8_t newIRQPin) {
|
||||||
|
uint8_t _newInterruptNum = digitalPinToInterrupt(newIRQPin);
|
||||||
|
if (_newInterruptNum == NOT_AN_INTERRUPT) return false;
|
||||||
|
#ifdef RF69_ATTACHINTERRUPT_TAKES_PIN_NUMBER
|
||||||
|
_newInterruptNum = newIRQPin;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// disconnect from existing IRQ pin
|
||||||
|
detachInterrupt( _interruptNum );
|
||||||
|
|
||||||
|
_interruptNum = _newInterruptNum;
|
||||||
|
attachInterrupt(_interruptNum, RFM69::isr0, RISING);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//for debugging
|
//for debugging
|
||||||
#define REGISTER_DETAIL 0
|
#define REGISTER_DETAIL 0
|
||||||
#if REGISTER_DETAIL
|
#if REGISTER_DETAIL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue