[nRF24] Reworked macro configuration system

This commit is contained in:
jgromes 2023-11-27 19:40:00 +01:00
parent 509b8204f1
commit 63287ab6fd
2 changed files with 6 additions and 6 deletions
src/modules/nRF24

View file

@ -1,6 +1,6 @@
#include "nRF24.h" #include "nRF24.h"
#include <string.h> #include <string.h>
#if !defined(RADIOLIB_EXCLUDE_NRF24) #if !RADIOLIB_EXCLUDE_NRF24
nRF24::nRF24(Module* mod) : PhysicalLayer(RADIOLIB_NRF24_FREQUENCY_STEP_SIZE, RADIOLIB_NRF24_MAX_PACKET_LENGTH) { nRF24::nRF24(Module* mod) : PhysicalLayer(RADIOLIB_NRF24_FREQUENCY_STEP_SIZE, RADIOLIB_NRF24_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -617,7 +617,7 @@ void nRF24::SPIwriteTxPayload(uint8_t* data, uint8_t 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, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes) {
// prepare the buffers // prepare the buffers
size_t buffLen = 1 + numBytes; size_t buffLen = 1 + numBytes;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
@ -648,7 +648,7 @@ void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* data
memcpy(dataIn, &buffIn[1], numBytes); memcpy(dataIn, &buffIn[1], numBytes);
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif

View file

@ -1,4 +1,4 @@
#if !defined(_RADIOLIB_NRF24_H) && !defined(RADIOLIB_EXCLUDE_NRF24) #if !defined(_RADIOLIB_NRF24_H) && !RADIOLIB_EXCLUDE_NRF24
#define _RADIOLIB_NRF24_H #define _RADIOLIB_NRF24_H
#include "../../Module.h" #include "../../Module.h"
@ -467,7 +467,7 @@ class nRF24: public PhysicalLayer {
*/ */
int16_t setEncoding(uint8_t encoding) override; int16_t setEncoding(uint8_t encoding) override;
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
@ -476,7 +476,7 @@ class nRF24: public PhysicalLayer {
void SPIwriteTxPayload(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 SPItransfer(uint8_t cmd, bool write = false, uint8_t* dataOut = NULL, uint8_t* dataIn = NULL, uint8_t numBytes = 0);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif