From 11b501cbc94744c58254e8157307a51097cca80a Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 28 Sep 2019 10:39:20 +0200 Subject: [PATCH] Added software serial platform macro --- src/Module.cpp | 6 +++--- src/TypeDef.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Module.cpp b/src/Module.cpp index 5ca9a77d..8c2e6964 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -7,8 +7,8 @@ Module::Module(int rx, int tx, HardwareSerial* useSer) { _int0 = -1; _int1 = -1; -#if defined(ESP32) || defined(SAMD_SERIES) || defined (ARDUINO_ARCH_STM32) - ModuleSerial = useSer; +#if SOFTWARE_SERIAL_UNSUPPORTED + ModuleSerial = useSer; #else ModuleSerial = new SoftwareSerial(_rx, _tx); #endif @@ -33,7 +33,7 @@ Module::Module(int cs, int int0, int int1, int rx, int tx, SPIClass& spi, SPISet _spi = &spi; _spiSettings = spiSettings; -#if defined(ESP32) || defined(SAMD_SERIES) || defined (ARDUINO_ARCH_STM32) +#if SOFTWARE_SERIAL_UNSUPPORTED ModuleSerial = useSer; #else ModuleSerial = new SoftwareSerial(_rx, _tx); diff --git a/src/TypeDef.h b/src/TypeDef.h index a3f89aed..e36218ef 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -7,6 +7,9 @@ #error "Unsupported Arduino version (< 1.0.0)" #endif +// the following platforms do not support SoftwareSerial library +#define SOFTWARE_SERIAL_UNSUPPORTED (defined(ESP32) || defined(SAMD_SERIES) || defined (ARDUINO_ARCH_STM32)) + #define RADIOLIB_DEBUG_PORT Serial //#define RADIOLIB_DEBUG