OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
Main Page
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Classes
Class List
Class Members
All
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
z
Functions
a
b
f
g
i
l
m
n
o
p
r
s
t
u
v
z
Variables
a
b
c
d
e
f
g
i
l
m
n
p
r
s
t
Files
File List
File Members
All
a
b
c
d
e
f
g
i
m
o
p
q
r
s
u
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
a
c
d
e
i
m
o
p
q
r
s
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
src
Radio.h
Go to the documentation of this file.
1
#
ifndef
_RADIO_H_
2
#
define
_RADIO_H_
3
4
#
include
<
Arduino
.
h
>
5
#
include
<
RadioLib
.
h
>
6
#
include
<
SPI
.
h
>
7
#
include
"config.h"
8
#
include
"tools.h"
9
10
#
define
RADIO_PLUGIN_START
11
namespace
ook
{
12
namespace
CONCAT
(
radio_
,
PLUGIN_NAME
)
{
13
class
RadioPlugin
:
public
Radio
{
14
public
:
15
16
#
define
RADIO_PLUGIN_END
17
}
;
18
struct
AutoRegister
{
19
AutoRegister
(
)
{
20
static
RadioPlugin
radioPlugin
;
21
Radio
::
add
(
QUOTE
(
PLUGIN_NAME
)
,
static_cast
<
Radio
*
>
(
&
radioPlugin
)
)
;
22
}
23
}
autoRegister
;
24
}
25
}
26
27
#
define
CHECK_RADIO_SET
28
if
(
current
==
nullptr
)
{
29
ERROR
(
"ERROR: No radio selected.\n"
)
;
30
return
false
;
31
}
32
33
#
define
PIN_MODE
(
x
,
y
)
if
(
x
!=
-
1
)
pinMode
(
x
,
y
)
;
34
#
define
PIN_WRITE
(
x
,
y
)
if
(
x
!=
-
1
)
digitalWrite
(
x
,
y
)
;
35
#
define
PIN_INPUT
(
x
)
if
(
x
!=
-
1
)
pinMode
(
x
,
INPUT
)
36
#
define
PIN_OUTPUT
(
x
)
if
(
x
!=
-
1
)
pinMode
(
x
,
OUTPUT
)
37
#
define
PIN_HIGH
(
x
)
if
(
x
!=
-
1
)
{
pinMode
(
x
,
OUTPUT
)
;
digitalWrite
(
x
,
HIGH
)
;
}
38
#
define
PIN_LOW
(
x
)
if
(
x
!=
-
1
)
{
pinMode
(
x
,
OUTPUT
)
;
digitalWrite
(
x
,
LOW
)
;
}
39
40
41
#
define
RADIO_DO
(
action
)
{
42
int
res
=
radio
->
action
;
43
showRadiolibResult
(
res
,
#
action
)
;
44
if
(
res
!=
0
)
return
false
;
45
}
46
47
#
define
MODULE_DO
(
action
)
{
48
int
res
=
radioLibModule
->
action
;
49
showRadiolibResult
(
res
,
#
action
)
;
50
if
(
res
!=
0
)
return
false
;
51
}
52
53
54
// Device::store cannot become an std::vector because of the auto-register trick.
55
56
class
Radio
{
57
public
:
58
static
struct
{
59
Radio
*
pointer
;
60
char
name
[
MAX_RADIO_NAME_LEN
];
61
} store[
MAX_RADIOS
];
62
static
Radio
*
current
;
63
static
int
len
;
64
static
int
pin_rx
;
65
static
int
pin_tx
;
66
static
bool
add
(
const
char
* name,
Radio
*pointer);
67
static
bool
setup
();
68
static
bool
select
(
const
String &name);
69
static
String
list
(
String
separator
=
", "
);
70
static
bool
radio_init
();
71
static
bool
radio_rx
();
72
static
bool
radio_tx
();
73
static
bool
radio_standby
();
74
String
name
();
75
virtual
bool
init
();
76
virtual
bool
rx
();
77
virtual
bool
tx
();
78
virtual
bool
standby
();
79
80
// radiolib-specific
81
Module
*
radioLibModule
;
82
SPIClass
*
spi
;
83
int
pin_cs
;
84
float
frequency
;
85
float
bandwidth
;
86
float
bitrate
;
87
int
threshold_type_fixed
;
88
int
threshold_type_peak
;
89
int
threshold_type_average
;
90
int
threshold_type_int
;
91
int
threshold_level
;
92
void
radiolibInit
();
93
void
showRadiolibResult
(
const
int
result,
const
char
* action);
94
int
thresholdSetup
(
const
int
fixed,
const
int
average,
const
int
peak);
95
};
96
97
#
endif
Generated by
1.9.1