[SX127x] Cppcheck fixes
This commit is contained in:
parent
ddd4b23e65
commit
06b3049e38
12 changed files with 32 additions and 33 deletions
|
@ -118,7 +118,7 @@ class SX1272: public SX127x {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
virtual int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
|
||||
/*!
|
||||
\brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
|
||||
|
@ -160,7 +160,7 @@ class SX1272: public SX127x {
|
|||
\param sf %LoRa link spreading factor to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
virtual int16_t setSpreadingFactor(uint8_t sf);
|
||||
|
||||
/*!
|
||||
\brief Sets %LoRa link coding rate denominator. Allowed values range from 5 to 8. Only available in %LoRa mode.
|
||||
|
@ -317,7 +317,7 @@ class SX1272: public SX127x {
|
|||
int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
|
||||
int16_t setCodingRateRaw(uint8_t newCodingRate);
|
||||
|
||||
int16_t configFSK();
|
||||
int16_t configFSK() override;
|
||||
void errataFix(bool rx) override;
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
|
|
|
@ -38,7 +38,7 @@ class SX1273: public SX1272 {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0) override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
@ -47,7 +47,7 @@ class SX1273: public SX1272 {
|
|||
\param sf %LoRa link spreading factor to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
int16_t setSpreadingFactor(uint8_t sf) override;
|
||||
|
||||
/*!
|
||||
\brief Set data.
|
||||
|
|
|
@ -7,7 +7,7 @@ SX1276::SX1276(Module* mod) : SX1278(mod) {
|
|||
|
||||
int16_t SX1276::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, uint8_t gain) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::begin(versions, 3, syncWord, preambleLength);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
@ -39,7 +39,7 @@ int16_t SX1276::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync
|
|||
|
||||
int16_t SX1276::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, bool enableOOK) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::beginFSK(versions, 3, freqDev, rxBw, preambleLength, enableOOK);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class SX1276: public SX1278 {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\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_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0) override;
|
||||
|
||||
/*!
|
||||
\brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
|
||||
|
@ -52,7 +52,7 @@ class SX1276: public SX1278 {
|
|||
\param enableOOK Use OOK modulation instead of FSK.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false) override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ SX1277::SX1277(Module* mod) : SX1278(mod) {
|
|||
|
||||
int16_t SX1277::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, uint8_t gain) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::begin(versions, 3, syncWord, preambleLength);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
@ -39,7 +39,7 @@ int16_t SX1277::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync
|
|||
|
||||
int16_t SX1277::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, bool enableOOK) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::beginFSK(versions, 3, freqDev, rxBw, preambleLength, enableOOK);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class SX1277: public SX1278 {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\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_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0) override;
|
||||
|
||||
/*!
|
||||
\brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
|
||||
|
@ -52,7 +52,7 @@ class SX1277: public SX1278 {
|
|||
\param enableOOK Use OOK modulation instead of FSK.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false) override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
@ -68,7 +68,7 @@ class SX1277: public SX1278 {
|
|||
\param sf %LoRa link spreading factor to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
int16_t setSpreadingFactor(uint8_t sf) override;
|
||||
|
||||
/*!
|
||||
\brief Set data.
|
||||
|
|
|
@ -8,7 +8,7 @@ SX1278::SX1278(Module* mod) : SX127x(mod) {
|
|||
|
||||
int16_t SX1278::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, uint8_t gain) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::begin(versions, 3, syncWord, preambleLength);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
@ -40,7 +40,7 @@ int16_t SX1278::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync
|
|||
|
||||
int16_t SX1278::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, bool enableOOK) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::beginFSK(versions, 3, freqDev, rxBw, preambleLength, enableOOK);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class SX1278: public SX127x {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\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_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
virtual int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
|
||||
/*!
|
||||
\brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
|
||||
|
@ -143,7 +143,7 @@ class SX1278: public SX127x {
|
|||
\param enableOOK Use OOK modulation instead of FSK.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
|
||||
virtual int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
|
||||
|
||||
/*!
|
||||
\brief Reset method. Will reset the chip to the default state using RST pin.
|
||||
|
@ -171,7 +171,7 @@ class SX1278: public SX127x {
|
|||
\param sf %LoRa link spreading factor to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
virtual int16_t setSpreadingFactor(uint8_t sf);
|
||||
|
||||
/*!
|
||||
\brief Sets %LoRa link coding rate denominator. Allowed values range from 5 to 8. Only available in %LoRa mode.
|
||||
|
@ -329,7 +329,7 @@ class SX1278: public SX127x {
|
|||
int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
|
||||
int16_t setCodingRateRaw(uint8_t newCodingRate);
|
||||
|
||||
int16_t configFSK();
|
||||
int16_t configFSK() override;
|
||||
void errataFix(bool rx) override;
|
||||
|
||||
#if !RADIOLIB_GODMODE
|
||||
|
|
|
@ -7,7 +7,7 @@ SX1279::SX1279(Module* mod) : SX1278(mod) {
|
|||
|
||||
int16_t SX1279::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t power, uint16_t preambleLength, uint8_t gain) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::begin(versions, 3, syncWord, preambleLength);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
@ -39,7 +39,7 @@ int16_t SX1279::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t sync
|
|||
|
||||
int16_t SX1279::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, uint16_t preambleLength, bool enableOOK) {
|
||||
// execute common part
|
||||
uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
const uint8_t versions[] = { RADIOLIB_SX1278_CHIP_VERSION, RADIOLIB_SX1278_CHIP_VERSION_ALT, RADIOLIB_SX1278_CHIP_VERSION_RFM9X };
|
||||
int16_t state = SX127x::beginFSK(versions, 3, freqDev, rxBw, preambleLength, enableOOK);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class SX1279: public SX1278 {
|
|||
Set to 0 to enable automatic gain control (recommended).
|
||||
\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_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
|
||||
int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0) override;
|
||||
|
||||
/*!
|
||||
\brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
|
||||
|
@ -52,7 +52,7 @@ class SX1279: public SX1278 {
|
|||
\param enableOOK Use OOK modulation instead of FSK.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
|
||||
int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false) override;
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ SX127x::SX127x(Module* mod) : PhysicalLayer(RADIOLIB_SX127X_FREQUENCY_STEP_SIZE,
|
|||
this->mod = mod;
|
||||
}
|
||||
|
||||
int16_t SX127x::begin(uint8_t* chipVersions, uint8_t numVersions, uint8_t syncWord, uint16_t preambleLength) {
|
||||
int16_t SX127x::begin(const uint8_t* chipVersions, uint8_t numVersions, uint8_t syncWord, uint16_t preambleLength) {
|
||||
// set module properties
|
||||
this->mod->init();
|
||||
this->mod->hal->pinMode(this->mod->getIrq(), this->mod->hal->GpioModeInput);
|
||||
|
@ -69,7 +69,7 @@ int16_t SX127x::begin(uint8_t* chipVersions, uint8_t numVersions, uint8_t syncWo
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX127x::beginFSK(uint8_t* chipVersions, uint8_t numVersions, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK) {
|
||||
int16_t SX127x::beginFSK(const uint8_t* chipVersions, uint8_t numVersions, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK) {
|
||||
// set module properties
|
||||
this->mod->init();
|
||||
this->mod->hal->pinMode(this->mod->getIrq(), this->mod->hal->GpioModeInput);
|
||||
|
@ -548,7 +548,7 @@ bool SX127x::fifoAdd(uint8_t* data, int totalLen, int* remLen) {
|
|||
|
||||
bool SX127x::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen) {
|
||||
// get pointer to the correct position in data buffer
|
||||
uint8_t* dataPtr = (uint8_t*)&data[*rcvLen];
|
||||
uint8_t* dataPtr = const_cast<uint8_t*>(&data[*rcvLen]);
|
||||
|
||||
// check how much data are we still expecting
|
||||
uint8_t len = RADIOLIB_SX127X_FIFO_THRESH - 1;
|
||||
|
@ -1869,12 +1869,11 @@ int16_t SX127x::setHeaderType(uint8_t headerType, uint8_t bitIndex, size_t len)
|
|||
}
|
||||
|
||||
// set requested packet mode
|
||||
Module* mod = this->getMod();
|
||||
int16_t state = mod->SPIsetRegValue(RADIOLIB_SX127X_REG_MODEM_CONFIG_1, headerType, bitIndex, bitIndex);
|
||||
int16_t state = this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_MODEM_CONFIG_1, headerType, bitIndex, bitIndex);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set length to register
|
||||
state = mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PAYLOAD_LENGTH, len);
|
||||
state = this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PAYLOAD_LENGTH, len);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// update cached value
|
||||
|
|
|
@ -606,7 +606,7 @@ class SX127x: public PhysicalLayer {
|
|||
\param preambleLength Length of %LoRa transmission preamble in symbols.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t begin(uint8_t* chipVersions, uint8_t numVersions, uint8_t syncWord, uint16_t preambleLength);
|
||||
int16_t begin(const uint8_t* chipVersions, uint8_t numVersions, uint8_t syncWord, uint16_t preambleLength);
|
||||
|
||||
/*!
|
||||
\brief Reset method. Will reset the chip to the default state using RST pin. Declared pure virtual since SX1272 and SX1278 implementations differ.
|
||||
|
@ -623,7 +623,7 @@ class SX127x: public PhysicalLayer {
|
|||
\param enableOOK Flag to specify OOK mode. This modulation is similar to FSK.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginFSK(uint8_t* chipVersions, uint8_t numVersions, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK);
|
||||
int16_t beginFSK(const uint8_t* chipVersions, uint8_t numVersions, float freqDev, float rxBw, uint16_t preambleLength, bool enableOOK);
|
||||
|
||||
/*!
|
||||
\brief Binary transmit method. Will transmit arbitrary binary data up to 255 bytes long using %LoRa or up to 63 bytes using FSK modem.
|
||||
|
@ -1251,7 +1251,7 @@ class SX127x: public PhysicalLayer {
|
|||
bool ookEnabled = false;
|
||||
bool implicitHdr = false;
|
||||
|
||||
int16_t configFSK();
|
||||
virtual int16_t configFSK();
|
||||
int16_t getActiveModem();
|
||||
int16_t setFrequencyRaw(float newFreq);
|
||||
int16_t setBitRateCommon(float br, uint8_t fracRegAddr);
|
||||
|
|
Loading…
Add table
Reference in a new issue