diff --git a/_build_opt_8h_source.html b/_build_opt_8h_source.html index 846db747..6ad15fef 100644 --- a/_build_opt_8h_source.html +++ b/_build_opt_8h_source.html @@ -84,7 +84,7 @@ $(document).ready(function(){initNavTree('_build_opt_8h_source.html','');});
BuildOpt.h
-
1 #ifndef _RADIOLIB_BUILD_OPTIONS_H
2 #define _RADIOLIB_BUILD_OPTIONS_H
3 
4 #if ARDUINO >= 100
5  #include "Arduino.h"
6 #else
7  #error "Unsupported Arduino version (< 1.0.0)"
8 #endif
9 
10 /*
11  * Platform-specific configuration.
12  *
13  * RADIOLIB_PLATFORM - platform name, used in debugging to quickly check the correct platform is detected.
14  * RADIOLIB_PIN_TYPE - which type should be used for pin numbers in functions like digitalRead().
15  * RADIOLIB_PIN_MODE - which type should be used for pin modes in functions like pinMode().
16  * RADIOLIB_PIN_STATUS - which type should be used for pin values in functions like digitalWrite().
17  * RADIOLIB_INTERRUPT_STATUS - which type should be used for pin changes in functions like attachInterrupt().
18  * RADIOLIB_DIGITAL_PIN_TO_INTERRUPT - function/macro to be used to convert digital pin number to interrupt pin number.
19  * RADIOLIB_NC - alias for unused pin, usually the largest possible value of RADIOLIB_PIN_TYPE.
20  * RADIOLIB_DEFAULT_SPI - default SPIClass instance to use.
21  * RADIOLIB_PROGMEM - macro to place variable into program storage (usually Flash).
22  * RADIOLIB_PROGMEM_READ_BYTE - function/macro to read variables saved in program storage (usually Flash).
23  * RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED - defined if the specific platform does not support SoftwareSerial.
24  * RADIOLIB_HARDWARE_SERIAL_PORT - which hardware serial port should be used on platform that do not have SoftwareSerial support.
25  * RADIOLIB_TONE_UNSUPPORTED - some platforms do not have tone()/noTone(), which is required for AFSK.
26  *
27  * In addition, some platforms may require RadioLib to disable specific drivers (such as ESP8266).
28  *
29  * Users may also specify their own configuration by uncommenting the RADIOLIB_CUSTOM_PLATFORM,
30  * and then specifying all platform parameters in the section below. This will override automatic
31  * platform detection.
32  */
33 
34 // uncomment to enable custom platform definition
35 //#define RADIOLIB_CUSTOM_PLATFORM
36 
37 #if defined(RADIOLIB_CUSTOM_PLATFORM)
38  // name for your platform
39  #define RADIOLIB_PLATFORM "Custom"
40 
41  // the following parameters must always be defined
42  #define RADIOLIB_PIN_TYPE uint8_t
43  #define RADIOLIB_PIN_MODE uint8_t
44  #define RADIOLIB_PIN_STATUS uint8_t
45  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
46  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
47  #define RADIOLIB_NC (0xFF)
48  #define RADIOLIB_DEFAULT_SPI SPI
49  #define RADIOLIB_PROGMEM PROGMEM
50  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
51 
52  // the following must be defined if the Arduino core does not support SoftwareSerial library
53  //#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
54  //#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
55 
56  // the following must be defined if the Arduino core does not support tone function
57  //#define RADIOLIB_TONE_UNSUPPORTED
58 
59  // some of RadioLib drivers may be excluded, to prevent collisions with platforms (or to speed up build process)
60  // the following is a complete list of all possible exclusion macros, uncomment any of them to disable that driver
61  // NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69
62  // while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional,
63  // so excluding SX1231 and keeping RF69 is valid.
64  //#define RADIOLIB_EXCLUDE_CC1101
65  //#define RADIOLIB_EXCLUDE_ESP8266
66  //#define RADIOLIB_EXCLUDE_HC05
67  //#define RADIOLIB_EXCLUDE_JDY08
68  //#define RADIOLIB_EXCLUDE_NRF24
69  //#define RADIOLIB_EXCLUDE_RF69
70  //#define RADIOLIB_EXCLUDE_SX1231 // dependent on RADIOLIB_EXCLUDE_RF69
71  //#define RADIOLIB_EXCLUDE_SI443X
72  //#define RADIOLIB_EXCLUDE_RFM2X // dependent on RADIOLIB_EXCLUDE_SI443X
73  //#define RADIOLIB_EXCLUDE_SX127X
74  //#define RADIOLIB_EXCLUDE_RFM9X // dependent on RADIOLIB_EXCLUDE_SX127X
75  //#define RADIOLIB_EXCLUDE_SX126X
76  //#define RADIOLIB_EXCLUDE_SX128X
77  //#define RADIOLIB_EXCLUDE_XBEE
78  //#define RADIOLIB_EXCLUDE_AFSK
79  //#define RADIOLIB_EXCLUDE_AX25
80  //#define RADIOLIB_EXCLUDE_HELLSCHREIBER
81  //#define RADIOLIB_EXCLUDE_HTTP
82  //#define RADIOLIB_EXCLUDE_MORSE
83  //#define RADIOLIB_EXCLUDE_MQTT
84  //#define RADIOLIB_EXCLUDE_RTTY
85  //#define RADIOLIB_EXCLUDE_SSTV
86 
87 #else
88  #if defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR))
89  // Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
90  #define RADIOLIB_PLATFORM "Arduino AVR"
91  #define RADIOLIB_PIN_TYPE uint8_t
92  #define RADIOLIB_PIN_MODE uint8_t
93  #define RADIOLIB_PIN_STATUS uint8_t
94  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
95  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
96  #define RADIOLIB_NC (0xFF)
97  #define RADIOLIB_DEFAULT_SPI SPI
98  #define RADIOLIB_PROGMEM PROGMEM
99  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
100 
101  #elif defined(ESP8266)
102  // ESP8266 boards
103  #define RADIOLIB_PLATFORM "ESP8266"
104  #define RADIOLIB_PIN_TYPE uint8_t
105  #define RADIOLIB_PIN_MODE uint8_t
106  #define RADIOLIB_PIN_STATUS uint8_t
107  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
108  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
109  #define RADIOLIB_NC (0xFF)
110  #define RADIOLIB_DEFAULT_SPI SPI
111  #define RADIOLIB_PROGMEM PROGMEM
112  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
113 
114  // RadioLib has ESP8266 driver, this must be disabled to use ESP8266 as platform
115  #define RADIOLIB_EXCLUDE_ESP8266
116 
117  #elif defined(ESP32)
118  // ESP32 boards
119  #define RADIOLIB_PLATFORM "ESP32"
120  #define RADIOLIB_PIN_TYPE uint8_t
121  #define RADIOLIB_PIN_MODE uint8_t
122  #define RADIOLIB_PIN_STATUS uint8_t
123  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
124  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
125  #define RADIOLIB_NC (0xFF)
126  #define RADIOLIB_DEFAULT_SPI SPI
127  #define RADIOLIB_PROGMEM PROGMEM
128  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
129  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
130  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
131 
132  // ESP32 doesn't support tone(), but it can be emulated via LED control peripheral
133  #define RADIOLIB_TONE_UNSUPPORTED
134  #define RADIOLIB_TONE_ESP32_CHANNEL (1)
135 
136  #elif defined(ARDUINO_ARCH_STM32)
137  // official STM32 Arduino core (https://github.com/stm32duino/Arduino_Core_STM32)
138  #define RADIOLIB_PLATFORM "Arduino STM32 (official)"
139  #define RADIOLIB_PIN_TYPE uint32_t
140  #define RADIOLIB_PIN_MODE uint32_t
141  #define RADIOLIB_PIN_STATUS uint32_t
142  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
143  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
144  #define RADIOLIB_NC (0xFFFFFFFF)
145  #define RADIOLIB_DEFAULT_SPI SPI
146  #define RADIOLIB_PROGMEM PROGMEM
147  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
148  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
149  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
150 
151  // slow down SX126x/8x SPI on this platform
152  #define RADIOLIB_SPI_SLOWDOWN
153 
154  #elif defined(SAMD_SERIES)
155  // Adafruit SAMD boards (M0 and M4)
156  #define RADIOLIB_PLATFORM "Adafruit SAMD"
157  #define RADIOLIB_PIN_TYPE uint32_t
158  #define RADIOLIB_PIN_MODE uint32_t
159  #define RADIOLIB_PIN_STATUS uint32_t
160  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
161  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
162  #define RADIOLIB_NC (0xFFFFFFFF)
163  #define RADIOLIB_DEFAULT_SPI SPI
164  #define RADIOLIB_PROGMEM PROGMEM
165  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
166  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
167  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
168 
169  // slow down SX126x/8x SPI on this platform
170  #define RADIOLIB_SPI_SLOWDOWN
171 
172  #elif defined(ARDUINO_ARCH_SAMD)
173  // Arduino SAMD (Zero, MKR, etc.)
174  #define RADIOLIB_PLATFORM "Arduino SAMD"
175  #define RADIOLIB_PIN_TYPE pin_size_t
176  #define RADIOLIB_PIN_MODE PinMode
177  #define RADIOLIB_PIN_STATUS PinStatus
178  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
179  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
180  #define RADIOLIB_NC (0xFF)
181  #define RADIOLIB_DEFAULT_SPI SPI
182  #define RADIOLIB_PROGMEM PROGMEM
183  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
184  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
185  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
186 
187  #elif defined(__SAM3X8E__)
188  // Arduino Due
189  #define RADIOLIB_PLATFORM "Arduino Due"
190  #define RADIOLIB_PIN_TYPE uint32_t
191  #define RADIOLIB_PIN_MODE uint32_t
192  #define RADIOLIB_PIN_STATUS uint32_t
193  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
194  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
195  #define RADIOLIB_NC (0xFFFFFFFF)
196  #define RADIOLIB_DEFAULT_SPI SPI
197  #define RADIOLIB_PROGMEM PROGMEM
198  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
199  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
200  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
201  #define RADIOLIB_TONE_UNSUPPORTED
202 
203  #elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
204  // Adafruit nRF52 boards
205  #define RADIOLIB_PLATFORM "Adafruit nRF52"
206  #define RADIOLIB_PIN_TYPE uint32_t
207  #define RADIOLIB_PIN_MODE uint32_t
208  #define RADIOLIB_PIN_STATUS uint32_t
209  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
210  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
211  #define RADIOLIB_NC (0xFFFFFFFF)
212  #define RADIOLIB_DEFAULT_SPI SPI
213  #define RADIOLIB_PROGMEM PROGMEM
214  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
215 
216  #elif defined(ARDUINO_ARC32_TOOLS)
217  // Intel Curie
218  #define RADIOLIB_PLATFORM "Intel Curie"
219  #define RADIOLIB_PIN_TYPE uint8_t
220  #define RADIOLIB_PIN_MODE uint8_t
221  #define RADIOLIB_PIN_STATUS uint8_t
222  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
223  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
224  #define RADIOLIB_NC (0xFF)
225  #define RADIOLIB_DEFAULT_SPI SPI
226  #define RADIOLIB_PROGMEM PROGMEM
227  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
228 
229  #elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
230  // Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
231  #define RADIOLIB_PLATFORM "Arduino megaAVR"
232  #define RADIOLIB_PIN_TYPE uint8_t
233  #define RADIOLIB_PIN_MODE PinMode
234  #define RADIOLIB_PIN_STATUS PinStatus
235  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
236  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
237  #define RADIOLIB_NC (0xFF)
238  #define RADIOLIB_DEFAULT_SPI SPI
239  #define RADIOLIB_PROGMEM PROGMEM
240  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
241 
242  #elif defined(ARDUINO_ARCH_APOLLO3)
243  // Sparkfun Apollo3 boards
244  #define RADIOLIB_PLATFORM "Sparkfun Apollo3"
245  #define RADIOLIB_PIN_TYPE pin_size_t
246  #define RADIOLIB_PIN_MODE Arduino_PinMode
247  #define RADIOLIB_PIN_STATUS PinStatus
248  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
249  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
250  #define RADIOLIB_NC (0xFF)
251  #define RADIOLIB_DEFAULT_SPI SPI
252  #define RADIOLIB_PROGMEM PROGMEM
253  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
254  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
255  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
256 
257  // Apollo3 uses mbed libraries, which already contain ESP8266 driver
258  #define RADIOLIB_EXCLUDE_ESP8266
259 
260  // slow down SX126x/8x SPI on this platform
261  #define RADIOLIB_SPI_SLOWDOWN
262 
263  #elif defined(ARDUINO_ARDUINO_NANO33BLE)
264  // Arduino Nano 33 BLE
265  #define RADIOLIB_PLATFORM "Arduino Nano 33 BLE"
266  #define RADIOLIB_PIN_TYPE pin_size_t
267  #define RADIOLIB_PIN_MODE PinMode
268  #define RADIOLIB_PIN_STATUS PinStatus
269  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
270  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
271  #define RADIOLIB_NC (0xFF)
272  #define RADIOLIB_DEFAULT_SPI SPI
273  #define RADIOLIB_PROGMEM PROGMEM
274  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
275  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
276  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
277 
278  // Nano 33 BLE uses mbed libraries, which already contain ESP8266 driver
279  #define RADIOLIB_EXCLUDE_ESP8266
280 
281  #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
282  // Arduino Portenta H7
283  #define RADIOLIB_PLATFORM "Portenta H7"
284  #define RADIOLIB_PIN_TYPE pin_size_t
285  #define RADIOLIB_PIN_MODE PinMode
286  #define RADIOLIB_PIN_STATUS PinStatus
287  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
288  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
289  #define RADIOLIB_NC (0xFF)
290  #define RADIOLIB_DEFAULT_SPI SPI
291  #define RADIOLIB_PROGMEM PROGMEM
292  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
293  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
294  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
295 
296  // Arduino Portenta H7 uses mbed libraries, which already contain ESP8266 driver
297  #define RADIOLIB_EXCLUDE_ESP8266
298 
299  #elif defined(__STM32F4__) || defined(__STM32F1__)
300  // Arduino STM32 core by Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32)
301  #define RADIOLIB_PLATFORM "STM32duino (unofficial)"
302  #define RADIOLIB_PIN_TYPE uint8_t
303  #define RADIOLIB_PIN_MODE WiringPinMode
304  #define RADIOLIB_PIN_STATUS uint8_t
305  #define RADIOLIB_INTERRUPT_STATUS ExtIntTriggerMode
306  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
307  #define RADIOLIB_NC (0xFF)
308  #define RADIOLIB_DEFAULT_SPI SPI
309  #define RADIOLIB_PROGMEM PROGMEM
310  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
311  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
312  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
313 
314  #elif defined(ARDUINO_ARCH_MEGAAVR)
315  // MegaCoreX by MCUdude (https://github.com/MCUdude/MegaCoreX)
316  #define RADIOLIB_PLATFORM "MegaCoreX"
317  #define RADIOLIB_PIN_TYPE uint8_t
318  #define RADIOLIB_PIN_MODE uint8_t
319  #define RADIOLIB_PIN_STATUS uint8_t
320  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
321  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
322  #define RADIOLIB_NC (0xFF)
323  #define RADIOLIB_DEFAULT_SPI SPI
324  #define RADIOLIB_PROGMEM PROGMEM
325  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
326 
327  #else
328  // other platforms not covered by the above list - this may or may not work
329  #define RADIOLIB_PLATFORM "Unknown"
330  #define RADIOLIB_UNKNOWN_PLATFORM
331  #define RADIOLIB_PIN_TYPE uint8_t
332  #define RADIOLIB_PIN_MODE uint8_t
333  #define RADIOLIB_PIN_STATUS uint8_t
334  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
335  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
336  #define RADIOLIB_NC (0xFF)
337  #define RADIOLIB_DEFAULT_SPI SPI
338  #define RADIOLIB_PROGMEM PROGMEM
339  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
340 
341  #endif
342 #endif
343 
344 /*
345  * Uncomment to enable debug output.
346  * Warning: Debug output will slow down the whole system significantly.
347  * Also, it will result in larger compiled binary.
348  * Levels: debug - only main info
349  * verbose - full transcript of all SPI/UART communication
350  */
351 
352 //#define RADIOLIB_DEBUG
353 //#define RADIOLIB_VERBOSE
354 
355 // set which Serial port should be used for debug output
356 #define RADIOLIB_DEBUG_PORT Serial
357 
358 #if defined(RADIOLIB_DEBUG)
359  #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
360  #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
361 #else
362  #define RADIOLIB_DEBUG_PRINT(...) {}
363  #define RADIOLIB_DEBUG_PRINTLN(...) {}
364 #endif
365 
366 #if defined(RADIOLIB_VERBOSE)
367  #define RADIOLIB_VERBOSE_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
368  #define RADIOLIB_VERBOSE_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
369 #else
370  #define RADIOLIB_VERBOSE_PRINT(...) {}
371  #define RADIOLIB_VERBOSE_PRINTLN(...) {}
372 #endif
373 
374 /*
375  * Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
376  * Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
377  * Failure to heed the above warning may result in bricked module.
378  */
379 //#define RADIOLIB_GODMODE
380 
381 /*
382  * Uncomment to enable pre-defined modules when using RadioShield.
383  */
384 //#define RADIOLIB_RADIOSHIELD
385 
386 /*
387  * Uncomment to enable static-only memory management: no dynamic allocation will be performed.
388  * Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
389  */
390 
391 //#define RADIOLIB_STATIC_ONLY
392 
393 // set the size of static arrays to use
394 #if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
395 #define RADIOLIB_STATIC_ARRAY_SIZE 256
396 #endif
397 
401 #define RADIOLIB_ASSERT(STATEVAR) { if((STATEVAR) != ERR_NONE) { return(STATEVAR); } }
402 
406 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
407 
408 // version definitions
409 #define RADIOLIB_VERSION_MAJOR (0x04)
410 #define RADIOLIB_VERSION_MINOR (0x02)
411 #define RADIOLIB_VERSION_PATCH (0x00)
412 #define RADIOLIB_VERSION_EXTRA (0x00)
413 
414 #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MINOR << 16) | (RADIOLIB_VERSION_PATCH << 8) | (RADIOLIB_VERSION_EXTRA))
415 
416 #endif
+
1 #ifndef _RADIOLIB_BUILD_OPTIONS_H
2 #define _RADIOLIB_BUILD_OPTIONS_H
3 
4 #if ARDUINO >= 100
5  #include "Arduino.h"
6 #else
7  #error "Unsupported Arduino version (< 1.0.0)"
8 #endif
9 
10 /*
11  * Platform-specific configuration.
12  *
13  * RADIOLIB_PLATFORM - platform name, used in debugging to quickly check the correct platform is detected.
14  * RADIOLIB_PIN_TYPE - which type should be used for pin numbers in functions like digitalRead().
15  * RADIOLIB_PIN_MODE - which type should be used for pin modes in functions like pinMode().
16  * RADIOLIB_PIN_STATUS - which type should be used for pin values in functions like digitalWrite().
17  * RADIOLIB_INTERRUPT_STATUS - which type should be used for pin changes in functions like attachInterrupt().
18  * RADIOLIB_DIGITAL_PIN_TO_INTERRUPT - function/macro to be used to convert digital pin number to interrupt pin number.
19  * RADIOLIB_NC - alias for unused pin, usually the largest possible value of RADIOLIB_PIN_TYPE.
20  * RADIOLIB_DEFAULT_SPI - default SPIClass instance to use.
21  * RADIOLIB_PROGMEM - macro to place variable into program storage (usually Flash).
22  * RADIOLIB_PROGMEM_READ_BYTE - function/macro to read variables saved in program storage (usually Flash).
23  * RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED - defined if the specific platform does not support SoftwareSerial.
24  * RADIOLIB_HARDWARE_SERIAL_PORT - which hardware serial port should be used on platform that do not have SoftwareSerial support.
25  * RADIOLIB_TONE_UNSUPPORTED - some platforms do not have tone()/noTone(), which is required for AFSK.
26  *
27  * In addition, some platforms may require RadioLib to disable specific drivers (such as ESP8266).
28  *
29  * Users may also specify their own configuration by uncommenting the RADIOLIB_CUSTOM_PLATFORM,
30  * and then specifying all platform parameters in the section below. This will override automatic
31  * platform detection.
32  */
33 
34 // uncomment to enable custom platform definition
35 //#define RADIOLIB_CUSTOM_PLATFORM
36 
37 #if defined(RADIOLIB_CUSTOM_PLATFORM)
38  // name for your platform
39  #define RADIOLIB_PLATFORM "Custom"
40 
41  // the following parameters must always be defined
42  #define RADIOLIB_PIN_TYPE uint8_t
43  #define RADIOLIB_PIN_MODE uint8_t
44  #define RADIOLIB_PIN_STATUS uint8_t
45  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
46  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
47  #define RADIOLIB_NC (0xFF)
48  #define RADIOLIB_DEFAULT_SPI SPI
49  #define RADIOLIB_PROGMEM PROGMEM
50  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
51 
52  // the following must be defined if the Arduino core does not support SoftwareSerial library
53  //#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
54  //#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
55 
56  // the following must be defined if the Arduino core does not support tone function
57  //#define RADIOLIB_TONE_UNSUPPORTED
58 
59  // some of RadioLib drivers may be excluded, to prevent collisions with platforms (or to speed up build process)
60  // the following is a complete list of all possible exclusion macros, uncomment any of them to disable that driver
61  // NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69
62  // while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional,
63  // so excluding SX1231 and keeping RF69 is valid.
64  //#define RADIOLIB_EXCLUDE_CC1101
65  //#define RADIOLIB_EXCLUDE_ESP8266
66  //#define RADIOLIB_EXCLUDE_HC05
67  //#define RADIOLIB_EXCLUDE_JDY08
68  //#define RADIOLIB_EXCLUDE_NRF24
69  //#define RADIOLIB_EXCLUDE_RF69
70  //#define RADIOLIB_EXCLUDE_SX1231 // dependent on RADIOLIB_EXCLUDE_RF69
71  //#define RADIOLIB_EXCLUDE_SI443X
72  //#define RADIOLIB_EXCLUDE_RFM2X // dependent on RADIOLIB_EXCLUDE_SI443X
73  //#define RADIOLIB_EXCLUDE_SX127X
74  //#define RADIOLIB_EXCLUDE_RFM9X // dependent on RADIOLIB_EXCLUDE_SX127X
75  //#define RADIOLIB_EXCLUDE_SX126X
76  //#define RADIOLIB_EXCLUDE_SX128X
77  //#define RADIOLIB_EXCLUDE_XBEE
78  //#define RADIOLIB_EXCLUDE_AFSK
79  //#define RADIOLIB_EXCLUDE_AX25
80  //#define RADIOLIB_EXCLUDE_HELLSCHREIBER
81  //#define RADIOLIB_EXCLUDE_HTTP
82  //#define RADIOLIB_EXCLUDE_MORSE
83  //#define RADIOLIB_EXCLUDE_MQTT
84  //#define RADIOLIB_EXCLUDE_RTTY
85  //#define RADIOLIB_EXCLUDE_SSTV
86 
87 #else
88  #if defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR))
89  // Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
90  #define RADIOLIB_PLATFORM "Arduino AVR"
91  #define RADIOLIB_PIN_TYPE uint8_t
92  #define RADIOLIB_PIN_MODE uint8_t
93  #define RADIOLIB_PIN_STATUS uint8_t
94  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
95  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
96  #define RADIOLIB_NC (0xFF)
97  #define RADIOLIB_DEFAULT_SPI SPI
98  #define RADIOLIB_PROGMEM PROGMEM
99  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
100 
101  #elif defined(ESP8266)
102  // ESP8266 boards
103  #define RADIOLIB_PLATFORM "ESP8266"
104  #define RADIOLIB_PIN_TYPE uint8_t
105  #define RADIOLIB_PIN_MODE uint8_t
106  #define RADIOLIB_PIN_STATUS uint8_t
107  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
108  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
109  #define RADIOLIB_NC (0xFF)
110  #define RADIOLIB_DEFAULT_SPI SPI
111  #define RADIOLIB_PROGMEM PROGMEM
112  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
113 
114  // RadioLib has ESP8266 driver, this must be disabled to use ESP8266 as platform
115  #define RADIOLIB_EXCLUDE_ESP8266
116 
117  #elif defined(ESP32)
118  // ESP32 boards
119  #define RADIOLIB_PLATFORM "ESP32"
120  #define RADIOLIB_PIN_TYPE uint8_t
121  #define RADIOLIB_PIN_MODE uint8_t
122  #define RADIOLIB_PIN_STATUS uint8_t
123  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
124  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
125  #define RADIOLIB_NC (0xFF)
126  #define RADIOLIB_DEFAULT_SPI SPI
127  #define RADIOLIB_PROGMEM PROGMEM
128  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
129  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
130  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
131 
132  // ESP32 doesn't support tone(), but it can be emulated via LED control peripheral
133  #define RADIOLIB_TONE_UNSUPPORTED
134  #define RADIOLIB_TONE_ESP32_CHANNEL (1)
135 
136  #elif defined(ARDUINO_ARCH_STM32)
137  // official STM32 Arduino core (https://github.com/stm32duino/Arduino_Core_STM32)
138  #define RADIOLIB_PLATFORM "Arduino STM32 (official)"
139  #define RADIOLIB_PIN_TYPE uint32_t
140  #define RADIOLIB_PIN_MODE uint32_t
141  #define RADIOLIB_PIN_STATUS uint32_t
142  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
143  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
144  #define RADIOLIB_NC (0xFFFFFFFF)
145  #define RADIOLIB_DEFAULT_SPI SPI
146  #define RADIOLIB_PROGMEM PROGMEM
147  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
148  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
149  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
150 
151  // slow down SX126x/8x SPI on this platform
152  #define RADIOLIB_SPI_SLOWDOWN
153 
154  #elif defined(SAMD_SERIES)
155  // Adafruit SAMD boards (M0 and M4)
156  #define RADIOLIB_PLATFORM "Adafruit SAMD"
157  #define RADIOLIB_PIN_TYPE uint32_t
158  #define RADIOLIB_PIN_MODE uint32_t
159  #define RADIOLIB_PIN_STATUS uint32_t
160  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
161  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
162  #define RADIOLIB_NC (0xFFFFFFFF)
163  #define RADIOLIB_DEFAULT_SPI SPI
164  #define RADIOLIB_PROGMEM PROGMEM
165  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
166  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
167  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
168 
169  // slow down SX126x/8x SPI on this platform
170  #define RADIOLIB_SPI_SLOWDOWN
171 
172  #elif defined(ARDUINO_ARCH_SAMD)
173  // Arduino SAMD (Zero, MKR, etc.)
174  #define RADIOLIB_PLATFORM "Arduino SAMD"
175  #define RADIOLIB_PIN_TYPE pin_size_t
176  #define RADIOLIB_PIN_MODE PinMode
177  #define RADIOLIB_PIN_STATUS PinStatus
178  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
179  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
180  #define RADIOLIB_NC (0xFF)
181  #define RADIOLIB_DEFAULT_SPI SPI
182  #define RADIOLIB_PROGMEM PROGMEM
183  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
184  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
185  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
186 
187  #elif defined(__SAM3X8E__)
188  // Arduino Due
189  #define RADIOLIB_PLATFORM "Arduino Due"
190  #define RADIOLIB_PIN_TYPE uint32_t
191  #define RADIOLIB_PIN_MODE uint32_t
192  #define RADIOLIB_PIN_STATUS uint32_t
193  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
194  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
195  #define RADIOLIB_NC (0xFFFFFFFF)
196  #define RADIOLIB_DEFAULT_SPI SPI
197  #define RADIOLIB_PROGMEM PROGMEM
198  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
199  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
200  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
201  #define RADIOLIB_TONE_UNSUPPORTED
202 
203  #elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
204  // Adafruit nRF52 boards
205  #define RADIOLIB_PLATFORM "Adafruit nRF52"
206  #define RADIOLIB_PIN_TYPE uint32_t
207  #define RADIOLIB_PIN_MODE uint32_t
208  #define RADIOLIB_PIN_STATUS uint32_t
209  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
210  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
211  #define RADIOLIB_NC (0xFFFFFFFF)
212  #define RADIOLIB_DEFAULT_SPI SPI
213  #define RADIOLIB_PROGMEM PROGMEM
214  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
215 
216  #elif defined(ARDUINO_ARC32_TOOLS)
217  // Intel Curie
218  #define RADIOLIB_PLATFORM "Intel Curie"
219  #define RADIOLIB_PIN_TYPE uint8_t
220  #define RADIOLIB_PIN_MODE uint8_t
221  #define RADIOLIB_PIN_STATUS uint8_t
222  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
223  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
224  #define RADIOLIB_NC (0xFF)
225  #define RADIOLIB_DEFAULT_SPI SPI
226  #define RADIOLIB_PROGMEM PROGMEM
227  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
228 
229  #elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY)
230  // Arduino megaAVR boards - Uno Wifi Rev.2, Nano Every
231  #define RADIOLIB_PLATFORM "Arduino megaAVR"
232  #define RADIOLIB_PIN_TYPE uint8_t
233  #define RADIOLIB_PIN_MODE PinMode
234  #define RADIOLIB_PIN_STATUS PinStatus
235  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
236  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
237  #define RADIOLIB_NC (0xFF)
238  #define RADIOLIB_DEFAULT_SPI SPI
239  #define RADIOLIB_PROGMEM PROGMEM
240  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
241 
242  #elif defined(ARDUINO_ARCH_APOLLO3)
243  // Sparkfun Apollo3 boards
244  #define RADIOLIB_PLATFORM "Sparkfun Apollo3"
245  #define RADIOLIB_PIN_TYPE pin_size_t
246  #define RADIOLIB_PIN_MODE Arduino_PinMode
247  #define RADIOLIB_PIN_STATUS PinStatus
248  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
249  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
250  #define RADIOLIB_NC (0xFF)
251  #define RADIOLIB_DEFAULT_SPI SPI
252  #define RADIOLIB_PROGMEM PROGMEM
253  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
254  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
255  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
256 
257  // Apollo3 uses mbed libraries, which already contain ESP8266 driver
258  #define RADIOLIB_EXCLUDE_ESP8266
259 
260  // slow down SX126x/8x SPI on this platform
261  #define RADIOLIB_SPI_SLOWDOWN
262 
263  #elif defined(ARDUINO_ARDUINO_NANO33BLE)
264  // Arduino Nano 33 BLE
265  #define RADIOLIB_PLATFORM "Arduino Nano 33 BLE"
266  #define RADIOLIB_PIN_TYPE pin_size_t
267  #define RADIOLIB_PIN_MODE PinMode
268  #define RADIOLIB_PIN_STATUS PinStatus
269  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
270  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
271  #define RADIOLIB_NC (0xFF)
272  #define RADIOLIB_DEFAULT_SPI SPI
273  #define RADIOLIB_PROGMEM PROGMEM
274  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
275  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
276  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
277 
278  // Nano 33 BLE uses mbed libraries, which already contain ESP8266 driver
279  #define RADIOLIB_EXCLUDE_ESP8266
280 
281  #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4)
282  // Arduino Portenta H7
283  #define RADIOLIB_PLATFORM "Portenta H7"
284  #define RADIOLIB_PIN_TYPE pin_size_t
285  #define RADIOLIB_PIN_MODE PinMode
286  #define RADIOLIB_PIN_STATUS PinStatus
287  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
288  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
289  #define RADIOLIB_NC (0xFF)
290  #define RADIOLIB_DEFAULT_SPI SPI
291  #define RADIOLIB_PROGMEM PROGMEM
292  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
293  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
294  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
295 
296  // Arduino Portenta H7 uses mbed libraries, which already contain ESP8266 driver
297  #define RADIOLIB_EXCLUDE_ESP8266
298 
299  #elif defined(__STM32F4__) || defined(__STM32F1__)
300  // Arduino STM32 core by Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32)
301  #define RADIOLIB_PLATFORM "STM32duino (unofficial)"
302  #define RADIOLIB_PIN_TYPE uint8_t
303  #define RADIOLIB_PIN_MODE WiringPinMode
304  #define RADIOLIB_PIN_STATUS uint8_t
305  #define RADIOLIB_INTERRUPT_STATUS ExtIntTriggerMode
306  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
307  #define RADIOLIB_NC (0xFF)
308  #define RADIOLIB_DEFAULT_SPI SPI
309  #define RADIOLIB_PROGMEM PROGMEM
310  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
311  #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
312  #define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
313 
314  #elif defined(ARDUINO_ARCH_MEGAAVR)
315  // MegaCoreX by MCUdude (https://github.com/MCUdude/MegaCoreX)
316  #define RADIOLIB_PLATFORM "MegaCoreX"
317  #define RADIOLIB_PIN_TYPE uint8_t
318  #define RADIOLIB_PIN_MODE uint8_t
319  #define RADIOLIB_PIN_STATUS uint8_t
320  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
321  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
322  #define RADIOLIB_NC (0xFF)
323  #define RADIOLIB_DEFAULT_SPI SPI
324  #define RADIOLIB_PROGMEM PROGMEM
325  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
326 
327  #else
328  // other platforms not covered by the above list - this may or may not work
329  #define RADIOLIB_PLATFORM "Unknown"
330  #define RADIOLIB_UNKNOWN_PLATFORM
331  #define RADIOLIB_PIN_TYPE uint8_t
332  #define RADIOLIB_PIN_MODE uint8_t
333  #define RADIOLIB_PIN_STATUS uint8_t
334  #define RADIOLIB_INTERRUPT_STATUS RADIOLIB_PIN_STATUS
335  #define RADIOLIB_DIGITAL_PIN_TO_INTERRUPT(p) digitalPinToInterrupt(p)
336  #define RADIOLIB_NC (0xFF)
337  #define RADIOLIB_DEFAULT_SPI SPI
338  #define RADIOLIB_PROGMEM PROGMEM
339  #define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
340 
341  #endif
342 #endif
343 
344 /*
345  * Uncomment to enable debug output.
346  * Warning: Debug output will slow down the whole system significantly.
347  * Also, it will result in larger compiled binary.
348  * Levels: debug - only main info
349  * verbose - full transcript of all SPI/UART communication
350  */
351 
352 //#define RADIOLIB_DEBUG
353 //#define RADIOLIB_VERBOSE
354 
355 // set which Serial port should be used for debug output
356 #define RADIOLIB_DEBUG_PORT Serial
357 
358 #if defined(RADIOLIB_DEBUG)
359  #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
360  #define RADIOLIB_DEBUG_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
361 #else
362  #define RADIOLIB_DEBUG_PRINT(...) {}
363  #define RADIOLIB_DEBUG_PRINTLN(...) {}
364 #endif
365 
366 #if defined(RADIOLIB_VERBOSE)
367  #define RADIOLIB_VERBOSE_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }
368  #define RADIOLIB_VERBOSE_PRINTLN(...) { RADIOLIB_DEBUG_PORT.println(__VA_ARGS__); }
369 #else
370  #define RADIOLIB_VERBOSE_PRINT(...) {}
371  #define RADIOLIB_VERBOSE_PRINTLN(...) {}
372 #endif
373 
374 /*
375  * Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
376  * Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
377  * Failure to heed the above warning may result in bricked module.
378  */
379 //#define RADIOLIB_GODMODE
380 
381 /*
382  * Uncomment to enable pre-defined modules when using RadioShield.
383  */
384 //#define RADIOLIB_RADIOSHIELD
385 
386 /*
387  * Uncomment to enable static-only memory management: no dynamic allocation will be performed.
388  * Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
389  */
390 
391 //#define RADIOLIB_STATIC_ONLY
392 
393 /*
394  * Uncomment to enable "paranoid" SPI mode
395  * Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
396  * This improves reliablility, but slightly slows down communication.
397  */
398 #define RADIOLIB_SPI_PARANOID
399 
400 // set the size of static arrays to use
401 #if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
402 #define RADIOLIB_STATIC_ARRAY_SIZE 256
403 #endif
404 
408 #define RADIOLIB_ASSERT(STATEVAR) { if((STATEVAR) != ERR_NONE) { return(STATEVAR); } }
409 
413 #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
414 
415 // version definitions
416 #define RADIOLIB_VERSION_MAJOR (0x04)
417 #define RADIOLIB_VERSION_MINOR (0x02)
418 #define RADIOLIB_VERSION_PATCH (0x00)
419 #define RADIOLIB_VERSION_EXTRA (0x00)
420 
421 #define RADIOLIB_VERSION ((RADIOLIB_VERSION_MAJOR << 24) | (RADIOLIB_VERSION_MINOR << 16) | (RADIOLIB_VERSION_PATCH << 8) | (RADIOLIB_VERSION_EXTRA))
422 
423 #endif
-
1 #ifndef _RADIOLIB_MODULE_H
2 #define _RADIOLIB_MODULE_H
3 
4 #include "TypeDef.h"
5 
6 #include <SPI.h>
7 #ifndef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
8 #include <SoftwareSerial.h>
9 #endif
10 
17 class Module {
18  public:
19 
31 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
32  Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
33 #else
34  Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial* serial = nullptr, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
35 #endif
36 
46  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst);
47 
59  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio);
60 
74  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass& spi, SPISettings spiSettings);
75 
91  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass& spi, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0));
92 
112 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
113  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = RADIOLIB_DEFAULT_SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT);
114 #else
115  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = RADIOLIB_DEFAULT_SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = nullptr);
116 #endif
117 
123  Module(const Module& mod);
124 
130  Module& operator=(const Module& mod);
131 
132  // public member variables
133 
137 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
138  HardwareSerial* ModuleSerial;
139 #else
140  SoftwareSerial* ModuleSerial;
141 #endif
142 
146  uint32_t baudrate = 9600;
147 
151  char AtLineFeed[3] = {'\r', '\n'};
152 
156  uint8_t SPIreadCommand = 0b00000000;
157 
161  uint8_t SPIwriteCommand = 0b10000000;
162 
163  // basic methods
164 
170  void init(uint8_t interface);
171 
177  void term(uint8_t interface);
178 
179  // AT methods
180 
184  void ATemptyBuffer();
185 
191  bool ATgetResponse();
192 
200  bool ATsendCommand(const char* cmd);
201 
211  bool ATsendData(uint8_t* data, uint32_t len);
212 
213  // SPI methods
214 
226  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
227 
243  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
244 
254  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
255 
263  uint8_t SPIreadRegister(uint8_t reg);
264 
274  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, uint8_t numBytes);
275 
283  void SPIwriteRegister(uint8_t reg, uint8_t data);
284 
298  void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
299 
300  // pin number access methods
301 
307  RADIOLIB_PIN_TYPE getCs() const { return(_cs); }
308 
314  RADIOLIB_PIN_TYPE getIrq() const { return(_irq); }
315 
321  RADIOLIB_PIN_TYPE getRst() const { return(_rst); }
322 
328  RADIOLIB_PIN_TYPE getGpio() const { return(_rx); }
329 
335  RADIOLIB_PIN_TYPE getRx() const { return(_rx); }
336 
342  RADIOLIB_PIN_TYPE getTx() const { return(_tx); }
343 
349  SPIClass* getSpi() const { return(_spi); }
350 
356  SPISettings getSpiSettings() const { return(_spiSettings); }
357 
366  void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
367 
375  void setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState);
376 
377  // Arduino core overrides
378 
386  static void pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode);
387 
395  static void digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value);
396 
404  static RADIOLIB_PIN_STATUS digitalRead(RADIOLIB_PIN_TYPE pin);
405 
413  static void tone(RADIOLIB_PIN_TYPE pin, uint16_t value);
414 
420  static void noTone(RADIOLIB_PIN_TYPE pin);
421 
431  static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void (*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode);
432 
438  static void detachInterrupt(RADIOLIB_PIN_TYPE interruptNum);
439 
443  static void yield();
444 
450  static void delay(uint32_t ms);
451 
457  static void delayMicroseconds(uint32_t us);
458 
462  static uint32_t millis();
463 
467  static uint32_t micros();
468 
469 #ifndef RADIOLIB_GODMODE
470  private:
471 #endif
472  RADIOLIB_PIN_TYPE _cs = RADIOLIB_NC;
473  RADIOLIB_PIN_TYPE _irq = RADIOLIB_NC;
474  RADIOLIB_PIN_TYPE _rst = RADIOLIB_NC;
475  RADIOLIB_PIN_TYPE _rx = RADIOLIB_NC;
476  RADIOLIB_PIN_TYPE _tx = RADIOLIB_NC;
477 
478  SPISettings _spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0);
479 
480  bool _initInterface = false;
481  SPIClass* _spi = NULL;
482 
483  bool _useRfSwitch = false;
484  RADIOLIB_PIN_TYPE _rxEn = RADIOLIB_NC, _txEn = RADIOLIB_NC;
485 
486  uint32_t _ATtimeout = 15000;
487 };
488 
489 #endif
static void pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode)
Arduino core pinMode override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:319
+
1 #ifndef _RADIOLIB_MODULE_H
2 #define _RADIOLIB_MODULE_H
3 
4 #include "TypeDef.h"
5 
6 #include <SPI.h>
7 #ifndef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
8 #include <SoftwareSerial.h>
9 #endif
10 
17 class Module {
18  public:
19 
31 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
32  Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
33 #else
34  Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial* serial = nullptr, RADIOLIB_PIN_TYPE rst = RADIOLIB_NC);
35 #endif
36 
46  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst);
47 
59  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio);
60 
74  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass& spi, SPISettings spiSettings);
75 
91  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass& spi, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0));
92 
112 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
113  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = RADIOLIB_DEFAULT_SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = &RADIOLIB_HARDWARE_SERIAL_PORT);
114 #else
115  Module(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass& spi = RADIOLIB_DEFAULT_SPI, SPISettings spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial* serial = nullptr);
116 #endif
117 
123  Module(const Module& mod);
124 
130  Module& operator=(const Module& mod);
131 
132  // public member variables
133 
137 #ifdef RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
138  HardwareSerial* ModuleSerial;
139 #else
140  SoftwareSerial* ModuleSerial;
141 #endif
142 
146  uint32_t baudrate = 9600;
147 
151  char AtLineFeed[3] = {'\r', '\n'};
152 
156  uint8_t SPIreadCommand = 0b00000000;
157 
161  uint8_t SPIwriteCommand = 0b10000000;
162 
163  // basic methods
164 
170  void init(uint8_t interface);
171 
177  void term(uint8_t interface);
178 
179  // AT methods
180 
184  void ATemptyBuffer();
185 
191  bool ATgetResponse();
192 
200  bool ATsendCommand(const char* cmd);
201 
211  bool ATsendData(uint8_t* data, uint32_t len);
212 
213  // SPI methods
214 
226  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
227 
243  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
244 
254  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
255 
263  uint8_t SPIreadRegister(uint8_t reg);
264 
274  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, uint8_t numBytes);
275 
283  void SPIwriteRegister(uint8_t reg, uint8_t data);
284 
298  void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
299 
300  // pin number access methods
301 
307  RADIOLIB_PIN_TYPE getCs() const { return(_cs); }
308 
314  RADIOLIB_PIN_TYPE getIrq() const { return(_irq); }
315 
321  RADIOLIB_PIN_TYPE getRst() const { return(_rst); }
322 
328  RADIOLIB_PIN_TYPE getGpio() const { return(_rx); }
329 
335  RADIOLIB_PIN_TYPE getRx() const { return(_rx); }
336 
342  RADIOLIB_PIN_TYPE getTx() const { return(_tx); }
343 
349  SPIClass* getSpi() const { return(_spi); }
350 
356  SPISettings getSpiSettings() const { return(_spiSettings); }
357 
366  void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
367 
375  void setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState);
376 
377  // Arduino core overrides
378 
386  static void pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode);
387 
395  static void digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value);
396 
404  static RADIOLIB_PIN_STATUS digitalRead(RADIOLIB_PIN_TYPE pin);
405 
413  static void tone(RADIOLIB_PIN_TYPE pin, uint16_t value);
414 
420  static void noTone(RADIOLIB_PIN_TYPE pin);
421 
431  static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void (*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode);
432 
438  static void detachInterrupt(RADIOLIB_PIN_TYPE interruptNum);
439 
443  static void yield();
444 
450  static void delay(uint32_t ms);
451 
457  static void delayMicroseconds(uint32_t us);
458 
462  static uint32_t millis();
463 
467  static uint32_t micros();
468 
469 #ifndef RADIOLIB_GODMODE
470  private:
471 #endif
472  RADIOLIB_PIN_TYPE _cs = RADIOLIB_NC;
473  RADIOLIB_PIN_TYPE _irq = RADIOLIB_NC;
474  RADIOLIB_PIN_TYPE _rst = RADIOLIB_NC;
475  RADIOLIB_PIN_TYPE _rx = RADIOLIB_NC;
476  RADIOLIB_PIN_TYPE _tx = RADIOLIB_NC;
477 
478  SPISettings _spiSettings = SPISettings(2000000, MSBFIRST, SPI_MODE0);
479 
480  bool _initInterface = false;
481  SPIClass* _spi = NULL;
482 
483  bool _useRfSwitch = false;
484  RADIOLIB_PIN_TYPE _rxEn = RADIOLIB_NC, _txEn = RADIOLIB_NC;
485 
486  uint32_t _ATtimeout = 15000;
487 };
488 
489 #endif
static void pinMode(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode)
Arduino core pinMode override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:323
char AtLineFeed[3]
Line feed to be used when sending AT commands. Defaults to CR+LF.
Definition: Module.h:151
Module & operator=(const Module &mod)
Overload for assignment operator.
Definition: Module.cpp:96
SPISettings getSpiSettings() const
Access method to get the SPI interface settings.
Definition: Module.h:356
-
void SPIwriteRegisterBurst(uint8_t reg, uint8_t *data, uint8_t numBytes)
SPI burst write method.
Definition: Module.cpp:264
-
static RADIOLIB_PIN_STATUS digitalRead(RADIOLIB_PIN_TYPE pin)
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:331
+
void SPIwriteRegisterBurst(uint8_t reg, uint8_t *data, uint8_t numBytes)
SPI burst write method.
Definition: Module.cpp:268
+
static RADIOLIB_PIN_STATUS digitalRead(RADIOLIB_PIN_TYPE pin)
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:335
RADIOLIB_PIN_TYPE getIrq() const
Access method to get the pin number of interrupt/GPIO.
Definition: Module.h:314
RADIOLIB_PIN_TYPE getTx() const
Access method to get the pin number of UART Rx.
Definition: Module.h:342
SoftwareSerial * ModuleSerial
Internal SoftwareSerial instance.
Definition: Module.h:140
-
void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes)
SPI single transfer method.
Definition: Module.cpp:272
+
void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes)
SPI single transfer method.
Definition: Module.cpp:276
RADIOLIB_PIN_TYPE getGpio() const
Access method to get the pin number of second interrupt/GPIO.
Definition: Module.h:328
-
static void delay(uint32_t ms)
Arduino core delay override.
Definition: Module.cpp:381
+
static void delay(uint32_t ms)
Arduino core delay override.
Definition: Module.cpp:385
RADIOLIB_PIN_TYPE getRx() const
Access method to get the pin number of UART Rx.
Definition: Module.h:335
-
static void yield()
Arduino core yield override.
Definition: Module.cpp:377
-
static void digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value)
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:325
+
static void yield()
Arduino core yield override.
Definition: Module.cpp:381
+
static void digitalWrite(RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value)
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin.
Definition: Module.cpp:329
uint8_t SPIreadCommand
Basic SPI read command. Defaults to 0x00.
Definition: Module.h:156
uint32_t baudrate
Baud rate of SoftwareSerial UART communication. Defaults to 9600 baud.
Definition: Module.h:146
void term(uint8_t interface)
Terminate low-level module control.
Definition: Module.cpp:137
RADIOLIB_PIN_TYPE getCs() const
Access method to get the pin number of SPI chip select.
Definition: Module.h:307
-
static void delayMicroseconds(uint32_t us)
Arduino core delayMicroseconds override.
Definition: Module.cpp:385
+
static void delayMicroseconds(uint32_t us)
Arduino core delayMicroseconds override.
Definition: Module.cpp:389
void init(uint8_t interface)
Initialize low-level module control.
Definition: Module.cpp:113
void ATemptyBuffer()
Empty internal AT buffer.
Definition: Module.cpp:152
-
static void tone(RADIOLIB_PIN_TYPE pin, uint16_t value)
Arduino core tone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPPOR...
Definition: Module.cpp:338
-
void setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState)
Set RF switch state.
Definition: Module.cpp:405
+
static void tone(RADIOLIB_PIN_TYPE pin, uint16_t value)
Arduino core tone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPPOR...
Definition: Module.cpp:342
+
void setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState)
Set RF switch state.
Definition: Module.cpp:409
bool ATgetResponse()
Get response after sending AT command.
Definition: Module.cpp:175
Implements all common low-level SPI/UART/I2C methods to control the wireless module. Every module class contains one private instance of this class.
Definition: Module.h:17
bool ATsendData(uint8_t *data, uint32_t len)
Send raw AT data. Will also call ATgetResponse.
Definition: Module.cpp:165
int16_t SPIgetRegValue(uint8_t reg, uint8_t msb=7, uint8_t lsb=0)
SPI read method that automatically masks unused bits. This method is the preferred SPI read mechanism...
Definition: Module.cpp:199
-
static uint32_t millis()
Arduino core millis override.
Definition: Module.cpp:389
-
void SPIwriteRegister(uint8_t reg, uint8_t data)
SPI basic write method. Use of this method is reserved for special cases, SPIsetRegValue should be us...
Definition: Module.cpp:268
-
uint8_t SPIreadRegister(uint8_t reg)
SPI basic read method. Use of this method is reserved for special cases, SPIgetRegValue should be use...
Definition: Module.cpp:258
-
static void noTone(RADIOLIB_PIN_TYPE pin)
Arduino core noTone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPP...
Definition: Module.cpp:354
+
static uint32_t millis()
Arduino core millis override.
Definition: Module.cpp:393
+
void SPIwriteRegister(uint8_t reg, uint8_t data)
SPI basic write method. Use of this method is reserved for special cases, SPIsetRegValue should be us...
Definition: Module.cpp:272
+
uint8_t SPIreadRegister(uint8_t reg)
SPI basic read method. Use of this method is reserved for special cases, SPIgetRegValue should be use...
Definition: Module.cpp:262
+
static void noTone(RADIOLIB_PIN_TYPE pin)
Arduino core noTone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPP...
Definition: Module.cpp:358
Module(RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial *serial=nullptr, RADIOLIB_PIN_TYPE rst=RADIOLIB_NC)
UART-based module constructor.
Definition: Module.cpp:29
-
static void detachInterrupt(RADIOLIB_PIN_TYPE interruptNum)
Arduino core detachInterrupt override.
Definition: Module.cpp:373
+
static void detachInterrupt(RADIOLIB_PIN_TYPE interruptNum)
Arduino core detachInterrupt override.
Definition: Module.cpp:377
bool ATsendCommand(const char *cmd)
Send AT command. Will also call ATgetResponse.
Definition: Module.cpp:158
-
static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void(*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode)
Arduino core attachInterrupt override.
Definition: Module.cpp:369
+
static void attachInterrupt(RADIOLIB_PIN_TYPE interruptNum, void(*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode)
Arduino core attachInterrupt override.
Definition: Module.cpp:373
uint8_t SPIwriteCommand
Basic SPI write command. Defaults to 0x80.
Definition: Module.h:161
-
void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t *inBytes)
SPI burst read method.
Definition: Module.cpp:254
+
void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t *inBytes)
SPI burst read method.
Definition: Module.cpp:258
RADIOLIB_PIN_TYPE getRst() const
Access method to get the pin number of hardware reset pin.
Definition: Module.h:321
SPIClass * getSpi() const
Access method to get the SPI interface.
Definition: Module.h:349
int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb=7, uint8_t lsb=0, uint8_t checkInterval=2)
Overwrite-safe SPI write method with verification. This method is the preferred SPI write mechanism...
Definition: Module.cpp:209
-
static uint32_t micros()
Arduino core micros override.
Definition: Module.cpp:393
-
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn)
Some modules contain external RF switch controlled by two pins. This function gives RadioLib control ...
Definition: Module.cpp:397
+
static uint32_t micros()
Arduino core micros override.
Definition: Module.cpp:397
+
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn)
Some modules contain external RF switch controlled by two pins. This function gives RadioLib control ...
Definition: Module.cpp:401