RadioLib Universal wireless communication library for Arduino

RadioLib.h
1 #if !defined(_RADIOLIB_H)
2 #define _RADIOLIB_H
3
38 #include "TypeDef.h"
39 #include "Module.h"
40
41 #include "Hal.h"
42 #if defined(RADIOLIB_BUILD_ARDUINO)
43 #include "ArduinoHal.h"
44 #endif
45
46
47 // warnings are printed in this file since BuildOpt.h is compiled in multiple places
48
49 // check God mode
50 #if defined(RADIOLIB_GODMODE)
51 #warning "God mode active, I hope it was intentional. Buckle up, lads."
52 #endif
53
54 // print debug info
55 #if defined(RADIOLIB_DEBUG)
56 #define RADIOLIB_VALUE_TO_STRING(x) #x
57 #define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
58 #define RADIOLIB_VAR_NAME_VALUE(var) #var "=" RADIOLIB_VALUE(var)
59 #pragma message(RADIOLIB_VAR_NAME_VALUE(RADIOLIB_PLATFORM))
60 #pragma message(RADIOLIB_VAR_NAME_VALUE(RADIOLIB_VERSION_MAJOR))
61 #pragma message(RADIOLIB_VAR_NAME_VALUE(RADIOLIB_VERSION_MINOR))
62 #pragma message(RADIOLIB_VAR_NAME_VALUE(RADIOLIB_VERSION_PATCH))
63 #pragma message(RADIOLIB_VAR_NAME_VALUE(RADIOLIB_VERSION_EXTRA))
64 #endif
65
66 // check unknown/unsupported platform
67 #if defined(RADIOLIB_UNKNOWN_PLATFORM)
68 #warning "RadioLib might not be compatible with this Arduino board - check supported platforms at https://github.com/jgromes/RadioLib!"
69 #endif
70
71 #include "modules/CC1101/CC1101.h"
72 #include "modules/LLCC68/LLCC68.h"
73 #include "modules/nRF24/nRF24.h"
74 #include "modules/RF69/RF69.h"
75 #include "modules/RFM2x/RFM22.h"
76 #include "modules/RFM2x/RFM23.h"
77 #include "modules/RFM9x/RFM95.h"
78 #include "modules/RFM9x/RFM96.h"
79 #include "modules/RFM9x/RFM97.h"
80 #include "modules/Si443x/Si4430.h"
81 #include "modules/Si443x/Si4431.h"
82 #include "modules/Si443x/Si4432.h"
83 #include "modules/SX1231/SX1231.h"
84 #include "modules/SX126x/SX1261.h"
85 #include "modules/SX126x/SX1262.h"
86 #include "modules/SX126x/SX1268.h"
87 #include "modules/SX126x/STM32WLx.h"
88 #include "modules/SX127x/SX1272.h"
89 #include "modules/SX127x/SX1273.h"
90 #include "modules/SX127x/SX1276.h"
91 #include "modules/SX127x/SX1277.h"
92 #include "modules/SX127x/SX1278.h"
93 #include "modules/SX127x/SX1279.h"
94 #include "modules/SX128x/SX1280.h"
95 #include "modules/SX128x/SX1281.h"
96 #include "modules/SX128x/SX1282.h"
97
98 // physical layer protocols
99 #include "protocols/PhysicalLayer/PhysicalLayer.h"
100 #include "protocols/AFSK/AFSK.h"
101 #include "protocols/AX25/AX25.h"
102 #include "protocols/Hellschreiber/Hellschreiber.h"
103 #include "protocols/Morse/Morse.h"
104 #include "protocols/Pager/Pager.h"
105 #include "protocols/RTTY/RTTY.h"
106 #include "protocols/SSTV/SSTV.h"
107 #include "protocols/FSK4/FSK4.h"
108 #include "protocols/APRS/APRS.h"
109 #include "protocols/ExternalRadio/ExternalRadio.h"
110
111 // only create Radio class when using RadioShield
112 #if defined(RADIOLIB_RADIOSHIELD)
113
114 // RadioShield pin definitions
115 #define RADIOSHIELD_CS_A 10
116 #define RADIOSHIELD_IRQ_A 2
117 #define RADIOSHIELD_RST_A 9
118 #define RADIOSHIELD_GPIO_A 8
119 #define RADIOSHIELD_CS_B 5
120 #define RADIOSHIELD_IRQ_B 3
121 #define RADIOSHIELD_RST_B 7
122 #define RADIOSHIELD_GPIO_B 6
123
130 class Radio {
131 public:
132
133 Module* ModuleA;
134 Module* ModuleB;
135
139 Radio() {
140 ModuleA = new Module(RADIOSHIELD_CS_A, RADIOSHIELD_IRQ_A, RADIOSHIELD_RST_A, RADIOSHIELD_GPIO_A);
141 ModuleB = new Module(RADIOSHIELD_CS_B, RADIOSHIELD_IRQ_B, RADIOSHIELD_RST_B, RADIOSHIELD_GPIO_B);
142 }
143
144 #if defined(RADIOLIB_GODMODE)
145 private:
146 #endif
147
148 };
149
150 Radio RadioShield;
151 #endif
152
153 #endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:28