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.
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
Revision 94:e6c0279f550a, committed 2017-11-12
- Comitter:
- Helmut Tschemernjak
- Date:
- Sun Nov 12 18:23:36 2017 +0100
- Parent:
- 93:c328629726a6
- Child:
- 95:36a7fc74e437
- Commit message:
- Added support to clear unused DIO handlers when the DIO pin is not connected.
Added support to use CADDone on DIO0 instead of DIO3 when DIO3 is not connected.
Changed in this revision
| sx1276/sx1276-mbed-hal.cpp | Show annotated file Show diff for this revision Revisions of this file |
| sx1276/sx1276.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/sx1276/sx1276-mbed-hal.cpp Tue Oct 24 20:05:16 2017 +0200
+++ b/sx1276/sx1276-mbed-hal.cpp Sun Nov 12 18:23:36 2017 +0100
@@ -170,14 +170,28 @@
{
if (_dio0)
_dio0->rise(callback(this, static_cast< Trigger > ( irqHandlers[0] )));
+ else
+ irqHandlers[0] = NULL;
+
if (_dio1)
_dio1->rise(callback(this, static_cast< Trigger > ( irqHandlers[1] )));
+ else
+ irqHandlers[1] = NULL;
+
if (_dio2)
_dio2->rise(callback(this, static_cast< Trigger > ( irqHandlers[2] )));
+ else
+ irqHandlers[2] = NULL;
+
if (_dio3)
_dio3->rise(callback(this, static_cast< Trigger > ( irqHandlers[3] )));
+ else
+ irqHandlers[3] = NULL;
+
if (_dio4)
_dio4->rise(callback(this, static_cast< Trigger > ( irqHandlers[4] )));
+ else
+ irqHandlers[4] = NULL;
}
void SX1276Generic::IoDeInit( void )
--- 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;
}

