From 4342be83860ea377b415964874450a43b557a43d Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 13 Mar 2021 19:57:38 +0100 Subject: [PATCH] [SX126x] Added low-level access macro --- src/modules/SX126x/SX1261.h | 2 +- src/modules/SX126x/SX1262.h | 2 +- src/modules/SX126x/SX1268.h | 2 +- src/modules/SX126x/SX126x.h | 22 +++++++++++++--------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/modules/SX126x/SX1261.h b/src/modules/SX126x/SX1261.h index a52d4235..0f5262fd 100644 --- a/src/modules/SX126x/SX1261.h +++ b/src/modules/SX126x/SX1261.h @@ -35,7 +35,7 @@ class SX1261 : public SX1262 { */ int16_t setOutputPower(int8_t power); -#ifndef RADIOLIB_GODMODE +#if !defined(RADIOLIB_GODMODE) private: #endif diff --git a/src/modules/SX126x/SX1262.h b/src/modules/SX126x/SX1262.h index 616cd407..3f5afd6c 100644 --- a/src/modules/SX126x/SX1262.h +++ b/src/modules/SX126x/SX1262.h @@ -95,7 +95,7 @@ class SX1262: public SX126x { */ int16_t setOutputPower(int8_t power); -#ifndef RADIOLIB_GODMODE +#if !defined(RADIOLIB_GODMODE) private: #endif diff --git a/src/modules/SX126x/SX1268.h b/src/modules/SX126x/SX1268.h index 909dd334..3803ec05 100644 --- a/src/modules/SX126x/SX1268.h +++ b/src/modules/SX126x/SX1268.h @@ -95,7 +95,7 @@ class SX1268: public SX126x { */ int16_t setOutputPower(int8_t power); -#ifndef RADIOLIB_GODMODE +#if !defined(RADIOLIB_GODMODE) private: #endif diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index ee99a27f..7ee07956 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -928,11 +928,22 @@ class SX126x: public PhysicalLayer { int16_t fixImplicitTimeout(); int16_t fixInvertedIQ(uint8_t iqConfig); -#ifndef RADIOLIB_GODMODE - private: +#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) + protected: #endif Module* _mod; + // common low-level SPI interface + int16_t SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); + int16_t SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); + int16_t SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); + int16_t SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); + int16_t SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes, bool waitForBusy, uint32_t timeout = 5000); + +#if !defined(RADIOLIB_GODMODE) + protected: +#endif + uint8_t _bw = 0, _sf = 0, _cr = 0, _ldro = 0, _crcType = 0, _headerType = 0; uint16_t _preambleLength = 0; float _bwKhz = 0; @@ -950,13 +961,6 @@ class SX126x: public PhysicalLayer { size_t _implicitLen = 0; int16_t config(uint8_t modem); - - // common low-level SPI interface - int16_t SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); - int16_t SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); - int16_t SPIreadCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); - int16_t SPIreadCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true); - int16_t SPItransfer(uint8_t* cmd, uint8_t cmdLen, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes, bool waitForBusy, uint32_t timeout = 5000); }; #endif