Update RadioLib
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
#include "LR1110.h"
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
LR1110::LR1110(Module* mod) : LR11x0(mod) {
|
||||
chipType = RADIOLIB_LR11X0_DEVICE_LR1110;
|
||||
}
|
||||
|
||||
int16_t LR1110::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);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginGFSK(br, freqDev, rxBw, preambleLength, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::setFrequency(float freq) {
|
||||
return(this->setFrequency(freq, true));
|
||||
}
|
||||
|
||||
int16_t LR1110::setFrequency(float freq, bool calibrate, 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);
|
||||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
// set frequency
|
||||
return(LR11x0::setRfFrequency((uint32_t)(freq*1000000.0f)));
|
||||
}
|
||||
|
||||
int16_t LR1110::setOutputPower(int8_t power) {
|
||||
return(this->setOutputPower(power, false));
|
||||
}
|
||||
|
||||
int16_t LR1110::setOutputPower(int8_t power, bool forceHighPower) {
|
||||
// check if power value is configurable
|
||||
int16_t state = this->checkOutputPower(power, NULL, forceHighPower);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// determine whether to use HP or LP PA and check range accordingly
|
||||
bool useHp = forceHighPower || (power > 14);
|
||||
|
||||
// TODO how and when to configure OCP?
|
||||
|
||||
// update PA config - always use VBAT for high-power PA
|
||||
state = setPaConfig((uint8_t)useHp, (uint8_t)useHp, 0x04, 0x07);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set output power
|
||||
state = setTxParams(power, RADIOLIB_LR11X0_PA_RAMP_48U);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::checkOutputPower(int8_t power, int8_t* clipped) {
|
||||
return(checkOutputPower(power, clipped, false));
|
||||
}
|
||||
|
||||
int16_t LR1110::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower) {
|
||||
if(forceHighPower || (power > 14)) {
|
||||
if(clipped) {
|
||||
*clipped = RADIOLIB_MAX(-9, RADIOLIB_MIN(22, power));
|
||||
}
|
||||
RADIOLIB_CHECK_RANGE(power, -9, 22, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||
|
||||
} else {
|
||||
if(clipped) {
|
||||
*clipped = RADIOLIB_MAX(-17, RADIOLIB_MIN(14, power));
|
||||
}
|
||||
RADIOLIB_CHECK_RANGE(power, -17, 14, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||
|
||||
}
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,133 @@
|
||||
#if !defined(_RADIOLIB_LR1110_H)
|
||||
#define _RADIOLIB_LR1110_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "LR11x0.h"
|
||||
|
||||
/*!
|
||||
\class LR1110
|
||||
\brief Derived class for %LR1110 modules.
|
||||
*/
|
||||
class LR1110: public LR11x0 {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
LR1110(Module* mod); // cppcheck-suppress noExplicitConstructor
|
||||
|
||||
// basic methods
|
||||
|
||||
/*!
|
||||
\brief Initialization method for LoRa modem.
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz.
|
||||
\param sf LoRa spreading factor. Defaults to 9.
|
||||
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
|
||||
\param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE (0x12).
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols.
|
||||
\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 begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for FSK modem.
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param br FSK bit rate in kbps. Defaults to 4.8 kbps.
|
||||
\param freqDev Frequency deviation from carrier frequency in kHz. Defaults to 5.0 kHz.
|
||||
\param rxBw Receiver bandwidth in kHz. Defaults to 156.2 kHz.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param preambleLength FSK preamble length in bits. Defaults to 16 bits.
|
||||
\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 beginGFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for LR-FHSS modem.
|
||||
\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 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);
|
||||
|
||||
// configuration methods
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz.
|
||||
Will also perform calibrations.
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFrequency(float freq) override;
|
||||
|
||||
/*!
|
||||
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz.
|
||||
\param freq Carrier frequency to be set in MHz.
|
||||
\param calibrate Run 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);
|
||||
|
||||
/*!
|
||||
\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).
|
||||
\param power Output power to be set in dBm, output PA is determined automatically preferring the low-power PA.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setOutputPower(int8_t power) override;
|
||||
|
||||
/*!
|
||||
\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).
|
||||
\param power Output power to be set in dBm.
|
||||
\param forceHighPower Force using the high-power PA. If set to false, PA will be determined automatically
|
||||
based on configured output power, preferring the low-power PA. If set to true, only high-power PA will be used.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setOutputPower(int8_t power, bool forceHighPower);
|
||||
|
||||
/*!
|
||||
\brief Check if output power is configurable.
|
||||
This method is needed for compatibility with PhysicalLayer::checkOutputPower.
|
||||
\param power Output power in dBm, PA will be determined automatically.
|
||||
\param clipped Clipped output power value to what is possible within the module's range.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
|
||||
|
||||
/*!
|
||||
\brief Check if output power is configurable.
|
||||
\param power Output power in dBm.
|
||||
\param clipped Clipped output power value to what is possible within the module's range.
|
||||
\param forceHighPower Force using the high-power PA. If set to false, PA will be determined automatically
|
||||
based on configured output power, preferring the low-power PA. If set to true, only high-power PA will be used.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,131 @@
|
||||
#include "LR1120.h"
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
LR1120::LR1120(Module* mod) : LR11x0(mod) {
|
||||
chipType = RADIOLIB_LR11X0_DEVICE_LR1120;
|
||||
}
|
||||
|
||||
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);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginGFSK(br, freqDev, rxBw, preambleLength, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setFrequency(freq);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
state = setOutputPower(power);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::setFrequency(float freq) {
|
||||
return(this->setFrequency(freq, true));
|
||||
}
|
||||
|
||||
int16_t LR1120::setFrequency(float freq, bool calibrate, 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
|
||||
int16_t state;
|
||||
if(calibrate) {
|
||||
state = LR11x0::calibImage(freq - band, freq + band);
|
||||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
// set frequency
|
||||
state = LR11x0::setRfFrequency((uint32_t)(freq*1000000.0f));
|
||||
RADIOLIB_ASSERT(state);
|
||||
this->highFreq = (freq > 1000.0);
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR1120::setOutputPower(int8_t power) {
|
||||
return(this->setOutputPower(power, false));
|
||||
}
|
||||
|
||||
int16_t LR1120::setOutputPower(int8_t power, bool forceHighPower) {
|
||||
// check if power value is configurable
|
||||
int16_t state = this->checkOutputPower(power, NULL, forceHighPower);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// determine whether to use HP or LP PA and check range accordingly
|
||||
uint8_t paSel = 0;
|
||||
uint8_t paSupply = 0;
|
||||
if(this->highFreq) {
|
||||
paSel = 2;
|
||||
} else if(forceHighPower || (power > 14)) {
|
||||
paSel = 1;
|
||||
paSupply = 1;
|
||||
}
|
||||
|
||||
// TODO how and when to configure OCP?
|
||||
|
||||
// update PA config - always use VBAT for high-power PA
|
||||
state = setPaConfig(paSel, paSupply, 0x04, 0x07);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set output power
|
||||
state = setTxParams(power, RADIOLIB_LR11X0_PA_RAMP_48U);
|
||||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::checkOutputPower(int8_t power, int8_t* clipped) {
|
||||
return(checkOutputPower(power, clipped, false));
|
||||
}
|
||||
|
||||
int16_t LR1120::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower) {
|
||||
if(this->highFreq) {
|
||||
if(clipped) {
|
||||
*clipped = RADIOLIB_MAX(-18, RADIOLIB_MIN(13, power));
|
||||
}
|
||||
RADIOLIB_CHECK_RANGE(power, -18, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
if(forceHighPower || (power > 14)) {
|
||||
if(clipped) {
|
||||
*clipped = RADIOLIB_MAX(-9, RADIOLIB_MIN(22, power));
|
||||
}
|
||||
RADIOLIB_CHECK_RANGE(power, -9, 22, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||
|
||||
} else {
|
||||
if(clipped) {
|
||||
*clipped = RADIOLIB_MAX(-17, RADIOLIB_MIN(14, power));
|
||||
}
|
||||
RADIOLIB_CHECK_RANGE(power, -17, 14, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
|
||||
|
||||
}
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
#if !defined(_RADIOLIB_LR1120_H)
|
||||
#define _RADIOLIB_LR1120_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "LR11x0.h"
|
||||
|
||||
/*!
|
||||
\class LR1120
|
||||
\brief Derived class for %LR1120 modules.
|
||||
*/
|
||||
class LR1120: public LR11x0 {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
LR1120(Module* mod); // cppcheck-suppress noExplicitConstructor
|
||||
|
||||
// basic methods
|
||||
|
||||
/*!
|
||||
\brief Initialization method for LoRa modem.
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz.
|
||||
\param sf LoRa spreading factor. Defaults to 9.
|
||||
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
|
||||
\param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE (0x12).
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols.
|
||||
\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 begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for FSK modem.
|
||||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param br FSK bit rate in kbps. Defaults to 4.8 kbps.
|
||||
\param freqDev Frequency deviation from carrier frequency in kHz. Defaults to 5.0 kHz.
|
||||
\param rxBw Receiver bandwidth in kHz. Defaults to 156.2 kHz.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param preambleLength FSK preamble length in bits. Defaults to 16 bits.
|
||||
\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 beginGFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6);
|
||||
|
||||
/*!
|
||||
\brief Initialization method for LR-FHSS modem.
|
||||
\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 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);
|
||||
|
||||
// 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.
|
||||
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.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFrequency(float freq) override;
|
||||
|
||||
/*!
|
||||
\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.
|
||||
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 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);
|
||||
|
||||
/*!
|
||||
\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).
|
||||
\param power Output power to be set in dBm, output PA is determined automatically preferring the low-power PA.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setOutputPower(int8_t power) override;
|
||||
|
||||
/*!
|
||||
\brief Sets output power. Allowed values are in range from -9 to 22 dBm (high-power PA), -17 to 14 dBm (low-power PA)
|
||||
or -18 to 13 dBm (high-frequency PA).
|
||||
\param power Output power to be set in dBm.
|
||||
\param forceHighPower Force using the high-power PA in sub-GHz bands, or high-frequency PA in 2.4 GHz band.
|
||||
If set to false, PA will be determined automatically based on configured output power and frequency,
|
||||
preferring the low-power PA but always using high-frequency PA in 2.4 GHz band.
|
||||
Ignored when operating in 2.4 GHz band.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setOutputPower(int8_t power, bool forceHighPower);
|
||||
|
||||
/*!
|
||||
\brief Check if output power is configurable.
|
||||
This method is needed for compatibility with PhysicalLayer::checkOutputPower.
|
||||
\param power Output power in dBm, PA will be determined automatically.
|
||||
\param clipped Clipped output power value to what is possible within the module's range.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
|
||||
|
||||
/*!
|
||||
\brief Check if output power is configurable.
|
||||
\param power Output power in dBm.
|
||||
\param clipped Clipped output power value to what is possible within the module's range.
|
||||
\param forceHighPower Force using the high-power PA. If set to false, PA will be determined automatically
|
||||
based on configured output power, preferring the low-power PA. If set to true, only high-power PA will be used.
|
||||
Ignored when operating in 2.4 GHz band.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
// flag to determine whether we are in the sub-GHz or 2.4 GHz range
|
||||
// this is needed to automatically detect which PA to use
|
||||
bool highFreq = false;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "LR1121.h"
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
LR1121::LR1121(Module* mod) : LR1120(mod) {
|
||||
chipType = RADIOLIB_LR11X0_DEVICE_LR1121;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#if !defined(_RADIOLIB_LR1121_H)
|
||||
#define _RADIOLIB_LR1121_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_LR11X0
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "LR11x0.h"
|
||||
#include "LR1120.h"
|
||||
|
||||
/*!
|
||||
\class LR1121
|
||||
\brief Derived class for %LR1121 modules.
|
||||
*/
|
||||
class LR1121: public LR1120 {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
#if !defined(_RADIOLIB_LR11X0_FIRMWARE_H)
|
||||
#define _RADIOLIB_LR11X0_FIRMWARE_H
|
||||
|
||||
#if defined(RADIOLIB_LR1110_FIRMWARE_IN_RAM)
|
||||
#define RADIOLIB_LR1110_FIRMWARE_ATTR
|
||||
#else
|
||||
#define RADIOLIB_LR1110_FIRMWARE_ATTR RADIOLIB_NONVOLATILE
|
||||
#endif
|
||||
|
||||
#define RADIOLIB_LR11X0_FIRMWARE_IMAGE_SIZE LR11XX_FIRMWARE_IMAGE_SIZE
|
||||
|
||||
#if defined(RADIOLIB_LR1110_FIRMWARE_0303)
|
||||
#include "firmware/lr1110_transceiver_0303.h"
|
||||
#elif defined(RADIOLIB_LR1110_FIRMWARE_0304)
|
||||
#include "firmware/lr1110_transceiver_0304.h"
|
||||
#elif defined(RADIOLIB_LR1110_FIRMWARE_0305)
|
||||
#include "firmware/lr1110_transceiver_0305.h"
|
||||
#elif defined(RADIOLIB_LR1110_FIRMWARE_0306)
|
||||
#include "firmware/lr1110_transceiver_0306.h"
|
||||
#elif defined(RADIOLIB_LR1110_FIRMWARE_0307)
|
||||
#include "firmware/lr1110_transceiver_0307.h"
|
||||
#elif defined(RADIOLIB_LR1110_FIRMWARE_0401)
|
||||
#include "firmware/lr1110_transceiver_0401.h"
|
||||
#elif defined(RADIOLIB_LR1120_FIRMWARE_0101)
|
||||
#include "firmware/lr1120_transceiver_0101.h"
|
||||
#elif defined(RADIOLIB_LR1120_FIRMWARE_0102)
|
||||
#include "firmware/lr1120_transceiver_0102.h"
|
||||
#elif defined(RADIOLIB_LR1120_FIRMWARE_0201)
|
||||
#include "firmware/lr1120_transceiver_0201.h"
|
||||
#elif defined(RADIOLIB_LR1121_FIRMWARE_0102)
|
||||
#include "firmware/lr1121_transceiver_0102.h"
|
||||
#elif defined(RADIOLIB_LR1121_FIRMWARE_0103)
|
||||
#include "firmware/lr1121_transceiver_0103.h"
|
||||
#else
|
||||
#error "No LR11x0 firmware image selected!"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user