From d31b4836e15b9a57c4319a61ad86183582a326ae Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 12 Jan 2024 20:12:45 +0100 Subject: [PATCH] [Si443x] Cleanup private/protected members --- src/modules/Si443x/Si4430.cpp | 3 ++- src/modules/Si443x/Si4431.cpp | 3 ++- src/modules/Si443x/Si4432.cpp | 3 ++- src/modules/Si443x/Si443x.h | 17 ++++++++--------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/modules/Si443x/Si4430.cpp b/src/modules/Si443x/Si4430.cpp index c8b030cb..45b55356 100644 --- a/src/modules/Si443x/Si4430.cpp +++ b/src/modules/Si443x/Si4430.cpp @@ -32,7 +32,8 @@ int16_t Si4430::setOutputPower(int8_t power) { RADIOLIB_CHECK_RANGE(power, -8, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER); // set output power - return(this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0)); + Module* mod = this->getMod(); + return(mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0)); } #endif diff --git a/src/modules/Si443x/Si4431.cpp b/src/modules/Si443x/Si4431.cpp index 953c888f..799cec76 100644 --- a/src/modules/Si443x/Si4431.cpp +++ b/src/modules/Si443x/Si4431.cpp @@ -25,7 +25,8 @@ int16_t Si4431::setOutputPower(int8_t power) { RADIOLIB_CHECK_RANGE(power, -8, 13, RADIOLIB_ERR_INVALID_OUTPUT_POWER); // set output power - return(this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0)); + Module* mod = this->getMod(); + return(mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 8) / 3), 2, 0)); } #endif diff --git a/src/modules/Si443x/Si4432.cpp b/src/modules/Si443x/Si4432.cpp index 12c212ef..40a97226 100644 --- a/src/modules/Si443x/Si4432.cpp +++ b/src/modules/Si443x/Si4432.cpp @@ -32,7 +32,8 @@ int16_t Si4432::setOutputPower(int8_t power) { RADIOLIB_CHECK_RANGE(power, -1, 20, RADIOLIB_ERR_INVALID_OUTPUT_POWER); // set output power - return(this->mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 1) / 3), 2, 0)); + Module* mod = this->getMod(); + return(mod->SPIsetRegValue(RADIOLIB_SI443X_REG_TX_POWER, (uint8_t)((power + 1) / 3), 2, 0)); } #endif diff --git a/src/modules/Si443x/Si443x.h b/src/modules/Si443x/Si443x.h index ca83ba12..9d639806 100644 --- a/src/modules/Si443x/Si443x.h +++ b/src/modules/Si443x/Si443x.h @@ -566,8 +566,6 @@ class Si443x: public PhysicalLayer { */ Si443x(Module* mod); - Module* getMod(); - // basic methods /*! @@ -828,11 +826,17 @@ class Si443x: public PhysicalLayer { #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL protected: #endif - Module* mod; + Module* getMod(); #if !RADIOLIB_GODMODE protected: #endif + int16_t setFrequencyRaw(float newFreq); + +#if !RADIOLIB_GODMODE + private: +#endif + Module* mod; float bitRate = 0; float frequencyDev = 0; @@ -842,18 +846,13 @@ class Si443x: public PhysicalLayer { bool packetLengthQueried = false; uint8_t packetLengthConfig = RADIOLIB_SI443X_FIXED_PACKET_LENGTH_ON; - int16_t setFrequencyRaw(float newFreq); - int16_t setPacketMode(uint8_t mode, uint8_t len); - -#if !RADIOLIB_GODMODE - private: -#endif bool findChip(); void clearIRQFlags(); void clearFIFO(size_t count); int16_t config(); int16_t updateClockRecovery(); int16_t directMode(); + int16_t setPacketMode(uint8_t mode, uint8_t len); }; #endif