[SX128x] Added low-level access macro

This commit is contained in:
jgromes 2021-03-13 19:57:44 +01:00
parent 4342be8386
commit e9f1f940a2
4 changed files with 20 additions and 12 deletions

View file

@ -52,7 +52,7 @@ class SX1280: public SX1281 {
*/ */
float getRangingResult(); float getRangingResult();
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE)
private: private:
#endif #endif

View file

@ -22,7 +22,7 @@ class SX1281: public SX128x {
*/ */
SX1281(Module* mod); SX1281(Module* mod);
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE)
private: private:
#endif #endif

View file

@ -23,7 +23,7 @@ class SX1282: public SX1280 {
*/ */
SX1282(Module* mod); SX1282(Module* mod);
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE)
private: private:
#endif #endif

View file

@ -760,11 +760,15 @@ class SX128x: public PhysicalLayer {
*/ */
uint8_t random(); uint8_t random();
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected: protected:
#endif #endif
Module* _mod; Module* _mod;
#if !defined(RADIOLIB_GODMODE)
protected:
#endif
// cached LoRa parameters // cached LoRa parameters
float _bwKhz = 0; float _bwKhz = 0;
uint8_t _bw = 0, _sf = 0, _cr = 0; uint8_t _bw = 0, _sf = 0, _cr = 0;
@ -795,7 +799,18 @@ class SX128x: public PhysicalLayer {
int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF); int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF);
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
private:
#endif
// 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)
private: private:
#endif #endif
// common parameters // common parameters
@ -814,13 +829,6 @@ class SX128x: public PhysicalLayer {
uint8_t _connectionState = 0, _crcBLE = 0, _bleTestPayload = 0; uint8_t _connectionState = 0, _crcBLE = 0, _bleTestPayload = 0;
int16_t config(uint8_t modem); 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 #endif