kopia lustrzana https://github.com/jgromes/RadioLib
[SX128x] Implement generalized IRQ checks
rodzic
08f92cdd29
commit
b401d11127
|
@ -638,6 +638,37 @@ int16_t SX128x::readData(uint8_t* data, size_t len) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
bool SX128x::isIrqSet(uint8_t irq) {
|
||||
uint16_t flags = getIrqStatus();
|
||||
switch(irq) {
|
||||
case RADIOLIB_IRQ_TX_DONE:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_TX_DONE);
|
||||
case RADIOLIB_IRQ_RX_DONE:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_RX_DONE);
|
||||
case RADIOLIB_IRQ_PREAMBLE_DETECTED:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED);
|
||||
case RADIOLIB_IRQ_SYNC_WORD_VALID:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_SYNC_WORD_VALID);
|
||||
case RADIOLIB_IRQ_SYNC_WORD_ERROR:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_SYNC_WORD_ERROR);
|
||||
case RADIOLIB_IRQ_HEADER_VALID:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_HEADER_VALID);
|
||||
case RADIOLIB_IRQ_HEADER_ERR:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_HEADER_ERROR);
|
||||
case RADIOLIB_IRQ_CRC_ERR:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_CRC_ERROR);
|
||||
case RADIOLIB_IRQ_CAD_DONE:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_CAD_DONE);
|
||||
case RADIOLIB_IRQ_CAD_DETECTED:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_CAD_DETECTED);
|
||||
case RADIOLIB_IRQ_TIMEOUT:
|
||||
return(flags & RADIOLIB_SX128X_IRQ_RX_TX_TIMEOUT);
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
int16_t SX128x::startChannelScan() {
|
||||
// check active modem
|
||||
if(getPacketType() != RADIOLIB_SX128X_PACKET_TYPE_LORA) {
|
||||
|
|
|
@ -576,6 +576,12 @@ class SX128x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t readData(uint8_t* data, size_t len) override;
|
||||
|
||||
/*!
|
||||
\brief Check whether a specific IRQ bit is set (e.g. RxTimeout, CadDone).
|
||||
\returns Whether requested IRQ is set.
|
||||
*/
|
||||
bool isIrqSet(uint8_t irq) override;
|
||||
|
||||
/*!
|
||||
\brief Interrupt-driven channel activity detection method. DIO1 will be activated
|
||||
when LoRa preamble is detected, or upon timeout. Defaults to CAD parameter values recommended by AN1200.48.
|
||||
|
|
Ładowanie…
Reference in New Issue