[LR11x0] Added get/set modem
This commit is contained in:
parent
920ac4eefd
commit
173d8cc202
6 changed files with 77 additions and 0 deletions
|
@ -105,4 +105,19 @@ int16_t LR1110::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPo
|
|||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR1110::setModem(ModemType_t modem) {
|
||||
switch(modem) {
|
||||
case(ModemType_t::LoRa): {
|
||||
return(this->begin());
|
||||
} break;
|
||||
case(ModemType_t::FSK): {
|
||||
return(this->beginGFSK());
|
||||
} break;
|
||||
case(ModemType_t::LRFHSS): {
|
||||
return(this->beginLRFHSS());
|
||||
} break;
|
||||
}
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -123,6 +123,14 @@ class LR1110: public LR11x0 {
|
|||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
|
||||
|
||||
/*!
|
||||
\brief Set modem for the radio to use. Will perform full reset and reconfigure the radio
|
||||
using its default parameters.
|
||||
\param modem Modem type to set - FSK, LoRa or LR-FHSS.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setModem(ModemType_t modem) override;
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
|
|
@ -128,4 +128,19 @@ int16_t LR1120::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPo
|
|||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR1120::setModem(ModemType_t modem) {
|
||||
switch(modem) {
|
||||
case(ModemType_t::LoRa): {
|
||||
return(this->begin());
|
||||
} break;
|
||||
case(ModemType_t::FSK): {
|
||||
return(this->beginGFSK());
|
||||
} break;
|
||||
case(ModemType_t::LRFHSS): {
|
||||
return(this->beginLRFHSS());
|
||||
} break;
|
||||
}
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -132,6 +132,14 @@ class LR1120: public LR11x0 {
|
|||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
|
||||
|
||||
/*!
|
||||
\brief Set modem for the radio to use. Will perform full reset and reconfigure the radio
|
||||
using its default parameters.
|
||||
\param modem Modem type to set - FSK, LoRa or LR-FHSS.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setModem(ModemType_t modem) override;
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
|
|
@ -2009,6 +2009,30 @@ int16_t LR11x0::getGnssSatellites(LR11x0GnssSatellite_t* sats, uint8_t numSats)
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::getModem(ModemType_t* modem) {
|
||||
if(!modem) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
|
||||
uint8_t packetType = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||
int16_t state = getPacketType(&packetType);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
switch(packetType) {
|
||||
case(RADIOLIB_LR11X0_PACKET_TYPE_LORA):
|
||||
*modem = ModemType_t::LoRa;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
case(RADIOLIB_LR11X0_PACKET_TYPE_GFSK):
|
||||
*modem = ModemType_t::FSK;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
case(RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS):
|
||||
*modem = ModemType_t::LRFHSS;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
int16_t LR11x0::modSetup(float tcxoVoltage, uint8_t modem) {
|
||||
this->mod->init();
|
||||
this->mod->hal->pinMode(this->mod->getIrq(), this->mod->hal->GpioModeInput);
|
||||
|
|
|
@ -1602,6 +1602,13 @@ class LR11x0: public PhysicalLayer {
|
|||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getGnssSatellites(LR11x0GnssSatellite_t* sats, uint8_t numSats);
|
||||
|
||||
/*!
|
||||
\brief Get modem currently in use by the radio.
|
||||
\param modem Pointer to a variable to save the retrieved configuration into.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getModem(ModemType_t* modem) override;
|
||||
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
|
|
Loading…
Add table
Reference in a new issue