[SX126x] Add public method to handle LR-FHSS hopping

This commit is contained in:
jgromes 2025-01-29 17:51:20 +00:00
parent fc6ff698b9
commit c187960cc1
3 changed files with 19 additions and 2 deletions

View file

@ -246,6 +246,7 @@ spectralScanAbort KEYWORD2
spectralScanGetStatus KEYWORD2
spectralScanGetResult KEYWORD2
setPaRampTime KEYWORD2
hopLRFHSS KEYWORD2
# nRF24
setIrqAction KEYWORD2

View file

@ -235,8 +235,7 @@ int16_t SX126x::transmit(const uint8_t* data, size_t len, uint8_t addr) {
break;
} else {
// handle frequency hop
this->setLRFHSSHop(this->lrFhssHopNum % 16);
clearIrqStatus();
this->hopLRFHSS();
}
}
}
@ -477,6 +476,16 @@ int16_t SX126x::standby(uint8_t mode, bool wakeup) {
return(this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_STANDBY, data, 1));
}
int16_t SX126x::hopLRFHSS() {
if(!(this->getIrqFlags() & RADIOLIB_SX126X_IRQ_LR_FHSS_HOP)) {
return(RADIOLIB_ERR_TX_TIMEOUT);
}
int16_t state = this->setLRFHSSHop(this->lrFhssHopNum % 16);
RADIOLIB_ASSERT(state);
return(clearIrqStatus());
}
void SX126x::setDio1Action(void (*func)(void)) {
this->mod->hal->attachInterrupt(this->mod->hal->pinToInterrupt(this->mod->getIrq()), func, this->mod->hal->GpioInterruptRising);
}

View file

@ -628,6 +628,13 @@ class SX126x: public PhysicalLayer {
*/
int16_t standby(uint8_t mode, bool wakeup = true);
/*!
\brief Handle LR-FHSS hop.
When using LR-FHSS in interrupt-driven mode, this method MUST be called each time an interrupt is triggered!
\returns \ref status_codes
*/
int16_t hopLRFHSS();
// interrupt methods
/*!