ST-DEVKIT-LRWAN
Dependents: DISCO-L072CZ-LRWAN1-base
Fork of SX1276GenericLib by
Diff: sx1276/sx1276.cpp
- Revision:
- 54:0d8ea87fbab9
- Parent:
- 53:6d3adad59633
- Child:
- 55:00c1f5b83920
--- a/sx1276/sx1276.cpp Thu May 18 18:34:54 2017 +0200 +++ b/sx1276/sx1276.cpp Fri May 19 11:50:12 2017 +0200 @@ -103,9 +103,13 @@ delete this->dioIrq; } -void SX1276::Init( RadioEvents_t *events ) +bool SX1276::Init( RadioEvents_t *events ) { + if (Read(REG_VERSION) == 0x00) + return false; + this->RadioEvents = events; + return true; } @@ -898,6 +902,23 @@ } } +bool SX1276::RxSignalPending() +{ + if (this->settings.State != RF_RX_RUNNING) + return false; + + switch( this->settings.Modem ) + { + case MODEM_FSK: + break; + case MODEM_LORA: + if (Read(REG_LR_MODEMSTAT) & RFLR_MODEMSTAT_SIGNAL_DETECTED) + return true; + break; + } + return false; +} + void SX1276::Tx( uint32_t timeout ) {