RadioLib/src/RadioLib.h

160 wiersze
4.4 KiB
C
Czysty Zwykły widok Historia

2021-03-13 18:06:04 +00:00
#if !defined(_RADIOLIB_H)
2019-02-08 14:58:29 +00:00
#define _RADIOLIB_H
2018-03-05 16:08:42 +00:00
2019-05-24 13:13:04 +00:00
/*!
\mainpage RadioLib Documentation
Universal wireless communication library for Arduino.
\par Currently Supported Wireless Modules and Protocols
- CC1101 FSK module
- RF69 FSK module
- Si443x FSK module
2019-05-24 13:13:04 +00:00
- SX126x LoRa/FSK module
- SX127x LoRa/FSK module
2020-04-07 11:30:05 +00:00
- SX128x LoRa/GFSK/BLE/FLRC module
2019-05-24 13:13:04 +00:00
- SX1231 FSK module
- PhysicalLayer protocols
2019-05-24 16:01:50 +00:00
- RTTY (RTTYClient)
- Morse Code (MorseClient)
2020-02-14 07:39:10 +00:00
- AX.25 (AX25Client)
2020-03-31 16:02:51 +00:00
- SSTV (SSTVClient)
2020-04-14 08:54:44 +00:00
- Hellschreiber (HellClient)
2021-09-24 06:58:11 +00:00
- 4-FSK (FSK4Client)
2021-11-28 21:56:36 +00:00
- APRS (APRSClient)
2019-05-24 13:13:04 +00:00
\par Quick Links
Documentation for most common methods can be found in its reference page (see the list above).\n
Some methods (mainly configuration) are also overridden in derived classes, such as SX1272, SX1278, RFM96 etc. for SX127x.\n
\ref status_codes have their own page.\n
2019-05-24 16:01:50 +00:00
Some modules implement methods of one or more compatibility layers, loosely based on the ISO/OSI model:
2019-05-24 13:13:04 +00:00
- PhysicalLayer - FSK and LoRa radio modules
\see https://github.com/jgromes/RadioLib
\copyright Copyright (c) 2019 Jan Gromes
*/
2018-03-05 16:08:42 +00:00
#include "TypeDef.h"
#include "Module.h"
2023-04-11 02:51:29 +00:00
#include "Hal.h"
#if defined(RADIOLIB_BUILD_ARDUINO)
#include "ArduinoHal.h"
#endif
// warnings are printed in this file since BuildOpt.h is compiled in multiple places
// check God mode
2023-11-27 18:38:10 +00:00
#if RADIOLIB_GODMODE
2019-11-20 15:55:11 +00:00
#warning "God mode active, I hope it was intentional. Buckle up, lads."
#endif
// print debug info
2023-11-27 20:24:32 +00:00
#if RADIOLIB_DEBUG
#pragma message(RADIOLIB_INFO)
#endif
// check unknown/unsupported platform
#if defined(RADIOLIB_UNKNOWN_PLATFORM)
#warning "RadioLib might not be compatible with this Arduino board - check supported platforms at https://github.com/jgromes/RadioLib!"
#endif
// print warning for low-end platforms
#if defined(RADIOLIB_LOWEND_PLATFORM)
#warning "Low-end platform detected, stability issues are likely!"
#endif
2019-11-20 16:19:15 +00:00
#include "modules/CC1101/CC1101.h"
#include "modules/LLCC68/LLCC68.h"
#include "modules/LR11x0/LR1110.h"
2024-04-21 13:24:49 +00:00
#include "modules/LR11x0/LR1120.h"
#include "modules/LR11x0/LR1121.h"
2019-11-20 16:19:15 +00:00
#include "modules/nRF24/nRF24.h"
#include "modules/RF69/RF69.h"
#include "modules/RFM2x/RFM22.h"
#include "modules/RFM2x/RFM23.h"
#include "modules/Si443x/Si4430.h"
#include "modules/Si443x/Si4431.h"
#include "modules/Si443x/Si4432.h"
#include "modules/SX123x/SX1231.h"
#include "modules/SX123x/SX1233.h"
2019-11-20 16:19:15 +00:00
#include "modules/SX126x/SX1261.h"
#include "modules/SX126x/SX1262.h"
#include "modules/SX126x/SX1268.h"
#include "modules/SX126x/STM32WLx.h"
2019-11-20 16:19:15 +00:00
#include "modules/SX127x/SX1272.h"
#include "modules/SX127x/SX1273.h"
#include "modules/SX127x/SX1276.h"
#include "modules/SX127x/SX1277.h"
#include "modules/SX127x/SX1278.h"
#include "modules/SX127x/SX1279.h"
2020-04-07 11:30:05 +00:00
#include "modules/SX128x/SX1280.h"
#include "modules/SX128x/SX1281.h"
#include "modules/SX128x/SX1282.h"
2018-03-05 16:08:42 +00:00
2019-05-24 13:13:04 +00:00
// physical layer protocols
2019-11-20 16:19:15 +00:00
#include "protocols/PhysicalLayer/PhysicalLayer.h"
2020-04-30 15:09:25 +00:00
#include "protocols/AFSK/AFSK.h"
2020-02-14 07:08:59 +00:00
#include "protocols/AX25/AX25.h"
2020-04-14 07:33:39 +00:00
#include "protocols/Hellschreiber/Hellschreiber.h"
2019-11-20 16:19:15 +00:00
#include "protocols/Morse/Morse.h"
2022-10-01 12:56:37 +00:00
#include "protocols/Pager/Pager.h"
2019-11-20 16:19:15 +00:00
#include "protocols/RTTY/RTTY.h"
2020-03-31 15:31:10 +00:00
#include "protocols/SSTV/SSTV.h"
#include "protocols/FSK4/FSK4.h"
2021-11-28 21:56:36 +00:00
#include "protocols/APRS/APRS.h"
#include "protocols/ExternalRadio/ExternalRadio.h"
2023-04-29 21:01:23 +00:00
#include "protocols/Print/Print.h"
#include "protocols/BellModem/BellModem.h"
#include "protocols/LoRaWAN/LoRaWAN.h"
2018-08-20 18:42:14 +00:00
2023-05-12 18:54:36 +00:00
// utilities
#include "utils/CRC.h"
2023-05-28 20:25:07 +00:00
#include "utils/Cryptography.h"
2023-05-12 18:54:36 +00:00
// only create Radio class when using RadioShield
2023-11-27 18:38:10 +00:00
#if RADIOLIB_RADIOSHIELD
2019-05-24 13:13:04 +00:00
// RadioShield pin definitions
2021-11-16 09:22:10 +00:00
#define RADIOSHIELD_CS_A 10
#define RADIOSHIELD_IRQ_A 2
#define RADIOSHIELD_RST_A 9
#define RADIOSHIELD_GPIO_A 8
#define RADIOSHIELD_CS_B 5
#define RADIOSHIELD_IRQ_B 3
#define RADIOSHIELD_RST_B 7
#define RADIOSHIELD_GPIO_B 6
2018-03-05 16:08:42 +00:00
2019-05-24 13:13:04 +00:00
/*!
\class Radio
\brief Library control object when using RadioShield.
Contains two pre-configured "modules", which correspond to the slots on shield.
*/
2019-02-08 14:58:29 +00:00
class Radio {
2018-03-05 16:08:42 +00:00
public:
2019-05-24 13:13:04 +00:00
2019-11-20 16:19:15 +00:00
Module* ModuleA;
Module* ModuleB;
2019-05-24 13:13:04 +00:00
/*!
2019-05-24 13:52:52 +00:00
\brief Default constructor. Only used to set ModuleA and ModuleB configuration.
2019-05-24 13:13:04 +00:00
*/
2019-11-20 16:19:15 +00:00
Radio() {
2021-11-16 09:22:10 +00:00
ModuleA = new Module(RADIOSHIELD_CS_A, RADIOSHIELD_IRQ_A, RADIOSHIELD_RST_A, RADIOSHIELD_GPIO_A);
ModuleB = new Module(RADIOSHIELD_CS_B, RADIOSHIELD_IRQ_B, RADIOSHIELD_RST_B, RADIOSHIELD_GPIO_B);
2019-11-20 16:19:15 +00:00
}
2023-11-27 18:38:10 +00:00
#if RADIOLIB_GODMODE
2018-03-05 16:08:42 +00:00
private:
2019-11-20 15:55:11 +00:00
#endif
2018-03-05 16:08:42 +00:00
};
2019-11-20 16:19:15 +00:00
Radio RadioShield;
#endif
2018-03-05 16:08:42 +00:00
#endif