[SX126x] General reformatting

This commit is contained in:
jgromes 2023-04-23 19:06:45 +02:00
parent cab358ff09
commit a015e541f6
12 changed files with 707 additions and 915 deletions

View file

@ -2,7 +2,7 @@
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !defined(RADIOLIB_EXCLUDE_SX126X)
LLCC68::LLCC68(Module* mod) : SX1262(mod) { LLCC68::LLCC68(Module* mod) : SX1262(mod) {
_chipType = RADIOLIB_LLCC68_CHIP_TYPE; chipType = RADIOLIB_LLCC68_CHIP_TYPE;
} }
int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { int16_t LLCC68::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {
@ -35,7 +35,7 @@ int16_t LLCC68::setBandwidth(float bw) {
} }
int16_t LLCC68::setSpreadingFactor(uint8_t sf) { int16_t LLCC68::setSpreadingFactor(uint8_t sf) {
switch(SX126x::_bw) { switch(SX126x::bandwidth) {
case RADIOLIB_SX126X_LORA_BW_125_0: case RADIOLIB_SX126X_LORA_BW_125_0:
RADIOLIB_CHECK_RANGE(sf, 5, 9, RADIOLIB_ERR_INVALID_SPREADING_FACTOR); RADIOLIB_CHECK_RANGE(sf, 5, 9, RADIOLIB_ERR_INVALID_SPREADING_FACTOR);
break; break;

View file

@ -13,39 +13,27 @@
/*! /*!
\class LLCC68 \class LLCC68
\brief Derived class for %LLCC68 modules. \brief Derived class for %LLCC68 modules.
*/ */
class LLCC68: public SX1262 { class LLCC68: public SX1262 {
public: public:
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio. \param mod Instance of Module that will be used to communicate with the radio.
*/ */
LLCC68(Module* mod); LLCC68(Module* mod);
/*! /*!
\brief Initialization method for LoRa modem. \brief Initialization method for LoRa modem.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz. \param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz. \param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz.
\param sf LoRa spreading factor. Defaults to 9. \param sf LoRa spreading factor. Defaults to 9.
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7). \param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
\param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12). \param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12).
\param power Output power in dBm. Defaults to 10 dBm. \param power Output power in dBm. Defaults to 10 dBm.
\param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols. \param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \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_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
@ -54,18 +42,14 @@ class LLCC68: public SX1262 {
/*! /*!
\brief Sets LoRa bandwidth. Allowed values are 125.0, 250.0 and 500.0 kHz. \brief Sets LoRa bandwidth. Allowed values are 125.0, 250.0 and 500.0 kHz.
\param bw LoRa bandwidth to be set in kHz. \param bw LoRa bandwidth to be set in kHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setBandwidth(float bw); int16_t setBandwidth(float bw);
/*! /*!
\brief Sets LoRa spreading factor. Allowed values range from 5 to 11, depending on currently set spreading factor. \brief Sets LoRa spreading factor. Allowed values range from 5 to 11, depending on currently set spreading factor.
\param sf LoRa spreading factor to be set. \param sf LoRa spreading factor to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);

View file

@ -1,5 +1,4 @@
/* /*
Copyright (c) 2018 Jan Gromeš Copyright (c) 2018 Jan Gromeš
Copyright (c) 2022 STMicroelectronics Copyright (c) 2022 STMicroelectronics
@ -9,8 +8,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
#include "STM32WLx.h" #include "STM32WLx.h"
#if !defined(RADIOLIB_EXCLUDE_STM32WLX) #if !defined(RADIOLIB_EXCLUDE_STM32WLX)
STM32WLx::STM32WLx(STM32WLx_Module* mod) : SX1262(mod) { STM32WLx::STM32WLx(STM32WLx_Module* mod) : SX1262(mod) { }
}
int16_t STM32WLx::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { int16_t STM32WLx::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {
// Execute common part // Execute common part
@ -47,18 +45,18 @@ int16_t STM32WLx::setOutputPower(int8_t power) {
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// Use HP only if available and needed for the requested power // Use HP only if available and needed for the requested power
bool hp_supported = _mod->findRfSwitchMode(MODE_TX_HP); bool hp_supported = this->mod->findRfSwitchMode(MODE_TX_HP);
bool use_hp = power > 14 && hp_supported; bool use_hp = power > 14 && hp_supported;
// set PA config. // set PA config.
if(use_hp) { if(use_hp) {
RADIOLIB_CHECK_RANGE(power, -9, 22, RADIOLIB_ERR_INVALID_OUTPUT_POWER); RADIOLIB_CHECK_RANGE(power, -9, 22, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
state = SX126x::setPaConfig(0x04, 0x00, 0x07); // HP output up to 22dBm state = SX126x::setPaConfig(0x04, 0x00, 0x07); // HP output up to 22dBm
_tx_mode = MODE_TX_HP; this->txMode = MODE_TX_HP;
} else { } else {
RADIOLIB_CHECK_RANGE(power, -17, 14, RADIOLIB_ERR_INVALID_OUTPUT_POWER); RADIOLIB_CHECK_RANGE(power, -17, 14, RADIOLIB_ERR_INVALID_OUTPUT_POWER);
state = SX126x::setPaConfig(0x04, 0x01, 0x00); // LP output up to 14dBm state = SX126x::setPaConfig(0x04, 0x01, 0x00); // LP output up to 14dBm
_tx_mode = MODE_TX_LP; this->txMode = MODE_TX_LP;
} }
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);

View file

@ -1,5 +1,4 @@
/* /*
Copyright (c) 2018 Jan Gromeš Copyright (c) 2018 Jan Gromeš
Copyright (c) 2022 STMicroelectronics Copyright (c) 2022 STMicroelectronics
@ -38,17 +37,16 @@ class STM32WLx : public SX1262 {
public: public:
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of STM32WLx_Module that will be used to communicate with the radio. \param mod Instance of STM32WLx_Module that will be used to communicate with the radio.
*/ */
STM32WLx(STM32WLx_Module* mod); STM32WLx(STM32WLx_Module* mod);
/*! /*!
* \brief Custom operation modes for STMWLx. \brief Custom operation modes for STMWLx.
*
* This splits the TX mode into two modes: Low-power and high-power. This splits the TX mode into two modes: Low-power and high-power.
* These constants can be used with the setRfSwitchTable() method, These constants can be used with the setRfSwitchTable() method,
* instead of the Module::OpMode_t constants. instead of the Module::OpMode_t constants.
*/ */
enum OpMode_t { enum OpMode_t {
/*! End of table marker, use \ref END_OF_MODE_TABLE constant instead */ /*! End of table marker, use \ref END_OF_MODE_TABLE constant instead */
@ -112,7 +110,6 @@ class STM32WLx : public SX1262 {
/*! /*!
\brief Sets interrupt service routine to call when DIO1/2/3 activates. \brief Sets interrupt service routine to call when DIO1/2/3 activates.
\param func ISR to call. \param func ISR to call.
*/ */
void setDio1Action(void (*func)(void)); void setDio1Action(void (*func)(void));

View file

@ -2,7 +2,7 @@
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !defined(RADIOLIB_EXCLUDE_SX126X)
SX1261::SX1261(Module* mod): SX1262(mod) { SX1261::SX1261(Module* mod): SX1262(mod) {
_chipType = RADIOLIB_SX1261_CHIP_TYPE; chipType = RADIOLIB_SX1261_CHIP_TYPE;
} }
int16_t SX1261::setOutputPower(int8_t power) { int16_t SX1261::setOutputPower(int8_t power) {

View file

@ -17,23 +17,19 @@
/*! /*!
\class SX1261 \class SX1261
\brief Derived class for %SX1261 modules. \brief Derived class for %SX1261 modules.
*/ */
class SX1261 : public SX1262 { class SX1261 : public SX1262 {
public: public:
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio. \param mod Instance of Module that will be used to communicate with the radio.
*/ */
SX1261(Module* mod); SX1261(Module* mod);
/*! /*!
\brief Sets output power. Allowed values are in range from -17 to 14 dBm. \brief Sets output power. Allowed values are in range from -17 to 14 dBm.
\param power Output power to be set in dBm. \param power Output power to be set in dBm.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);

View file

@ -2,7 +2,7 @@
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !defined(RADIOLIB_EXCLUDE_SX126X)
SX1262::SX1262(Module* mod) : SX126x(mod) { SX1262::SX1262(Module* mod) : SX126x(mod) {
_chipType = RADIOLIB_SX1262_CHIP_TYPE; chipType = RADIOLIB_SX1262_CHIP_TYPE;
} }
int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {

View file

@ -17,14 +17,12 @@
/*! /*!
\class SX1262 \class SX1262
\brief Derived class for %SX1262 modules. \brief Derived class for %SX1262 modules.
*/ */
class SX1262: public SX126x { class SX1262: public SX126x {
public: public:
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio. \param mod Instance of Module that will be used to communicate with the radio.
*/ */
SX1262(Module* mod); SX1262(Module* mod);
@ -33,72 +31,46 @@ class SX1262: public SX126x {
/*! /*!
\brief Initialization method for LoRa modem. \brief Initialization method for LoRa modem.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz. \param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz. \param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz.
\param sf LoRa spreading factor. Defaults to 9. \param sf LoRa spreading factor. Defaults to 9.
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7). \param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
\param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12). \param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12).
\param power Output power in dBm. Defaults to 10 dBm. \param power Output power in dBm. Defaults to 10 dBm.
\param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols. \param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \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_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
/*! /*!
\brief Initialization method for FSK modem. \brief Initialization method for FSK modem.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz. \param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param br FSK bit rate in kbps. Defaults to 4.8 kbps. \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 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 rxBw Receiver bandwidth in kHz. Defaults to 156.2 kHz.
\param power Output power in dBm. Defaults to 10 dBm. \param power Output power in dBm. Defaults to 10 dBm.
\param preambleLength FSK preamble length in bits. Defaults to 16 bits. \param preambleLength FSK preamble length in bits. Defaults to 16 bits.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t beginFSK(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, bool useRegulatorLDO = false); int16_t beginFSK(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, bool useRegulatorLDO = false);
int16_t beginLRFHSS(float freq = 434.0, float tcxoVoltage = 0, bool useRegulatorLDO = false);
// configuration methods // configuration methods
/*! /*!
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz. \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 freq Carrier frequency to be set in MHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
/*! /*!
\brief Sets carrier frequency. Allowed values are in range from 150.0 to 960.0 MHz. \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 freq Carrier frequency to be set in MHz.
\param calibrate Run image calibration. \param calibrate Run image calibration.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq, bool calibrate); int16_t setFrequency(float freq, bool calibrate);
@ -106,9 +78,7 @@ class SX1262: public SX126x {
/*! /*!
\brief Sets output power. Allowed values are in range from -9 to 22 dBm. \brief Sets output power. Allowed values are in range from -9 to 22 dBm.
This method is virtual to allow override from the SX1261 class. This method is virtual to allow override from the SX1261 class.
\param power Output power to be set in dBm. \param power Output power to be set in dBm.
\returns \ref status_codes \returns \ref status_codes
*/ */
virtual int16_t setOutputPower(int8_t power); virtual int16_t setOutputPower(int8_t power);

View file

@ -2,7 +2,7 @@
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !defined(RADIOLIB_EXCLUDE_SX126X)
SX1268::SX1268(Module* mod) : SX126x(mod) { SX1268::SX1268(Module* mod) : SX126x(mod) {
_chipType = RADIOLIB_SX1268_CHIP_TYPE; chipType = RADIOLIB_SX1268_CHIP_TYPE;
} }
int16_t SX1268::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) { int16_t SX1268::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO) {

View file

@ -16,14 +16,12 @@
/*! /*!
\class SX1268 \class SX1268
\brief Derived class for %SX1268 modules. \brief Derived class for %SX1268 modules.
*/ */
class SX1268: public SX126x { class SX1268: public SX126x {
public: public:
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio. \param mod Instance of Module that will be used to communicate with the radio.
*/ */
SX1268(Module* mod); SX1268(Module* mod);
@ -32,48 +30,29 @@ class SX1268: public SX126x {
/*! /*!
\brief Initialization method for LoRa modem. \brief Initialization method for LoRa modem.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz. \param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz. \param bw LoRa bandwidth in kHz. Defaults to 125.0 kHz.
\param sf LoRa spreading factor. Defaults to 9. \param sf LoRa spreading factor. Defaults to 9.
\param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7). \param cr LoRa coding rate denominator. Defaults to 7 (coding rate 4/7).
\param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12). \param syncWord 1-byte LoRa sync word. Defaults to RADIOLIB_SX126X_SYNC_WORD_PRIVATE (0x12).
\param power Output power in dBm. Defaults to 10 dBm. \param power Output power in dBm. Defaults to 10 dBm.
\param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols. \param preambleLength LoRa preamble length in symbols. Defaults to 8 symbols.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \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_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false); int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
/*! /*!
\brief Initialization method for FSK modem. \brief Initialization method for FSK modem.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz. \param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param br FSK bit rate in kbps. Defaults to 4.8 kbps. \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 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 rxBw Receiver bandwidth in kHz. Defaults to 156.2 kHz.
\param power Output power in dBm. Defaults to 10 dBm. \param power Output power in dBm. Defaults to 10 dBm.
\param preambleLength FSK preamble length in bits. Defaults to 16 bits. \param preambleLength FSK preamble length in bits. Defaults to 16 bits.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t beginFSK(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, bool useRegulatorLDO = false); int16_t beginFSK(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, bool useRegulatorLDO = false);
@ -82,29 +61,22 @@ class SX1268: public SX126x {
/*! /*!
\brief Sets carrier frequency. Allowed values are in range from 410.0 to 810.0 MHz. \brief Sets carrier frequency. Allowed values are in range from 410.0 to 810.0 MHz.
\param freq Carrier frequency to be set in MHz. \param freq Carrier frequency to be set in MHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
/*! /*!
\brief Sets carrier frequency. Allowed values are in range from 410.0 to 810.0 MHz. \brief Sets carrier frequency. Allowed values are in range from 410.0 to 810.0 MHz.
\param freq Carrier frequency to be set in MHz. \param freq Carrier frequency to be set in MHz.
\param calibrate Run image calibration. \param calibrate Run image calibration.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq, bool calibrate); int16_t setFrequency(float freq, bool calibrate);
/*! /*!
\brief Sets output power. Allowed values are in range from -9 to 22 dBm. \brief Sets output power. Allowed values are in range from -9 to 22 dBm.
\param power Output power to be set in dBm. \param power Output power to be set in dBm.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);

File diff suppressed because it is too large Load diff

View file

@ -437,7 +437,6 @@
/*! /*!
\class SX126x \class SX126x
\brief Base class for %SX126x series. All derived classes for %SX126x (e.g. SX1262 or SX1268) inherit from this base class. \brief Base class for %SX126x series. All derived classes for %SX126x (e.g. SX1262 or SX1268) inherit from this base class.
This class should not be instantiated directly from Arduino sketch, only from its derived classes. This class should not be instantiated directly from Arduino sketch, only from its derived classes.
*/ */
@ -451,7 +450,6 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Default constructor. \brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio. \param mod Instance of Module that will be used to communicate with the radio.
*/ */
SX126x(Module* mod); SX126x(Module* mod);
@ -467,46 +465,32 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Initialization method for LoRa modem. \brief Initialization method for LoRa modem.
\param cr LoRa coding rate denominator. Allowed values range from 5 to 8. \param cr LoRa coding rate denominator. Allowed values range from 5 to 8.
\param syncWord 1-byte LoRa sync word. \param syncWord 1-byte LoRa sync word.
\param preambleLength LoRa preamble length in symbols. Allowed values range from 1 to 65535. \param preambleLength LoRa preamble length in symbols. Allowed values range from 1 to 65535.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); int16_t begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
/*! /*!
\brief Initialization method for FSK modem. \brief Initialization method for FSK modem.
\param br FSK bit rate in kbps. Allowed values range from 0.6 to 300.0 kbps. \param br FSK bit rate in kbps. Allowed values range from 0.6 to 300.0 kbps.
\param freqDev Frequency deviation from carrier frequency in kHz. Allowed values range from 0.0 to 200.0 kHz. \param freqDev Frequency deviation from carrier frequency in kHz. Allowed values range from 0.0 to 200.0 kHz.
\param rxBw Receiver bandwidth in kHz. Allowed values are 4.8, 5.8, 7.3, 9.7, 11.7, 14.6, 19.5, 23.4, 29.3, 39.0,
\param rxBw Receiver bandwidth in kHz. Allowed values are 4.8, 5.8, 7.3, 9.7, 11.7, 14.6, 19.5, 23.4, 29.3, 39.0, 46.9, 58.6, 78.2, 93.8, 117.3, 156.2, 187.2, 234.3, 312.0, 373.6 and 467.0 kHz. 46.9, 58.6, 78.2, 93.8, 117.3, 156.2, 187.2, 234.3, 312.0, 373.6 and 467.0 kHz.
\param preambleLength FSK preamble length in bits. Allowed values range from 0 to 65535. \param preambleLength FSK preamble length in bits. Allowed values range from 0 to 65535.
\param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip. \param tcxoVoltage TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip.
\param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false. \param useRegulatorLDO Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t beginFSK(float br, float freqDev, float rxBw, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false); int16_t beginFSK(float br, float freqDev, float rxBw, uint16_t preambleLength, float tcxoVoltage, bool useRegulatorLDO = false);
/*! /*!
\brief Reset method. Will reset the chip to the default state using RST pin. \brief Reset method. Will reset the chip to the default state using RST pin.
\param verify Whether correct module startup should be verified. When set to true, RadioLib will attempt to verify the module has started correctly \param verify Whether correct module startup should be verified. When set to true, RadioLib will attempt to verify the module has started correctly
by repeatedly issuing setStandby command. Enabled by default. by repeatedly issuing setStandby command. Enabled by default.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t reset(bool verify = true); int16_t reset(bool verify = true);
@ -514,13 +498,9 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Blocking binary transmit method. \brief Blocking binary transmit method.
Overloads for string-based transmissions are implemented in PhysicalLayer. Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent. \param data Binary data to be sent.
\param len Number of bytes to send. \param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
@ -528,20 +508,15 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Blocking binary receive method. \brief Blocking binary receive method.
Overloads for string-based transmissions are implemented in PhysicalLayer. Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent. \param data Binary data to be sent.
\param len Number of bytes to send. \param len Number of bytes to send.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t receive(uint8_t* data, size_t len) override; int16_t receive(uint8_t* data, size_t len) override;
/*! /*!
\brief Starts direct mode transmission. \brief Starts direct mode transmission.
\param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY. \param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t transmitDirect(uint32_t frf = 0) override; int16_t transmitDirect(uint32_t frf = 0) override;
@ -549,45 +524,37 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Starts direct mode reception. Only implemented for PhysicalLayer compatibility, as %SX126x series does not support direct mode reception. \brief Starts direct mode reception. Only implemented for PhysicalLayer compatibility, as %SX126x series does not support direct mode reception.
Will always return RADIOLIB_ERR_UNKNOWN. Will always return RADIOLIB_ERR_UNKNOWN.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t receiveDirect() override; int16_t receiveDirect() override;
/*! /*!
\brief Performs scan for LoRa transmission in the current channel. Detects both preamble and payload. \brief Performs scan for LoRa transmission in the current channel. Detects both preamble and payload.
\param symbolNum Number of symbols for CAD detection. Defaults to the value recommended by AN1200.48. \param symbolNum Number of symbols for CAD detection. Defaults to the value recommended by AN1200.48.
\param detPeak Peak value for CAD detection. Defaults to the value recommended by AN1200.48. \param detPeak Peak value for CAD detection. Defaults to the value recommended by AN1200.48.
\param detMin Minimum value for CAD detection. Defaults to the value recommended by AN1200.48. \param detMin Minimum value for CAD detection. Defaults to the value recommended by AN1200.48.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t scanChannel(uint8_t symbolNum = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT); int16_t scanChannel(uint8_t symbolNum = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT);
/*! /*!
\brief Sets the module to sleep mode. \brief Sets the module to sleep mode.
\param retainConfig Set to true to retain configuration of the currently active modem ("warm start")
\param retainConfig Set to true to retain configuration of the currently active modem ("warm start") or to false to discard current configuration ("cold start"). Defaults to true. or to false to discard current configuration ("cold start"). Defaults to true.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t sleep(bool retainConfig = true); int16_t sleep(bool retainConfig = true);
/*! /*!
\brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator). \brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t standby() override; int16_t standby() override;
/*! /*!
\brief Sets the module to standby mode. \brief Sets the module to standby mode.
\param mode Oscillator to be used in standby mode. Can be set to RADIOLIB_SX126X_STANDBY_RC (13 MHz RC oscillator)
\param mode Oscillator to be used in standby mode. Can be set to RADIOLIB_SX126X_STANDBY_RC (13 MHz RC oscillator) or RADIOLIB_SX126X_STANDBY_XOSC (32 MHz external crystal oscillator). or RADIOLIB_SX126X_STANDBY_XOSC (32 MHz external crystal oscillator).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t standby(uint8_t mode); int16_t standby(uint8_t mode);
@ -596,7 +563,6 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Sets interrupt service routine to call when DIO1 activates. \brief Sets interrupt service routine to call when DIO1 activates.
\param func ISR to call. \param func ISR to call.
*/ */
void setDio1Action(void (*func)(void)); void setDio1Action(void (*func)(void));
@ -609,110 +575,91 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Interrupt-driven binary transmit method. \brief Interrupt-driven binary transmit method.
Overloads for string-based transmissions are implemented in PhysicalLayer. Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent. \param data Binary data to be sent.
\param len Number of bytes to send. \param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled. \param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override; int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
/*! /*!
\brief Clean up after transmission is done. \brief Clean up after transmission is done.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t finishTransmit() override; int16_t finishTransmit() override;
/*! /*!
\brief Interrupt-driven receive method. DIO1 will be activated when full packet is received. \brief Interrupt-driven receive method. DIO1 will be activated when full packet is received.
\param timeout Receive mode type and/or raw timeout value, expressed as multiples of 15.625 us. \param timeout Receive mode type and/or raw timeout value, expressed as multiples of 15.625 us.
When set to RADIOLIB_SX126X_RX_TIMEOUT_INF, the timeout will be infinite and the device will remain in Rx mode until explicitly commanded to stop (Rx continuous mode). When set to RADIOLIB_SX126X_RX_TIMEOUT_INF, the timeout will be infinite and the device will remain
When set to RADIOLIB_SX126X_RX_TIMEOUT_NONE, there will be no timeout and the device will return to standby when a packet is received (Rx single mode). in Rx mode until explicitly commanded to stop (Rx continuous mode).
For any other value, timeout will be applied and signal will be generated on DIO1 for conditions defined by irqFlags and irqMask. When set to RADIOLIB_SX126X_RX_TIMEOUT_NONE, there will be no timeout and the device will return
to standby when a packet is received (Rx single mode).
For any other value, timeout will be applied and signal will be generated on DIO1 for conditions
defined by irqFlags and irqMask.
\param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT. \param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT.
\param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE. \param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE.
\param len Only for PhysicalLayer compatibility, not used. \param len Only for PhysicalLayer compatibility, not used.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startReceive(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE, size_t len = 0); int16_t startReceive(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE, size_t len = 0);
/*! /*!
\brief Interrupt-driven receive method where the device mostly sleeps and periodically wakes to listen. \brief Interrupt-driven receive method where the device mostly sleeps and periodically wakes to listen.
Note that this function assumes the unit will take 500us + TCXO_delay to change state. See datasheet section 13.1.7, version 1.2. Note that this function assumes the unit will take 500us + TCXO_delay to change state.
See datasheet section 13.1.7, version 1.2.
\param rxPeriod The duration the receiver will be in Rx mode, in microseconds. \param rxPeriod The duration the receiver will be in Rx mode, in microseconds.
\param sleepPeriod The duration the receiver will not be in Rx mode, in microseconds. \param sleepPeriod The duration the receiver will not be in Rx mode, in microseconds.
\param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT. \param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT.
\param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE. \param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startReceiveDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE); int16_t startReceiveDutyCycle(uint32_t rxPeriod, uint32_t sleepPeriod, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
/*! /*!
\brief Calls \ref startReceiveDutyCycle with rxPeriod and sleepPeriod set so the unit shouldn't miss any messages. \brief Calls \ref startReceiveDutyCycle with rxPeriod and sleepPeriod set so the unit shouldn't miss any messages.
\param senderPreambleLength Expected preamble length of the messages to receive. \param senderPreambleLength Expected preamble length of the messages to receive.
If set to zero, the currently configured preamble length will be used. Defaults to zero. If set to zero, the currently configured preamble length will be used. Defaults to zero.
\param minSymbols Parameters will be chosen to ensure that the unit will catch at least this many symbols of any preamble of the specified length. Defaults to 8. \param minSymbols Parameters will be chosen to ensure that the unit will catch at least this many symbols
According to Semtech, receiver requires 8 symbols to reliably latch a preamble. This makes this method redundant when transmitter preamble length is less than 17 (2*minSymbols + 1). of any preamble of the specified length. Defaults to 8.
According to Semtech, receiver requires 8 symbols to reliably latch a preamble.
This makes this method redundant when transmitter preamble length is less than 17 (2*minSymbols + 1).
\param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT. \param irqFlags Sets the IRQ flags, defaults to RADIOLIB_SX126X_IRQ_RX_DEFAULT.
\param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE. \param irqMask Sets the mask of IRQ flags that will trigger DIO1, defaults to RADIOLIB_SX126X_IRQ_RX_DONE.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startReceiveDutyCycleAuto(uint16_t senderPreambleLength = 0, uint16_t minSymbols = 8, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE); int16_t startReceiveDutyCycleAuto(uint16_t senderPreambleLength = 0, uint16_t minSymbols = 8, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
/*! /*!
\brief Reads the current IRQ status. \brief Reads the current IRQ status.
\returns IRQ status bits \returns IRQ status bits
*/ */
uint16_t getIrqStatus(); uint16_t getIrqStatus();
/*! /*!
\brief Reads data received after calling startReceive method. \brief Reads data received after calling startReceive method.
\param data Pointer to array to save the received binary data. \param data Pointer to array to save the received binary data.
\param len Number of bytes that will be read. When set to 0, the packet length will be retreived automatically. \param len Number of bytes that will be read. When set to 0, the packet length will be retreived automatically.
When more bytes than received are requested, only the number of bytes requested will be returned. When more bytes than received are requested, only the number of bytes requested will be returned.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t readData(uint8_t* data, size_t len) override; int16_t readData(uint8_t* data, size_t len) override;
/*! /*!
\brief Interrupt-driven channel activity detection method. DIO0 will be activated when LoRa preamble is detected, or upon timeout. \brief Interrupt-driven channel activity detection method. DIO0 will be activated
when LoRa preamble is detected, or upon timeout.
\param symbolNum Number of symbols for CAD detection. Defaults to the value recommended by AN1200.48. \param symbolNum Number of symbols for CAD detection. Defaults to the value recommended by AN1200.48.
\param detPeak Peak value for CAD detection. Defaults to the value recommended by AN1200.48. \param detPeak Peak value for CAD detection. Defaults to the value recommended by AN1200.48.
\param detMin Minimum value for CAD detection. Defaults to the value recommended by AN1200.48. \param detMin Minimum value for CAD detection. Defaults to the value recommended by AN1200.48.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t startChannelScan(uint8_t symbolNum = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT); int16_t startChannelScan(uint8_t symbolNum = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, uint8_t detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT);
/*! /*!
\brief Read the channel scan result \brief Read the channel scan result
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t getChannelScanResult(); int16_t getChannelScanResult();
@ -721,101 +668,81 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Sets LoRa bandwidth. Allowed values are 7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125.0, 250.0 and 500.0 kHz. \brief Sets LoRa bandwidth. Allowed values are 7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125.0, 250.0 and 500.0 kHz.
\param bw LoRa bandwidth to be set in kHz. \param bw LoRa bandwidth to be set in kHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setBandwidth(float bw); int16_t setBandwidth(float bw);
/*! /*!
\brief Sets LoRa spreading factor. Allowed values range from 5 to 12. \brief Sets LoRa spreading factor. Allowed values range from 5 to 12.
\param sf LoRa spreading factor to be set. \param sf LoRa spreading factor to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);
/*! /*!
\brief Sets LoRa coding rate denominator. Allowed values range from 5 to 8. \brief Sets LoRa coding rate denominator. Allowed values range from 5 to 8.
\param cr LoRa coding rate denominator to be set. \param cr LoRa coding rate denominator to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setCodingRate(uint8_t cr); int16_t setCodingRate(uint8_t cr);
/*! /*!
\brief Sets LoRa sync word. \brief Sets LoRa sync word.
\param syncWord LoRa sync word to be set. \param syncWord LoRa sync word to be set.
\param controlBits Undocumented control bits, required for compatibility purposes. \param controlBits Undocumented control bits, required for compatibility purposes.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44); int16_t setSyncWord(uint8_t syncWord, uint8_t controlBits = 0x44);
/*! /*!
\brief Sets current protection limit. Can be set in 2.5 mA steps. \brief Sets current protection limit. Can be set in 2.5 mA steps.
\param currentLimit current protection limit to be set in mA. Allowed values range from 0 to 140. \param currentLimit current protection limit to be set in mA. Allowed values range from 0 to 140.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setCurrentLimit(float currentLimit); int16_t setCurrentLimit(float currentLimit);
/*! /*!
\brief Reads current protection limit. \brief Reads current protection limit.
\returns Currently configured overcurrent protection limit in mA. \returns Currently configured overcurrent protection limit in mA.
*/ */
float getCurrentLimit(); float getCurrentLimit();
/*! /*!
\brief Sets preamble length for LoRa or FSK modem. Allowed values range from 1 to 65535. \brief Sets preamble length for LoRa or FSK modem. Allowed values range from 1 to 65535.
\param preambleLength Preamble length to be set in symbols (LoRa) or bits (FSK). \param preambleLength Preamble length to be set in symbols (LoRa) or bits (FSK).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setPreambleLength(uint16_t preambleLength); int16_t setPreambleLength(uint16_t preambleLength);
/*! /*!
\brief Sets FSK frequency deviation. Allowed values range from 0.0 to 200.0 kHz. \brief Sets FSK frequency deviation. Allowed values range from 0.0 to 200.0 kHz.
\param freqDev FSK frequency deviation to be set in kHz. \param freqDev FSK frequency deviation to be set in kHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequencyDeviation(float freqDev) override; int16_t setFrequencyDeviation(float freqDev) override;
/*! /*!
\brief Sets FSK bit rate. Allowed values range from 0.6 to 300.0 kbps. \brief Sets FSK bit rate. Allowed values range from 0.6 to 300.0 kbps.
\param br FSK bit rate to be set in kbps. \param br FSK bit rate to be set in kbps.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setBitRate(float br); int16_t setBitRate(float br);
/*! /*!
\brief Sets FSK receiver bandwidth. Allowed values are 4.8, 5.8, 7.3, 9.7, 11.7, 14.6, 19.5, 23.4, 29.3, 39.0, 46.9, 58.6, 78.2, 93.8, 117.3, 156.2, 187.2, 234.3, 312.0, 373.6 and 467.0 kHz. \brief Sets FSK receiver bandwidth. Allowed values are 4.8, 5.8, 7.3, 9.7, 11.7, 14.6, 19.5,
23.4, 29.3, 39.0, 46.9, 58.6, 78.2, 93.8, 117.3, 156.2, 187.2, 234.3, 312.0, 373.6 and 467.0 kHz.
\param FSK receiver bandwidth to be set in kHz. \param rxBw FSK receiver bandwidth to be set in kHz.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setRxBandwidth(float rxBw); int16_t setRxBandwidth(float rxBw);
/*! /*!
\brief Enables or disables Rx Boosted Gain mode as described in SX126x datasheet section 9.6 (SX1261/2 v2.1, SX1268 v1.1) \brief Enables or disables Rx Boosted Gain mode as described in SX126x datasheet
section 9.6 (SX1261/2 v2.1, SX1268 v1.1)
\param rxbgm True for Rx Boosted Gain, false for Rx Power Saving Gain \param rxbgm True for Rx Boosted Gain, false for Rx Power Saving Gain
\param persist True to persist Rx gain setting when waking up from warm-start mode
\param persist True to persist Rx gain setting when waking up from warm-start mode (e.g. when using Rx duty cycle mode) (e.g. when using Rx duty cycle mode).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setRxBoostedGainMode(bool rxbgm, bool persist = true); int16_t setRxBoostedGainMode(bool rxbgm, bool persist = true);
@ -824,124 +751,100 @@ class SX126x: public PhysicalLayer {
\brief Sets time-bandwidth product of Gaussian filter applied for shaping. \brief Sets time-bandwidth product of Gaussian filter applied for shaping.
Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5, RADIOLIB_SHAPING_0_7 or RADIOLIB_SHAPING_1_0. Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5, RADIOLIB_SHAPING_0_7 or RADIOLIB_SHAPING_1_0.
Set to RADIOLIB_SHAPING_NONE to disable data shaping. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
\param sh Time-bandwidth product of Gaussian filter to be set. \param sh Time-bandwidth product of Gaussian filter to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setDataShaping(uint8_t sh) override; int16_t setDataShaping(uint8_t sh) override;
/*! /*!
\brief Sets FSK sync word in the form of array of up to 8 bytes. \brief Sets FSK sync word in the form of array of up to 8 bytes.
\param syncWord FSK sync word to be set. \param syncWord FSK sync word to be set.
\param len FSK sync word length in bytes. \param len FSK sync word length in bytes.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSyncWord(uint8_t* syncWord, uint8_t len); int16_t setSyncWord(uint8_t* syncWord, uint8_t len);
/*! /*!
\brief Sets FSK sync word in the form of array of up to 8 bytes. \brief Sets FSK sync word in the form of array of up to 8 bytes.
\param syncWord FSK sync word to be set. \param syncWord FSK sync word to be set.
\param bitsLen FSK sync word length in bits. If length is not divisible by 8,
\param bitsLen FSK sync word length in bits. If length is not divisible by 8, least significant bits of syncWord will be ignored. least significant bits of syncWord will be ignored.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen); int16_t setSyncBits(uint8_t *syncWord, uint8_t bitsLen);
/*! /*!
\brief Sets node address. Calling this method will also enable address filtering for node address only. \brief Sets node address. Calling this method will also enable address filtering for node address only.
\param nodeAddr Node address to be set. \param nodeAddr Node address to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setNodeAddress(uint8_t nodeAddr); int16_t setNodeAddress(uint8_t nodeAddr);
/*! /*!
\brief Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address. \brief Sets broadcast address. Calling this method will also enable address
filtering for node and broadcast address.
\param broadAddr Node address to be set. \param broadAddr Node address to be set.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setBroadcastAddress(uint8_t broadAddr); int16_t setBroadcastAddress(uint8_t broadAddr);
/*! /*!
\brief Disables address filtering. Calling this method will also erase previously set addresses. \brief Disables address filtering. Calling this method will also erase previously set addresses.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t disableAddressFiltering(); int16_t disableAddressFiltering();
/*! /*!
\brief Sets CRC configuration. \brief Sets CRC configuration.
\param len CRC length in bytes, Allowed values are 1 or 2, set to 0 to disable CRC. \param len CRC length in bytes, Allowed values are 1 or 2, set to 0 to disable CRC.
\param initial Initial CRC value. FSK only. Defaults to 0x1D0F (CCIT CRC). \param initial Initial CRC value. FSK only. Defaults to 0x1D0F (CCIT CRC).
\param polynomial Polynomial for CRC calculation. FSK only. Defaults to 0x1021 (CCIT CRC). \param polynomial Polynomial for CRC calculation. FSK only. Defaults to 0x1021 (CCIT CRC).
\param inverted Invert CRC bytes. FSK only. Defaults to true (CCIT CRC). \param inverted Invert CRC bytes. FSK only. Defaults to true (CCIT CRC).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setCRC(uint8_t len, uint16_t initial = 0x1D0F, uint16_t polynomial = 0x1021, bool inverted = true); int16_t setCRC(uint8_t len, uint16_t initial = 0x1D0F, uint16_t polynomial = 0x1021, bool inverted = true);
/*! /*!
\brief Sets FSK whitening parameters. \brief Sets FSK whitening parameters.
\param enabled True = Whitening enabled \param enabled True = Whitening enabled
\param initial Initial value used for the whitening LFSR in FSK mode. Defaults to 0x0100,
\param initial Initial value used for the whitening LFSR in FSK mode. Defaults to 0x0100, use 0x01FF for SX127x compatibility. use 0x01FF for SX127x compatibility.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setWhitening(bool enabled, uint16_t initial = 0x0100); int16_t setWhitening(bool enabled, uint16_t initial = 0x0100);
/*! /*!
\brief Sets TCXO (Temperature Compensated Crystal Oscillator) configuration. \brief Sets TCXO (Temperature Compensated Crystal Oscillator) configuration.
\param voltage TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V.
\param TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V. Set to 0 to disable TCXO. Set to 0 to disable TCXO.
NOTE: After setting this parameter to 0, the module will be reset (since there's no other way to disable TCXO). NOTE: After setting this parameter to 0, the module will be reset (since there's no other way to disable TCXO).
\param TCXO timeout in us. Defaults to 5000 us. \param delay TCXO timeout in us. Defaults to 5000 us.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setTCXO(float voltage, uint32_t delay = 5000); int16_t setTCXO(float voltage, uint32_t delay = 5000);
/*! /*!
\brief Set DIO2 to function as RF switch (default in Semtech example designs). \brief Set DIO2 to function as RF switch (default in Semtech example designs).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setDio2AsRfSwitch(bool enable = true); int16_t setDio2AsRfSwitch(bool enable = true);
/*! /*!
\brief Gets effective data rate for the last transmitted packet. The value is calculated only for payload bytes. \brief Gets effective data rate for the last transmitted packet. The value is calculated only for payload bytes.
\returns Effective data rate in bps. \returns Effective data rate in bps.
*/ */
float getDataRate() const; float getDataRate() const;
/*! /*!
\brief GetsRSSI (Recorded Signal Strength Indicator). \brief GetsRSSI (Recorded Signal Strength Indicator).
\param packet Whether to read last packet RSSI, or the current value. \param packet Whether to read last packet RSSI, or the current value.
\returns RSSI value in dBm. \returns RSSI value in dBm.
*/ */
float getRSSI(bool packet = true); float getRSSI(bool packet = true);
/*! /*!
\brief Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem. \brief Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
\returns SNR of the last received packet in dB. \returns SNR of the last received packet in dB.
*/ */
float getSNR(); float getSNR();
@ -957,75 +860,60 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Query modem for the packet length of received payload. \brief Query modem for the packet length of received payload.
\param update Update received packet length. Will return cached value when set to false. \param update Update received packet length. Will return cached value when set to false.
\returns Length of last received packet in bytes. \returns Length of last received packet in bytes.
*/ */
size_t getPacketLength(bool update = true) override; size_t getPacketLength(bool update = true) override;
/*! /*!
\brief Set modem in fixed packet length mode. Available in FSK mode only. \brief Set modem in fixed packet length mode. Available in FSK mode only.
\param len Packet length. \param len Packet length.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_SX126X_MAX_PACKET_LENGTH); int16_t fixedPacketLengthMode(uint8_t len = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
/*! /*!
\brief Set modem in variable packet length mode. Available in FSK mode only. \brief Set modem in variable packet length mode. Available in FSK mode only.
\param len Maximum packet length. \param len Maximum packet length.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SX126X_MAX_PACKET_LENGTH); int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SX126X_MAX_PACKET_LENGTH);
/*! /*!
\brief Get expected time-on-air for a given size of payload \brief Get expected time-on-air for a given size of payload
\param len Payload length in bytes. \param len Payload length in bytes.
\returns Expected time-on-air in microseconds. \returns Expected time-on-air in microseconds.
*/ */
uint32_t getTimeOnAir(size_t len); uint32_t getTimeOnAir(size_t len);
/*! /*!
\brief Set implicit header mode for future reception/transmission. \brief Set implicit header mode for future reception/transmission.
\param len Payload length in bytes. \param len Payload length in bytes.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t implicitHeader(size_t len); int16_t implicitHeader(size_t len);
/*! /*!
\brief Set explicit header mode for future reception/transmission. \brief Set explicit header mode for future reception/transmission.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t explicitHeader(); int16_t explicitHeader();
/*! /*!
\brief Set regulator mode to LDO. \brief Set regulator mode to LDO.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setRegulatorLDO(); int16_t setRegulatorLDO();
/*! /*!
\brief Set regulator mode to DC-DC. \brief Set regulator mode to DC-DC.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setRegulatorDCDC(); int16_t setRegulatorDCDC();
/*! /*!
\brief Sets transmission encoding. Available in FSK mode only. Serves only as alias for PhysicalLayer compatibility. \brief Sets transmission encoding. Available in FSK mode only. Serves only as alias for PhysicalLayer compatibility.
\param encoding Encoding to be used. Set to 0 for NRZ, and 2 for whitening. \param encoding Encoding to be used. Set to 0 for NRZ, and 2 for whitening.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setEncoding(uint8_t encoding) override; int16_t setEncoding(uint8_t encoding) override;
@ -1037,18 +925,18 @@ class SX126x: public PhysicalLayer {
void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]); 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 \brief Forces LoRa low data rate optimization. Only available in LoRa mode. After calling this method,
the provided value, regardless of symbol length. To re-enable automatic LDRO configuration, call SX126x::autoLDRO() LDRO will always be set to the provided value, regardless of symbol length.
To re-enable automatic LDRO configuration, call SX126x::autoLDRO()
\param enable Force LDRO to be always enabled (true) or disabled (false). \param enable Force LDRO to be always enabled (true) or disabled (false).
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t forceLDRO(bool enable); 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 \brief Re-enables automatic LDRO configuration. Only available in LoRa mode.
when symbol length exceeds 16 ms. After calling this method, LDRO will be enabled automatically when symbol length exceeds 16 ms.
\returns \ref status_codes \returns \ref status_codes
*/ */
@ -1056,31 +944,26 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Get one truly random byte from RSSI noise. \brief Get one truly random byte from RSSI noise.
\returns TRNG byte. \returns TRNG byte.
*/ */
uint8_t randomByte(); uint8_t randomByte();
/*! /*!
\brief Enable/disable inversion of the I and Q signals \brief Enable/disable inversion of the I and Q signals
\param enable QI inversion enabled (true) or disabled (false);
\param invertIQ QI inversion enabled (true) or disabled (false);
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t invertIQ(bool invertIQ); int16_t invertIQ(bool enable);
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
/*! /*!
\brief Set interrupt service routine function to call when data bit is receveid in direct mode. \brief Set interrupt service routine function to call when data bit is receveid in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
*/ */
void setDirectAction(void (*func)(void)); void setDirectAction(void (*func)(void));
/*! /*!
\brief Function to read and process data bit in direct reception mode. \brief Function to read and process data bit in direct reception mode.
\param pin Pin on which to read. \param pin Pin on which to read.
*/ */
void readBit(uint32_t pin); void readBit(uint32_t pin);
@ -1089,27 +972,19 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Upload binary patch into the SX126x device RAM. \brief Upload binary patch into the SX126x device RAM.
Patch is needed to e.g., enable spectral scan and must be uploaded again on every power cycle. Patch is needed to e.g., enable spectral scan and must be uploaded again on every power cycle.
\param patch Binary patch to upload. \param patch Binary patch to upload.
\param len Length of the binary patch in 4-byte words. \param len Length of the binary patch in 4-byte words.
\param nonvolatile Set to true when the patch is saved in non-volatile memory of the host processor, \param nonvolatile Set to true when the patch is saved in non-volatile memory of the host processor,
or to false when the patch is in its RAM. or to false when the patch is in its RAM.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile = true); int16_t uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile = true);
/*! /*!
\brief Start spectral scan. Requires binary path to be uploaded. \brief Start spectral scan. Requires binary path to be uploaded.
\param numSamples Number of samples for each scan. Fewer samples = better temporal resolution. \param numSamples Number of samples for each scan. Fewer samples = better temporal resolution.
\param window RSSI averaging window size. \param window RSSI averaging window size.
\param interval Scan interval length, one of RADIOLIB_SX126X_SCAN_INTERVAL_* macros. \param interval Scan interval length, one of RADIOLIB_SX126X_SCAN_INTERVAL_* macros.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t spectralScanStart(uint16_t numSamples, uint8_t window = RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT, uint8_t interval = RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US); int16_t spectralScanStart(uint16_t numSamples, uint8_t window = RADIOLIB_SX126X_SPECTRAL_SCAN_WINDOW_DEFAULT, uint8_t interval = RADIOLIB_SX126X_SCAN_INTERVAL_8_20_US);
@ -1121,16 +996,13 @@ class SX126x: public PhysicalLayer {
/*! /*!
\brief Read the status of spectral scan. \brief Read the status of spectral scan.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t spectralScanGetStatus(); int16_t spectralScanGetStatus();
/*! /*!
\brief Read the result of spectral scan. \brief Read the result of spectral scan.
\param results Array to which the results will be saved, must be RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE long. \param results Array to which the results will be saved, must be RADIOLIB_SX126X_SPECTRAL_SCAN_RES_SIZE long.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t spectralScanGetResult(uint16_t* results); int16_t spectralScanGetResult(uint16_t* results);
@ -1156,8 +1028,8 @@ class SX126x: public PhysicalLayer {
int16_t setTxParams(uint8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U); int16_t setTxParams(uint8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U);
int16_t setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro); int16_t setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
int16_t setModulationParamsFSK(uint32_t br, uint8_t pulseShape, uint8_t rxBw, uint32_t freqDev); int16_t setModulationParamsFSK(uint32_t br, uint8_t pulseShape, uint8_t rxBw, uint32_t freqDev);
int16_t setPacketParams(uint16_t preambleLength, uint8_t crcType, uint8_t payloadLength, uint8_t headerType, uint8_t invertIQ); int16_t setPacketParams(uint16_t preambleLen, uint8_t crcType, uint8_t payloadLen, uint8_t hdrType, uint8_t invertIQ);
int16_t setPacketParamsFSK(uint16_t preambleLength, uint8_t crcType, uint8_t syncWordLength, uint8_t addrComp, uint8_t whitening, uint8_t packetType = RADIOLIB_SX126X_GFSK_PACKET_VARIABLE, uint8_t payloadLength = 0xFF, uint8_t preambleDetectorLength = RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16); int16_t setPacketParamsFSK(uint16_t preambleLen, uint8_t crcType, uint8_t syncWordLen, uint8_t addrCmp, uint8_t whiten, uint8_t packType = RADIOLIB_SX126X_GFSK_PACKET_VARIABLE, uint8_t payloadLen = 0xFF, uint8_t preambleDetectorLen = RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16);
int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00); int16_t setBufferBaseAddress(uint8_t txBaseAddress = 0x00, uint8_t rxBaseAddress = 0x00);
int16_t setRegulatorMode(uint8_t mode); int16_t setRegulatorMode(uint8_t mode);
uint8_t getStatus(); uint8_t getStatus();
@ -1168,7 +1040,7 @@ class SX126x: public PhysicalLayer {
int16_t startReceiveCommon(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE); int16_t startReceiveCommon(uint32_t timeout = RADIOLIB_SX126X_RX_TIMEOUT_INF, uint16_t irqFlags = RADIOLIB_SX126X_IRQ_RX_DEFAULT, uint16_t irqMask = RADIOLIB_SX126X_IRQ_RX_DONE);
int16_t setFrequencyRaw(float freq); int16_t setFrequencyRaw(float freq);
int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setPacketMode(uint8_t mode, uint8_t len);
int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF); int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
int16_t directMode(); int16_t directMode();
int16_t packetMode(); int16_t packetMode();
@ -1181,7 +1053,7 @@ class SX126x: public PhysicalLayer {
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected: protected:
#endif #endif
Module* _mod; Module* mod;
// common low-level SPI interface // common low-level SPI interface
static int16_t SPIparseStatus(uint8_t in); static int16_t SPIparseStatus(uint8_t in);
@ -1190,26 +1062,26 @@ class SX126x: public PhysicalLayer {
protected: protected:
#endif #endif
uint8_t _bw = 0, _sf = 0, _cr = 0, _ldro = 0, _crcType = 0, _headerType = 0; uint8_t bandwidth = 0, spreadingFactor = 0, codingRate = 0, ldrOptimize = 0, crcTypeLoRa = 0, headerType = 0;
uint16_t _preambleLength = 0; uint16_t preambleLengthLoRa = 0;
float _bwKhz = 0; float bandwidthKhz = 0;
bool _ldroAuto = true; bool ldroAuto = true;
uint32_t _br = 0, _freqDev = 0; uint32_t bitRate = 0, freqencyDev = 0;
uint8_t _rxBw = 0, _pulseShape = 0, _crcTypeFSK = 0, _syncWordLength = 0, _addrComp = 0, _whitening = 0, _packetType = 0; uint8_t rxBandwidth = 0, pulseShape = 0, crcTypeFSK = 0, syncWordLength = 0, addrComp = 0, whitening = 0, packetType = 0;
uint16_t _preambleLengthFSK = 0; uint16_t preambleLengthFSK = 0;
float _rxBwKhz = 0; float rxBandwidthKhz = 0;
float _dataRate = 0; float dataRateMeasured = 0;
uint32_t _tcxoDelay = 0; uint32_t tcxoDelay = 0;
size_t _implicitLen = 0; size_t implicitLen = 0;
uint8_t _invertIQ = RADIOLIB_SX126X_LORA_IQ_STANDARD; uint8_t invertIQEnabled = RADIOLIB_SX126X_LORA_IQ_STANDARD;
const char* _chipType; const char* chipType;
// Allow subclasses to define different TX modes // Allow subclasses to define different TX modes
uint8_t _tx_mode = Module::MODE_TX; uint8_t txMode = Module::MODE_TX;
int16_t config(uint8_t modem); int16_t config(uint8_t modem);
bool findChip(const char* verStr); bool findChip(const char* verStr);