-
Notifications
You must be signed in to change notification settings - Fork 398
God Mode
Sometimes, it is useful to have direct access to the low-level SPI communication between RadioLib and the radio module. However, this access is potentially dangerous, as it allows the user to manipulate the module in ways RadioLib is not expecting. Because of that, this low-level SPI interface is not accessible by default and to access it, the user has to enable a privileged access mode - either low-level mode, or full God mode.
USAGE OF THE METHODS SHOWN HERE HAS THE POTENTIAL TO PERMANENTLY DAMAGE YOUR RADIO MODULE!
It should also be noted that none of these access macros should be used in production, only for debugging. If something in RadioLib isn't interfacing well with your application, and you find yourself using low level access often, feel free to suggest a change in the Issues or Discussions.
This mode can be enabled by adding the macro #define RADIOLIB_LOW_LEVEL (1)
to BuildOptUser.h, or defining it somewhere else in the build system.
In this mode, RadioLib modules will expose a Module* getMod()
method, that can be used to directly access the SPI methods:
SX1278 radio = new Module(10, 2, 3, 5);
(...)
radio.begin();
(...)
Module* mod = radio.getMod();
uint8_t value = mod->SPIreadRegister(0x12); // should only be called after radio.begin(), as SPI gets initialized there
Similar to low-level mode, God mode is enabled by #define RADIOLIB_GODMODE (1)
. In this mode, all methods and member variables of all RadioLib classes will be made public
and so will be exposed to the user. This allows direct manipulation of the library internals.