OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
Classes | Macros
Radio.h File Reference
#include <Arduino.h>
#include <RadioLib.h>
#include <SPI.h>
#include "config.h"
#include "tools.h"

Go to the source code of this file.

Classes

class  Radio
 

Macros

#define RADIO_PLUGIN_START
 
#define RADIO_PLUGIN_END
 
#define CHECK_RADIO_SET
 
#define PIN_MODE(x, y)   if (x != -1) pinMode(x, y);
 
#define PIN_WRITE(x, y)   if (x != -1) digitalWrite(x, y);
 
#define PIN_INPUT(x)   if (x != -1) pinMode(x, INPUT)
 
#define PIN_OUTPUT(x)   if (x != -1) pinMode(x, OUTPUT)
 
#define PIN_HIGH(x)   if (x != -1) { pinMode(x, OUTPUT); digitalWrite(x, HIGH); }
 
#define PIN_LOW(x)   if (x != -1) { pinMode(x, OUTPUT); digitalWrite(x, LOW); }
 
#define RADIO_DO(action)
 
#define MODULE_DO(action)
 

Macro Definition Documentation

◆ RADIO_PLUGIN_START

#define RADIO_PLUGIN_START
Value:
namespace ook {\
namespace CONCAT(radio_, PLUGIN_NAME) {\
class RadioPlugin : public Radio {\
public:
Definition: Radio.h:56
#define CONCAT(x, y)
Definition: tools.h:9

Definition at line 10 of file Radio.h.

◆ RADIO_PLUGIN_END

#define RADIO_PLUGIN_END
Value:
};\
struct AutoRegister {\
AutoRegister() {\
static RadioPlugin radioPlugin;\
Radio::add(QUOTE(PLUGIN_NAME), static_cast<Radio*>(&radioPlugin));\
}\
} autoRegister;\
}\
}
static bool add(const char *name, Radio *pointer)
Registers an instance of Radio, i.e. a radio plugin in the static store
Definition: Radio.cpp:18
#define QUOTE(x)
Definition: tools.h:7

Definition at line 16 of file Radio.h.

◆ CHECK_RADIO_SET

#define CHECK_RADIO_SET
Value:
if (current == nullptr) {\
ERROR("ERROR: No radio selected.\n");\
return false;\
}

Definition at line 27 of file Radio.h.

◆ PIN_MODE

#define PIN_MODE (   x,
 
)    if (x != -1) pinMode(x, y);

Definition at line 33 of file Radio.h.

◆ PIN_WRITE

#define PIN_WRITE (   x,
 
)    if (x != -1) digitalWrite(x, y);

Definition at line 34 of file Radio.h.

◆ PIN_INPUT

#define PIN_INPUT (   x)    if (x != -1) pinMode(x, INPUT)

Definition at line 35 of file Radio.h.

◆ PIN_OUTPUT

#define PIN_OUTPUT (   x)    if (x != -1) pinMode(x, OUTPUT)

Definition at line 36 of file Radio.h.

◆ PIN_HIGH

#define PIN_HIGH (   x)    if (x != -1) { pinMode(x, OUTPUT); digitalWrite(x, HIGH); }

Definition at line 37 of file Radio.h.

◆ PIN_LOW

#define PIN_LOW (   x)    if (x != -1) { pinMode(x, OUTPUT); digitalWrite(x, LOW); }

Definition at line 38 of file Radio.h.

◆ RADIO_DO

#define RADIO_DO (   action)
Value:
{\
int res = radio->action;\
showRadiolibResult(res, #action);\
if (res != 0) return false;\
}

Definition at line 41 of file Radio.h.

◆ MODULE_DO

#define MODULE_DO (   action)
Value:
{\
int res = radioLibModule->action;\
showRadiolibResult(res, #action);\
if (res != 0) return false;\
}

Definition at line 47 of file Radio.h.