From 5e7be103641a8e0b05fc8d2029ff4127e4aa700c Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 18 Jan 2025 17:47:34 +0100 Subject: [PATCH] [nRF24] Cppcheck fixes --- src/modules/nRF24/nRF24.cpp | 8 ++++---- src/modules/nRF24/nRF24.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/nRF24/nRF24.cpp b/src/modules/nRF24/nRF24.cpp index 0218ddd7..105ac298 100644 --- a/src/modules/nRF24/nRF24.cpp +++ b/src/modules/nRF24/nRF24.cpp @@ -387,7 +387,7 @@ int16_t nRF24::setAddressWidth(uint8_t addrWidth) { return(state); } -int16_t nRF24::setTransmitPipe(uint8_t* addr) { +int16_t nRF24::setTransmitPipe(const uint8_t* addr) { // set mode to standby int16_t state = standby(); RADIOLIB_ASSERT(state); @@ -402,7 +402,7 @@ int16_t nRF24::setTransmitPipe(uint8_t* addr) { return(state); } -int16_t nRF24::setReceivePipe(uint8_t pipeNum, uint8_t* addr) { +int16_t nRF24::setReceivePipe(uint8_t pipeNum, const uint8_t* addr) { // set mode to standby int16_t state = standby(); RADIOLIB_ASSERT(state); @@ -610,11 +610,11 @@ void nRF24::SPIreadRxPayload(uint8_t* data, uint8_t numBytes) { SPItransfer(RADIOLIB_NRF24_CMD_READ_RX_PAYLOAD, false, NULL, data, numBytes); } -void nRF24::SPIwriteTxPayload(uint8_t* data, uint8_t numBytes) { +void nRF24::SPIwriteTxPayload(const uint8_t* data, uint8_t numBytes) { SPItransfer(RADIOLIB_NRF24_CMD_WRITE_TX_PAYLOAD, true, data, NULL, numBytes); } -void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes) { +void nRF24::SPItransfer(uint8_t cmd, bool write, const uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes) { (void)this->mod->SPItransferStream(&cmd, 1, write, dataOut, dataIn, numBytes, false); } diff --git a/src/modules/nRF24/nRF24.h b/src/modules/nRF24/nRF24.h index 428df70f..e7db4ec5 100644 --- a/src/modules/nRF24/nRF24.h +++ b/src/modules/nRF24/nRF24.h @@ -374,7 +374,7 @@ class nRF24: public PhysicalLayer { \param addr Address to which the next packet shall be transmitted. \returns \ref status_codes */ - int16_t setTransmitPipe(uint8_t* addr); + int16_t setTransmitPipe(const uint8_t* addr); /*! \brief Sets address of receive pipes 0 or 1. The address width must be the same as the same @@ -384,7 +384,7 @@ class nRF24: public PhysicalLayer { \param addr Address from which %nRF24 shall receive new packets on the specified pipe. \returns \ref status_codes */ - int16_t setReceivePipe(uint8_t pipeNum, uint8_t* addr); + int16_t setReceivePipe(uint8_t pipeNum, const uint8_t* addr); /*! \brief Sets address of receive pipes 2 - 5. The first 2 - 4 address bytes for these pipes @@ -471,8 +471,8 @@ class nRF24: public PhysicalLayer { Module* getMod() override; void SPIreadRxPayload(uint8_t* data, uint8_t numBytes); - void SPIwriteTxPayload(uint8_t* data, uint8_t numBytes); - void SPItransfer(uint8_t cmd, bool write = false, uint8_t* dataOut = NULL, uint8_t* dataIn = NULL, uint8_t numBytes = 0); + void SPIwriteTxPayload(const uint8_t* data, uint8_t numBytes); + void SPItransfer(uint8_t cmd, bool write = false, const uint8_t* dataOut = NULL, uint8_t* dataIn = NULL, uint8_t numBytes = 0); #if !RADIOLIB_GODMODE private: