OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Radio Class Reference

#include <Radio.h>

Public Member Functions

String name ()
 
virtual bool init ()
 virtual, to be overridden by each plugin More...
 
virtual bool rx ()
 virtual, to be overridden by each plugin More...
 
virtual bool tx ()
 virtual, to be overridden by each plugin More...
 
virtual bool standby ()
 virtual, to be overridden by each plugin More...
 
void radiolibInit ()
 Sets up the SPI port, inits a RadioLib Module, outputs diagnostics wrt RadioLib parameters like freq and bandwidth. More...
 
void showRadiolibResult (const int result, const char *action)
 Serial output of the command as a string and the RadioLib result value. More...
 
int thresholdSetup (const int fixed, const int average, const int peak)
 RadioLib-specific picking of one of three constants based on threshold_type setting. More...
 

Static Public Member Functions

static bool add (const char *name, Radio *pointer)
 Registers an instance of Radio, i.e. a radio plugin in the static store More...
 
static bool setup ()
 Shows loaded plugins, selects the radio in setting radio and inits it. More...
 
static bool select (const String &name)
 Selects radio given a name by storing its pointer in static current More...
 
static String list (String separator=", ")
 Returns a String with alist of registered radio plugins. More...
 
static bool radio_init ()
 Static, called as Radio::radio_init(), will call overridden init() in plugin. More...
 
static bool radio_rx ()
 Static, called as Radio::radio_rx(), will call overridden rx() in plugin. More...
 
static bool radio_tx ()
 Static, called as Radio::radio_tx(), will call overridden tx() in plugin. More...
 
static bool radio_standby ()
 Static, called as Radio::radio_standby(), will call overridden standby() in plugin. More...
 

Public Attributes

Module * radioLibModule
 
SPIClass * spi
 
int pin_cs
 
float frequency
 
float bandwidth
 
float bitrate
 
int threshold_type_fixed
 
int threshold_type_peak
 
int threshold_type_average
 
int threshold_type_int
 
int threshold_level
 
Radiopointer
 
char name [MAX_RADIO_NAME_LEN]
 Returns the name of the plugin as a String. More...
 

Static Public Attributes

struct {
   Radio *   pointer
 
   char   name [MAX_RADIO_NAME_LEN]
 
store [MAX_RADIOS]
 
static Radiocurrent = nullptr
 
static int len = 0
 
static int pin_rx
 
static int pin_tx
 

Detailed Description

Definition at line 56 of file Radio.h.

Member Function Documentation

◆ add()

bool Radio::add ( const char *  name,
Radio pointer 
)
static

Registers an instance of Radio, i.e. a radio plugin in the static store

Parameters
name(char*) Name of plugin, maximum MAX_RADIO_NAME_LEN characters
pointerPointer to the plugin instance
Returns
false if store already holds info on MAX_RADIOS plugins

Definition at line 18 of file Radio.cpp.

◆ setup()

bool Radio::setup ( )
static

Shows loaded plugins, selects the radio in setting radio and inits it.

Returns
false if no radio could be selected, whatever radio_init() returned oterwise

Definition at line 33 of file Radio.cpp.

◆ select()

bool Radio::select ( const String &  name)
static

Selects radio given a name by storing its pointer in static current

Parameters
nameName of plugin t be selected
Returns
true if that radio exists.

Definition at line 45 of file Radio.cpp.

◆ list()

String Radio::list ( String  separator = ", ")
static

Returns a String with alist of registered radio plugins.

Parameters
separatorBetween the names, e.g. ", "
Returns
The list

Definition at line 60 of file Radio.cpp.

◆ radio_init()

bool Radio::radio_init ( )
static

Static, called as Radio::radio_init(), will call overridden init() in plugin.

Returns
whatever plugin's init() returns, or false if no radio is selected

Definition at line 83 of file Radio.cpp.

◆ radio_rx()

bool Radio::radio_rx ( )
static

Static, called as Radio::radio_rx(), will call overridden rx() in plugin.

Returns
whatever plugin's rx() returns, or false if no radio is selected or no pin_rx set

Definition at line 93 of file Radio.cpp.

◆ radio_tx()

bool Radio::radio_tx ( )
static

Static, called as Radio::radio_tx(), will call overridden tx() in plugin.

Returns
whatever plugin's tx() returns, or false if no radio is selected or no pin_tx set

Definition at line 106 of file Radio.cpp.

◆ radio_standby()

bool Radio::radio_standby ( )
static

Static, called as Radio::radio_standby(), will call overridden standby() in plugin.

Returns
whatever plugin's standby() returns, or false if no radio is selected.

Definition at line 120 of file Radio.cpp.

◆ name()

String Radio::name ( )

◆ init()

bool Radio::init ( )
virtual

virtual, to be overridden by each plugin

Returns
false if not overridden

Definition at line 128 of file Radio.cpp.

◆ rx()

bool Radio::rx ( )
virtual

virtual, to be overridden by each plugin

Returns
false if not overridden

Definition at line 134 of file Radio.cpp.

◆ tx()

bool Radio::tx ( )
virtual

virtual, to be overridden by each plugin

Returns
false if not overridden

Definition at line 140 of file Radio.cpp.

◆ standby()

bool Radio::standby ( )
virtual

virtual, to be overridden by each plugin

Returns
false if not overridden

Definition at line 146 of file Radio.cpp.

◆ radiolibInit()

void Radio::radiolibInit ( )

Sets up the SPI port, inits a RadioLib Module, outputs diagnostics wrt RadioLib parameters like freq and bandwidth.

Definition at line 153 of file Radio.cpp.

◆ showRadiolibResult()

void Radio::showRadiolibResult ( const int  result,
const char *  action 
)

Serial output of the command as a string and the RadioLib result value.

Parameters
resultthe numeric value from RadioLib
actionThe command that was executed as a char*

Definition at line 193 of file Radio.cpp.

◆ thresholdSetup()

int Radio::thresholdSetup ( const int  fixed,
const int  average,
const int  peak 
)

RadioLib-specific picking of one of three constants based on threshold_type setting.

Parameters
fixedconstant to mean fixed threshold
averageconstant to mean average threshold
peakconstant to mean peak threshold
Returns
one of these constants, based on what's in threshold_type setting

Definition at line 213 of file Radio.cpp.

Member Data Documentation

◆ pointer

Radio* Radio::pointer

Definition at line 59 of file Radio.h.

◆ name

String Radio::name

Returns the name of the plugin as a String.

Returns
Name of plugin

Definition at line 60 of file Radio.h.

◆ 

struct { ... } Radio::store[MAX_RADIOS]

◆ current

Radio * Radio::current = nullptr
static

Definition at line 62 of file Radio.h.

◆ len

int Radio::len = 0
static

Definition at line 63 of file Radio.h.

◆ pin_rx

int Radio::pin_rx
static

Definition at line 64 of file Radio.h.

◆ pin_tx

int Radio::pin_tx
static

Definition at line 65 of file Radio.h.

◆ radioLibModule

Module* Radio::radioLibModule

Definition at line 81 of file Radio.h.

◆ spi

SPIClass* Radio::spi

Definition at line 82 of file Radio.h.

◆ pin_cs

int Radio::pin_cs

Definition at line 83 of file Radio.h.

◆ frequency

float Radio::frequency

Definition at line 84 of file Radio.h.

◆ bandwidth

float Radio::bandwidth

Definition at line 85 of file Radio.h.

◆ bitrate

float Radio::bitrate

Definition at line 86 of file Radio.h.

◆ threshold_type_fixed

int Radio::threshold_type_fixed

Definition at line 87 of file Radio.h.

◆ threshold_type_peak

int Radio::threshold_type_peak

Definition at line 88 of file Radio.h.

◆ threshold_type_average

int Radio::threshold_type_average

Definition at line 89 of file Radio.h.

◆ threshold_type_int

int Radio::threshold_type_int

Definition at line 90 of file Radio.h.

◆ threshold_level

int Radio::threshold_level

Definition at line 91 of file Radio.h.


The documentation for this class was generated from the following files: