diff --git a/src/RadioLib.h b/src/RadioLib.h index edeb8fd6..e8e26ad0 100644 --- a/src/RadioLib.h +++ b/src/RadioLib.h @@ -64,6 +64,7 @@ #include "modules/ESP8266/ESP8266.h" #include "modules/HC05/HC05.h" #include "modules/JDY08/JDY08.h" +#include "modules/LLCC68/LLCC68.h" #include "modules/nRF24/nRF24.h" #include "modules/RF69/RF69.h" #include "modules/RFM2x/RFM22.h" diff --git a/src/modules/LLCC68/LLCC68.cpp b/src/modules/LLCC68/LLCC68.cpp new file mode 100644 index 00000000..cf9cb66c --- /dev/null +++ b/src/modules/LLCC68/LLCC68.cpp @@ -0,0 +1,31 @@ +#include "LLCC68.h" +#if !defined(RADIOLIB_EXCLUDE_SX126X) + +LLCC68::LLCC68(Module* mod) : SX1262(mod) { + +} + +int16_t LLCC68::setBandwidth(float bw) { + RADIOLIB_CHECK_RANGE(bw, 100.0, 510.0, ERR_INVALID_BANDWIDTH); + return(SX1262::setBandwidth(bw)); +} + +int16_t LLCC68::setSpreadingFactor(uint8_t sf) { + switch(SX126x::_bw) { + case SX126X_LORA_BW_125_0: + RADIOLIB_CHECK_RANGE(sf, 5, 9, ERR_INVALID_SPREADING_FACTOR); + break; + case SX126X_LORA_BW_250_0: + RADIOLIB_CHECK_RANGE(sf, 5, 10, ERR_INVALID_SPREADING_FACTOR); + break; + case SX126X_LORA_BW_500_0: + RADIOLIB_CHECK_RANGE(sf, 5, 11, ERR_INVALID_SPREADING_FACTOR); + break; + default: + return(ERR_INVALID_SPREADING_FACTOR); + } + + return(SX1262::setSpreadingFactor(sf)); +} + +#endif diff --git a/src/modules/LLCC68/LLCC68.h b/src/modules/LLCC68/LLCC68.h new file mode 100644 index 00000000..7bb8a810 --- /dev/null +++ b/src/modules/LLCC68/LLCC68.h @@ -0,0 +1,53 @@ +#if !defined(_RADIOLIB_LLCC68_H) +#define _RADIOLIB_LLCC68_H + +#include "../../TypeDef.h" + +#if !defined(RADIOLIB_EXCLUDE_SX126X) + +#include "../../Module.h" +#include "../SX126x/SX1262.h" + +/*! + \class LLCC68 + + \brief Derived class for %LLCC68 modules. +*/ +class LLCC68: public SX1262 { + public: + /*! + \brief Default constructor. + + \param mod Instance of Module that will be used to communicate with the radio. + */ + LLCC68(Module* mod); + + // configuration methods + + /*! + \brief Sets LoRa bandwidth. Allowed values are 125.0, 250.0 and 500.0 kHz. + + \param bw LoRa bandwidth to be set in kHz. + + \returns \ref status_codes + */ + int16_t setBandwidth(float bw); + + /*! + \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. + + \returns \ref status_codes + */ + int16_t setSpreadingFactor(uint8_t sf); + +#if !defined(RADIOLIB_GODMODE) + private: +#endif + +}; + +#endif + +#endif