Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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;
}