[LLCC68] Added support for LLCC68 param range checks (#314)
This commit is contained in:
parent
cf0dc4f0c9
commit
6b0c5c2c92
3 changed files with 85 additions and 0 deletions
|
@ -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"
|
||||
|
|
31
src/modules/LLCC68/LLCC68.cpp
Normal file
31
src/modules/LLCC68/LLCC68.cpp
Normal file
|
@ -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
|
53
src/modules/LLCC68/LLCC68.h
Normal file
53
src/modules/LLCC68/LLCC68.h
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue