Implemented god mode

This commit is contained in:
jgromes 2019-11-20 16:55:11 +01:00
parent cd1c799a64
commit 2fc641449a
29 changed files with 237 additions and 147 deletions

View file

@ -54,7 +54,9 @@ class ISerial {
size_t println(const Printable&); size_t println(const Printable&);
size_t println(void); size_t println(void);
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
Module* _mod; Module* _mod;
}; };

View file

@ -310,7 +310,9 @@ class Module {
*/ */
SPISettings getSpiSettings() const { return(_spiSettings); } SPISettings getSpiSettings() const { return(_spiSettings); }
#ifndef RADIOLIB_GODMODE
private: private:
#endif
int _cs; int _cs;
int _tx; int _tx;
int _rx; int _rx;

View file

@ -38,6 +38,10 @@
#include "TypeDef.h" #include "TypeDef.h"
#include "Module.h" #include "Module.h"
#ifdef RADIOLIB_GODMODE
#warning "God mode active, I hope it was intentional. Buckle up, lads."
#endif
#include "modules/CC1101.h" #include "modules/CC1101.h"
#ifndef ESP8266 #ifndef ESP8266
#include "modules/ESP8266.h" #include "modules/ESP8266.h"
@ -101,7 +105,9 @@ class Radio {
Module* ModuleA; Module* ModuleA;
Module* ModuleB; Module* ModuleB;
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };

View file

@ -18,7 +18,8 @@
/* /*
* Uncomment to enable debug output. * Uncomment to enable debug output.
* Warning: Debug output will slow down the whole system significantly * Warning: Debug output will slow down the whole system significantly.
* Also, it will result in larger compiled binary.
* Levels: debug - only main info * Levels: debug - only main info
* verbose - full transcript of all SPI/UART communication * verbose - full transcript of all SPI/UART communication
*/ */

View file

@ -820,7 +820,9 @@ class CC1101: public PhysicalLayer {
*/ */
int16_t setPromiscuousMode(bool promiscuous = true); int16_t setPromiscuousMode(bool promiscuous = true);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
Module* _mod; Module* _mod;
float _freq; float _freq;

View file

@ -54,7 +54,9 @@ class ESP8266: public TransportLayer {
size_t receive(uint8_t* data, size_t len, uint32_t timeout = 10000); size_t receive(uint8_t* data, size_t len, uint32_t timeout = 10000);
size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10); size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
Module* _mod; Module* _mod;
}; };

View file

@ -762,7 +762,9 @@ class RF69: public PhysicalLayer {
*/ */
int16_t setPromiscuousMode(bool promiscuous = true); int16_t setPromiscuousMode(bool promiscuous = true);
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
Module* _mod; Module* _mod;
float _br; float _br;
@ -780,7 +782,9 @@ class RF69: public PhysicalLayer {
int16_t config(); int16_t config();
int16_t directMode(); int16_t directMode();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
int16_t setMode(uint8_t mode); int16_t setMode(uint8_t mode);
void clearIRQFlags(); void clearIRQFlags();
}; };

View file

@ -67,7 +67,9 @@ class RFM95: public SX1278 {
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };

View file

@ -67,7 +67,9 @@ class RFM96: public SX1278 {
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };

View file

@ -35,7 +35,10 @@ class RFM97: public RFM95 {
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };
#endif #endif

View file

@ -46,7 +46,9 @@ class SX1231: public RF69 {
*/ */
int16_t begin(float freq = 434.0, float br = 48.0, float rxBw = 125.0, float freqDev = 50.0, int8_t power = 13); int16_t begin(float freq = 434.0, float br = 48.0, float rxBw = 125.0, float freqDev = 50.0, int8_t power = 13);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
uint8_t _chipRevision; uint8_t _chipRevision;
}; };

View file

@ -32,7 +32,9 @@ class SX1261 : public SX1262 {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
int16_t setOptimalLowPowerPaConfig(int8_t* inOutPower); int16_t setOptimalLowPowerPaConfig(int8_t* inOutPower);
}; };

View file

@ -89,7 +89,10 @@ class SX1262: public SX126x {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };
#endif #endif

View file

@ -91,6 +91,11 @@ class SX1268: public SX126x {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#ifndef RADIOLIB_GODMODE
private:
#endif
}; };
#endif #endif

View file

@ -724,7 +724,9 @@ class SX126x: public PhysicalLayer {
*/ */
uint32_t getTimeOnAir(size_t len); uint32_t getTimeOnAir(size_t len);
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
// SX1276x SPI command implementations // SX1276x SPI command implementations
int16_t setTx(uint32_t timeout = 0); int16_t setTx(uint32_t timeout = 0);
int16_t setRx(uint32_t timeout); int16_t setRx(uint32_t timeout);
@ -758,7 +760,10 @@ class SX126x: public PhysicalLayer {
\brief Fixes overly eager PA clamping on SX1262 / SX1268, as described in section 15.2 of the datasheet \brief Fixes overly eager PA clamping on SX1262 / SX1268, as described in section 15.2 of the datasheet
*/ */
int16_t fixPaClamping(); int16_t fixPaClamping();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
Module* _mod; Module* _mod;
uint8_t _bw, _sf, _cr, _ldro, _crcType; uint8_t _bw, _sf, _cr, _ldro, _crcType;
@ -774,8 +779,6 @@ class SX126x: public PhysicalLayer {
int16_t config(uint8_t modem); int16_t config(uint8_t modem);
// common low-level SPI interface // 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* 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 SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);

View file

@ -250,14 +250,18 @@ class SX1272: public SX127x {
*/ */
int16_t setCRC(bool enableCRC); int16_t setCRC(bool enableCRC);
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
int16_t setBandwidthRaw(uint8_t newBandwidth); int16_t setBandwidthRaw(uint8_t newBandwidth);
int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor); int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
int16_t setCodingRateRaw(uint8_t newCodingRate); int16_t setCodingRateRaw(uint8_t newCodingRate);
int16_t configFSK(); int16_t configFSK();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };

View file

@ -61,6 +61,11 @@ class SX1273: public SX1272 {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);
#ifndef RADIOLIB_GODMODE
private:
#endif
}; };
#endif #endif

View file

@ -61,6 +61,11 @@ class SX1276: public SX1278 {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#ifndef RADIOLIB_GODMODE
private:
#endif
}; };
#endif #endif

View file

@ -70,6 +70,11 @@ class SX1277: public SX1278 {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);
#ifndef RADIOLIB_GODMODE
private:
#endif
}; };
#endif #endif

View file

@ -259,14 +259,18 @@ class SX1278: public SX127x {
*/ */
int16_t setCRC(bool enableCRC); int16_t setCRC(bool enableCRC);
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
int16_t setBandwidthRaw(uint8_t newBandwidth); int16_t setBandwidthRaw(uint8_t newBandwidth);
int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor); int16_t setSpreadingFactorRaw(uint8_t newSpreadingFactor);
int16_t setCodingRateRaw(uint8_t newCodingRate); int16_t setCodingRateRaw(uint8_t newCodingRate);
int16_t configFSK(); int16_t configFSK();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
}; };

View file

@ -61,6 +61,11 @@ class SX1279: public SX1278 {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#ifndef RADIOLIB_GODMODE
private:
#endif
}; };
#endif #endif

View file

@ -867,7 +867,9 @@ class SX127x: public PhysicalLayer {
void regDump(); void regDump();
#endif #endif
#ifndef RADIOLIB_GODMODE
protected: protected:
#endif
Module* _mod; Module* _mod;
float _freq; float _freq;
@ -884,8 +886,9 @@ class SX127x: public PhysicalLayer {
int16_t getActiveModem(); int16_t getActiveModem();
int16_t directMode(); int16_t directMode();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
float _dataRate; float _dataRate;
size_t _packetLength; size_t _packetLength;
bool _packetLengthQueried; // FSK packet length is the first byte in FIFO, length can only be queried once bool _packetLengthQueried; // FSK packet length is the first byte in FIFO, length can only be queried once

View file

@ -81,7 +81,9 @@ class XBeeSerial: public ISerial {
*/ */
int16_t setPanId(const char* panID); int16_t setPanId(const char* panID);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
bool enterCmdMode(); bool enterCmdMode();
}; };
@ -170,7 +172,9 @@ class XBee {
*/ */
int16_t setPanId(uint8_t* panID); int16_t setPanId(uint8_t* panID);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
Module* _mod; Module* _mod;
uint8_t _frameID; uint8_t _frameID;
size_t _frameLength; size_t _frameLength;

View file

@ -408,7 +408,9 @@ class nRF24: public PhysicalLayer {
*/ */
size_t getPacketLength(bool update = true); size_t getPacketLength(bool update = true);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
Module* _mod; Module* _mod;
uint8_t _addrWidth; uint8_t _addrWidth;

View file

@ -58,7 +58,9 @@ class HTTPClient {
*/ */
int16_t post(const char* url, const char* content, String& response, const char* contentType = "text/plain"); int16_t post(const char* url, const char* content, String& response, const char* contentType = "text/plain");
#ifndef RADIOLIB_GODMODE
private: private:
#endif
TransportLayer* _tl; TransportLayer* _tl;
uint16_t _port; uint16_t _port;

View file

@ -127,7 +127,9 @@ class MQTTClient {
*/ */
int16_t check(void (*func)(const char*, const char*)); int16_t check(void (*func)(const char*, const char*));
#ifndef RADIOLIB_GODMODE
private: private:
#endif
TransportLayer* _tl; TransportLayer* _tl;
uint16_t _port; uint16_t _port;

View file

@ -67,7 +67,9 @@ class MorseClient {
size_t println(unsigned long, int = DEC); size_t println(unsigned long, int = DEC);
size_t println(double, int = 2); size_t println(double, int = 2);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
PhysicalLayer* _phy; PhysicalLayer* _phy;
uint32_t _base; uint32_t _base;
uint16_t _dotLength; uint16_t _dotLength;

View file

@ -215,7 +215,9 @@ class PhysicalLayer {
*/ */
virtual size_t getPacketLength(bool update = true) = 0; virtual size_t getPacketLength(bool update = true) = 0;
#ifndef RADIOLIB_GODMODE
private: private:
#endif
float _crystalFreq; float _crystalFreq;
uint8_t _divExponent; uint8_t _divExponent;
size_t _maxPacketLength; size_t _maxPacketLength;

View file

@ -57,7 +57,9 @@ class ITA2String {
*/ */
uint8_t* byteArr(); uint8_t* byteArr();
#ifndef RADIOLIB_GODMODE
private: private:
#endif
#ifdef RADIOLIB_STATIC_ONLY #ifdef RADIOLIB_STATIC_ONLY
char _str[RADIOLIB_STATIC_ARRAY_SIZE]; char _str[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
@ -141,7 +143,9 @@ class RTTYClient {
size_t println(unsigned long, int = DEC); size_t println(unsigned long, int = DEC);
size_t println(double, int = 2); size_t println(double, int = 2);
#ifndef RADIOLIB_GODMODE
private: private:
#endif
PhysicalLayer* _phy; PhysicalLayer* _phy;
uint8_t _encoding; uint8_t _encoding;