[SX127x] Added method to get CAD result

This commit is contained in:
jgromes 2023-08-12 18:40:38 +02:00
parent bb468ad59f
commit b48567722b
2 changed files with 16 additions and 3 deletions

View file

@ -701,6 +701,13 @@ int16_t SX127x::startChannelScan() {
return(state);
}
int16_t SX127x::getChannelScanResult() {
if(this->getIRQFlags() & RADIOLIB_SX127X_CLEAR_IRQ_FLAG_CAD_DETECTED == RADIOLIB_SX127X_CLEAR_IRQ_FLAG_CAD_DETECTED) {
return(RADIOLIB_PREAMBLE_DETECTED);
}
return(RADIOLIB_CHANNEL_FREE);
}
int16_t SX127x::setSyncWord(uint8_t syncWord) {
// check active modem
if(getActiveModem() != RADIOLIB_SX127X_LORA) {

View file

@ -834,7 +834,13 @@ class SX127x: public PhysicalLayer {
DIO1 will be activated if there's no preamble detected before timeout.
\returns \ref status_codes
*/
int16_t startChannelScan();
int16_t startChannelScan() override;
/*!
\brief Read the channel scan result.
\returns \ref status_codes
*/
int16_t getChannelScanResult() override;
// configuration methods
@ -1016,11 +1022,11 @@ class SX127x: public PhysicalLayer {
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SX127X_MAX_PACKET_LENGTH_FSK);
/*!
\brief Get expected time-on-air for a given size of payload
\brief Get expected time-on-air for a given size of payload.
\param len Payload length in bytes.
\returns Expected time-on-air in microseconds.
*/
uint32_t getTimeOnAir(size_t len);
uint32_t getTimeOnAir(size_t len) override;
/*!
\brief Enable CRC filtering and generation.