SX1276GenericLib to support sx1276 bassed LoRa modules, including HopeRF RFM95, Murata CMWX1ZZABZ and Semtech SX1276MB1MAS/SX1276MB1LAS modules
Dependents: DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_USB_Rx ... more
Fork of SX1276Lib by
Diff: sx1276/sx1276.cpp
- Revision:
- 94:e6c0279f550a
- Parent:
- 89:b0203b4a36ec
- Child:
- 95:36a7fc74e437
diff -r c328629726a6 -r e6c0279f550a sx1276/sx1276.cpp --- a/sx1276/sx1276.cpp Tue Oct 24 20:05:16 2017 +0200 +++ b/sx1276/sx1276.cpp Sun Nov 12 18:23:36 2017 +0100 @@ -1039,8 +1039,13 @@ //RFLR_IRQFLAGS_CADDETECTED ); - // DIO3=CADDone - Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO3_MASK ) | RFLR_DIOMAPPING1_DIO3_00 ); + if (this->dioIrq[3]) { + // DIO3=CADDone + Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO3_MASK ) | RFLR_DIOMAPPING1_DIO3_00 ); + } else { + // DIO0=CADDone + Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO0_MASK ) | RFLR_DIOMAPPING1_DIO0_00 ); + } this->settings.State = RF_CAD; SetOpMode( RFLR_OPMODE_CAD ); @@ -1495,6 +1500,33 @@ break; } break; + case RF_CAD: + // CadDone interrupt + switch( this->settings.Modem ) { + case MODEM_LORA: + { + if( ( Read( REG_LR_IRQFLAGS ) & RFLR_IRQFLAGS_CADDETECTED ) == RFLR_IRQFLAGS_CADDETECTED ) + { + // Clear Irq + Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDETECTED | RFLR_IRQFLAGS_CADDONE ); + if (this->RadioEvents && this->RadioEvents->CadDone) + { + this->RadioEvents->CadDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, true ); + } + } else { + // Clear Irq + Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDONE ); + if (this->RadioEvents && this->RadioEvents->CadDone) + { + this->RadioEvents->CadDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, false ); + } + } + } + case MODEM_FSK: + default: + this->settings.State = RF_IDLE; + break; + } default: break; }