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 #pragma message("\nRadioLib Debug Info\nVersion " \
59 RADIOLIB_VALUE(RADIOLIB_VERSION_MAJOR) "." \
60 RADIOLIB_VALUE(RADIOLIB_VERSION_MINOR) "." \
61 RADIOLIB_VALUE(RADIOLIB_VERSION_PATCH) "." \
62 RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\n" \
63 "Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "\n" \
64 "Compiled: " RADIOLIB_VALUE(__DATE__) " " RADIOLIB_VALUE(__TIME__) \
65 )
66 #endif
67
68 // check unknown/unsupported platform
69 #if defined(RADIOLIB_UNKNOWN_PLATFORM)
70 #warning "RadioLib might not be compatible with this Arduino board - check supported platforms at https://github.com/jgromes/RadioLib!"
71 #endif
72
73 #include "modules/CC1101/CC1101.h"
74 #include "modules/LLCC68/LLCC68.h"
75 #include "modules/nRF24/nRF24.h"
76 #include "modules/RF69/RF69.h"
77 #include "modules/RFM2x/RFM22.h"
78 #include "modules/RFM2x/RFM23.h"
79 #include "modules/Si443x/Si4430.h"
80 #include "modules/Si443x/Si4431.h"
81 #include "modules/Si443x/Si4432.h"
82 #include "modules/SX1231/SX1231.h"
83 #include "modules/SX126x/SX1261.h"
84 #include "modules/SX126x/SX1262.h"
85 #include "modules/SX126x/SX1268.h"
86 #include "modules/SX126x/STM32WLx.h"
87 #include "modules/SX127x/SX1272.h"
88 #include "modules/SX127x/SX1273.h"
89 #include "modules/SX127x/SX1276.h"
90 #include "modules/SX127x/SX1277.h"
91 #include "modules/SX127x/SX1278.h"
92 #include "modules/SX127x/SX1279.h"
93 #include "modules/SX128x/SX1280.h"
94 #include "modules/SX128x/SX1281.h"
95 #include "modules/SX128x/SX1282.h"
96
97 // physical layer protocols
98 #include "protocols/PhysicalLayer/PhysicalLayer.h"
99 #include "protocols/AFSK/AFSK.h"
100 #include "protocols/AX25/AX25.h"
101 #include "protocols/Hellschreiber/Hellschreiber.h"
102 #include "protocols/Morse/Morse.h"
103 #include "protocols/Pager/Pager.h"
104 #include "protocols/RTTY/RTTY.h"
105 #include "protocols/SSTV/SSTV.h"
106 #include "protocols/FSK4/FSK4.h"
107 #include "protocols/APRS/APRS.h"
108 #include "protocols/ExternalRadio/ExternalRadio.h"
109 #include "protocols/Print/Print.h"
110 #include "protocols/BellModem/BellModem.h"
111 #include "protocols/LoRaWAN/LoRaWAN.h"
112
113 // utilities
114 #include "utils/CRC.h"
115 #include "utils/Cryptography.h"
116
117 // only create Radio class when using RadioShield
118 #if defined(RADIOLIB_RADIOSHIELD)
119
120 // RadioShield pin definitions
121 #define RADIOSHIELD_CS_A 10
122 #define RADIOSHIELD_IRQ_A 2
123 #define RADIOSHIELD_RST_A 9
124 #define RADIOSHIELD_GPIO_A 8
125 #define RADIOSHIELD_CS_B 5
126 #define RADIOSHIELD_IRQ_B 3
127 #define RADIOSHIELD_RST_B 7
128 #define RADIOSHIELD_GPIO_B 6
129
136 class Radio {
137 public:
138
139 Module* ModuleA;
140 Module* ModuleB;
141
145 Radio() {
146 ModuleA = new Module(RADIOSHIELD_CS_A, RADIOSHIELD_IRQ_A, RADIOSHIELD_RST_A, RADIOSHIELD_GPIO_A);
147 ModuleB = new Module(RADIOSHIELD_CS_B, RADIOSHIELD_IRQ_B, RADIOSHIELD_RST_B, RADIOSHIELD_GPIO_B);
148 }
149
150 #if defined(RADIOLIB_GODMODE)
151 private:
152 #endif
153
154 };
155
156 Radio RadioShield;
157 #endif
158
159 #endif
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31