Driver for the SX1276 RF Transceiver(Updated to work with nucleo, tested with L073RZ)
Fork of SX1276Lib by
Revision 27:4fa62fc82e92, committed 2017-11-28
- Comitter:
- Oleh_Zvonarov
- Date:
- Tue Nov 28 18:50:30 2017 +0000
- Parent:
- 26:d09a8ef807e2
- Commit message:
- Modified to work with Nucleo
Changed in this revision
sx1276/sx1276-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 |
diff -r d09a8ef807e2 -r 4fa62fc82e92 sx1276/sx1276-hal.cpp --- a/sx1276/sx1276-hal.cpp Mon Apr 24 09:26:23 2017 +0000 +++ b/sx1276/sx1276-hal.cpp Tue Nov 28 18:50:30 2017 +0000 @@ -147,11 +147,11 @@ dio3.mode( PullDown ); dio4.mode( PullDown ); #endif - dio0.rise( mbed::callback( this, static_cast< TriggerMB1xAS > ( irqHandlers[0] ) ) ); - dio1.rise( mbed::callback( this, static_cast< TriggerMB1xAS > ( irqHandlers[1] ) ) ); - dio2.rise( mbed::callback( this, static_cast< TriggerMB1xAS > ( irqHandlers[2] ) ) ); - dio3.rise( mbed::callback( this, static_cast< TriggerMB1xAS > ( irqHandlers[3] ) ) ); - dio4.rise( mbed::callback( this, static_cast< TriggerMB1xAS > ( irqHandlers[4] ) ) ); + dio0.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[0] ) ); + dio1.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[1] ) ); + dio2.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[2] ) ); + dio3.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[3] ) ); + dio4.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[4] ) ); } void SX1276MB1xAS::IoDeInit( void )
diff -r d09a8ef807e2 -r 4fa62fc82e92 sx1276/sx1276.cpp --- a/sx1276/sx1276.cpp Mon Apr 24 09:26:23 2017 +0000 +++ b/sx1276/sx1276.cpp Tue Nov 28 18:50:30 2017 +0000 @@ -825,7 +825,7 @@ this->settings.State = RF_RX_RUNNING; if( timeout != 0 ) { - rxTimeoutTimer.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), timeout * 1e3 ); + rxTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout ); } if( this->settings.Modem == MODEM_FSK ) @@ -834,8 +834,11 @@ if( rxContinuous == false ) { - rxTimeoutSyncWord.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), - this->settings.Fsk.RxSingleTimeout * 1e3 ); + rxTimeoutSyncWord.attach_us( this, &SX1276::OnTimeoutIrq, ceil( ( 8.0 * ( this->settings.Fsk.PreambleLen + + ( ( Read( REG_SYNCCONFIG ) & + ~RF_SYNCCONFIG_SYNCSIZE_MASK ) + + 1.0 ) + 10.0 ) / + ( double )this->settings.Fsk.Datarate ) * 1e6 ) + 4000 ); } } else @@ -909,7 +912,7 @@ } this->settings.State = RF_TX_RUNNING; - txTimeoutTimer.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), timeout * 1e3 ); + txTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout ); SetOpMode( RF_OPMODE_TRANSMITTER ); } @@ -960,7 +963,7 @@ Write( REG_DIOMAPPING2, RF_DIOMAPPING2_DIO4_10 | RF_DIOMAPPING2_DIO5_10 ); this->settings.State = RF_TX_RUNNING; - txTimeoutTimer.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), timeout ); + txTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout ); SetOpMode( RF_OPMODE_TRANSMITTER ); } @@ -1097,8 +1100,11 @@ { // Continuous mode restart Rx chain Write( REG_RXCONFIG, Read( REG_RXCONFIG ) | RF_RXCONFIG_RESTARTRXWITHOUTPLLLOCK ); - rxTimeoutSyncWord.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), - this->settings.Fsk.RxSingleTimeout * 1e3 ); + rxTimeoutSyncWord.attach_us( this, &SX1276::OnTimeoutIrq, ceil( ( 8.0 * ( this->settings.Fsk.PreambleLen + + ( ( Read( REG_SYNCCONFIG ) & + ~RF_SYNCCONFIG_SYNCSIZE_MASK ) + + 1.0 ) + 10.0 ) / + ( double )this->settings.Fsk.Datarate ) * 1e6 ) + 4000 ); } else { @@ -1182,8 +1188,11 @@ { // Continuous mode restart Rx chain Write( REG_RXCONFIG, Read( REG_RXCONFIG ) | RF_RXCONFIG_RESTARTRXWITHOUTPLLLOCK ); - rxTimeoutSyncWord.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), - this->settings.Fsk.RxSingleTimeout * 1e3 ); + rxTimeoutSyncWord.attach_us( this, &SX1276::OnTimeoutIrq, ceil( ( 8.0 * ( this->settings.Fsk.PreambleLen + + ( ( Read( REG_SYNCCONFIG ) & + ~RF_SYNCCONFIG_SYNCSIZE_MASK ) + + 1.0 ) + 10.0 ) / + ( double )this->settings.Fsk.Datarate ) * 1e6 ) + 4000 ); } if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxError != NULL ) ) @@ -1229,8 +1238,11 @@ { // Continuous mode restart Rx chain Write( REG_RXCONFIG, Read( REG_RXCONFIG ) | RF_RXCONFIG_RESTARTRXWITHOUTPLLLOCK ); - rxTimeoutSyncWord.attach_us( mbed::callback( this, &SX1276::OnTimeoutIrq ), - this->settings.Fsk.RxSingleTimeout * 1e3 ); + rxTimeoutSyncWord.attach_us( this, &SX1276::OnTimeoutIrq, ceil( ( 8.0 * ( this->settings.Fsk.PreambleLen + + ( ( Read( REG_SYNCCONFIG ) & + ~RF_SYNCCONFIG_SYNCSIZE_MASK ) + + 1.0 ) + 10.0 ) / + ( double )this->settings.Fsk.Datarate ) * 1e6 ) + 4000 ); } if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxDone != NULL ) )