[RF69] Cppcheck fixes

This commit is contained in:
jgromes 2025-01-18 15:25:48 +01:00
parent 77dad34c05
commit beb6689287
4 changed files with 7 additions and 7 deletions

View file

@ -219,7 +219,7 @@ int16_t RF69::packetMode() {
return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE, 6, 5)); return(this->mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_PACKET_MODE, 6, 5));
} }
void RF69::setAESKey(uint8_t* key) { void RF69::setAESKey(const uint8_t* key) {
this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_AES_KEY_1, key, 16); this->mod->SPIwriteRegisterBurst(RADIOLIB_RF69_REG_AES_KEY_1, key, 16);
} }
@ -364,7 +364,7 @@ bool RF69::fifoAdd(uint8_t* data, int totalLen, int* remLen) {
bool RF69::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen) { bool RF69::fifoGet(volatile uint8_t* data, int totalLen, volatile int* rcvLen) {
// get pointer to the correct position in data buffer // 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 // check how much data are we still expecting
uint8_t len = RADIOLIB_RF69_FIFO_THRESH - 1; uint8_t len = RADIOLIB_RF69_FIFO_THRESH - 1;
@ -692,7 +692,7 @@ int16_t RF69::setOutputPower(int8_t pwr, bool highPower) {
return(state); return(state);
} }
int16_t RF69::setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits) { int16_t RF69::setSyncWord(const uint8_t* syncWord, size_t len, uint8_t maxErrBits) {
// check constraints // check constraints
if((maxErrBits > 7) || (len > 8)) { if((maxErrBits > 7) || (len > 8)) {
return(RADIOLIB_ERR_INVALID_SYNC_WORD); return(RADIOLIB_ERR_INVALID_SYNC_WORD);

View file

@ -577,7 +577,7 @@ class RF69: public PhysicalLayer {
\brief Sets AES key. \brief Sets AES key.
\param key Key to be used for AES encryption. Must be exactly 16 bytes long. \param key Key to be used for AES encryption. Must be exactly 16 bytes long.
*/ */
void setAESKey(uint8_t* key); void setAESKey(const uint8_t* key);
/*! /*!
\brief Enables AES encryption. \brief Enables AES encryption.
@ -789,7 +789,7 @@ class RF69: public PhysicalLayer {
\param len Sync word length in bytes. \param len Sync word length in bytes.
\param maxErrBits Maximum allowed number of bit errors in received sync word. Defaults to 0. \param maxErrBits Maximum allowed number of bit errors in received sync word. Defaults to 0.
*/ */
int16_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0); int16_t setSyncWord(const uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0);
/*! /*!
\brief Sets preamble length. \brief Sets preamble length.

View file

@ -108,7 +108,7 @@ class SX1231: public RF69 {
\param preambleLen Preamble Length in bits. Defaults to 16 bits. \param preambleLen Preamble Length in bits. Defaults to 16 bits.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16); virtual int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16);
#if !RADIOLIB_GODMODE #if !RADIOLIB_GODMODE
protected: protected:

View file

@ -38,7 +38,7 @@ class SX1233: public SX1231 {
\param preambleLen Preamble Length in bits. Defaults to 16 bits. \param preambleLen Preamble Length in bits. Defaults to 16 bits.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16); int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16) override;
/*! /*!
\brief Sets bit rate. Allowed values range from 0.5 to 300.0 kbps. \brief Sets bit rate. Allowed values range from 0.5 to 300.0 kbps.