[CC1101] Fixed incorrect GPIO NC check logic

This commit is contained in:
jgromes 2022-10-09 19:14:07 +02:00
parent 0b1a421863
commit ae64ec1911
2 changed files with 6 additions and 3 deletions

View file

@ -48,7 +48,10 @@ void setup() {
// set the function that will be called
// when packet transmission is finished
radio.setGdo0Action(setFlag);
// NOTE: Unlike other modules (such as SX127x),
// different GDOx pins are used for
// transmit and receive interrupts!
radio.setGdo2Action(setFlag);
// start transmitting the first packet
Serial.print(F("[CC1101] Sending first packet ... "));

View file

@ -232,7 +232,7 @@ void CC1101::clearGdo0Action() {
}
void CC1101::setGdo2Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir) {
if(_mod->getGpio() != RADIOLIB_NC) {
if(_mod->getGpio() == RADIOLIB_NC) {
return;
}
_mod->pinMode(_mod->getGpio(), INPUT);
@ -240,7 +240,7 @@ void CC1101::setGdo2Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir) {
}
void CC1101::clearGdo2Action() {
if(_mod->getGpio() != RADIOLIB_NC) {
if(_mod->getGpio() == RADIOLIB_NC) {
return;
}
_mod->detachInterrupt(RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(_mod->getGpio()));