kopia lustrzana https://github.com/jgromes/RadioLib
[LR11x0] Generalize IRQ checks
rodzic
19ec9da281
commit
0eb987a83c
|
@ -1328,12 +1328,37 @@ int16_t LR11x0::irqRxDoneRxTimeout(uint32_t &irqFlags, uint32_t &irqMask) {
|
|||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
bool LR11x0::isRxTimeout() {
|
||||
uint32_t irq = getIrqStatus();
|
||||
bool rxTimedOut = irq & RADIOLIB_LR11X0_IRQ_TIMEOUT;
|
||||
return(rxTimedOut);
|
||||
bool LR11x0::isIrqSet(uint8_t irq) {
|
||||
uint16_t flags = getIrqStatus();
|
||||
switch(irq) {
|
||||
case RADIOLIB_IRQ_TX_DONE:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_TX_DONE);
|
||||
case RADIOLIB_IRQ_RX_DONE:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_RX_DONE);
|
||||
case RADIOLIB_IRQ_PREAMBLE_DETECTED:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED);
|
||||
case RADIOLIB_IRQ_SYNC_WORD_VALID:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID);
|
||||
case RADIOLIB_IRQ_HEADER_VALID:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID);
|
||||
case RADIOLIB_IRQ_HEADER_ERR:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_HEADER_ERR);
|
||||
case RADIOLIB_IRQ_CRC_ERR:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_CRC_ERR);
|
||||
case RADIOLIB_IRQ_CAD_DONE:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_CAD_DONE);
|
||||
case RADIOLIB_IRQ_CAD_DETECTED:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_CAD_DETECTED);
|
||||
case RADIOLIB_IRQ_TIMEOUT:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_TIMEOUT);
|
||||
case RADIOLIB_IRQ_LR_FHSS_HOP:
|
||||
return(flags & RADIOLIB_LR11X0_IRQ_LR_FHSS_HOP);
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
uint8_t LR11x0::randomByte() {
|
||||
uint32_t num = 0;
|
||||
(void)getRandomNumber(&num);
|
||||
|
|
|
@ -1229,10 +1229,10 @@ class LR11x0: public PhysicalLayer {
|
|||
int16_t irqRxDoneRxTimeout(uint32_t &irqFlags, uint32_t &irqMask) override;
|
||||
|
||||
/*!
|
||||
\brief Check whether the IRQ bit for RxTimeout is set
|
||||
\returns Whether RxTimeout IRQ is set
|
||||
\brief Check whether a specific IRQ bit is set (e.g. RxTimeout, CadDone).
|
||||
\returns Whether requested IRQ is set.
|
||||
*/
|
||||
bool isRxTimeout() override;
|
||||
bool isIrqSet(uint8_t irq) override;
|
||||
|
||||
/*!
|
||||
\brief Get one truly random byte from RSSI noise.
|
||||
|
|
Ładowanie…
Reference in New Issue