Update Radiolib version to 7.1.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "LR1110.h"
|
||||
#include <math.h>
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
LR1110::LR1110(Module* mod) : LR11x0(mod) {
|
||||
@@ -31,9 +33,9 @@ int16_t LR1110::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, bool narrowGrid, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, narrowGrid, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
@@ -45,20 +47,24 @@ int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, fl
|
||||
}
|
||||
|
||||
int16_t LR1110::setFrequency(float freq) {
|
||||
return(this->setFrequency(freq, true));
|
||||
return(this->setFrequency(freq, false));
|
||||
}
|
||||
|
||||
int16_t LR1110::setFrequency(float freq, bool calibrate, float band) {
|
||||
int16_t LR1110::setFrequency(float freq, bool skipCalibration, float band) {
|
||||
RADIOLIB_CHECK_RANGE(freq, 150.0, 960.0, RADIOLIB_ERR_INVALID_FREQUENCY);
|
||||
|
||||
// calibrate image rejection
|
||||
if(calibrate) {
|
||||
int16_t state = LR11x0::calibImage(freq - band, freq + band);
|
||||
|
||||
// check if we need to recalibrate image
|
||||
int16_t state;
|
||||
if(!skipCalibration && (fabsf(freq - this->freqMHz) >= RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG_MHZ)) {
|
||||
state = LR11x0::calibrateImageRejection(freq - band, freq + band);
|
||||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
// set frequency
|
||||
return(LR11x0::setRfFrequency((uint32_t)(freq*1000000.0f)));
|
||||
state = LR11x0::setRfFrequency((uint32_t)(freq*1000000.0f));
|
||||
RADIOLIB_ASSERT(state);
|
||||
this->freqMHz = freq;
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::setOutputPower(int8_t power) {
|
||||
@@ -105,4 +111,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
|
||||
@@ -58,19 +58,21 @@ class LR1110: public LR11x0 {
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values. Defaults to 722.66 kHz.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values. Defaults to 2/3 coding rate.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing. Defaults to true (narrow/non-FCC) grid.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param tcxoVoltage TCXO reference voltage to be set. Defaults to 1.6 V.
|
||||
If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL.
|
||||
To use XTAL, either set this value to 0, or set LR11x0::XTAL to true.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, bool narrowGrid = true, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
|
||||
// configuration methods
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz.
|
||||
Will also perform calibrations.
|
||||
Will automatically perform image calibration if the frequency changes by
|
||||
more than RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG MHz.
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
@@ -78,14 +80,16 @@ class LR1110: public LR11x0 {
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz.
|
||||
Will automatically perform image calibration if the frequency changes by
|
||||
more than RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG MHz.
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
\param calibrate Run image calibration.
|
||||
\param skipCalibration Skip automated image calibration.
|
||||
\param band Half bandwidth for image calibration. For example,
|
||||
if carrier is 434 MHz and band is set to 4 MHz, then the image will be calibrate
|
||||
for band 430 - 438 MHz. Unused if calibrate is set to false, defaults to 4 MHz
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFrequency(float freq, bool calibrate, float band = 4);
|
||||
int16_t setFrequency(float freq, bool skipCalibration, float band = 4);
|
||||
|
||||
/*!
|
||||
\brief Sets output power. Allowed values are in range from -9 to 22 dBm (high-power PA) or -17 to 14 dBm (low-power PA).
|
||||
@@ -122,6 +126,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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "LR1120.h"
|
||||
#include <math.h>
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
LR1120::LR1120(Module* mod) : LR11x0(mod) {
|
||||
@@ -7,7 +9,7 @@ LR1120::LR1120(Module* mod) : LR11x0(mod) {
|
||||
|
||||
int16_t LR1120::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::begin(bw, sf, cr, syncWord, preambleLength, tcxoVoltage);
|
||||
int16_t state = LR11x0::begin(bw, sf, cr, syncWord, preambleLength, tcxoVoltage, freq > 1000.0);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
@@ -31,9 +33,9 @@ int16_t LR1120::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, bool narrowGrid, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, narrowGrid, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
@@ -45,26 +47,27 @@ int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, fl
|
||||
}
|
||||
|
||||
int16_t LR1120::setFrequency(float freq) {
|
||||
return(this->setFrequency(freq, true));
|
||||
return(this->setFrequency(freq, false));
|
||||
}
|
||||
|
||||
int16_t LR1120::setFrequency(float freq, bool calibrate, float band) {
|
||||
int16_t LR1120::setFrequency(float freq, bool skipCalibration, float band) {
|
||||
if(!(((freq >= 150.0) && (freq <= 960.0)) ||
|
||||
((freq >= 1900.0) && (freq <= 2200.0)) ||
|
||||
((freq >= 2400.0) && (freq <= 2500.0)))) {
|
||||
return(RADIOLIB_ERR_INVALID_FREQUENCY);
|
||||
}
|
||||
|
||||
// calibrate image rejection
|
||||
// check if we need to recalibrate image
|
||||
int16_t state;
|
||||
if(calibrate) {
|
||||
state = LR11x0::calibImage(freq - band, freq + band);
|
||||
if(!skipCalibration && (fabsf(freq - this->freqMHz) >= RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG_MHZ)) {
|
||||
state = LR11x0::calibrateImageRejection(freq - band, freq + band);
|
||||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
// set frequency
|
||||
state = LR11x0::setRfFrequency((uint32_t)(freq*1000000.0f));
|
||||
RADIOLIB_ASSERT(state);
|
||||
this->freqMHz = freq;
|
||||
this->highFreq = (freq > 1000.0);
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
@@ -128,4 +131,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
|
||||
@@ -58,19 +58,22 @@ class LR1120: public LR11x0 {
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values. Defaults to 722.66 kHz.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values. Defaults to 2/3 coding rate.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing. Defaults to true (narrow/non-FCC) grid.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param tcxoVoltage TCXO reference voltage to be set. Defaults to 1.6 V.
|
||||
If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL.
|
||||
To use XTAL, either set this value to 0, or set LR11x0::XTAL to true.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, bool narrowGrid = true, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
|
||||
// configuration methods
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz,
|
||||
1900 - 2200 MHz and 2400 - 2500 MHz. Will also perform calibrations.
|
||||
1900 - 2200 MHz and 2400 - 2500 MHz.
|
||||
Will automatically perform image calibration if the frequency changes by
|
||||
more than RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG MHz.
|
||||
NOTE: When switching between sub-GHz and high-frequency bands, after changing the frequency,
|
||||
setOutputPower() must be called in order to set the correct power amplifier!
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
@@ -80,17 +83,19 @@ class LR1120: public LR11x0 {
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz,
|
||||
1900 - 2200 MHz and 2400 - 2500 MHz. Will also perform calibrations.
|
||||
1900 - 2200 MHz and 2400 - 2500 MHz.
|
||||
Will automatically perform image calibration if the frequency changes by
|
||||
more than RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG MHz.
|
||||
NOTE: When switching between sub-GHz and high-frequency bands, after changing the frequency,
|
||||
setOutputPower() must be called in order to set the correct power amplifier!
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
\param calibrate Run image calibration.
|
||||
\param skipCalibration Skip automated image calibration.
|
||||
\param band Half bandwidth for image calibration. For example,
|
||||
if carrier is 434 MHz and band is set to 4 MHz, then the image will be calibrate
|
||||
for band 430 - 438 MHz. Unused if calibrate is set to false, defaults to 4 MHz
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFrequency(float freq, bool calibrate, float band = 4);
|
||||
int16_t setFrequency(float freq, bool skipCalibration, float band = 4);
|
||||
|
||||
/*!
|
||||
\brief Sets output power. Allowed values are in range from -9 to 22 dBm (high-power PA) or -17 to 14 dBm (low-power PA).
|
||||
@@ -131,6 +136,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
|
||||
|
||||
@@ -21,9 +21,6 @@ class LR1121: public LR1120 {
|
||||
*/
|
||||
LR1121(Module* mod); // cppcheck-suppress noExplicitConstructor
|
||||
|
||||
// TODO this is where overrides to disable GNSS+WiFi scanning methods on LR1121
|
||||
// will be put once those are implemented
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
@@ -23,13 +23,13 @@ LR11x0::LR11x0(Module* mod) : PhysicalLayer(RADIOLIB_LR11X0_FREQUENCY_STEP_SIZE,
|
||||
this->irqMap[RADIOLIB_IRQ_TIMEOUT] = RADIOLIB_LR11X0_IRQ_TIMEOUT;
|
||||
}
|
||||
|
||||
int16_t LR11x0::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage) {
|
||||
int16_t LR11x0::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool high) {
|
||||
// set module properties and perform initial setup
|
||||
int16_t state = this->modSetup(tcxoVoltage, RADIOLIB_LR11X0_PACKET_TYPE_LORA);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setBandwidth(bw);
|
||||
state = setBandwidth(bw, high);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setSpreadingFactor(sf);
|
||||
@@ -98,11 +98,14 @@ int16_t LR11x0::beginGFSK(float br, float freqDev, float rxBw, uint16_t preamble
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, float tcxoVoltage) {
|
||||
int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, bool narrowGrid, float tcxoVoltage) {
|
||||
// set module properties and perform initial setup
|
||||
int16_t state = this->modSetup(tcxoVoltage, RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set grid spacing
|
||||
this->lrFhssGrid = narrowGrid ? RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_NON_FCC : RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC;
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setLrFhssConfig(bw, cr);
|
||||
RADIOLIB_ASSERT(state);
|
||||
@@ -117,6 +120,34 @@ int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, float tcxoVoltage) {
|
||||
return(setModulationParamsLrFhss(RADIOLIB_LR11X0_LR_FHSS_BIT_RATE_RAW, RADIOLIB_LR11X0_LR_FHSS_SHAPING_GAUSSIAN_BT_1_0));
|
||||
}
|
||||
|
||||
int16_t LR11x0::beginGNSS(uint8_t constellations, float tcxoVoltage) {
|
||||
// set module properties and perform initial setup - packet type does not matter
|
||||
int16_t state = this->modSetup(tcxoVoltage, RADIOLIB_LR11X0_PACKET_TYPE_LORA);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = this->clearErrors();
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = this->configLfClock(RADIOLIB_LR11X0_LF_BUSY_RELEASE_DISABLED | RADIOLIB_LR11X0_LF_CLK_XOSC);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
uint16_t errs = 0;
|
||||
state = this->getErrors(&errs);
|
||||
RADIOLIB_ASSERT(state);
|
||||
if(errs & 0x40) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("LF_XOSC_START_ERR");
|
||||
return(RADIOLIB_ERR_SPI_CMD_FAILED);
|
||||
}
|
||||
|
||||
state = this->gnssSetConstellationToUse(constellations);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setRegulatorLDO();
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR11x0::reset() {
|
||||
// run the reset sequence
|
||||
this->mod->hal->pinMode(this->mod->getRst(), this->mod->hal->GpioModeOutput);
|
||||
@@ -216,11 +247,8 @@ int16_t LR11x0::receive(uint8_t* data, size_t len) {
|
||||
timeout = (RadioLibTime_t)(((maxLen * 8.0) / brBps) * 1000.0 * 5.0);
|
||||
|
||||
} else if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
|
||||
size_t maxLen = len;
|
||||
if(len == 0) {
|
||||
maxLen = 0xFF;
|
||||
}
|
||||
timeout = (RadioLibTime_t)(((maxLen * 8.0) / (RADIOLIB_LR11X0_LR_FHSS_BIT_RATE)) * 1000.0 * 5.0);
|
||||
// this modem cannot receive
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
|
||||
} else {
|
||||
return(RADIOLIB_ERR_UNKNOWN);
|
||||
@@ -288,7 +316,7 @@ int16_t LR11x0::receiveDirect() {
|
||||
}
|
||||
|
||||
int16_t LR11x0::scanChannel() {
|
||||
ChannelScanConfig_t config = {
|
||||
ChannelScanConfig_t cfg = {
|
||||
.cad = {
|
||||
.symNum = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT,
|
||||
.detPeak = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT,
|
||||
@@ -299,7 +327,7 @@ int16_t LR11x0::scanChannel() {
|
||||
.irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK,
|
||||
},
|
||||
};
|
||||
return(this->scanChannel(config));
|
||||
return(this->scanChannel(cfg));
|
||||
}
|
||||
|
||||
int16_t LR11x0::scanChannel(const ChannelScanConfig_t &config) {
|
||||
@@ -421,8 +449,8 @@ int16_t LR11x0::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
|
||||
|
||||
if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
|
||||
// in LR-FHSS mode, the packet is built by the device
|
||||
// TODO add configurable grid step and device offset
|
||||
state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC, true, this->lrFhssBw, this->lrFhssHopSeq, 0, const_cast<uint8_t*>(data), len);
|
||||
// TODO add configurable device offset
|
||||
state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, this->lrFhssGrid, true, this->lrFhssBw, this->lrFhssHopSeq, 0, const_cast<uint8_t*>(data), len);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
} else {
|
||||
@@ -472,8 +500,7 @@ int16_t LR11x0::startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMa
|
||||
state = getPacketType(&modem);
|
||||
RADIOLIB_ASSERT(state);
|
||||
if((modem != RADIOLIB_LR11X0_PACKET_TYPE_LORA) &&
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK) &&
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS)) {
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK)) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
@@ -521,8 +548,7 @@ int16_t LR11x0::readData(uint8_t* data, size_t len) {
|
||||
state = getPacketType(&modem);
|
||||
RADIOLIB_ASSERT(state);
|
||||
if((modem != RADIOLIB_LR11X0_PACKET_TYPE_LORA) &&
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK) &&
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS)) {
|
||||
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK)) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
@@ -561,7 +587,7 @@ int16_t LR11x0::readData(uint8_t* data, size_t len) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::startChannelScan() {
|
||||
ChannelScanConfig_t config = {
|
||||
ChannelScanConfig_t cfg = {
|
||||
.cad = {
|
||||
.symNum = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT,
|
||||
.detPeak = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT,
|
||||
@@ -572,7 +598,7 @@ int16_t LR11x0::startChannelScan() {
|
||||
.irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK,
|
||||
},
|
||||
};
|
||||
return(this->startChannelScan(config));
|
||||
return(this->startChannelScan(cfg));
|
||||
}
|
||||
|
||||
int16_t LR11x0::startChannelScan(const ChannelScanConfig_t &config) {
|
||||
@@ -594,7 +620,7 @@ int16_t LR11x0::startChannelScan(const ChannelScanConfig_t &config) {
|
||||
|
||||
// set DIO pin mapping
|
||||
uint16_t irqFlags = (config.cad.irqFlags == RADIOLIB_IRQ_NOT_SUPPORTED) ? RADIOLIB_LR11X0_IRQ_CAD_DETECTED | RADIOLIB_LR11X0_IRQ_CAD_DONE : config.cad.irqFlags;
|
||||
state = setDioIrqParams(irqFlags, irqFlags);
|
||||
state = setDioIrqParams(getIrqMapped(irqFlags), getIrqMapped(irqFlags));
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// clear interrupt flags
|
||||
@@ -628,7 +654,7 @@ int16_t LR11x0::getChannelScanResult() {
|
||||
return(RADIOLIB_ERR_UNKNOWN);
|
||||
}
|
||||
|
||||
int16_t LR11x0::setBandwidth(float bw) {
|
||||
int16_t LR11x0::setBandwidth(float bw, bool high) {
|
||||
// check active modem
|
||||
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||
int16_t state = getPacketType(&type);
|
||||
@@ -638,25 +664,39 @@ int16_t LR11x0::setBandwidth(float bw) {
|
||||
}
|
||||
|
||||
// ensure byte conversion doesn't overflow
|
||||
RADIOLIB_CHECK_RANGE(bw, 0.0, 510.0, RADIOLIB_ERR_INVALID_BANDWIDTH);
|
||||
if (high) {
|
||||
RADIOLIB_CHECK_RANGE(bw, 203.125, 815.0, RADIOLIB_ERR_INVALID_BANDWIDTH);
|
||||
|
||||
// check allowed bandwidth values
|
||||
uint8_t bw_div2 = bw / 2 + 0.01;
|
||||
switch (bw_div2) {
|
||||
case 31: // 62.5:
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_62_5;
|
||||
break;
|
||||
case 62: // 125.0:
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_125_0;
|
||||
break;
|
||||
case 125: // 250.0
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_250_0;
|
||||
break;
|
||||
case 250: // 500.0
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_500_0;
|
||||
break;
|
||||
default:
|
||||
if(fabsf(bw - 203.125) <= 0.001) {
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_203_125;
|
||||
} else if(fabsf(bw - 406.25) <= 0.001) {
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_406_25;
|
||||
} else if(fabsf(bw - 812.5) <= 0.001) {
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_812_50;
|
||||
} else {
|
||||
return(RADIOLIB_ERR_INVALID_BANDWIDTH);
|
||||
}
|
||||
} else {
|
||||
RADIOLIB_CHECK_RANGE(bw, 0.0, 510.0, RADIOLIB_ERR_INVALID_BANDWIDTH);
|
||||
|
||||
// check allowed bandwidth values
|
||||
uint8_t bw_div2 = bw / 2 + 0.01;
|
||||
switch (bw_div2) {
|
||||
case 31: // 62.5:
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_62_5;
|
||||
break;
|
||||
case 62: // 125.0:
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_125_0;
|
||||
break;
|
||||
case 125: // 250.0
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_250_0;
|
||||
break;
|
||||
case 250: // 500.0
|
||||
this->bandwidth = RADIOLIB_LR11X0_LORA_BW_500_0;
|
||||
break;
|
||||
default:
|
||||
return(RADIOLIB_ERR_INVALID_BANDWIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
// update modulation parameters
|
||||
@@ -1038,7 +1078,12 @@ int16_t LR11x0::setDataRate(DataRate_t dr) {
|
||||
state = this->setCodingRate(dr.lora.codingRate);
|
||||
|
||||
} else if(type == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
|
||||
// set the basic config
|
||||
state = this->setLrFhssConfig(dr.lrFhss.bw, dr.lrFhss.cr);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set hopping grid
|
||||
this->lrFhssGrid = dr.lrFhss.narrowGrid ? RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_NON_FCC : RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC;
|
||||
|
||||
}
|
||||
|
||||
@@ -1077,7 +1122,11 @@ int16_t LR11x0::setPreambleLength(size_t preambleLength) {
|
||||
return(setPacketParamsLoRa(this->preambleLengthLoRa, this->headerType, this->implicitLen, this->crcTypeLoRa, (uint8_t)this->invertIQEnabled));
|
||||
} else if(type == RADIOLIB_LR11X0_PACKET_TYPE_GFSK) {
|
||||
this->preambleLengthGFSK = preambleLength;
|
||||
this->preambleDetLength = RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS;
|
||||
this->preambleDetLength = preambleLength >= 32 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_32_BITS :
|
||||
preambleLength >= 24 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_24_BITS :
|
||||
preambleLength >= 16 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_16_BITS :
|
||||
preambleLength > 0 ? RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_8_BITS :
|
||||
RADIOLIB_LR11X0_GFSK_PREAMBLE_DETECT_DISABLED;
|
||||
return(setPacketParamsGFSK(this->preambleLengthGFSK, this->preambleDetLength, this->syncWordLength, this->addrComp, this->packetType, RADIOLIB_LR11X0_MAX_PACKET_LENGTH, this->crcTypeGFSK, this->whitening));
|
||||
}
|
||||
|
||||
@@ -1401,17 +1450,36 @@ void LR11x0::setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS],
|
||||
// find which pins are used
|
||||
uint8_t enable = 0;
|
||||
for(size_t i = 0; i < Module::RFSWITCH_MAX_PINS; i++) {
|
||||
if((pins[i] == RADIOLIB_NC) || (pins[i] > RADIOLIB_LR11X0_DIO10)) {
|
||||
// check if this pin is unused
|
||||
if(pins[i] == RADIOLIB_NC) {
|
||||
continue;
|
||||
}
|
||||
enable |= 1UL << pins[i];
|
||||
|
||||
// only keep DIO pins, there may be some GPIOs in the switch tabke
|
||||
if(pins[i] & RFSWITCH_PIN_FLAG) {
|
||||
enable |= 1UL << RADIOLIB_LR11X0_DIOx_VAL(pins[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// now get the configuration
|
||||
uint8_t modes[7] = { 0 };
|
||||
for(size_t i = 0; i < 7; i++) {
|
||||
// check end of table
|
||||
if(table[i].mode == LR11x0::MODE_END_OF_TABLE) {
|
||||
break;
|
||||
}
|
||||
|
||||
// get the mode ID in case the modes are out-of-order
|
||||
uint8_t index = table[i].mode - LR11x0::MODE_STBY;
|
||||
|
||||
// iterate over the pins
|
||||
for(size_t j = 0; j < Module::RFSWITCH_MAX_PINS; j++) {
|
||||
modes[i] |= (table[i].values[j] > 0) ? (1UL << j) : 0;
|
||||
// only process modes for the DIOx pins, skip GPIO pins
|
||||
if(!(pins[j] & RFSWITCH_PIN_FLAG)) {
|
||||
continue;
|
||||
}
|
||||
modes[index] |= (table[i].values[j] == this->mod->hal->GpioLevelHigh) ? (1UL << j) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1419,6 +1487,33 @@ void LR11x0::setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS],
|
||||
this->setDioAsRfSwitch(enable, modes[0], modes[1], modes[2], modes[3], modes[4], modes[5], modes[6]);
|
||||
}
|
||||
|
||||
int16_t LR11x0::forceLDRO(bool enable) {
|
||||
// check packet type
|
||||
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||
int16_t state = getPacketType(&type);
|
||||
RADIOLIB_ASSERT(state);
|
||||
if(type != RADIOLIB_LR11X0_PACKET_TYPE_LORA) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
// update modulation parameters
|
||||
this->ldroAuto = false;
|
||||
this->ldrOptimize = (uint8_t)enable;
|
||||
return(setModulationParamsLoRa(this->spreadingFactor, this->bandwidth, this->codingRate, this->ldrOptimize));
|
||||
}
|
||||
|
||||
int16_t LR11x0::autoLDRO() {
|
||||
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||
int16_t state = getPacketType(&type);
|
||||
RADIOLIB_ASSERT(state);
|
||||
if(type != RADIOLIB_LR11X0_PACKET_TYPE_LORA) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
this->ldroAuto = true;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR11x0::setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount, uint16_t hopSeed) {
|
||||
// check active modem
|
||||
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||
@@ -1441,6 +1536,11 @@ int16_t LR11x0::setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount, uint16
|
||||
}
|
||||
|
||||
int16_t LR11x0::startWifiScan(char wifiType, uint8_t mode, uint16_t chanMask, uint8_t numScans, uint16_t timeout) {
|
||||
// LR1121 cannot do WiFi scanning
|
||||
if(this->chipType == RADIOLIB_LR11X0_DEVICE_LR1121) {
|
||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
uint8_t type;
|
||||
switch(wifiType) {
|
||||
case('b'):
|
||||
@@ -1500,9 +1600,7 @@ int16_t LR11x0::getWifiScanResultsCount(uint8_t* count) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::getWifiScanResult(LR11x0WifiResult_t* result, uint8_t index, bool brief) {
|
||||
if(!result) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(result);
|
||||
|
||||
// read a single result
|
||||
uint8_t format = brief ? RADIOLIB_LR11X0_WIFI_RESULT_TYPE_BASIC : RADIOLIB_LR11X0_WIFI_RESULT_TYPE_COMPLETE;
|
||||
@@ -1576,9 +1674,7 @@ int16_t LR11x0::getWifiScanResult(LR11x0WifiResult_t* result, uint8_t index, boo
|
||||
}
|
||||
|
||||
int16_t LR11x0::wifiScan(uint8_t wifiType, uint8_t* count, uint8_t mode, uint16_t chanMask, uint8_t numScans, uint16_t timeout) {
|
||||
if(!count) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(count);
|
||||
|
||||
// start scan
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("WiFi scan start");
|
||||
@@ -1603,9 +1699,7 @@ int16_t LR11x0::wifiScan(uint8_t wifiType, uint8_t* count, uint8_t mode, uint16_
|
||||
}
|
||||
|
||||
int16_t LR11x0::getVersionInfo(LR11x0VersionInfo_t* info) {
|
||||
if(!info) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(info);
|
||||
|
||||
int16_t state = this->getVersion(&info->hardware, &info->device, &info->fwMajor, &info->fwMinor);
|
||||
RADIOLIB_ASSERT(state);
|
||||
@@ -1625,9 +1719,7 @@ int16_t LR11x0::getVersionInfo(LR11x0VersionInfo_t* info) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::updateFirmware(const uint32_t* image, size_t size, bool nonvolatile) {
|
||||
if(!image) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(image);
|
||||
|
||||
// put the device to bootloader mode
|
||||
int16_t state = this->reboot(true);
|
||||
@@ -1684,6 +1776,275 @@ int16_t LR11x0::updateFirmware(const uint32_t* image, size_t size, bool nonvolat
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::isGnssScanCapable() {
|
||||
// get the version
|
||||
LR11x0VersionInfo_t version;
|
||||
int16_t state = this->getVersionInfo(&version);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the device firmware version is sufficient
|
||||
uint16_t versionFull = ((uint16_t)version.fwMajor << 8) | (uint16_t)version.fwMinor;
|
||||
state = RADIOLIB_ERR_UNSUPPORTED;
|
||||
if((version.device == RADIOLIB_LR11X0_DEVICE_LR1110) && (versionFull >= 0x0401)) {
|
||||
state = RADIOLIB_ERR_NONE;
|
||||
} else if((version.device == RADIOLIB_LR11X0_DEVICE_LR1120) && (versionFull >= 0x0201)) {
|
||||
state = RADIOLIB_ERR_NONE;
|
||||
}
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// in debug mode, dump the almanac
|
||||
#if RADIOLIB_DEBUG_PROTOCOL
|
||||
uint32_t addr = 0;
|
||||
uint16_t sz = 0;
|
||||
state = this->gnssAlmanacReadAddrSize(&addr, &sz);
|
||||
RADIOLIB_ASSERT(state);
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Almanac@%08x, %d bytes", addr, sz);
|
||||
uint32_t buff[32] = { 0 };
|
||||
while(sz > 0) {
|
||||
size_t len = sz > 32 ? 32 : sz/sizeof(uint32_t);
|
||||
state = this->readRegMem32(addr, buff, len);
|
||||
RADIOLIB_ASSERT(state);
|
||||
RADIOLIB_DEBUG_HEXDUMP(NULL, (uint8_t*)buff, len*sizeof(uint32_t), addr);
|
||||
addr += len*sizeof(uint32_t);
|
||||
sz -= len*sizeof(uint32_t);
|
||||
}
|
||||
|
||||
uint8_t almanac[22] = { 0 };
|
||||
for(uint8_t i = 0; i < 128; i++) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Almanac[%d]:", i);
|
||||
state = this->gnssAlmanacReadSV(i, almanac);
|
||||
RADIOLIB_ASSERT(state);
|
||||
RADIOLIB_DEBUG_HEXDUMP(NULL, almanac, 22);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::gnssScan(LR11x0GnssResult_t* res) {
|
||||
RADIOLIB_ASSERT_PTR(res);
|
||||
|
||||
// go to standby
|
||||
int16_t state = standby();
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set DIO mapping
|
||||
state = setDioIrqParams(RADIOLIB_LR11X0_IRQ_GNSS_DONE | RADIOLIB_LR11X0_IRQ_GNSS_ABORT);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set scan mode (single vs multiple)
|
||||
state = this->gnssSetMode(0x03);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set RF switch
|
||||
this->mod->setRfSwitchState(LR11x0::MODE_GNSS);
|
||||
|
||||
// start scan with high effort
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GNSS scan start");
|
||||
state = this->gnssPerformScan(RADIOLIB_LR11X0_GNSS_EFFORT_MID, 0x3C, 16);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// wait for scan finished or timeout
|
||||
// this can take very long if both GPS and BeiDou are enabled
|
||||
RadioLibTime_t softTimeout = 300UL * 1000UL;
|
||||
RadioLibTime_t start = this->mod->hal->millis();
|
||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
if(this->mod->hal->millis() - start > softTimeout) {
|
||||
this->gnssAbort();
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Timeout waiting for IRQ");
|
||||
}
|
||||
}
|
||||
|
||||
// restore the switch
|
||||
this->mod->setRfSwitchState(Module::MODE_IDLE);
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GNSS scan done in %lu ms", (long unsigned int)(this->mod->hal->millis() - start));
|
||||
|
||||
// distinguish between GNSS-done and GNSS-abort outcomes and clear the flags
|
||||
uint32_t irq = this->getIrqStatus();
|
||||
this->clearIrq(RADIOLIB_LR11X0_IRQ_ALL);
|
||||
if(irq & RADIOLIB_LR11X0_IRQ_GNSS_ABORT) {
|
||||
return(RADIOLIB_ERR_RX_TIMEOUT);
|
||||
}
|
||||
|
||||
// retrieve the demodulator status
|
||||
uint8_t info = 0;
|
||||
state = this->gnssReadDemodStatus(&res->demodStat, &info);
|
||||
RADIOLIB_ASSERT(state);
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Demod status %d, info %02x", (int)res->demodStat, (unsigned int)info);
|
||||
|
||||
// retrieve the number of detected satellites
|
||||
state = this->gnssGetNbSvDetected(&res->numSatsDet);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// retrieve the result size
|
||||
state = this->gnssGetResultSize(&res->resSize);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check and return demodulator status
|
||||
if(res->demodStat < RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_TOW_FOUND) {
|
||||
return(RADIOLIB_ERR_GNSS_DEMOD(res->demodStat));
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::getGnssAlmanacStatus(LR11x0GnssAlmanacStatus_t *stat) {
|
||||
RADIOLIB_ASSERT_PTR(stat);
|
||||
|
||||
// save the time the time until subframe is relative to
|
||||
stat->start = this->mod->hal->millis();
|
||||
|
||||
// get the raw data
|
||||
uint8_t raw[53] = { 0 };
|
||||
int16_t state = this->gnssReadAlmanacStatus(raw);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// parse the reply
|
||||
stat->gps.status = (int8_t)raw[0];
|
||||
stat->gps.timeUntilSubframe = ((uint32_t)(raw[1]) << 24) | ((uint32_t)(raw[2]) << 16) | ((uint32_t)(raw[3]) << 8) | (uint32_t)raw[4];
|
||||
stat->gps.numSubframes = raw[5];
|
||||
stat->gps.nextSubframe4SvId = raw[6];
|
||||
stat->gps.nextSubframe5SvId = raw[7];
|
||||
stat->gps.nextSubframeStart = raw[8];
|
||||
stat->gps.numUpdateNeeded = raw[9];
|
||||
stat->gps.flagsUpdateNeeded[0] = ((uint32_t)(raw[10]) << 24) | ((uint32_t)(raw[11]) << 16) | ((uint32_t)(raw[12]) << 8) | (uint32_t)raw[13];
|
||||
stat->gps.flagsActive[0] = ((uint32_t)(raw[14]) << 24) | ((uint32_t)(raw[15]) << 16) | ((uint32_t)(raw[16]) << 8) | (uint32_t)raw[17];
|
||||
stat->beidou.status = (int8_t)raw[18];
|
||||
stat->beidou.timeUntilSubframe = ((uint32_t)(raw[19]) << 24) | ((uint32_t)(raw[20]) << 16) | ((uint32_t)(raw[21]) << 8) | (uint32_t)raw[22];
|
||||
stat->beidou.numSubframes = raw[23];
|
||||
stat->beidou.nextSubframe4SvId = raw[24];
|
||||
stat->beidou.nextSubframe5SvId = raw[25];
|
||||
stat->beidou.nextSubframeStart = raw[26];
|
||||
stat->beidou.numUpdateNeeded = raw[27];
|
||||
stat->beidou.flagsUpdateNeeded[0] = ((uint32_t)(raw[28]) << 24) | ((uint32_t)(raw[29]) << 16) | ((uint32_t)(raw[30]) << 8) | (uint32_t)raw[31];
|
||||
stat->beidou.flagsUpdateNeeded[1] = ((uint32_t)(raw[32]) << 24) | ((uint32_t)(raw[33]) << 16) | ((uint32_t)(raw[34]) << 8) | (uint32_t)raw[35];
|
||||
stat->beidou.flagsActive[0] = ((uint32_t)(raw[36]) << 24) | ((uint32_t)(raw[37]) << 16) | ((uint32_t)(raw[38]) << 8) | (uint32_t)raw[39];
|
||||
stat->beidou.flagsActive[1] = ((uint32_t)(raw[40]) << 24) | ((uint32_t)(raw[41]) << 16) | ((uint32_t)(raw[42]) << 8) | (uint32_t)raw[43];
|
||||
stat->beidouSvNoAlmanacFlags[0] = ((uint32_t)(raw[44]) << 24) | ((uint32_t)(raw[45]) << 16) | ((uint32_t)(raw[46]) << 8) | (uint32_t)raw[47];
|
||||
stat->beidouSvNoAlmanacFlags[1] = ((uint32_t)(raw[18]) << 24) | ((uint32_t)(raw[49]) << 16) | ((uint32_t)(raw[50]) << 8) | (uint32_t)raw[51];
|
||||
stat->nextAlmanacId = raw[52];
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::gnssDelayUntilSubframe(LR11x0GnssAlmanacStatus_t *stat, uint8_t constellation) {
|
||||
RADIOLIB_ASSERT_PTR(stat);
|
||||
|
||||
// almanac update has to be called at least 1.3 seconds before the subframe
|
||||
// we use 2.3 seconds to be on the safe side
|
||||
|
||||
// calculate absolute times
|
||||
RadioLibTime_t window = stat->start + stat->gps.timeUntilSubframe - 2300;
|
||||
if(constellation == RADIOLIB_LR11X0_GNSS_CONSTELLATION_BEIDOU) {
|
||||
window = stat->start + stat->beidou.timeUntilSubframe - 2300;
|
||||
}
|
||||
RadioLibTime_t now = this->mod->hal->millis();
|
||||
if(now > window) {
|
||||
// we missed the window
|
||||
return(RADIOLIB_ERR_GNSS_SUBFRAME_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
RadioLibTime_t delay = window - now;
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Time until subframe %lu ms", delay);
|
||||
this->mod->hal->delay(delay);
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
// TODO fix last satellite always out of date
|
||||
int16_t LR11x0::updateGnssAlmanac(uint8_t constellation) {
|
||||
int16_t state = this->setDioIrqParams(RADIOLIB_LR11X0_IRQ_GNSS_DONE | RADIOLIB_LR11X0_IRQ_GNSS_ABORT);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = this->gnssAlmanacUpdateFromSat(RADIOLIB_LR11X0_GNSS_EFFORT_MID, constellation);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// wait for scan finished or timeout, assumes 2 subframes and up to 2.3s pre-roll
|
||||
uint32_t softTimeout = 16UL * 1000UL;
|
||||
uint32_t start = this->mod->hal->millis();
|
||||
while (!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
if(this->mod->hal->millis() - start > softTimeout) {
|
||||
this->gnssAbort();
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Timeout waiting for almanac update");
|
||||
}
|
||||
}
|
||||
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GPS almanac update done in %lu ms", (long unsigned int)(this->mod->hal->millis() - start));
|
||||
|
||||
// distinguish between GNSS-done and GNSS-abort outcomes and clear the flags
|
||||
uint32_t irq = this->getIrqStatus();
|
||||
this->clearIrq(RADIOLIB_LR11X0_IRQ_ALL);
|
||||
if(irq & RADIOLIB_LR11X0_IRQ_GNSS_ABORT) {
|
||||
state = RADIOLIB_ERR_RX_TIMEOUT;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::getGnssPosition(LR11x0GnssPosition_t* pos, bool filtered) {
|
||||
RADIOLIB_ASSERT_PTR(pos);
|
||||
|
||||
uint8_t error = 0;
|
||||
int16_t state;
|
||||
if(filtered) {
|
||||
state = this->gnssReadDopplerSolverRes(&error, &pos->numSatsUsed, NULL, NULL, NULL, NULL, &pos->latitude, &pos->longitude, &pos->accuracy, NULL);
|
||||
} else {
|
||||
state = this->gnssReadDopplerSolverRes(&error, &pos->numSatsUsed, &pos->latitude, &pos->longitude, &pos->accuracy, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the solver error
|
||||
if(error != 0) {
|
||||
return(RADIOLIB_ERR_GNSS_SOLVER(error));
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::getGnssSatellites(LR11x0GnssSatellite_t* sats, uint8_t numSats) {
|
||||
RADIOLIB_ASSERT_PTR(sats);
|
||||
if(numSats >= 32) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
|
||||
uint8_t svId[32] = { 0 };
|
||||
uint8_t snr[32] = { 0 };
|
||||
int16_t doppler[32] = { 0 };
|
||||
int16_t state = this->gnssGetSvDetected(svId, snr, doppler, numSats);
|
||||
RADIOLIB_ASSERT(state);
|
||||
for(size_t i = 0; i < numSats; i++) {
|
||||
sats[i].svId = svId[i];
|
||||
sats[i].c_n0 = snr[i] + 31;
|
||||
sats[i].doppler = doppler[i];
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR11x0::getModem(ModemType_t* modem) {
|
||||
RADIOLIB_ASSERT_PTR(modem);
|
||||
|
||||
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);
|
||||
@@ -1777,7 +2138,9 @@ bool LR11x0::findChip(uint8_t ver) {
|
||||
// read the version
|
||||
LR11x0VersionInfo_t info;
|
||||
int16_t state = getVersionInfo(&info);
|
||||
if((state == RADIOLIB_ERR_NONE) && (info.device == ver)) {
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
if(info.device == ver) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Found LR11x0: RADIOLIB_LR11X0_CMD_GET_VERSION = 0x%02x", info.device);
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Base FW version: %d.%d", (int)info.fwMajor, (int)info.fwMinor);
|
||||
if(this->chipType != RADIOLIB_LR11X0_DEVICE_LR1121) {
|
||||
@@ -2061,10 +2424,10 @@ int16_t LR11x0::setRegMode(uint8_t mode) {
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_REG_MODE, true, &mode, 1));
|
||||
}
|
||||
|
||||
int16_t LR11x0::calibImage(float freq1, float freq2) {
|
||||
int16_t LR11x0::calibrateImageRejection(float freqMin, float freqMax) {
|
||||
uint8_t buff[2] = {
|
||||
(uint8_t)floor((freq1 - 1.0f) / 4.0f),
|
||||
(uint8_t)ceil((freq2 + 1.0f) / 4.0f)
|
||||
(uint8_t)floor((freqMin - 1.0f) / 4.0f),
|
||||
(uint8_t)ceil((freqMax + 1.0f) / 4.0f)
|
||||
};
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_CALIB_IMAGE, true, buff, sizeof(buff)));
|
||||
}
|
||||
@@ -2083,7 +2446,7 @@ int16_t LR11x0::setDioIrqParams(uint32_t irq1, uint32_t irq2) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::setDioIrqParams(uint32_t irq) {
|
||||
return(setDioIrqParams(irq, irq));
|
||||
return(setDioIrqParams(irq, 0));
|
||||
}
|
||||
|
||||
int16_t LR11x0::clearIrq(uint32_t irq) {
|
||||
@@ -2126,7 +2489,8 @@ int16_t LR11x0::getTemp(float* temp) {
|
||||
// pass the replies
|
||||
if(temp) {
|
||||
uint16_t raw = ((uint16_t)(buff[0]) << 8) | (uint16_t)buff[1];
|
||||
*temp = 25.0f - (1000.0f/1.7f)*(((float)raw/2047.0f)*1350.0f - 0.7295f);
|
||||
raw = raw & 0x07FF; //According LR1121 datasheet we need [0..10] bits
|
||||
*temp = 25.0f - (1000.0f/1.7f)*(((float)raw/2047.0f)*1.35f - 0.7295f); //According LR1121 datasheet 1.35
|
||||
}
|
||||
|
||||
return(state);
|
||||
@@ -2225,23 +2589,17 @@ int16_t LR11x0::readInfoPage(uint16_t addr, uint32_t* data, size_t len) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::getChipEui(uint8_t* eui) {
|
||||
if(!eui) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(eui);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_GET_CHIP_EUI, false, eui, RADIOLIB_LR11X0_EUI_LEN));
|
||||
}
|
||||
|
||||
int16_t LR11x0::getSemtechJoinEui(uint8_t* eui) {
|
||||
if(!eui) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(eui);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_GET_SEMTECH_JOIN_EUI, false, eui, RADIOLIB_LR11X0_EUI_LEN));
|
||||
}
|
||||
|
||||
int16_t LR11x0::deriveRootKeysAndGetPin(uint8_t* pin) {
|
||||
if(!pin) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(pin);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_DERIVE_ROOT_KEYS_AND_GET_PIN, false, pin, RADIOLIB_LR11X0_PIN_LEN));
|
||||
}
|
||||
|
||||
@@ -2337,9 +2695,7 @@ int16_t LR11x0::getRssiInst(float* rssi) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::setGfskSyncWord(uint8_t* sync) {
|
||||
if(!sync) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(sync);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_GFSK_SYNC_WORD, true, sync, RADIOLIB_LR11X0_GFSK_SYNC_WORD_LEN));
|
||||
}
|
||||
|
||||
@@ -2392,7 +2748,19 @@ int16_t LR11x0::setPacketType(uint8_t type) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::setModulationParamsLoRa(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro) {
|
||||
uint8_t buff[4] = { sf, bw, cr, ldro };
|
||||
// calculate symbol length and enable low data rate optimization, if auto-configuration is enabled
|
||||
if(this->ldroAuto) {
|
||||
float symbolLength = (float)(uint32_t(1) << this->spreadingFactor) / (float)this->bandwidthKhz;
|
||||
if(symbolLength >= 16.0) {
|
||||
this->ldrOptimize = RADIOLIB_LR11X0_LORA_LDRO_ENABLED;
|
||||
} else {
|
||||
this->ldrOptimize = RADIOLIB_LR11X0_LORA_LDRO_DISABLED;
|
||||
}
|
||||
} else {
|
||||
this->ldrOptimize = ldro;
|
||||
}
|
||||
|
||||
uint8_t buff[4] = { sf, bw, cr, this->ldrOptimize };
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_MODULATION_PARAMS, true, buff, sizeof(buff)));
|
||||
}
|
||||
|
||||
@@ -2976,9 +3344,7 @@ int16_t LR11x0::gnssGetResultSize(uint16_t* size) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::gnssReadResults(uint8_t* result, uint16_t size) {
|
||||
if(!result) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(result);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_GNSS_READ_RESULTS, false, result, size));
|
||||
}
|
||||
|
||||
@@ -3262,10 +3628,20 @@ int16_t LR11x0::gnssWriteBitMaskSatActivated(uint8_t bitMask, uint32_t* bitMaskA
|
||||
return(state);
|
||||
}
|
||||
|
||||
void LR11x0::gnssAbort() {
|
||||
// send the abort signal (single NOP)
|
||||
this->mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_8;
|
||||
// we need to call the most basic overload of the SPI write method otherwise the call will be ambiguous
|
||||
uint8_t cmd[2] = { 0, 0 };
|
||||
this->mod->SPIwriteStream(cmd, 2, NULL, 0, false, false);
|
||||
this->mod->spiConfig.widths[RADIOLIB_MODULE_SPI_WIDTH_CMD] = Module::BITS_16;
|
||||
|
||||
// wait for at least 2.9 seconds as specified by the user manual
|
||||
this->mod->hal->delay(3000);
|
||||
}
|
||||
|
||||
int16_t LR11x0::cryptoSetKey(uint8_t keyId, uint8_t* key) {
|
||||
if(!key) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(key);
|
||||
uint8_t buff[1 + RADIOLIB_AES128_KEY_SIZE] = { 0 };
|
||||
buff[0] = keyId;
|
||||
memcpy(&buff[1], key, RADIOLIB_AES128_KEY_SIZE);
|
||||
@@ -3273,9 +3649,7 @@ int16_t LR11x0::cryptoSetKey(uint8_t keyId, uint8_t* key) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::cryptoDeriveKey(uint8_t srcKeyId, uint8_t dstKeyId, uint8_t* key) {
|
||||
if(!key) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(key);
|
||||
uint8_t buff[2 + RADIOLIB_AES128_KEY_SIZE] = { 0 };
|
||||
buff[0] = srcKeyId;
|
||||
buff[1] = dstKeyId;
|
||||
@@ -3322,11 +3696,17 @@ int16_t LR11x0::cryptoProcessJoinAccept(uint8_t decKeyId, uint8_t verKeyId, uint
|
||||
// check the crypto engine state
|
||||
if(rplBuff[0] != RADIOLIB_LR11X0_CRYPTO_STATUS_SUCCESS) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("Crypto Engine error: %02x", rplBuff[0]);
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] rplBuff;
|
||||
#endif
|
||||
return(RADIOLIB_ERR_SPI_CMD_FAILED);
|
||||
}
|
||||
|
||||
// pass the data
|
||||
memcpy(dataOut, &rplBuff[1], len);
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] rplBuff;
|
||||
#endif
|
||||
return(state);
|
||||
}
|
||||
|
||||
@@ -3467,23 +3847,17 @@ int16_t LR11x0::bootReboot(bool stay) {
|
||||
}
|
||||
|
||||
int16_t LR11x0::bootGetPin(uint8_t* pin) {
|
||||
if(!pin) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(pin);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_BOOT_GET_PIN, false, pin, RADIOLIB_LR11X0_PIN_LEN));
|
||||
}
|
||||
|
||||
int16_t LR11x0::bootGetChipEui(uint8_t* eui) {
|
||||
if(!eui) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(eui);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_BOOT_GET_CHIP_EUI, false, eui, RADIOLIB_LR11X0_EUI_LEN));
|
||||
}
|
||||
|
||||
int16_t LR11x0::bootGetJoinEui(uint8_t* eui) {
|
||||
if(!eui) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
RADIOLIB_ASSERT_PTR(eui);
|
||||
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_BOOT_GET_JOIN_EUI, false, eui, RADIOLIB_LR11X0_EUI_LEN));
|
||||
}
|
||||
|
||||
@@ -3557,6 +3931,9 @@ int16_t LR11x0::cryptoCommon(uint16_t cmd, uint8_t keyId, uint8_t* dataIn, size_
|
||||
|
||||
// pass the data
|
||||
memcpy(dataOut, &rplBuff[1], len);
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] rplBuff;
|
||||
#endif
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@
|
||||
#define RADIOLIB_LR11X0_CALIBRATE_HF_RC (0x01UL << 1) // 1 1 high frequency RC
|
||||
#define RADIOLIB_LR11X0_CALIBRATE_LF_RC (0x01UL << 0) // 0 0 low frequency RC
|
||||
#define RADIOLIB_LR11X0_CALIBRATE_ALL (0x3FUL << 0) // 5 0 everything
|
||||
#define RADIOLIB_LR11X0_CAL_IMG_FREQ_TRIG_MHZ (20.0)
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_SET_REG_MODE
|
||||
#define RADIOLIB_LR11X0_REG_MODE_LDO (0x00UL << 0) // 0 0 regulator mode: LDO in all modes
|
||||
@@ -249,11 +250,13 @@
|
||||
#define RADIOLIB_LR11X0_RFSW_DIO8_DISABLED (0x00UL << 3) // 4 0 DIO8 disabled (default)
|
||||
#define RADIOLIB_LR11X0_RFSW_DIO10_ENABLED (0x01UL << 4) // 4 0 RF switch: DIO10 enabled
|
||||
#define RADIOLIB_LR11X0_RFSW_DIO10_DISABLED (0x00UL << 4) // 4 0 DIO10 disabled (default)
|
||||
#define RADIOLIB_LR11X0_DIO5 (0)
|
||||
#define RADIOLIB_LR11X0_DIO6 (1)
|
||||
#define RADIOLIB_LR11X0_DIO7 (2)
|
||||
#define RADIOLIB_LR11X0_DIO8 (3)
|
||||
#define RADIOLIB_LR11X0_DIO10 (4)
|
||||
#define RADIOLIB_LR11X0_DIOx(X) ((X) | RFSWITCH_PIN_FLAG)
|
||||
#define RADIOLIB_LR11X0_DIOx_VAL(X) ((X) & ~RFSWITCH_PIN_FLAG)
|
||||
#define RADIOLIB_LR11X0_DIO5 (RADIOLIB_LR11X0_DIOx(0))
|
||||
#define RADIOLIB_LR11X0_DIO6 (RADIOLIB_LR11X0_DIOx(1))
|
||||
#define RADIOLIB_LR11X0_DIO7 (RADIOLIB_LR11X0_DIOx(2))
|
||||
#define RADIOLIB_LR11X0_DIO8 (RADIOLIB_LR11X0_DIOx(3))
|
||||
#define RADIOLIB_LR11X0_DIO10 (RADIOLIB_LR11X0_DIOx(4))
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS
|
||||
#define RADIOLIB_LR11X0_IRQ_TX_DONE (0x01UL << 2) // 31 0 interrupt: packet transmitted
|
||||
@@ -274,7 +277,8 @@
|
||||
#define RADIOLIB_LR11X0_IRQ_FSK_LEN_ERROR (0x01UL << 24) // 31 0 FSK packet received with length error
|
||||
#define RADIOLIB_LR11X0_IRQ_FSK_ADDR_ERROR (0x01UL << 25) // 31 0 FSK packet received with address error
|
||||
#define RADIOLIB_LR11X0_IRQ_LORA_RX_TIMESTAMP (0x01UL << 27) // 31 0 last LoRa symbol was received (timestamp source)
|
||||
#define RADIOLIB_LR11X0_IRQ_ALL (0x0BF80FFCUL) // 31 0 all interrupts
|
||||
#define RADIOLIB_LR11X0_IRQ_GNSS_ABORT (0x01UL << 28) // 31 0 GNSS scan aborted
|
||||
#define RADIOLIB_LR11X0_IRQ_ALL (0x1BF80FFCUL) // 31 0 all interrupts
|
||||
#define RADIOLIB_LR11X0_IRQ_NONE (0x00UL << 0) // 31 0 no interrupts
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_CONFIG_LF_LOCK
|
||||
@@ -364,6 +368,9 @@
|
||||
#define RADIOLIB_LR11X0_LORA_BW_125_0 (0x04UL << 0) // 7 0 125.0 kHz
|
||||
#define RADIOLIB_LR11X0_LORA_BW_250_0 (0x05UL << 0) // 7 0 250.0 kHz
|
||||
#define RADIOLIB_LR11X0_LORA_BW_500_0 (0x06UL << 0) // 7 0 500.0 kHz
|
||||
#define RADIOLIB_LR11X0_LORA_BW_203_125 (0x0DUL << 0) // 7 0 203.0 kHz (2.4GHz only)
|
||||
#define RADIOLIB_LR11X0_LORA_BW_406_25 (0x0EUL << 0) // 7 0 406.0 kHz (2.4GHz only)
|
||||
#define RADIOLIB_LR11X0_LORA_BW_812_50 (0x0FUL << 0) // 7 0 812.0 kHz (2.4GHz only)
|
||||
#define RADIOLIB_LR11X0_LORA_CR_4_5_SHORT (0x01UL << 0) // 7 0 coding rate: 4/5 with short interleaver
|
||||
#define RADIOLIB_LR11X0_LORA_CR_4_6_SHORT (0x02UL << 0) // 7 0 4/6 with short interleaver
|
||||
#define RADIOLIB_LR11X0_LORA_CR_4_7_SHORT (0x03UL << 0) // 7 0 4/7 with short interleaver
|
||||
@@ -549,7 +556,7 @@
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_FLASH (0x03UL << 0) // 7 4 flash integrity error
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_ERR_ALMANAC_UPD (0x04UL << 0) // 7 4 almanac update not allowed
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_250_HZ (0x00UL << 0) // 8 7 frequency search space: 250 Hz
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_500_HZ (0x01UL << 0) // 8 7 500 H
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_500_HZ (0x01UL << 0) // 8 7 500 Hz
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_1000_HZ (0x02UL << 0) // 8 7 1000 Hz
|
||||
#define RADIOLIB_LR11X0_GNSS_CONTEXT_FREQ_SPACE_2000_HZ (0x03UL << 0) // 8 7 2000 Hz
|
||||
|
||||
@@ -561,6 +568,65 @@
|
||||
#define RADIOLIB_LR11X0_GNSS_ALMANAC_HEADER_ID (0x80UL << 0) // 7 0 starting byte of GNSS almanac header
|
||||
#define RADIOLIB_LR11X0_GNSS_ALMANAC_BLOCK_SIZE (20)
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_GNSS_FETCH_TIME
|
||||
#define RADIOLIB_LR11X0_GNSS_EFFORT_LOW (0x00UL << 0) // 7 0 GNSS effort mode: low sensitivity
|
||||
#define RADIOLIB_LR11X0_GNSS_EFFORT_MID (0x01UL << 0) // 7 0 medium sensitivity
|
||||
#define RADIOLIB_LR11X0_GNSS_FETCH_TIME_OPT_TOW (0x00UL << 0) // 7 0 time fetch options: ToW only, requires WN to demodulated beforehand
|
||||
#define RADIOLIB_LR11X0_GNSS_FETCH_TIME_OPT_TOW_WN (0x01UL << 0) // 7 0 ToW and WN
|
||||
#define RADIOLIB_LR11X0_GNSS_FETCH_TIME_OPT_TOW_WN_ROLL (0x02UL << 0) // 7 0 ToW, WN and rollover
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_GNSS_READ_DEMOD_STATUS
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NOT_POSSIBLE (-21) // 7 0 GNSS demodulation status: not possible to demodulate
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_SAT_LOST (-20) // 7 0 satellite lost
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_ALMANAC_DEMOD_ERROR (-19) // 7 0 almanac demodulation error
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_TOO_LATE (-18) // 7 0 woke up after preamble (demodulation started too late)
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_20_MS_FAIL (-17) // 7 0 20ms real-time clock failed
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WAKE_UP_FAIL (-16) // 7 0 wake up sync failed
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WN_INVALID (-15) // 7 0 week number not validated
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NO_ACTIVE_SAT (-14) // 7 0 no active satellite selected in satellite list
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_SLEEP_TOO_LONG (-13) // 7 0 sleep time too long
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_TOW_INVALID (-12) // 7 0 wrong time-of-week demodulated
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_PREAMBLE_INVALID (-11) // 7 0 preamble not validated
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_DISABLED (-10) // 7 0 demodulator disabled
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_EXTR_FAILED (-9) // 7 0 demodulator extraction failed
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NO_BIT_CHANGE (-8) // 7 0 no bit change found during demodulation start
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NO_BIT_CHANGE_ADV (-7) // 7 0 no bit change found during advanced scan
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NO_SAT_FOUND (-6) // 7 0 no satellites found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_SYNC_LOST (-5) // 7 0 word sync lost
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_PARITY_NOT_ENOUGH (-3) // 7 0 parity check fail (not enough)
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_PARITY_TOO_MANY (-2) // 7 0 parity check fail (too many)
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_NO_PARITY (-1) // 7 0 parity check fail (no parity found)
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WORD_SYNC_NONE (0) // 7 0 word sync search not started
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WORD_SYNC_POT (1) // 7 0 potential word sync found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WORD_SYNC_OK (2) // 7 0 word sync found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_TOW_FOUND (3) // 7 0 time-of-week found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_WN_FOUND (4) // 7 0 week number and time-of-week found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_ALM_FOUND_UNSAVED (5) // 7 0 almanac found but not saved
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_HALF_ALM_SAVED (6) // 7 0 half of almanac found and saved
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_FULL_ALM_SAVED (7) // 7 0 full almanac found and saved
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_WORD_SYNC_FOUND (0x01UL << 0) // 7 0 GNSS demodulation info: word synchronization found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_TOW_FOUND (0x01UL << 1) // 7 0 time-of-week found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_WN_DEMODED (0x01UL << 2) // 7 0 week number demodulated
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_WN_FOUND (0x01UL << 3) // 7 0 week number found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_SUBFRAME_1_FOUND (0x01UL << 4) // 7 0 subframe 1 found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_SUBFRAME_4_FOUND (0x01UL << 5) // 7 0 subframe 4 found
|
||||
#define RADIOLIB_LR11X0_GNSS_DEMOD_INFO_SUBFRAME_5_FOUND (0x01UL << 6) // 7 0 subframe 5 found
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_GNSS_READ_ALMANAC_STATUS
|
||||
#define RADIOLIB_LR11X0_GNSS_ALMANAC_STATUS_UP_TO_DATE (0) // 7 0 GPS/BeiDou almanac status: all satellites up-to-date
|
||||
#define RADIOLIB_LR11X0_GNSS_ALMANAC_STATUS_OUTDATED (1) // 7 0 at least one satellite needs update
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_GNSS_READ_DOPPLER_SOLVER_RES
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_NONE (0) // 7 0 internal 2D solver error: no error
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_RES_HIGH (1) // 7 0 residue too high
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_NOT_CONVERGED (2) // 7 0 not converged on solution
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_NOT_ENOUGH_SV (3) // 7 0 not enough satellites
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_ILL_MATRIX (4) // 7 0 matrix error (?)
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_TIME (5) // 7 0 time error
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_ALM_PART_OLD (6) // 7 0 part of almanac too old or not available
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_INCONSISTENT (7) // 7 0 not consistent with history (?)
|
||||
#define RADIOLIB_LR11X0_GNSS_SOLVER_ERR_ALM_OLD (8) // 7 0 all of almanac too old
|
||||
|
||||
// RADIOLIB_LR11X0_CMD_CRYPTO_SET_KEY
|
||||
#define RADIOLIB_LR11X0_CRYPTO_STATUS_SUCCESS (0x00UL << 0) // 7 0 crypto engine status: success
|
||||
#define RADIOLIB_LR11X0_CRYPTO_STATUS_FAIL_CMAC (0x01UL << 0) // 7 0 MIC check failed
|
||||
@@ -714,8 +780,90 @@ struct LR11x0VersionInfo_t {
|
||||
uint8_t almanacGNSS;
|
||||
};
|
||||
|
||||
/*!
|
||||
\struct LR11x0GnssResult_t
|
||||
\brief Structure to report information results of a GNSS scan.
|
||||
*/
|
||||
struct LR11x0GnssResult_t {
|
||||
/*! \brief Demodulator status. One of RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_* */
|
||||
int8_t demodStat;
|
||||
|
||||
/*! \brief Number of satellites detected during the scan. */
|
||||
uint8_t numSatsDet;
|
||||
|
||||
/*! \brief Result size, used when passing data to LoRa cloud. */
|
||||
uint16_t resSize;
|
||||
};
|
||||
|
||||
/*!
|
||||
\struct LR11x0GnssPosition_t
|
||||
\brief Structure to report position from LR11x0 internal solver.
|
||||
*/
|
||||
struct LR11x0GnssPosition_t {
|
||||
/*! \brief Latitude in degrees. */
|
||||
float latitude;
|
||||
|
||||
/*! \brief Longitude in degrees. */
|
||||
float longitude;
|
||||
|
||||
/*! \brief Accuracy of this result. */
|
||||
uint16_t accuracy;
|
||||
|
||||
/*! \brief Number of satellites used to solve this position. */
|
||||
uint8_t numSatsUsed;
|
||||
};
|
||||
|
||||
/*!
|
||||
\struct LR11x0GnssSatellite_t
|
||||
\brief Structure to save information about a satellite found during GNSS scan.
|
||||
*/
|
||||
struct LR11x0GnssSatellite_t {
|
||||
/*! \brief Satellite vehicle (SV) identifier. */
|
||||
uint8_t svId;
|
||||
|
||||
/*! \brief C/N0 in dB. */
|
||||
uint8_t c_n0;
|
||||
|
||||
/*! \brief Doppler shift of the signal in Hz. */
|
||||
int16_t doppler;
|
||||
};
|
||||
|
||||
/*!
|
||||
\struct LR11x0GnssAlmanacStatusPart_t
|
||||
\brief Structure to save information about one constellation of the GNSS almanac.
|
||||
*/
|
||||
struct LR11x0GnssAlmanacStatusPart_t {
|
||||
int8_t status;
|
||||
uint32_t timeUntilSubframe;
|
||||
uint8_t numSubframes;
|
||||
uint8_t nextSubframe4SvId;
|
||||
uint8_t nextSubframe5SvId;
|
||||
uint8_t nextSubframeStart;
|
||||
uint8_t numUpdateNeeded;
|
||||
uint32_t flagsUpdateNeeded[2];
|
||||
uint32_t flagsActive[2];
|
||||
};
|
||||
|
||||
/*!
|
||||
\struct LR11x0GnssAlmanacStatus_t
|
||||
\brief Structure to save information about the GNSS almanac.
|
||||
This is not the actual almanac, just some context information about it.
|
||||
*/
|
||||
struct LR11x0GnssAlmanacStatus_t {
|
||||
/*! \brief GPS part of the almanac */
|
||||
LR11x0GnssAlmanacStatusPart_t gps;
|
||||
|
||||
/*! \brief BeiDou part of the almanac */
|
||||
LR11x0GnssAlmanacStatusPart_t beidou;
|
||||
|
||||
/*! \brief Extra flags present for BeiDou only */
|
||||
uint32_t beidouSvNoAlmanacFlags[2];
|
||||
|
||||
/*! \brief Next almanac ID */
|
||||
uint8_t nextAlmanacId;
|
||||
|
||||
/*! \brief Timestamp of when almanac status was retrieved - timeUntilSubframe is relative to this value. */
|
||||
RadioLibTime_t start;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -773,9 +921,10 @@ class LR11x0: public PhysicalLayer {
|
||||
\param syncWord 1-byte LoRa sync word.
|
||||
\param preambleLength LoRa preamble length in symbols
|
||||
\param tcxoVoltage TCXO reference voltage to be set.
|
||||
\param high defaults to false for Sub-GHz band, true for frequencies above 1GHz
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage);
|
||||
int16_t begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool high = false);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for FSK modem.
|
||||
@@ -792,10 +941,19 @@ class LR11x0: public PhysicalLayer {
|
||||
\brief Initialization method for LR-FHSS modem.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing.
|
||||
\param tcxoVoltage TCXO reference voltage to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(uint8_t bw, uint8_t cr, float tcxoVoltage);
|
||||
int16_t beginLRFHSS(uint8_t bw, uint8_t cr, bool narrowGrid, float tcxoVoltage);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for GNSS scanning.
|
||||
\param constellations GNSS constellations to use (GPS, BeiDou or both). Defaults to both.
|
||||
\param tcxoVoltage TCXO reference voltage to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginGNSS(uint8_t constellations = RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS | RADIOLIB_LR11X0_GNSS_CONSTELLATION_BEIDOU, float tcxoVoltage = 1.6);
|
||||
|
||||
/*!
|
||||
\brief Reset method. Will reset the chip to the default state using RST pin.
|
||||
@@ -993,11 +1151,12 @@ class LR11x0: public PhysicalLayer {
|
||||
// configuration methods
|
||||
|
||||
/*!
|
||||
\brief Sets LoRa bandwidth. Allowed values are 62.5, 125.0, 250.0 and 500.0 kHz.
|
||||
\brief Sets LoRa bandwidth. Allowed values are 62.5, 125.0, 250.0 and 500.0 kHz. (default, high = false)
|
||||
\param bw LoRa bandwidth to be set in kHz.
|
||||
\param high if set to true, allowed bandwidth is 203.125, 406.25 and 812.5 kHz, frequency must be above 1GHz
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setBandwidth(float bw);
|
||||
int16_t setBandwidth(float bw, bool high = false);
|
||||
|
||||
/*!
|
||||
\brief Sets LoRa spreading factor. Allowed values range from 5 to 12.
|
||||
@@ -1283,6 +1442,21 @@ class LR11x0: public PhysicalLayer {
|
||||
/*! \copydoc Module::setRfSwitchTable */
|
||||
void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
|
||||
|
||||
/*!
|
||||
\brief Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method, LDRO will always be set to
|
||||
the provided value, regardless of symbol length. To re-enable automatic LDRO configuration, call LR11x0::autoLDRO()
|
||||
\param enable Force LDRO to be always enabled (true) or disabled (false).
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t forceLDRO(bool enable);
|
||||
|
||||
/*!
|
||||
\brief Re-enables automatic LDRO configuration. Only available in LoRa mode. After calling this method, LDRO will be enabled automatically
|
||||
when symbol length exceeds 16 ms.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t autoLDRO();
|
||||
|
||||
/*!
|
||||
\brief Sets LR-FHSS configuration.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values.
|
||||
@@ -1375,6 +1549,79 @@ class LR11x0: public PhysicalLayer {
|
||||
*/
|
||||
int16_t updateFirmware(const uint32_t* image, size_t size, bool nonvolatile = true);
|
||||
|
||||
/*!
|
||||
\brief Method to check whether the device is capable of performing a GNSS scan.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t isGnssScanCapable();
|
||||
|
||||
/*!
|
||||
\brief Performs GNSS scan.
|
||||
\param res Pointer to LR11x0GnssPosition_t structure to populate.
|
||||
Will not be saved if set to NULL, defaults to NULL.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t gnssScan(LR11x0GnssResult_t* res = NULL);
|
||||
|
||||
/*!
|
||||
\brief Read information about the almanac.
|
||||
\param stat Pointer to structure to save the almanac status into.
|
||||
This is not the actual almanac, just a structure providing information about it.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getGnssAlmanacStatus(LR11x0GnssAlmanacStatus_t *stat);
|
||||
|
||||
/*!
|
||||
\brief Blocking wait until the next subframe with almanac data is available.
|
||||
Used to control timing during almanac update from satellite.
|
||||
\param stat Pointer to structure containing the almanac status read by getGnssAlmanacStatus.
|
||||
This is not the actual almanac, just a structure providing information about it.
|
||||
\param constellation Constellation to wait for, one of RADIOLIB_LR11X0_GNSS_CONSTELLATION_*.
|
||||
Constellations cannot be updated at the same time, but rather must be updated sequentially!
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t gnssDelayUntilSubframe(LR11x0GnssAlmanacStatus_t *stat, uint8_t constellation);
|
||||
|
||||
/*!
|
||||
\brief Perform almanac update. Must be called immediately after gnssDelayUntilSubframe.
|
||||
\param constellation Constellation to update, one of RADIOLIB_LR11X0_GNSS_CONSTELLATION_*.
|
||||
Constellations cannot be updated at the same time, but rather must be updated sequentially!
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t updateGnssAlmanac(uint8_t constellation);
|
||||
|
||||
/*!
|
||||
\brief Get GNSS position. Called after gnssScan to retrieve the position calculated by the internal solver.
|
||||
\param pos Pointer to LR11x0GnssPosition_t structure to populate.
|
||||
\param filtered Whether to save the filtered, or unfiltered values. Defaults to true (filtered).
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getGnssPosition(LR11x0GnssPosition_t* pos, bool filtered = true);
|
||||
|
||||
/*!
|
||||
\brief Get GNSS satellites found during the last scan.
|
||||
\param sats Pointer to array of LR11x0GnssSatellite_t structures to populate.
|
||||
\param numSats Number of satellites to read. Can be retrieved from LR11x0GnssResult_t passed to gnssScan.
|
||||
\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;
|
||||
|
||||
/*!
|
||||
\brief Perform image rejection calibration for the specified frequency band.
|
||||
WARNING: Use at your own risk! Setting incorrect values may lead to decreased performance
|
||||
\param freqMin Frequency band lower bound.
|
||||
\param freqMax Frequency band upper bound.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t calibrateImageRejection(float freqMin, float freqMax);
|
||||
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
@@ -1394,7 +1641,6 @@ class LR11x0: public PhysicalLayer {
|
||||
int16_t clearErrors(void);
|
||||
int16_t calibrate(uint8_t params);
|
||||
int16_t setRegMode(uint8_t mode);
|
||||
int16_t calibImage(float freq1, float freq2);
|
||||
int16_t setDioAsRfSwitch(uint8_t en, uint8_t stbyCfg, uint8_t rxCfg, uint8_t txCfg, uint8_t txHpCfg, uint8_t txHfCfg, uint8_t gnssCfg, uint8_t wifiCfg);
|
||||
int16_t setDioIrqParams(uint32_t irq1, uint32_t irq2);
|
||||
int16_t setDioIrqParams(uint32_t irq);
|
||||
@@ -1525,6 +1771,7 @@ class LR11x0: public PhysicalLayer {
|
||||
int16_t gnssReadWarmStartStatus(uint8_t bitMask, uint8_t* nbVisSat, uint32_t* timeElapsed);
|
||||
int16_t gnssGetSvSync(uint8_t mask, uint8_t nbSv, uint8_t* syncList);
|
||||
int16_t gnssWriteBitMaskSatActivated(uint8_t bitMask, uint32_t* bitMaskActivated0, uint32_t* bitMaskActivated1);
|
||||
void gnssAbort();
|
||||
|
||||
int16_t cryptoSetKey(uint8_t keyId, uint8_t* key);
|
||||
int16_t cryptoDeriveKey(uint8_t srcKeyId, uint8_t dstKeyId, uint8_t* key);
|
||||
@@ -1554,6 +1801,7 @@ class LR11x0: public PhysicalLayer {
|
||||
protected:
|
||||
#endif
|
||||
uint8_t chipType = 0;
|
||||
float freqMHz = 0;
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
@@ -1574,7 +1822,7 @@ class LR11x0: public PhysicalLayer {
|
||||
uint16_t preambleLengthGFSK = 0;
|
||||
|
||||
// cached LR-FHSS parameters
|
||||
uint8_t lrFhssCr = 0, lrFhssBw = 0, lrFhssHdrCount = 0;
|
||||
uint8_t lrFhssCr = 0, lrFhssBw = 0, lrFhssHdrCount = 0, lrFhssGrid = 0;
|
||||
uint16_t lrFhssHopSeq = 0;
|
||||
|
||||
float dataRateMeasured = 0;
|
||||
|
||||
Reference in New Issue
Block a user