diff --git a/src/configuration.h b/src/configuration.h index 8231d555..7eed800d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -256,6 +256,7 @@ along with this program. If not, see . // supported modules list #define USE_SX1262 #define USE_SX1268 +#define USE_LLCC68 // common pinouts for SX126X modules #define SX126X_CS 18 // NSS for SX126X diff --git a/src/main.cpp b/src/main.cpp index 0171631e..d28b8431 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,6 +40,7 @@ #include "RF95Interface.h" #include "SX1262Interface.h" #include "SX1268Interface.h" +#include "LLCC68Interface.h" #ifdef NRF52_SERIES #include "variant.h" @@ -539,6 +540,19 @@ void setup() } #endif +#if defined(USE_LLCC68) + if (!rIf) { + rIf = new LLCC68Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI); + if (!rIf->init()) { + DEBUG_MSG("Warning: Failed to find LLCC68 radio\n"); + delete rIf; + rIf = NULL; + } else { + DEBUG_MSG("LLCC68 Radio init succeeded, using LLCC68 radio\n"); + } + } +#endif + #ifdef USE_SIM_RADIO if (!rIf) { rIf = new SimRadio; diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index a50fbd6b..2c8d9b29 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -3,4 +3,5 @@ // We need this declaration for proper linking in derived classes template class SX126xInterface; -template class SX126xInterface; \ No newline at end of file +template class SX126xInterface; +template class SX126xInterface; \ No newline at end of file diff --git a/src/mesh/LLCC68Interface.cpp b/src/mesh/LLCC68Interface.cpp new file mode 100644 index 00000000..013b31b4 --- /dev/null +++ b/src/mesh/LLCC68Interface.cpp @@ -0,0 +1,9 @@ +#include "configuration.h" +#include "LLCC68Interface.h" +#include "error.h" + +LLCC68Interface::LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, + SPIClass &spi) + : SX126xInterface(cs, irq, rst, busy, spi) +{ +} \ No newline at end of file diff --git a/src/mesh/LLCC68Interface.h b/src/mesh/LLCC68Interface.h new file mode 100644 index 00000000..9d0ab6ca --- /dev/null +++ b/src/mesh/LLCC68Interface.h @@ -0,0 +1,13 @@ +#pragma once + +#include "SX126xInterface.h" + +/** + * Our adapter for LLCC68 radios + * https://www.semtech.com/products/wireless-rf/lora-core/llcc68 + */ +class LLCC68Interface : public SX126xInterface +{ + public: + LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); +}; \ No newline at end of file