Merge branch 'jgromes:master' into master

This commit is contained in:
StevenCellist 2023-12-09 10:31:13 +01:00 committed by GitHub
commit fc8d80c9de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
94 changed files with 466 additions and 464 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "RadioLib", "name": "RadioLib",
"version": "6.2.0", "version": "6.3.0",
"description": "Universal wireless communication library. User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.) and other protocols (Pagers, LoRaWAN).", "description": "Universal wireless communication library. User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.) and other protocols (Pagers, LoRaWAN).",
"keywords": "radio, communication, morse, cc1101, aprs, sx1276, sx1278, sx1272, rtty, ax25, afsk, nrf24, rfm96, sx1231, rfm96, rfm98, sstv, sx1278, sx1272, sx1276, sx1280, sx1281, sx1282, sx1261, sx1262, sx1268, si4432, rfm22, llcc68, pager, pocsag, lorawan", "keywords": "radio, communication, morse, cc1101, aprs, sx1276, sx1278, sx1272, rtty, ax25, afsk, nrf24, rfm96, sx1231, rfm96, rfm98, sstv, sx1278, sx1272, sx1276, sx1280, sx1281, sx1282, sx1261, sx1262, sx1268, si4432, rfm22, llcc68, pager, pocsag, lorawan",
"homepage": "https://github.com/jgromes/RadioLib", "homepage": "https://github.com/jgromes/RadioLib",

View file

@ -1,5 +1,5 @@
name=RadioLib name=RadioLib
version=6.2.0 version=6.3.0
author=Jan Gromes <gromes.jan@gmail.com> author=Jan Gromes <gromes.jan@gmail.com>
maintainer=Jan Gromes <gromes.jan@gmail.com> maintainer=Jan Gromes <gromes.jan@gmail.com>
sentence=Universal wireless communication library sentence=Universal wireless communication library

View file

@ -62,7 +62,7 @@ class ArduinoHal : public RadioLibHal {
void yield() override; void yield() override;
uint32_t pinToInterrupt(uint32_t pin) override; uint32_t pinToInterrupt(uint32_t pin) override;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
SPIClass* spi = NULL; SPIClass* spi = NULL;

View file

@ -1,6 +1,132 @@
#if !defined(_RADIOLIB_BUILD_OPTIONS_H) #if !defined(_RADIOLIB_BUILD_OPTIONS_H)
#define _RADIOLIB_BUILD_OPTIONS_H #define _RADIOLIB_BUILD_OPTIONS_H
/* RadioLib build configuration options */
/*
* Debug output enable.
* Warning: Debug output will slow down the whole system significantly.
* Also, it will result in larger compiled binary.
* Levels: debug - only main info
* verbose - full transcript of all SPI communication
*/
#if !defined(RADIOLIB_DEBUG)
#define RADIOLIB_DEBUG (0)
#endif
#if !defined(RADIOLIB_VERBOSE)
#define RADIOLIB_VERBOSE (0)
#endif
// set which output port should be used for debug output
// may be Serial port (on Arduino) or file like stdout or stderr (on generic platforms)
#if !defined(RADIOLIB_DEBUG_PORT)
#define RADIOLIB_DEBUG_PORT Serial
#endif
/*
* Comment to disable "paranoid" SPI mode, or set RADIOLIB_SPI_PARANOID to 0
* Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
* This improves reliability, but slightly slows down communication.
* Note: Enabled by default.
*/
#if !defined(RADIOLIB_SPI_PARANOID)
#define RADIOLIB_SPI_PARANOID (1)
#endif
/*
* Comment to disable parameter range checking
* RadioLib will check provided parameters (such as frequency) against limits determined by the device manufacturer.
* It is highly advised to keep this macro defined, removing it will allow invalid values to be set,
* possibly leading to bricked module and/or program crashing.
* Note: Enabled by default.
*/
#if !defined(RADIOLIB_CHECK_PARAMS)
#define RADIOLIB_CHECK_PARAMS (1)
#endif
/*
* SX127x errata fix enable
* Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
* It should only be enabled if you really are observing some errata-related issue.
* Note: Disabled by default.
*/
#if !defined(RADIOLIB_FIX_ERRATA_SX127X)
#define RADIOLIB_FIX_ERRATA_SX127X (0)
#endif
/*
* God mode enable - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
* Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
* Failure to heed the above warning may result in bricked module.
*/
#if !defined(RADIOLIB_GODMODE)
#define RADIOLIB_GODMODE (0)
#endif
/*
* Low-level hardware access enable
* This will make some hardware methods like SPI get/set accessible from the user sketch - think of it as "god mode lite"
* Warning: RadioLib won't stop you from writing invalid stuff into your device, so it's quite easy to brick your module with this.
*/
#if !defined(RADIOLIB_LOW_LEVEL)
#define RADIOLIB_LOW_LEVEL (0)
#endif
/*
* Enable pre-defined modules when using RadioShield, disabled by default.
*/
#if !defined(RADIOLIB_RADIOSHIELD)
#define RADIOLIB_RADIOSHIELD (0)
#endif
/*
* Enable interrupt-based timing control
* For details, see https://github.com/jgromes/RadioLib/wiki/Interrupt-Based-Timing
*/
#if !defined(RADIOLIB_INTERRUPT_TIMING)
#define RADIOLIB_INTERRUPT_TIMING (0)
#endif
/*
* Enable static-only memory management: no dynamic allocation will be performed.
* Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
*/
#if !defined(RADIOLIB_STATIC_ONLY)
#define RADIOLIB_STATIC_ONLY (0)
#endif
// set the size of static arrays to use
#if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
#define RADIOLIB_STATIC_ARRAY_SIZE (256)
#endif
// the base address for persistent storage
// some protocols (e.g. LoRaWAN) require a method
// to store some data persistently
// on Arduino, this will use EEPROM, on non-Arduino platform,
// it will use anything provided by the hardware abstraction layer
// RadioLib will place these starting at this address
#if !defined(RADIOLIB_HAL_PERSISTENT_STORAGE_BASE)
#define RADIOLIB_HAL_PERSISTENT_STORAGE_BASE (0)
#endif
// the amount of space allocated to the persistent storage
#if !defined(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE)
#define RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE (0x0180)
#endif
/*
* Uncomment on boards whose clock runs too slow or too fast
* Set the value according to the following scheme:
* Enable timestamps on your terminal
* Print something to terminal, wait 1000 milliseconds, print something again
* If the difference is e.g. 1014 milliseconds between the prints, set this value to 14
* Or, for more accuracy, wait for 100,000 milliseconds and divide the total drift by 100
*/
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
//#define RADIOLIB_CLOCK_DRIFT_MS (0)
#endif
#if ARDUINO >= 100 #if ARDUINO >= 100
// Arduino build // Arduino build
#include "Arduino.h" #include "Arduino.h"
@ -61,23 +187,23 @@
// NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69 // NOTE: Some of the exclusion macros are dependent on each other. For example, it is not possible to exclude RF69
// while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional, // while keeping SX1231 (because RF69 is the base class for SX1231). The dependency is always uni-directional,
// so excluding SX1231 and keeping RF69 is valid. // so excluding SX1231 and keeping RF69 is valid.
//#define RADIOLIB_EXCLUDE_CC1101 //#define RADIOLIB_EXCLUDE_CC1101 (1)
//#define RADIOLIB_EXCLUDE_NRF24 //#define RADIOLIB_EXCLUDE_NRF24 (1)
//#define RADIOLIB_EXCLUDE_RF69 //#define RADIOLIB_EXCLUDE_RF69 (1)
//#define RADIOLIB_EXCLUDE_SX1231 // dependent on RADIOLIB_EXCLUDE_RF69 //#define RADIOLIB_EXCLUDE_SX1231 (1) // dependent on RADIOLIB_EXCLUDE_RF69
//#define RADIOLIB_EXCLUDE_SI443X //#define RADIOLIB_EXCLUDE_SI443X (1)
//#define RADIOLIB_EXCLUDE_RFM2X // dependent on RADIOLIB_EXCLUDE_SI443X //#define RADIOLIB_EXCLUDE_RFM2X (1) // dependent on RADIOLIB_EXCLUDE_SI443X
//#define RADIOLIB_EXCLUDE_SX127X //#define RADIOLIB_EXCLUDE_SX127X (1)
//#define RADIOLIB_EXCLUDE_SX126X //#define RADIOLIB_EXCLUDE_SX126X (1)
//#define RADIOLIB_EXCLUDE_STM32WLX // dependent on RADIOLIB_EXCLUDE_SX126X //#define RADIOLIB_EXCLUDE_STM32WLX (1) // dependent on RADIOLIB_EXCLUDE_SX126X
//#define RADIOLIB_EXCLUDE_SX128X //#define RADIOLIB_EXCLUDE_SX128X (1)
//#define RADIOLIB_EXCLUDE_AFSK //#define RADIOLIB_EXCLUDE_AFSK (1)
//#define RADIOLIB_EXCLUDE_AX25 //#define RADIOLIB_EXCLUDE_AX25 (1)
//#define RADIOLIB_EXCLUDE_HELLSCHREIBER //#define RADIOLIB_EXCLUDE_HELLSCHREIBER (1)
//#define RADIOLIB_EXCLUDE_MORSE //#define RADIOLIB_EXCLUDE_MORSE (1)
//#define RADIOLIB_EXCLUDE_RTTY //#define RADIOLIB_EXCLUDE_RTTY (1)
//#define RADIOLIB_EXCLUDE_SSTV //#define RADIOLIB_EXCLUDE_SSTV (1)
//#define RADIOLIB_EXCLUDE_DIRECT_RECEIVE //#define RADIOLIB_EXCLUDE_DIRECT_RECEIVE (1)
#elif defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR)) #elif defined(__AVR__) && !(defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || defined(ARDUINO_ARCH_MEGAAVR))
// Arduino AVR boards (except for megaAVR) - Uno, Mega etc. // Arduino AVR boards (except for megaAVR) - Uno, Mega etc.
@ -337,137 +463,13 @@
#endif #endif
/*
* Uncomment to enable debug output.
* Warning: Debug output will slow down the whole system significantly.
* Also, it will result in larger compiled binary.
* Levels: debug - only main info
* verbose - full transcript of all SPI communication
*/
#if !defined(RADIOLIB_DEBUG)
//#define RADIOLIB_DEBUG
#endif
#if !defined(RADIOLIB_VERBOSE)
//#define RADIOLIB_VERBOSE
#endif
// set which output port should be used for debug output
// may be Serial port (on Arduino) or file like stdout or stderr (on generic platforms)
#if defined(RADIOLIB_BUILD_ARDUINO) && !defined(RADIOLIB_DEBUG_PORT)
#define RADIOLIB_DEBUG_PORT Serial
#endif
/*
* Uncomment to enable "paranoid" SPI mode
* Every write to an SPI register using SPI set function will be verified by a subsequent read operation.
* This improves reliability, but slightly slows down communication.
* Note: Enabled by default.
*/
#if !defined(RADIOLIB_SPI_PARANOID)
#define RADIOLIB_SPI_PARANOID
#endif
/*
* Uncomment to enable parameter range checking
* RadioLib will check provided parameters (such as frequency) against limits determined by the device manufacturer.
* It is highly advised to keep this macro defined, removing it will allow invalid values to be set,
* possibly leading to bricked module and/or program crashing.
* Note: Enabled by default.
*/
#if !defined(RADIOLIB_CHECK_PARAMS)
#define RADIOLIB_CHECK_PARAMS
#endif
/*
* Uncomment to enable SX127x errata fix
* Warning: SX127x errata fix has been reported to cause issues with LoRa bandwidths lower than 62.5 kHz.
* It should only be enabled if you really are observing some errata-related issue.
* Note: Disabled by default.
*/
#if !defined(RADIOLIB_FIX_ERRATA_SX127X)
//#define RADIOLIB_FIX_ERRATA_SX127X
#endif
/*
* Uncomment to enable god mode - all methods and member variables in all classes will be made public, thus making them accessible from Arduino code.
* Warning: Come on, it's called GOD mode - obviously only use this if you know what you're doing.
* Failure to heed the above warning may result in bricked module.
*/
#if !defined(RADIOLIB_GODMODE)
//#define RADIOLIB_GODMODE
#endif
/*
* Uncomment to enable low-level hardware access
* This will make some hardware methods like SPI get/set accessible from the user sketch - think of it as "god mode lite"
* Warning: RadioLib won't stop you from writing invalid stuff into your device, so it's quite easy to brick your module with this.
*/
#if !defined(RADIOLIB_LOW_LEVEL)
//#define RADIOLIB_LOW_LEVEL
#endif
/*
* Uncomment to enable pre-defined modules when using RadioShield.
*/
#if !defined(RADIOLIB_RADIOSHIELD)
//#define RADIOLIB_RADIOSHIELD
#endif
/*
* Uncomment to enable interrupt-based timing control
* For details, see https://github.com/jgromes/RadioLib/wiki/Interrupt-Based-Timing
*/
#if !defined(RADIOLIB_INTERRUPT_TIMING)
//#define RADIOLIB_INTERRUPT_TIMING
#endif
/*
* Uncomment to enable static-only memory management: no dynamic allocation will be performed.
* Warning: Large static arrays will be created in some methods. It is not advised to send large packets in this mode.
*/
#if !defined(RADIOLIB_STATIC_ONLY)
//#define RADIOLIB_STATIC_ONLY
#endif
// set the size of static arrays to use
#if !defined(RADIOLIB_STATIC_ARRAY_SIZE)
#define RADIOLIB_STATIC_ARRAY_SIZE (256)
#endif
// the base address for persistent storage
// some protocols (e.g. LoRaWAN) require a method
// to store some data persistently
// on Arduino, this will use EEPROM, on non-Arduino platform,
// it will use anything provided by the hardware abstraction layer
// RadioLib will place these starting at this address
#if !defined(RADIOLIB_HAL_PERSISTENT_STORAGE_BASE)
#define RADIOLIB_HAL_PERSISTENT_STORAGE_BASE (0)
#endif
// the amount of space allocated to the persistent storage
#if !defined(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE)
#define RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE (0x0180)
#endif
/*
* Uncomment on boards whose clock runs too slow or too fast
* Set the value according to the following scheme:
* Enable timestamps on your terminal
* Print something to terminal, wait 1000 milliseconds, print something again
* If the difference is e.g. 1014 milliseconds between the prints, set this value to 14
* Or, for more accuracy, wait for 100,000 milliseconds and divide the total drift by 100
*/
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
//#define RADIOLIB_CLOCK_DRIFT_MS (0)
#endif
// This only compiles on STM32 boards with SUBGHZ module, but also // This only compiles on STM32 boards with SUBGHZ module, but also
// include when generating docs // include when generating docs
#if (!defined(ARDUINO_ARCH_STM32) || !defined(SUBGHZSPI_BASE)) && !defined(DOXYGEN) #if (!defined(ARDUINO_ARCH_STM32) || !defined(SUBGHZSPI_BASE)) && !defined(DOXYGEN)
#define RADIOLIB_EXCLUDE_STM32WLX #define RADIOLIB_EXCLUDE_STM32WLX (1)
#endif #endif
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
#if defined(RADIOLIB_BUILD_ARDUINO) #if defined(RADIOLIB_BUILD_ARDUINO)
#define RADIOLIB_DEBUG_PRINT(...) Module::serialPrintf(__VA_ARGS__) #define RADIOLIB_DEBUG_PRINT(...) Module::serialPrintf(__VA_ARGS__)
#define RADIOLIB_DEBUG_PRINTLN(M, ...) Module::serialPrintf(M "\n", ##__VA_ARGS__) #define RADIOLIB_DEBUG_PRINTLN(M, ...) Module::serialPrintf(M "\n", ##__VA_ARGS__)
@ -491,7 +493,7 @@
#define RADIOLIB_DEBUG_HEXDUMP(...) {} #define RADIOLIB_DEBUG_HEXDUMP(...) {}
#endif #endif
#if defined(RADIOLIB_VERBOSE) #if RADIOLIB_VERBOSE
#define RADIOLIB_VERBOSE_PRINT(...) RADIOLIB_DEBUG_PRINT(__VA_ARGS__) #define RADIOLIB_VERBOSE_PRINT(...) RADIOLIB_DEBUG_PRINT(__VA_ARGS__)
#define RADIOLIB_VERBOSE_PRINTLN(...) RADIOLIB_DEBUG_PRINTLN(__VA_ARGS__) #define RADIOLIB_VERBOSE_PRINTLN(...) RADIOLIB_DEBUG_PRINTLN(__VA_ARGS__)
#else #else
@ -507,13 +509,13 @@
/*! /*!
\brief Macro to check variable is within constraints - this is commonly used to check parameter ranges. Requires RADIOLIB_CHECK_RANGE to be enabled \brief Macro to check variable is within constraints - this is commonly used to check parameter ranges. Requires RADIOLIB_CHECK_RANGE to be enabled
*/ */
#if defined(RADIOLIB_CHECK_PARAMS) #if RADIOLIB_CHECK_PARAMS
#define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } } #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
#else #else
#define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {} #define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {}
#endif #endif
#if defined(RADIOLIB_FIX_ERRATA_SX127X) #if RADIOLIB_FIX_ERRATA_SX127X
#define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); } #define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
#else #else
#define RADIOLIB_ERRATA_SX127X(...) {} #define RADIOLIB_ERRATA_SX127X(...) {}
@ -526,7 +528,7 @@
// version definitions // version definitions
#define RADIOLIB_VERSION_MAJOR 6 #define RADIOLIB_VERSION_MAJOR 6
#define RADIOLIB_VERSION_MINOR 2 #define RADIOLIB_VERSION_MINOR 3
#define RADIOLIB_VERSION_PATCH 0 #define RADIOLIB_VERSION_PATCH 0
#define RADIOLIB_VERSION_EXTRA 0 #define RADIOLIB_VERSION_EXTRA 0

View file

@ -5,7 +5,7 @@
// most commonly, RADIOLIB_EXCLUDE_* macros // most commonly, RADIOLIB_EXCLUDE_* macros
// or enabling debug output // or enabling debug output
//#define RADIOLIB_DEBUG //#define RADIOLIB_DEBUG (1)
//#define RADIOLIB_VERBOSE //#define RADIOLIB_VERBOSE (1)
#endif #endif

View file

@ -5,7 +5,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
// needed for debug print // needed for debug print
#include <stdarg.h> #include <stdarg.h>
#endif #endif
@ -75,7 +75,7 @@ int16_t Module::SPIsetRegValue(uint16_t reg, uint8_t value, uint8_t msb, uint8_t
uint8_t newValue = (currentValue & ~mask) | (value & mask); uint8_t newValue = (currentValue & ~mask) | (value & mask);
SPIwriteRegister(reg, newValue); SPIwriteRegister(reg, newValue);
#if defined(RADIOLIB_SPI_PARANOID) #if RADIOLIB_SPI_PARANOID
// check register value each millisecond until check interval is reached // check register value each millisecond until check interval is reached
// some registers need a bit of time to process the change (e.g. SX127X_REG_OP_MODE) // some registers need a bit of time to process the change (e.g. SX127X_REG_OP_MODE)
uint32_t start = this->hal->micros(); uint32_t start = this->hal->micros();
@ -145,7 +145,7 @@ void Module::SPIwriteRegister(uint16_t reg, uint8_t data) {
void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* dataIn, size_t numBytes) { void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* dataIn, size_t numBytes) {
// prepare the buffers // prepare the buffers
size_t buffLen = this->SPIaddrWidth/8 + numBytes; size_t buffLen = this->SPIaddrWidth/8 + numBytes;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
@ -182,7 +182,7 @@ void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* d
} }
// print debug information // print debug information
#if defined(RADIOLIB_VERBOSE) #if RADIOLIB_VERBOSE
uint8_t* debugBuffPtr = NULL; uint8_t* debugBuffPtr = NULL;
if(cmd == SPIwriteCommand) { if(cmd == SPIwriteCommand) {
RADIOLIB_VERBOSE_PRINT("W\t%X\t", reg); RADIOLIB_VERBOSE_PRINT("W\t%X\t", reg);
@ -197,7 +197,7 @@ void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* d
RADIOLIB_VERBOSE_PRINTLN(); RADIOLIB_VERBOSE_PRINTLN();
#endif #endif
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif
@ -240,7 +240,7 @@ int16_t Module::SPIwriteStream(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, size
int16_t Module::SPIcheckStream() { int16_t Module::SPIcheckStream() {
int16_t state = RADIOLIB_ERR_NONE; int16_t state = RADIOLIB_ERR_NONE;
#if defined(RADIOLIB_SPI_PARANOID) #if RADIOLIB_SPI_PARANOID
// get the status // get the status
uint8_t spiStatus = 0; uint8_t spiStatus = 0;
uint8_t cmd = this->SPIstatusCommand; uint8_t cmd = this->SPIstatusCommand;
@ -262,7 +262,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
if(!write) { if(!write) {
buffLen++; buffLen++;
} }
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
@ -292,7 +292,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
this->hal->yield(); this->hal->yield();
if(this->hal->millis() - start >= timeout) { if(this->hal->millis() - start >= timeout) {
RADIOLIB_DEBUG_PRINTLN("GPIO pre-transfer timeout, is it connected?"); RADIOLIB_DEBUG_PRINTLN("GPIO pre-transfer timeout, is it connected?");
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif
@ -319,7 +319,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
this->hal->yield(); this->hal->yield();
if(this->hal->millis() - start >= timeout) { if(this->hal->millis() - start >= timeout) {
RADIOLIB_DEBUG_PRINTLN("GPIO post-transfer timeout, is it connected?"); RADIOLIB_DEBUG_PRINTLN("GPIO post-transfer timeout, is it connected?");
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif
@ -342,7 +342,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
} }
// print debug information // print debug information
#if defined(RADIOLIB_VERBOSE) #if RADIOLIB_VERBOSE
// print command byte(s) // print command byte(s)
RADIOLIB_VERBOSE_PRINT("CMD"); RADIOLIB_VERBOSE_PRINT("CMD");
if(write) { if(write) {
@ -369,7 +369,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
RADIOLIB_VERBOSE_PRINTLN(); RADIOLIB_VERBOSE_PRINTLN();
#endif #endif
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif
@ -378,7 +378,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
} }
void Module::waitForMicroseconds(uint32_t start, uint32_t len) { void Module::waitForMicroseconds(uint32_t start, uint32_t len) {
#if defined(RADIOLIB_INTERRUPT_TIMING) #if RADIOLIB_INTERRUPT_TIMING
(void)start; (void)start;
if((this->TimerSetupCb != nullptr) && (len != this->prevTimingLen)) { if((this->TimerSetupCb != nullptr) && (len != this->prevTimingLen)) {
prevTimingLen = len; prevTimingLen = len;
@ -403,7 +403,7 @@ uint32_t Module::reflect(uint32_t in, uint8_t bits) {
return(res); return(res);
} }
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
void Module::hexdump(uint8_t* data, size_t len, uint32_t offset, uint8_t width, bool be) { void Module::hexdump(uint8_t* data, size_t len, uint32_t offset, uint8_t width, bool be) {
size_t rem_len = len; size_t rem_len = len;
for(size_t i = 0; i < len; i+=16) { for(size_t i = 0; i < len; i+=16) {
@ -450,20 +450,20 @@ void Module::hexdump(uint8_t* data, size_t len, uint32_t offset, uint8_t width,
} }
void Module::regdump(uint16_t start, size_t len) { void Module::regdump(uint16_t start, size_t len) {
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t buff[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buff[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint8_t* buff = new uint8_t[len]; uint8_t* buff = new uint8_t[len];
#endif #endif
SPIreadRegisterBurst(start, len, buff); SPIreadRegisterBurst(start, len, buff);
hexdump(buff, len, start); hexdump(buff, len, start);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buff; delete[] buff;
#endif #endif
} }
#endif #endif
#if defined(RADIOLIB_DEBUG) and defined(RADIOLIB_BUILD_ARDUINO) #if RADIOLIB_DEBUG && defined(RADIOLIB_BUILD_ARDUINO)
// https://github.com/esp8266/Arduino/blob/65579d29081cb8501e4d7f786747bf12e7b37da2/cores/esp8266/Print.cpp#L50 // https://github.com/esp8266/Arduino/blob/65579d29081cb8501e4d7f786747bf12e7b37da2/cores/esp8266/Print.cpp#L50
size_t Module::serialPrintf(const char* format, ...) { size_t Module::serialPrintf(const char* format, ...) {
va_list arg; va_list arg;

View file

@ -168,7 +168,7 @@ class Module {
*/ */
SPIparseStatusCb_t SPIparseStatusCb = nullptr; SPIparseStatusCb_t SPIparseStatusCb = nullptr;
#if defined(RADIOLIB_INTERRUPT_TIMING) #if RADIOLIB_INTERRUPT_TIMING
/*! /*!
\brief Timer interrupt setup callback typedef. \brief Timer interrupt setup callback typedef.
@ -468,7 +468,7 @@ class Module {
*/ */
static uint32_t reflect(uint32_t in, uint8_t bits); static uint32_t reflect(uint32_t in, uint8_t bits);
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
/*! /*!
\brief Function to dump data as hex into the debug port. \brief Function to dump data as hex into the debug port.
\param data Data to dump. \param data Data to dump.
@ -486,11 +486,11 @@ class Module {
void regdump(uint16_t start, size_t len); void regdump(uint16_t start, size_t len);
#endif #endif
#if defined(RADIOLIB_DEBUG) and defined(RADIOLIB_BUILD_ARDUINO) #if RADIOLIB_DEBUG and defined(RADIOLIB_BUILD_ARDUINO)
static size_t serialPrintf(const char* format, ...); static size_t serialPrintf(const char* format, ...);
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
uint32_t csPin = RADIOLIB_NC; uint32_t csPin = RADIOLIB_NC;
@ -502,7 +502,7 @@ class Module {
uint32_t rfSwitchPins[RFSWITCH_MAX_PINS] = { RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC }; uint32_t rfSwitchPins[RFSWITCH_MAX_PINS] = { RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC };
const RfSwitchMode_t *rfSwitchTable = nullptr; const RfSwitchMode_t *rfSwitchTable = nullptr;
#if defined(RADIOLIB_INTERRUPT_TIMING) #if RADIOLIB_INTERRUPT_TIMING
uint32_t prevTimingLen = 0; uint32_t prevTimingLen = 0;
#endif #endif
}; };

View file

@ -47,12 +47,12 @@
// warnings are printed in this file since BuildOpt.h is compiled in multiple places // warnings are printed in this file since BuildOpt.h is compiled in multiple places
// check God mode // check God mode
#if defined(RADIOLIB_GODMODE) #if RADIOLIB_GODMODE
#warning "God mode active, I hope it was intentional. Buckle up, lads." #warning "God mode active, I hope it was intentional. Buckle up, lads."
#endif #endif
// print debug info // print debug info
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
#define RADIOLIB_VALUE_TO_STRING(x) #x #define RADIOLIB_VALUE_TO_STRING(x) #x
#define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x) #define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
#pragma message("\nRadioLib Debug Info\nVersion: \"" \ #pragma message("\nRadioLib Debug Info\nVersion: \"" \
@ -120,7 +120,7 @@
#include "utils/Cryptography.h" #include "utils/Cryptography.h"
// only create Radio class when using RadioShield // only create Radio class when using RadioShield
#if defined(RADIOLIB_RADIOSHIELD) #if RADIOLIB_RADIOSHIELD
// RadioShield pin definitions // RadioShield pin definitions
#define RADIOSHIELD_CS_A 10 #define RADIOSHIELD_CS_A 10
@ -152,7 +152,7 @@ class Radio {
ModuleB = new Module(RADIOSHIELD_CS_B, RADIOSHIELD_IRQ_B, RADIOSHIELD_RST_B, RADIOSHIELD_GPIO_B); ModuleB = new Module(RADIOSHIELD_CS_B, RADIOSHIELD_IRQ_B, RADIOSHIELD_RST_B, RADIOSHIELD_GPIO_B);
} }
#if defined(RADIOLIB_GODMODE) #if RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,6 +1,6 @@
#include "CC1101.h" #include "CC1101.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_CC1101) #if !RADIOLIB_EXCLUDE_CC1101
CC1101::CC1101(Module* module) : PhysicalLayer(RADIOLIB_CC1101_FREQUENCY_STEP_SIZE, RADIOLIB_CC1101_MAX_PACKET_LENGTH) { CC1101::CC1101(Module* module) : PhysicalLayer(RADIOLIB_CC1101_FREQUENCY_STEP_SIZE, RADIOLIB_CC1101_MAX_PACKET_LENGTH) {
this->mod = module; this->mod = module;
@ -935,7 +935,7 @@ int16_t CC1101::getChipVersion() {
return(SPIgetRegValue(RADIOLIB_CC1101_REG_VERSION)); return(SPIgetRegValue(RADIOLIB_CC1101_REG_VERSION));
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void CC1101::setDirectAction(void (*func)(void)) { void CC1101::setDirectAction(void (*func)(void)) {
setGdo0Action(func, this->mod->hal->GpioInterruptRising); setGdo0Action(func, this->mod->hal->GpioInterruptRising);
} }

View file

@ -1,4 +1,4 @@
#if !defined(_RADIOLIB_CC1101_H) && !defined(RADIOLIB_EXCLUDE_CC1101) #if !defined(_RADIOLIB_CC1101_H) && !RADIOLIB_EXCLUDE_CC1101
#define _RADIOLIB_CC1101_H #define _RADIOLIB_CC1101_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
@ -922,7 +922,7 @@ class CC1101: public PhysicalLayer {
*/ */
int16_t getChipVersion(); int16_t getChipVersion();
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set interrupt service routine function to call when data bit is receveid in direct mode. \brief Set interrupt service routine function to call when data bit is receveid in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
@ -944,7 +944,7 @@ class CC1101: public PhysicalLayer {
*/ */
int16_t setDIOMapping(uint32_t pin, uint32_t value); int16_t setDIOMapping(uint32_t pin, uint32_t value);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
@ -959,7 +959,7 @@ class CC1101: public PhysicalLayer {
void SPIsendCommand(uint8_t cmd); void SPIsendCommand(uint8_t cmd);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "LLCC68.h" #include "LLCC68.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
LLCC68::LLCC68(Module* mod) : SX1262(mod) { LLCC68::LLCC68(Module* mod) : SX1262(mod) {
chipType = RADIOLIB_LLCC68_CHIP_TYPE; chipType = RADIOLIB_LLCC68_CHIP_TYPE;

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
#include "../../Module.h" #include "../../Module.h"
#include "../SX126x/SX1262.h" #include "../SX126x/SX1262.h"
@ -56,7 +56,7 @@ class LLCC68: public SX1262 {
*/ */
int16_t setSpreadingFactor(uint8_t sf); int16_t setSpreadingFactor(uint8_t sf);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,6 +1,6 @@
#include "RF69.h" #include "RF69.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_RF69) #if !RADIOLIB_EXCLUDE_RF69
RF69::RF69(Module* module) : PhysicalLayer(RADIOLIB_RF69_FREQUENCY_STEP_SIZE, RADIOLIB_RF69_MAX_PACKET_LENGTH) { RF69::RF69(Module* module) : PhysicalLayer(RADIOLIB_RF69_FREQUENCY_STEP_SIZE, RADIOLIB_RF69_MAX_PACKET_LENGTH) {
this->mod = module; this->mod = module;
@ -960,7 +960,7 @@ uint8_t RF69::randomByte() {
return(randByte); return(randByte);
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void RF69::setDirectAction(void (*func)(void)) { void RF69::setDirectAction(void (*func)(void)) {
setDio1Action(func); setDio1Action(func);
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RF69) #if !RADIOLIB_EXCLUDE_RF69
#include "../../Module.h" #include "../../Module.h"
@ -973,7 +973,7 @@ class RF69: public PhysicalLayer {
*/ */
int16_t getChipVersion(); int16_t getChipVersion();
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set interrupt service routine function to call when data bit is received in direct mode. \brief Set interrupt service routine function to call when data bit is received in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
@ -995,12 +995,12 @@ class RF69: public PhysicalLayer {
*/ */
int16_t setDIOMapping(uint32_t pin, uint32_t value); int16_t setDIOMapping(uint32_t pin, uint32_t value);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
@ -1025,7 +1025,7 @@ class RF69: public PhysicalLayer {
int16_t directMode(); int16_t directMode();
int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setPacketMode(uint8_t mode, uint8_t len);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
int16_t setMode(uint8_t mode); int16_t setMode(uint8_t mode);

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RFM2X) #if !RADIOLIB_EXCLUDE_RFM2X
#include "../../Module.h" #include "../../Module.h"
#include "../Si443x/Si443x.h" #include "../Si443x/Si443x.h"

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RFM2X) #if !RADIOLIB_EXCLUDE_RFM2X
#include "../../Module.h" #include "../../Module.h"
#include "../Si443x/Si443x.h" #include "../Si443x/Si443x.h"

View file

@ -1,5 +1,5 @@
#include "SX1231.h" #include "SX1231.h"
#if !defined(RADIOLIB_EXCLUDE_SX1231) #if !RADIOLIB_EXCLUDE_SX1231
SX1231::SX1231(Module* mod) : RF69(mod) { SX1231::SX1231(Module* mod) : RF69(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX1231) #if !RADIOLIB_EXCLUDE_SX1231
#include "../../Module.h" #include "../../Module.h"
#include "../RF69/RF69.h" #include "../RF69/RF69.h"
@ -110,7 +110,7 @@ class SX1231: public RF69 {
*/ */
int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16); int16_t begin(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
uint8_t chipRevision = 0; uint8_t chipRevision = 0;

View file

@ -6,7 +6,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
*/ */
#include "STM32WLx.h" #include "STM32WLx.h"
#if !defined(RADIOLIB_EXCLUDE_STM32WLX) #if !RADIOLIB_EXCLUDE_STM32WLX
STM32WLx::STM32WLx(STM32WLx_Module* mod) : SX1262(mod) { } STM32WLx::STM32WLx(STM32WLx_Module* mod) : SX1262(mod) { }
@ -150,4 +150,4 @@ void STM32WLx::clearChannelScanAction() {
this->clearDio1Action(); this->clearDio1Action();
} }
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX) #endif

View file

@ -10,7 +10,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_STM32WLX) #if !RADIOLIB_EXCLUDE_STM32WLX
#include "../../Module.h" #include "../../Module.h"
#include "SX1262.h" #include "SX1262.h"
@ -153,16 +153,16 @@ class STM32WLx : public SX1262 {
*/ */
void clearChannelScanAction(); void clearChannelScanAction();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
virtual int16_t clearIrqStatus(uint16_t clearIrqParams) override; virtual int16_t clearIrqStatus(uint16_t clearIrqParams) override;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
}; };
#endif // !defined(RADIOLIB_EXCLUDE_SX126X) #endif
#endif // _RADIOLIB_STM32WLX_MODULE_H #endif

View file

@ -7,7 +7,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
#include "STM32WLx_Module.h" #include "STM32WLx_Module.h"
#if !defined(RADIOLIB_EXCLUDE_STM32WLX) #if !RADIOLIB_EXCLUDE_STM32WLX
#include "../../ArduinoHal.h" #include "../../ArduinoHal.h"
@ -103,4 +103,4 @@ STM32WLx_Module::STM32WLx_Module():
RADIOLIB_STM32WLx_VIRTUAL_PIN_BUSY RADIOLIB_STM32WLx_VIRTUAL_PIN_BUSY
) {} ) {}
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX) #endif

View file

@ -10,7 +10,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_STM32WLX) #if !RADIOLIB_EXCLUDE_STM32WLX
#include "../../Module.h" #include "../../Module.h"
@ -33,6 +33,6 @@ class STM32WLx_Module : public Module {
STM32WLx_Module(); STM32WLx_Module();
}; };
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX) #endif
#endif // _RADIOLIB_STM32WLX_MODULE_H #endif

View file

@ -1,5 +1,5 @@
#include "SX1261.h" #include "SX1261.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
SX1261::SX1261(Module* mod): SX1262(mod) { SX1261::SX1261(Module* mod): SX1262(mod) {
chipType = RADIOLIB_SX1261_CHIP_TYPE; chipType = RADIOLIB_SX1261_CHIP_TYPE;

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
#include "../../Module.h" #include "../../Module.h"
#include "SX126x.h" #include "SX126x.h"
@ -34,7 +34,7 @@ class SX1261 : public SX1262 {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1262.h" #include "SX1262.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
SX1262::SX1262(Module* mod) : SX126x(mod) { SX1262::SX1262(Module* mod) : SX126x(mod) {
chipType = RADIOLIB_SX1262_CHIP_TYPE; chipType = RADIOLIB_SX1262_CHIP_TYPE;

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
#include "../../Module.h" #include "../../Module.h"
#include "SX126x.h" #include "SX126x.h"
@ -87,7 +87,7 @@ class SX1262: public SX126x {
*/ */
virtual int16_t setOutputPower(int8_t power); virtual int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1268.h" #include "SX1268.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
SX1268::SX1268(Module* mod) : SX126x(mod) { SX1268::SX1268(Module* mod) : SX126x(mod) {
chipType = RADIOLIB_SX1268_CHIP_TYPE; chipType = RADIOLIB_SX1268_CHIP_TYPE;

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
#include "../../Module.h" #include "../../Module.h"
#include "SX126x.h" #include "SX126x.h"
@ -85,7 +85,7 @@ class SX1268: public SX126x {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,7 +1,7 @@
#include "SX126x.h" #include "SX126x.h"
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) { SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -1547,7 +1547,7 @@ int16_t SX126x::invertIQ(bool enable) {
return(setPacketParams(this->preambleLengthLoRa, this->crcTypeLoRa, this->implicitLen, this->headerType, this->invertIQEnabled)); return(setPacketParams(this->preambleLengthLoRa, this->crcTypeLoRa, this->implicitLen, this->headerType, this->invertIQEnabled));
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void SX126x::setDirectAction(void (*func)(void)) { void SX126x::setDirectAction(void (*func)(void)) {
setDio1Action(func); setDio1Action(func);
} }
@ -1563,7 +1563,7 @@ int16_t SX126x::uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile)
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
// check the version // check the version
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
char ver_pre[16]; char ver_pre[16];
this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_pre); this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_pre);
RADIOLIB_DEBUG_PRINTLN("Pre-update version string: %s", ver_pre); RADIOLIB_DEBUG_PRINTLN("Pre-update version string: %s", ver_pre);
@ -1595,7 +1595,7 @@ int16_t SX126x::uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile)
this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_PRAM_UPDATE, NULL, 0); this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_PRAM_UPDATE, NULL, 0);
// check the version again // check the version again
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
char ver_post[16]; char ver_post[16];
this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_post); this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)ver_post);
RADIOLIB_DEBUG_PRINTLN("Post-update version string: %s", ver_post); RADIOLIB_DEBUG_PRINTLN("Post-update version string: %s", ver_post);
@ -1839,7 +1839,7 @@ int16_t SX126x::calibrateImage(uint8_t* data) {
int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE_IMAGE, data, 2); int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE_IMAGE, data, 2);
// if something failed, show the device errors // if something failed, show the device errors
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
if(state != RADIOLIB_ERR_NONE) { if(state != RADIOLIB_ERR_NONE) {
// unless mode is forced to standby, device errors will be 0 // unless mode is forced to standby, device errors will be 0
standby(); standby();
@ -2099,7 +2099,7 @@ int16_t SX126x::config(uint8_t modem) {
state = this->mod->SPIcheckStream(); state = this->mod->SPIcheckStream();
// if something failed, show the device errors // if something failed, show the device errors
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
if(state != RADIOLIB_ERR_NONE) { if(state != RADIOLIB_ERR_NONE) {
// unless mode is forced to standby, device errors will be 0 // unless mode is forced to standby, device errors will be 0
standby(); standby();
@ -2142,7 +2142,7 @@ bool SX126x::findChip(const char* verStr) {
RADIOLIB_DEBUG_PRINTLN(); RADIOLIB_DEBUG_PRINTLN();
flagFound = true; flagFound = true;
} else { } else {
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
RADIOLIB_DEBUG_PRINTLN("SX126x not found! (%d of 10 tries) RADIOLIB_SX126X_REG_VERSION_STRING:", i + 1); RADIOLIB_DEBUG_PRINTLN("SX126x not found! (%d of 10 tries) RADIOLIB_SX126X_REG_VERSION_STRING:", i + 1);
RADIOLIB_DEBUG_HEXDUMP((uint8_t*)version, 16, RADIOLIB_SX126X_REG_VERSION_STRING); RADIOLIB_DEBUG_HEXDUMP((uint8_t*)version, 16, RADIOLIB_SX126X_REG_VERSION_STRING);
RADIOLIB_DEBUG_PRINTLN("Expected string: %s", verStr); RADIOLIB_DEBUG_PRINTLN("Expected string: %s", verStr);

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
#include "../../Module.h" #include "../../Module.h"
@ -1039,7 +1039,7 @@ class SX126x: public PhysicalLayer {
*/ */
int16_t invertIQ(bool enable) override; int16_t invertIQ(bool enable) override;
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set interrupt service routine function to call when data bit is received in direct mode. \brief Set interrupt service routine function to call when data bit is received in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
@ -1104,7 +1104,7 @@ class SX126x: public PhysicalLayer {
*/ */
int16_t setPaConfig(uint8_t paDutyCycle, uint8_t deviceSel, uint8_t hpMax = RADIOLIB_SX126X_PA_CONFIG_HP_MAX, uint8_t paLut = RADIOLIB_SX126X_PA_CONFIG_PA_LUT); int16_t setPaConfig(uint8_t paDutyCycle, uint8_t deviceSel, uint8_t hpMax = RADIOLIB_SX126X_PA_CONFIG_HP_MAX, uint8_t paLut = RADIOLIB_SX126X_PA_CONFIG_PA_LUT);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
// SX126x SPI command implementations // SX126x SPI command implementations
@ -1146,7 +1146,7 @@ class SX126x: public PhysicalLayer {
int16_t fixImplicitTimeout(); int16_t fixImplicitTimeout();
int16_t fixInvertedIQ(uint8_t iqConfig); int16_t fixInvertedIQ(uint8_t iqConfig);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
@ -1154,7 +1154,7 @@ class SX126x: public PhysicalLayer {
// common low-level SPI interface // common low-level SPI interface
static int16_t SPIparseStatus(uint8_t in); static int16_t SPIparseStatus(uint8_t in);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif

View file

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../../TypeDef.h" #include "../../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX126X) #if !RADIOLIB_EXCLUDE_SX126X
// the following is a binary patch to the SX1262 // the following is a binary patch to the SX1262
// this patch is needed to enable spectral scan functionality // this patch is needed to enable spectral scan functionality

View file

@ -1,6 +1,6 @@
#include "SX1272.h" #include "SX1272.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1272::SX1272(Module* mod) : SX127x(mod) { SX1272::SX1272(Module* mod) : SX127x(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "../../Module.h" #include "../../Module.h"
#include "SX127x.h" #include "SX127x.h"
@ -271,7 +271,7 @@ class SX1272: public SX127x {
*/ */
int16_t explicitHeader(); int16_t explicitHeader();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
int16_t setBandwidthRaw(uint8_t newBandwidth); int16_t setBandwidthRaw(uint8_t newBandwidth);
@ -282,7 +282,7 @@ class SX1272: public SX127x {
int16_t configFSK(); int16_t configFSK();
void errataFix(bool rx); void errataFix(bool rx);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
bool ldroAuto = true; bool ldroAuto = true;

View file

@ -1,5 +1,5 @@
#include "SX1273.h" #include "SX1273.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1273::SX1273(Module* mod) : SX1272(mod) { SX1273::SX1273(Module* mod) : SX1272(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "SX1272.h" #include "SX1272.h"
@ -56,7 +56,7 @@ class SX1273: public SX1272 {
*/ */
int16_t setDataRate(DataRate_t dr) override; int16_t setDataRate(DataRate_t dr) override;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1276.h" #include "SX1276.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1276::SX1276(Module* mod) : SX1278(mod) { SX1276::SX1276(Module* mod) : SX1278(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "SX1278.h" #include "SX1278.h"
@ -63,7 +63,7 @@ class SX1276: public SX1278 {
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1277.h" #include "SX1277.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1277::SX1277(Module* mod) : SX1278(mod) { SX1277::SX1277(Module* mod) : SX1278(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "SX1278.h" #include "SX1278.h"
@ -77,7 +77,7 @@ class SX1277: public SX1278 {
*/ */
int16_t setDataRate(DataRate_t dr) override; int16_t setDataRate(DataRate_t dr) override;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,6 +1,6 @@
#include "SX1278.h" #include "SX1278.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1278::SX1278(Module* mod) : SX127x(mod) { SX1278::SX1278(Module* mod) : SX127x(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "../../Module.h" #include "../../Module.h"
#include "SX127x.h" #include "SX127x.h"
@ -282,7 +282,7 @@ class SX1278: public SX127x {
*/ */
int16_t explicitHeader(); int16_t explicitHeader();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
int16_t setBandwidthRaw(uint8_t newBandwidth); int16_t setBandwidthRaw(uint8_t newBandwidth);
@ -293,7 +293,7 @@ class SX1278: public SX127x {
int16_t configFSK(); int16_t configFSK();
void errataFix(bool rx); void errataFix(bool rx);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
bool ldroAuto = true; bool ldroAuto = true;

View file

@ -1,5 +1,5 @@
#include "SX1279.h" #include "SX1279.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX1279::SX1279(Module* mod) : SX1278(mod) { SX1279::SX1279(Module* mod) : SX1278(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "SX1278.h" #include "SX1278.h"
@ -63,7 +63,7 @@ class SX1279: public SX1278 {
*/ */
int16_t setFrequency(float freq); int16_t setFrequency(float freq);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,6 +1,6 @@
#include "SX127x.h" #include "SX127x.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
SX127x::SX127x(Module* mod) : PhysicalLayer(RADIOLIB_SX127X_FREQUENCY_STEP_SIZE, RADIOLIB_SX127X_MAX_PACKET_LENGTH) { SX127x::SX127x(Module* mod) : PhysicalLayer(RADIOLIB_SX127X_FREQUENCY_STEP_SIZE, RADIOLIB_SX127X_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -1628,7 +1628,7 @@ int16_t SX127x::invertIQ(bool enable) {
return(state); return(state);
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void SX127x::setDirectAction(void (*func)(void)) { void SX127x::setDirectAction(void (*func)(void)) {
setDio1Action(func, this->mod->hal->GpioInterruptRising); setDio1Action(func, this->mod->hal->GpioInterruptRising);
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX127X) #if !RADIOLIB_EXCLUDE_SX127X
#include "../../Module.h" #include "../../Module.h"
@ -1150,7 +1150,7 @@ class SX127x: public PhysicalLayer {
*/ */
int16_t invertIQ(bool enable) override; int16_t invertIQ(bool enable) override;
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set interrupt service routine function to call when data bit is received in direct mode. \brief Set interrupt service routine function to call when data bit is received in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
@ -1218,12 +1218,12 @@ class SX127x: public PhysicalLayer {
*/ */
int16_t setRSSIThreshold(float dbm); int16_t setRSSIThreshold(float dbm);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
@ -1245,7 +1245,7 @@ class SX127x: public PhysicalLayer {
int16_t directMode(); int16_t directMode();
int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setPacketMode(uint8_t mode, uint8_t len);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
float dataRate = 0; float dataRate = 0;

View file

@ -1,6 +1,6 @@
#include "SX1280.h" #include "SX1280.h"
#include <string.h> #include <string.h>
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
SX1280::SX1280(Module* mod) : SX1281(mod) { SX1280::SX1280(Module* mod) : SX1281(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
#include "../../Module.h" #include "../../Module.h"
#include "SX128x.h" #include "SX128x.h"
@ -45,7 +45,7 @@ class SX1280: public SX1281 {
*/ */
float getRangingResult(); float getRangingResult();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1281.h" #include "SX1281.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
SX1281::SX1281(Module* mod) : SX128x(mod) { SX1281::SX1281(Module* mod) : SX128x(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
#include "../../Module.h" #include "../../Module.h"
#include "SX128x.h" #include "SX128x.h"
@ -20,7 +20,7 @@ class SX1281: public SX128x {
*/ */
SX1281(Module* mod); SX1281(Module* mod);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SX1282.h" #include "SX1282.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
/// \todo implement advanced ranging /// \todo implement advanced ranging
SX1282::SX1282(Module* mod) : SX1280(mod) { SX1282::SX1282(Module* mod) : SX1280(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
#include "../../Module.h" #include "../../Module.h"
#include "SX128x.h" #include "SX128x.h"
@ -21,7 +21,7 @@ class SX1282: public SX1280 {
*/ */
SX1282(Module* mod); SX1282(Module* mod);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif

View file

@ -1,6 +1,6 @@
#include "SX128x.h" #include "SX128x.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
SX128x::SX128x(Module* mod) : PhysicalLayer(RADIOLIB_SX128X_FREQUENCY_STEP_SIZE, RADIOLIB_SX128X_MAX_PACKET_LENGTH) { SX128x::SX128x(Module* mod) : PhysicalLayer(RADIOLIB_SX128X_FREQUENCY_STEP_SIZE, RADIOLIB_SX128X_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -1333,7 +1333,7 @@ int16_t SX128x::invertIQ(bool enable) {
return(setPacketParamsLoRa(this->preambleLengthLoRa, this->headerType, this->payloadLen, this->crcLoRa, this->invertIQEnabled)); return(setPacketParamsLoRa(this->preambleLengthLoRa, this->headerType, this->payloadLen, this->crcLoRa, this->invertIQEnabled));
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void SX128x::setDirectAction(void (*func)(void)) { void SX128x::setDirectAction(void (*func)(void)) {
// SX128x is unable to perform direct mode reception // SX128x is unable to perform direct mode reception
// this method is implemented only for PhysicalLayer compatibility // this method is implemented only for PhysicalLayer compatibility

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SX128X) #if !RADIOLIB_EXCLUDE_SX128X
#include "../../Module.h" #include "../../Module.h"
@ -310,7 +310,7 @@
#define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_3 0b00000100 // 2 0 detected sync word 3 #define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_3 0b00000100 // 2 0 detected sync word 3
//RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS //RADIOLIB_SX128X_CMD_SET_DIO_IRQ_PARAMS
#define RADIOLIB_SX128X_IRQ_RADIOLIB_PREAMBLE_DETECTED 0x8000 // 15 15 interrupt source: preamble detected #define RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED 0x8000 // 15 15 interrupt source: preamble detected
#define RADIOLIB_SX128X_IRQ_ADVANCED_RANGING_DONE 0x8000 // 15 15 advanced ranging done #define RADIOLIB_SX128X_IRQ_ADVANCED_RANGING_DONE 0x8000 // 15 15 advanced ranging done
#define RADIOLIB_SX128X_IRQ_RX_TX_TIMEOUT 0x4000 // 14 14 Rx or Tx timeout #define RADIOLIB_SX128X_IRQ_RX_TX_TIMEOUT 0x4000 // 14 14 Rx or Tx timeout
#define RADIOLIB_SX128X_IRQ_CAD_DETECTED 0x2000 // 13 13 channel activity detected #define RADIOLIB_SX128X_IRQ_CAD_DETECTED 0x2000 // 13 13 channel activity detected
@ -765,7 +765,7 @@ class SX128x: public PhysicalLayer {
*/ */
int16_t invertIQ(bool enable); int16_t invertIQ(bool enable);
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Dummy method, to ensure PhysicalLayer compatibility. \brief Dummy method, to ensure PhysicalLayer compatibility.
\param func Ignored. \param func Ignored.
@ -779,12 +779,12 @@ class SX128x: public PhysicalLayer {
void readBit(uint32_t pin); void readBit(uint32_t pin);
#endif #endif
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
@ -817,14 +817,14 @@ class SX128x: public PhysicalLayer {
int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF); int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
private: private:
#endif #endif
// common low-level SPI interface // common low-level SPI interface
static int16_t SPIparseStatus(uint8_t in); static int16_t SPIparseStatus(uint8_t in);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
// common parameters // common parameters

View file

@ -1,5 +1,5 @@
#include "Si4430.h" #include "Si4430.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
Si4430::Si4430(Module* mod) : Si4432(mod) { Si4430::Si4430(Module* mod) : Si4432(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
#include "../../Module.h" #include "../../Module.h"
#include "Si4432.h" #include "Si4432.h"
@ -53,11 +53,11 @@ class Si4430: public Si4432 {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
}; };

View file

@ -1,5 +1,5 @@
#include "Si4431.h" #include "Si4431.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
Si4431::Si4431(Module* mod) : Si4432(mod) { Si4431::Si4431(Module* mod) : Si4432(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
#include "../../Module.h" #include "../../Module.h"
#include "Si4432.h" #include "Si4432.h"
@ -46,11 +46,11 @@ class Si4431: public Si4432 {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
}; };

View file

@ -1,5 +1,5 @@
#include "Si4432.h" #include "Si4432.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
Si4432::Si4432(Module* mod) : Si443x(mod) { Si4432::Si4432(Module* mod) : Si443x(mod) {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
#include "../../Module.h" #include "../../Module.h"
#include "Si443x.h" #include "Si443x.h"
@ -53,11 +53,11 @@ class Si4432: public Si443x {
*/ */
int16_t setOutputPower(int8_t power); int16_t setOutputPower(int8_t power);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
}; };

View file

@ -1,6 +1,6 @@
#include "Si443x.h" #include "Si443x.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
Si443x::Si443x(Module* mod) : PhysicalLayer(RADIOLIB_SI443X_FREQUENCY_STEP_SIZE, RADIOLIB_SI443X_MAX_PACKET_LENGTH) { Si443x::Si443x(Module* mod) : PhysicalLayer(RADIOLIB_SI443X_FREQUENCY_STEP_SIZE, RADIOLIB_SI443X_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -623,7 +623,7 @@ int16_t Si443x::getChipVersion() {
return(this->mod->SPIgetRegValue(RADIOLIB_SI443X_REG_DEVICE_VERSION)); return(this->mod->SPIgetRegValue(RADIOLIB_SI443X_REG_DEVICE_VERSION));
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void Si443x::setDirectAction(void (*func)(void)) { void Si443x::setDirectAction(void (*func)(void)) {
setIrqAction(func); setIrqAction(func);
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SI443X) #if !RADIOLIB_EXCLUDE_SI443X
#include "../../Module.h" #include "../../Module.h"
@ -797,7 +797,7 @@ class Si443x: public PhysicalLayer {
*/ */
int16_t getChipVersion(); int16_t getChipVersion();
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set interrupt service routine function to call when data bit is received in direct mode. \brief Set interrupt service routine function to call when data bit is received in direct mode.
\param func Pointer to interrupt service routine. \param func Pointer to interrupt service routine.
@ -825,12 +825,12 @@ class Si443x: public PhysicalLayer {
*/ */
int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SI443X_MAX_PACKET_LENGTH); int16_t variablePacketLengthMode(uint8_t maxLen = RADIOLIB_SI443X_MAX_PACKET_LENGTH);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
@ -845,7 +845,7 @@ class Si443x: public PhysicalLayer {
int16_t setFrequencyRaw(float newFreq); int16_t setFrequencyRaw(float newFreq);
int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setPacketMode(uint8_t mode, uint8_t len);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
bool findChip(); bool findChip();

View file

@ -1,6 +1,6 @@
#include "nRF24.h" #include "nRF24.h"
#include <string.h> #include <string.h>
#if !defined(RADIOLIB_EXCLUDE_NRF24) #if !RADIOLIB_EXCLUDE_NRF24
nRF24::nRF24(Module* mod) : PhysicalLayer(RADIOLIB_NRF24_FREQUENCY_STEP_SIZE, RADIOLIB_NRF24_MAX_PACKET_LENGTH) { nRF24::nRF24(Module* mod) : PhysicalLayer(RADIOLIB_NRF24_FREQUENCY_STEP_SIZE, RADIOLIB_NRF24_MAX_PACKET_LENGTH) {
this->mod = mod; this->mod = mod;
@ -617,7 +617,7 @@ void nRF24::SPIwriteTxPayload(uint8_t* data, uint8_t numBytes) {
void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes) { void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes) {
// prepare the buffers // prepare the buffers
size_t buffLen = 1 + numBytes; size_t buffLen = 1 + numBytes;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
@ -648,7 +648,7 @@ void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* data
memcpy(dataIn, &buffIn[1], numBytes); memcpy(dataIn, &buffIn[1], numBytes);
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] buffOut; delete[] buffOut;
delete[] buffIn; delete[] buffIn;
#endif #endif

View file

@ -1,4 +1,4 @@
#if !defined(_RADIOLIB_NRF24_H) && !defined(RADIOLIB_EXCLUDE_NRF24) #if !defined(_RADIOLIB_NRF24_H) && !RADIOLIB_EXCLUDE_NRF24
#define _RADIOLIB_NRF24_H #define _RADIOLIB_NRF24_H
#include "../../Module.h" #include "../../Module.h"
@ -467,7 +467,7 @@ class nRF24: public PhysicalLayer {
*/ */
int16_t setEncoding(uint8_t encoding) override; int16_t setEncoding(uint8_t encoding) override;
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected: protected:
#endif #endif
Module* mod; Module* mod;
@ -476,7 +476,7 @@ class nRF24: public PhysicalLayer {
void SPIwriteTxPayload(uint8_t* data, uint8_t numBytes); void SPIwriteTxPayload(uint8_t* data, uint8_t numBytes);
void SPItransfer(uint8_t cmd, bool write = false, uint8_t* dataOut = NULL, uint8_t* dataIn = NULL, uint8_t numBytes = 0); void SPItransfer(uint8_t cmd, bool write = false, uint8_t* dataOut = NULL, uint8_t* dataIn = NULL, uint8_t numBytes = 0);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif

View file

@ -1,5 +1,5 @@
#include "AFSK.h" #include "AFSK.h"
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient::AFSKClient(PhysicalLayer* phy, uint32_t pin): outPin(pin) { AFSKClient::AFSKClient(PhysicalLayer* phy, uint32_t pin): outPin(pin) {
phyLayer = phy; phyLayer = phy;

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
#include "../../Module.h" #include "../../Module.h"
@ -49,7 +49,7 @@ class AFSKClient {
*/ */
int16_t noTone(bool keepOn = false); int16_t noTone(bool keepOn = false);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;

View file

@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if !defined(RADIOLIB_EXCLUDE_APRS) #if !RADIOLIB_EXCLUDE_APRS
APRSClient::APRSClient(AX25Client* ax) { APRSClient::APRSClient(AX25Client* ax) {
axClient = ax; axClient = ax;
@ -42,7 +42,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
if(time != NULL) { if(time != NULL) {
len += strlen(time); len += strlen(time);
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
char* info = new char[len + 1]; char* info = new char[len + 1];
#else #else
char info[RADIOLIB_STATIC_ARRAY_SIZE]; char info[RADIOLIB_STATIC_ARRAY_SIZE];
@ -66,7 +66,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
// send the frame // send the frame
int16_t state = sendFrame(destCallsign, destSSID, info); int16_t state = sendFrame(destCallsign, destSSID, info);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] info; delete[] info;
#endif #endif
return(state); return(state);
@ -89,7 +89,7 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
// prepare buffers // prepare buffers
char destCallsign[7]; char destCallsign[7];
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
size_t infoLen = 10; size_t infoLen = 10;
if(telemLen > 0) { if(telemLen > 0) {
infoLen += 1 + telemLen; infoLen += 1 + telemLen;
@ -231,7 +231,7 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
destSSID = 1; destSSID = 1;
} }
int16_t state = sendFrame(destCallsign, destSSID, info); int16_t state = sendFrame(destCallsign, destSSID, info);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] info; delete[] info;
#endif #endif
return(state); return(state);

View file

@ -1,9 +1,9 @@
#if !defined(_RADIOLIB_RADIOLIB_APRS_H) #if !defined(_RADIOLIB_APRS_H)
#define _RADIOLIB_RADIOLIB_APRS_H #define _RADIOLIB_APRS_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_APRS) #if !RADIOLIB_EXCLUDE_APRS
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AX25/AX25.h" #include "../AX25/AX25.h"
@ -128,7 +128,7 @@ class APRSClient {
*/ */
int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info); int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
AX25Client* axClient; AX25Client* axClient;

View file

@ -1,6 +1,6 @@
#include "AX25.h" #include "AX25.h"
#include <string.h> #include <string.h>
#if !defined(RADIOLIB_EXCLUDE_AX25) #if !RADIOLIB_EXCLUDE_AX25
AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* srcCallsign, uint8_t srcSSID, uint8_t control) AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* srcCallsign, uint8_t srcSSID, uint8_t control)
: AX25Frame(destCallsign, destSSID, srcCallsign, srcSSID, control, 0, NULL, 0) { : AX25Frame(destCallsign, destSSID, srcCallsign, srcSSID, control, 0, NULL, 0) {
@ -25,7 +25,7 @@ AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* src
// set repeaters // set repeaters
this->numRepeaters = 0; this->numRepeaters = 0;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
this->repeaterCallsigns = NULL; this->repeaterCallsigns = NULL;
this->repeaterSSIDs = NULL; this->repeaterSSIDs = NULL;
#endif #endif
@ -43,7 +43,7 @@ AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* src
// info field // info field
this->infoLen = infoLen; this->infoLen = infoLen;
if(infoLen > 0) { if(infoLen > 0) {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
this->info = new uint8_t[infoLen]; this->info = new uint8_t[infoLen];
#endif #endif
memcpy(this->info, info, infoLen); memcpy(this->info, info, infoLen);
@ -55,7 +55,7 @@ AX25Frame::AX25Frame(const AX25Frame& frame) {
} }
AX25Frame::~AX25Frame() { AX25Frame::~AX25Frame() {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
// deallocate info field // deallocate info field
if(infoLen > 0) { if(infoLen > 0) {
delete[] this->info; delete[] this->info;
@ -124,7 +124,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs
} }
// create buffers // create buffers
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
this->repeaterCallsigns = new char*[numRepeaters]; this->repeaterCallsigns = new char*[numRepeaters];
for(uint8_t i = 0; i < numRepeaters; i++) { for(uint8_t i = 0; i < numRepeaters; i++) {
this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i]) + 1]; this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i]) + 1];
@ -153,12 +153,12 @@ void AX25Frame::setSendSequence(uint8_t seqNumber) {
AX25Client::AX25Client(PhysicalLayer* phy) { AX25Client::AX25Client(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
bellModem = nullptr; bellModem = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AX25Client::AX25Client(AFSKClient* audio) { AX25Client::AX25Client(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
bellModem = new BellClient(audio); bellModem = new BellClient(audio);
@ -194,7 +194,7 @@ int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t preL
preambleLen = preLen; preambleLen = preLen;
// configure for direct mode // configure for direct mode
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(bellModem != nullptr) { if(bellModem != nullptr) {
return(phyLayer->startDirect()); return(phyLayer->startDirect());
} }
@ -226,7 +226,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
} }
// check repeater configuration // check repeater configuration
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
if(!(((frame->repeaterCallsigns == NULL) && (frame->repeaterSSIDs == NULL) && (frame->numRepeaters == 0)) || if(!(((frame->repeaterCallsigns == NULL) && (frame->repeaterSSIDs == NULL) && (frame->numRepeaters == 0)) ||
((frame->repeaterCallsigns != NULL) && (frame->repeaterSSIDs != NULL) && (frame->numRepeaters != 0)))) { ((frame->repeaterCallsigns != NULL) && (frame->repeaterSSIDs != NULL) && (frame->numRepeaters != 0)))) {
return(RADIOLIB_ERR_INVALID_NUM_REPEATERS); return(RADIOLIB_ERR_INVALID_NUM_REPEATERS);
@ -241,7 +241,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
// calculate frame length without FCS (destination address, source address, repeater addresses, control, PID, info) // calculate frame length without FCS (destination address, source address, repeater addresses, control, PID, info)
size_t frameBuffLen = ((2 + frame->numRepeaters)*(RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1)) + 1 + 1 + frame->infoLen; size_t frameBuffLen = ((2 + frame->numRepeaters)*(RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1)) + 1 + 1 + frame->infoLen;
// create frame buffer without preamble, start or stop flags // create frame buffer without preamble, start or stop flags
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
uint8_t* frameBuff = new uint8_t[frameBuffLen + 2]; uint8_t* frameBuff = new uint8_t[frameBuffLen + 2];
#else #else
uint8_t frameBuff[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t frameBuff[RADIOLIB_STATIC_ARRAY_SIZE];
@ -323,7 +323,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
*(frameBuffPtr++) = (uint8_t)(fcs & 0xFF); *(frameBuffPtr++) = (uint8_t)(fcs & 0xFF);
// prepare buffer for the final frame (stuffed, with added preamble + flags and NRZI-encoded) // prepare buffer for the final frame (stuffed, with added preamble + flags and NRZI-encoded)
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
// worst-case scenario: sequence of 1s, will have 120% of the original length, stuffed frame also includes both flags // worst-case scenario: sequence of 1s, will have 120% of the original length, stuffed frame also includes both flags
uint8_t* stuffedFrameBuff = new uint8_t[preambleLen + 1 + (6*frameBuffLen)/5 + 2]; uint8_t* stuffedFrameBuff = new uint8_t[preambleLen + 1 + (6*frameBuffLen)/5 + 2];
#else #else
@ -367,7 +367,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
} }
// deallocate memory // deallocate memory
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] frameBuff; delete[] frameBuff;
#endif #endif
@ -413,7 +413,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
// transmit // transmit
int16_t state = RADIOLIB_ERR_NONE; int16_t state = RADIOLIB_ERR_NONE;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(bellModem != nullptr) { if(bellModem != nullptr) {
bellModem->idle(); bellModem->idle();
@ -427,12 +427,12 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
} else { } else {
#endif #endif
state = phyLayer->transmit(stuffedFrameBuff, stuffedFrameBuffLen); state = phyLayer->transmit(stuffedFrameBuff, stuffedFrameBuffLen);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
} }
#endif #endif
// deallocate memory // deallocate memory
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] stuffedFrameBuff; delete[] stuffedFrameBuff;
#endif #endif

View file

@ -1,9 +1,9 @@
#if !defined(_RADIOLIB_RADIOLIB_AX25_H) #if !defined(_RADIOLIB_AX25_H)
#define _RADIOLIB_RADIOLIB_AX25_H #define _RADIOLIB_AX25_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_AX25) #if !RADIOLIB_EXCLUDE_AX25
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -125,7 +125,7 @@ class AX25Frame {
*/ */
uint16_t sendSeqNumber; uint16_t sendSeqNumber;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
/*! /*!
\brief The info field. \brief The info field.
*/ */
@ -243,7 +243,7 @@ class AX25Client {
*/ */
explicit AX25Client(PhysicalLayer* phy); explicit AX25Client(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -303,13 +303,13 @@ class AX25Client {
*/ */
int16_t sendFrame(AX25Frame* frame); int16_t sendFrame(AX25Frame* frame);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
friend class APRSClient; friend class APRSClient;
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
BellClient* bellModem; BellClient* bellModem;
#endif #endif

View file

@ -1,5 +1,5 @@
#include "BellModem.h" #include "BellModem.h"
#if !defined(RADIOLIB_EXCLUDE_BELL) #if !RADIOLIB_EXCLUDE_BELL
const struct BellModem_t Bell101 { const struct BellModem_t Bell101 {
.freqMark = 1270, .freqMark = 1270,

View file

@ -7,7 +7,7 @@
#include "../../ArduinoHal.h" #include "../../ArduinoHal.h"
#endif #endif
#if !defined(RADIOLIB_EXCLUDE_BELL) #if !RADIOLIB_EXCLUDE_BELL
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -116,7 +116,7 @@ class BellClient: public AFSKClient, public RadioLibPrint {
*/ */
int16_t standby(); int16_t standby();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
BellModem_t modemType; BellModem_t modemType;

View file

@ -1,15 +1,15 @@
#include "FSK4.h" #include "FSK4.h"
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_FSK4) #if !RADIOLIB_EXCLUDE_FSK4
FSK4Client::FSK4Client(PhysicalLayer* phy) { FSK4Client::FSK4Client(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
FSK4Client::FSK4Client(AFSKClient* audio) { FSK4Client::FSK4Client(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
audioClient = audio; audioClient = audio;
@ -87,7 +87,7 @@ void FSK4Client::tone(uint8_t i) {
} }
int16_t FSK4Client::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t FSK4Client::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->tone(freqHz)); return(audioClient->tone(freqHz));
} }
@ -99,7 +99,7 @@ int16_t FSK4Client::standby() {
// ensure everything is stopped in interrupt timing mode // ensure everything is stopped in interrupt timing mode
Module* mod = phyLayer->getMod(); Module* mod = phyLayer->getMod();
mod->waitForMicroseconds(0, 0); mod->waitForMicroseconds(0, 0);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->noTone()); return(audioClient->noTone());
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_FSK4) #if !RADIOLIB_EXCLUDE_FSK4
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -20,7 +20,7 @@ class FSK4Client {
*/ */
explicit FSK4Client(PhysicalLayer* phy); explicit FSK4Client(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -74,11 +74,11 @@ class FSK4Client {
*/ */
int16_t standby(); int16_t standby();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif

View file

@ -1,16 +1,16 @@
#include "Hellschreiber.h" #include "Hellschreiber.h"
#if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER) #if !RADIOLIB_EXCLUDE_HELLSCHREIBER
HellClient::HellClient(PhysicalLayer* phy) { HellClient::HellClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
lineFeed = " "; lineFeed = " ";
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
HellClient::HellClient(AFSKClient* audio) { HellClient::HellClient(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
lineFeed = " "; lineFeed = " ";
@ -82,7 +82,7 @@ size_t HellClient::write(uint8_t b) {
} }
int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->tone(freqHz)); return(audioClient->tone(freqHz));
} }
@ -91,7 +91,7 @@ int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
} }
int16_t HellClient::standby() { int16_t HellClient::standby() {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->noTone(invert)); return(audioClient->noTone(invert));
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER) #if !RADIOLIB_EXCLUDE_HELLSCHREIBER
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -95,7 +95,7 @@ class HellClient: public RadioLibPrint {
*/ */
explicit HellClient(PhysicalLayer* phy); explicit HellClient(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -132,11 +132,11 @@ class HellClient: public RadioLibPrint {
*/ */
size_t write(uint8_t b); size_t write(uint8_t b);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif

View file

@ -1,7 +1,7 @@
#include "LoRaWAN.h" #include "LoRaWAN.h"
#include <string.h> #include <string.h>
#if !defined(RADIOLIB_EXCLUDE_LORAWAN) #if !RADIOLIB_EXCLUDE_LORAWAN
#if defined(RADIOLIB_EEPROM_UNSUPPORTED) #if defined(RADIOLIB_EEPROM_UNSUPPORTED)
#warning "Persistent storage not supported!" #warning "Persistent storage not supported!"
@ -65,7 +65,7 @@ int16_t LoRaWANNode::restore() {
// check the magic value // check the magic value
if(mod->hal->getPersistentParameter<uint16_t>(RADIOLIB_PERSISTENT_PARAM_LORAWAN_MAGIC_ID) != RADIOLIB_LORAWAN_MAGIC) { if(mod->hal->getPersistentParameter<uint16_t>(RADIOLIB_PERSISTENT_PARAM_LORAWAN_MAGIC_ID) != RADIOLIB_LORAWAN_MAGIC) {
#if defined(RADIOLIB_DEBUG) #if RADIOLIB_DEBUG
RADIOLIB_DEBUG_PRINTLN("magic id not set (no saved session)"); RADIOLIB_DEBUG_PRINTLN("magic id not set (no saved session)");
RADIOLIB_DEBUG_PRINTLN("first 16 bytes of NVM:"); RADIOLIB_DEBUG_PRINTLN("first 16 bytes of NVM:");
uint8_t nvmBuff[16]; uint8_t nvmBuff[16];
@ -148,7 +148,7 @@ int16_t LoRaWANNode::restoreFcntUp() {
uint8_t fcntBuffStart = mod->hal->getPersistentAddr(RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID); uint8_t fcntBuffStart = mod->hal->getPersistentAddr(RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID);
uint8_t fcntBuffEnd = mod->hal->getPersistentAddr(RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID + 1); uint8_t fcntBuffEnd = mod->hal->getPersistentAddr(RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID + 1);
uint8_t buffSize = fcntBuffEnd - fcntBuffStart; uint8_t buffSize = fcntBuffEnd - fcntBuffStart;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t fcntBuff[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t fcntBuff[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint8_t* fcntBuff = new uint8_t[buffSize]; uint8_t* fcntBuff = new uint8_t[buffSize];
@ -182,7 +182,7 @@ int16_t LoRaWANNode::restoreFcntUp() {
} }
} }
uint32_t bits_7_0 = (uint32_t)fcntBuff[idx-1] & 0x7F; uint32_t bits_7_0 = (uint32_t)fcntBuff[idx-1] & 0x7F;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] fcntBuff; delete[] fcntBuff;
#endif #endif
@ -764,7 +764,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
// build the uplink message // build the uplink message
// the first 16 bytes are reserved for MIC calculation blocks // the first 16 bytes are reserved for MIC calculation blocks
size_t uplinkMsgLen = RADIOLIB_LORAWAN_FRAME_LEN(len, foptsBufSize); size_t uplinkMsgLen = RADIOLIB_LORAWAN_FRAME_LEN(len, foptsBufSize);
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t uplinkMsg[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t uplinkMsg[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint8_t* uplinkMsg = new uint8_t[uplinkMsgLen]; uint8_t* uplinkMsg = new uint8_t[uplinkMsgLen];
@ -891,7 +891,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
this->rxDelayStart = mod->hal->millis(); this->rxDelayStart = mod->hal->millis();
RADIOLIB_DEBUG_PRINTLN("Uplink sent <-- Rx Delay start"); RADIOLIB_DEBUG_PRINTLN("Uplink sent <-- Rx Delay start");
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] uplinkMsg; delete[] uplinkMsg;
#endif #endif
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -1060,7 +1060,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
// build the buffer for the downlink message // build the buffer for the downlink message
// the first 16 bytes are reserved for MIC calculation block // the first 16 bytes are reserved for MIC calculation block
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
uint8_t* downlinkMsg = new uint8_t[RADIOLIB_AES128_BLOCK_SIZE + downlinkMsgLen]; uint8_t* downlinkMsg = new uint8_t[RADIOLIB_AES128_BLOCK_SIZE + downlinkMsgLen];
#else #else
uint8_t downlinkMsg[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t downlinkMsg[RADIOLIB_STATIC_ARRAY_SIZE];
@ -1082,7 +1082,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
} }
if(state != RADIOLIB_ERR_NONE) { if(state != RADIOLIB_ERR_NONE) {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif
return(state); return(state);
@ -1127,7 +1127,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
uint32_t fcnt32 = fcnt16; uint32_t fcnt32 = fcnt16;
if(fcntDownPrev > 0) { if(fcntDownPrev > 0) {
if((fcnt16 <= fcntDownPrev) && ((0xFFFF - (uint16_t)fcntDownPrev + fcnt16) > RADIOLIB_LORAWAN_MAX_FCNT_GAP)) { if((fcnt16 <= fcntDownPrev) && ((0xFFFF - (uint16_t)fcntDownPrev + fcnt16) > RADIOLIB_LORAWAN_MAX_FCNT_GAP)) {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif
if (isAppDownlink) { if (isAppDownlink) {
@ -1143,7 +1143,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
// check the MIC // check the MIC
if(!verifyMIC(downlinkMsg, RADIOLIB_AES128_BLOCK_SIZE + downlinkMsgLen, this->sNwkSIntKey)) { if(!verifyMIC(downlinkMsg, RADIOLIB_AES128_BLOCK_SIZE + downlinkMsgLen, this->sNwkSIntKey)) {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif
return(RADIOLIB_ERR_CRC_MISMATCH); return(RADIOLIB_ERR_CRC_MISMATCH);
@ -1167,7 +1167,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
uint32_t addr = LoRaWANNode::ntoh<uint32_t>(&downlinkMsg[RADIOLIB_LORAWAN_FHDR_DEV_ADDR_POS]); uint32_t addr = LoRaWANNode::ntoh<uint32_t>(&downlinkMsg[RADIOLIB_LORAWAN_FHDR_DEV_ADDR_POS]);
if(addr != this->devAddr) { if(addr != this->devAddr) {
RADIOLIB_DEBUG_PRINTLN("Device address mismatch, expected 0x%08X, got 0x%08X", this->devAddr, addr); RADIOLIB_DEBUG_PRINTLN("Device address mismatch, expected 0x%08X, got 0x%08X", this->devAddr, addr);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif
return(RADIOLIB_ERR_DOWNLINK_MALFORMED); return(RADIOLIB_ERR_DOWNLINK_MALFORMED);
@ -1209,7 +1209,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
// if FOptsLen for the next uplink is larger than can be piggybacked onto an uplink, send separate uplink // if FOptsLen for the next uplink is larger than can be piggybacked onto an uplink, send separate uplink
if(this->commandsUp.len > 15) { if(this->commandsUp.len > 15) {
size_t foptsBufSize = this->commandsUp.len; size_t foptsBufSize = this->commandsUp.len;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t foptsBuff[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t foptsBuff[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint8_t* foptsBuff = new uint8_t[foptsBufSize]; uint8_t* foptsBuff = new uint8_t[foptsBufSize];
@ -1236,18 +1236,18 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
this->isMACPayload = true; this->isMACPayload = true;
this->uplink(foptsBuff, foptsBufSize, RADIOLIB_LORAWAN_FPORT_MAC_COMMAND); this->uplink(foptsBuff, foptsBufSize, RADIOLIB_LORAWAN_FPORT_MAC_COMMAND);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] foptsBuff; delete[] foptsBuff;
#endif #endif
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t strDown[RADIOLIB_STATIC_ARRAY_SIZE]; uint8_t strDown[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint8_t* strDown = new uint8_t[this->band->payloadLenMax[this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK]]]; uint8_t* strDown = new uint8_t[this->band->payloadLenMax[this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK]]];
#endif #endif
size_t lenDown = 0; size_t lenDown = 0;
state = this->downlink(strDown, &lenDown); state = this->downlink(strDown, &lenDown);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] strDown; delete[] strDown;
#endif #endif
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
@ -1274,7 +1274,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
if(payLen <= 0) { if(payLen <= 0) {
// no payload // no payload
*len = 0; *len = 0;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif
@ -1288,7 +1288,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
// TODO it COULD be the case that the assumed rollover is incorrect, then figure out a way to catch this and retry with just fcnt16 // TODO it COULD be the case that the assumed rollover is incorrect, then figure out a way to catch this and retry with just fcnt16
processAES(&downlinkMsg[RADIOLIB_LORAWAN_FRAME_PAYLOAD_POS(foptsLen)], payLen - 1, this->appSKey, data, fcnt32, RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK, 0x00, true); processAES(&downlinkMsg[RADIOLIB_LORAWAN_FRAME_PAYLOAD_POS(foptsLen)], payLen - 1, this->appSKey, data, fcnt32, RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK, 0x00, true);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] downlinkMsg; delete[] downlinkMsg;
#endif #endif

View file

@ -1,4 +1,4 @@
#if !defined(_RADIOLIB_LORAWAN_H) && !defined(RADIOLIB_EXCLUDE_LORAWAN) #if !defined(_RADIOLIB_LORAWAN_H) && !RADIOLIB_EXCLUDE_LORAWAN
#define _RADIOLIB_LORAWAN_H #define _RADIOLIB_LORAWAN_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
@ -350,7 +350,7 @@ class LoRaWANNode {
public: public:
// Offset between TX and RX1 (such that RX1 has equal or lower DR) // Offset between TX and RX1 (such that RX1 has equal or lower DR)
uint8_t rx1DrOffset; uint8_t rx1DrOffset = 0;
// RX2 channel properties - may be changed by MAC command // RX2 channel properties - may be changed by MAC command
LoRaWANChannel_t rx2; LoRaWANChannel_t rx2;
@ -578,7 +578,7 @@ class LoRaWANNode {
*/ */
void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false); void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer = NULL; PhysicalLayer* phyLayer = NULL;
@ -622,7 +622,7 @@ class LoRaWANNode {
uint32_t adrFcnt = 0; uint32_t adrFcnt = 0;
// whether the current configured channel is in FSK mode // whether the current configured channel is in FSK mode
bool FSK; bool FSK = false;
// flag that shows whether the device is joined and there is an ongoing session // flag that shows whether the device is joined and there is an ongoing session
bool isJoinedFlag = false; bool isJoinedFlag = false;

View file

@ -1,6 +1,6 @@
#include "LoRaWAN.h" #include "LoRaWAN.h"
#if !defined(RADIOLIB_EXCLUDE_LORAWAN) #if !RADIOLIB_EXCLUDE_LORAWAN
const LoRaWANBand_t EU868 = { const LoRaWANBand_t EU868 = {
.bandType = RADIOLIB_LORAWAN_BAND_DYNAMIC, .bandType = RADIOLIB_LORAWAN_BAND_DYNAMIC,

View file

@ -2,17 +2,17 @@
#include <ctype.h> #include <ctype.h>
#if !defined(RADIOLIB_EXCLUDE_MORSE) #if !RADIOLIB_EXCLUDE_MORSE
MorseClient::MorseClient(PhysicalLayer* phy) { MorseClient::MorseClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
lineFeed = "^"; lineFeed = "^";
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
MorseClient::MorseClient(AFSKClient* audio) { MorseClient::MorseClient(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
lineFeed = "^"; lineFeed = "^";
@ -59,7 +59,7 @@ char MorseClient::decode(uint8_t symbol, uint8_t len) {
return(RADIOLIB_MORSE_UNSUPPORTED); return(RADIOLIB_MORSE_UNSUPPORTED);
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) { int MorseClient::read(uint8_t* symbol, uint8_t* len, float low, float high) {
Module* mod = phyLayer->getMod(); Module* mod = phyLayer->getMod();
@ -167,7 +167,7 @@ size_t MorseClient::write(uint8_t b) {
} }
int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->tone(freqHz)); return(audioClient->tone(freqHz));
} }
@ -176,7 +176,7 @@ int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
} }
int16_t MorseClient::standby() { int16_t MorseClient::standby() {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->noTone(true)); return(audioClient->noTone(true));
} }

View file

@ -1,5 +1,5 @@
#if !defined(_RADIOLIB_RADIOLIB_MORSE_H) && !defined(RADIOLIB_EXCLUDE_MORSE) #if !defined(_RADIOLIB_MORSE_H) && !RADIOLIB_EXCLUDE_MORSE
#define _RADIOLIB_RADIOLIB_MORSE_H #define _RADIOLIB_MORSE_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
@ -98,7 +98,7 @@ class MorseClient: public RadioLibPrint {
*/ */
explicit MorseClient(PhysicalLayer* phy); explicit MorseClient(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -139,7 +139,7 @@ class MorseClient: public RadioLibPrint {
\returns 0 if not enough symbols were decoded, 1 if inter-character space was detected, \returns 0 if not enough symbols were decoded, 1 if inter-character space was detected,
2 if inter-word space was detected. 2 if inter-word space was detected.
*/ */
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
int read(uint8_t* symbol, uint8_t* len, float low = 0.75f, float high = 1.25f); int read(uint8_t* symbol, uint8_t* len, float low = 0.75f, float high = 1.25f);
#endif #endif
@ -150,11 +150,11 @@ class MorseClient: public RadioLibPrint {
*/ */
size_t write(uint8_t b); size_t write(uint8_t b);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif

View file

@ -1,9 +1,9 @@
#include "Pager.h" #include "Pager.h"
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_PAGER) #if !RADIOLIB_EXCLUDE_PAGER
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
// this is a massive hack, but we need a global-scope ISR to manage the bit reading // this is a massive hack, but we need a global-scope ISR to manage the bit reading
// let's hope nobody ever tries running two POCSAG receivers at the same time // let's hope nobody ever tries running two POCSAG receivers at the same time
static PhysicalLayer* readBitInstance = NULL; static PhysicalLayer* readBitInstance = NULL;
@ -21,7 +21,7 @@ static void PagerClientReadBit(void) {
PagerClient::PagerClient(PhysicalLayer* phy) { PagerClient::PagerClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
readBitInstance = phyLayer; readBitInstance = phyLayer;
#endif #endif
} }
@ -127,7 +127,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
// calculate message length in 32-bit code words // calculate message length in 32-bit code words
size_t msgLen = RADIOLIB_PAGER_PREAMBLE_LENGTH + (1 + RADIOLIB_PAGER_BATCH_LEN) * numBatches; size_t msgLen = RADIOLIB_PAGER_PREAMBLE_LENGTH + (1 + RADIOLIB_PAGER_BATCH_LEN) * numBatches;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint32_t msg[RADIOLIB_STATIC_ARRAY_SIZE]; uint32_t msg[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
uint32_t* msg = new uint32_t[msgLen]; uint32_t* msg = new uint32_t[msgLen];
@ -225,7 +225,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
// transmit the message // transmit the message
PagerClient::write(msg, msgLen); PagerClient::write(msg, msgLen);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] msg; delete[] msg;
#endif #endif
@ -235,7 +235,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
return(RADIOLIB_ERR_NONE); return(RADIOLIB_ERR_NONE);
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
int16_t PagerClient::startReceive(uint32_t pin, uint32_t addr, uint32_t mask) { int16_t PagerClient::startReceive(uint32_t pin, uint32_t addr, uint32_t mask) {
// save the variables // save the variables
readBitPin = pin; readBitPin = pin;
@ -289,7 +289,7 @@ int16_t PagerClient::readData(String& str, size_t len, uint32_t* addr) {
} }
// build a temporary buffer // build a temporary buffer
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1]; uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
#else #else
uint8_t* data = new uint8_t[length + 1]; uint8_t* data = new uint8_t[length + 1];
@ -316,7 +316,7 @@ int16_t PagerClient::readData(String& str, size_t len, uint32_t* addr) {
} }
// deallocate temporary buffer // deallocate temporary buffer
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] data; delete[] data;
#endif #endif
@ -496,7 +496,7 @@ void PagerClient::write(uint32_t codeWord) {
} }
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
uint32_t PagerClient::read() { uint32_t PagerClient::read() {
uint32_t codeWord = 0; uint32_t codeWord = 0;
codeWord |= (uint32_t)phyLayer->read() << 24; codeWord |= (uint32_t)phyLayer->read() << 24;

View file

@ -1,4 +1,4 @@
#if !defined(_RADIOLIB_PAGER_H) && !defined(RADIOLIB_EXCLUDE_PAGER) #if !defined(_RADIOLIB_PAGER_H) && !RADIOLIB_EXCLUDE_PAGER
#define _RADIOLIB_PAGER_H #define _RADIOLIB_PAGER_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
@ -119,7 +119,7 @@ class PagerClient {
*/ */
int16_t transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t encoding = RADIOLIB_PAGER_BCD, uint8_t function = RADIOLIB_PAGER_FUNC_AUTO); int16_t transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t encoding = RADIOLIB_PAGER_BCD, uint8_t function = RADIOLIB_PAGER_FUNC_AUTO);
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Start reception of POCSAG packets. \brief Start reception of POCSAG packets.
\param pin Pin to receive digital data on (e.g., DIO2 for SX127x). \param pin Pin to receive digital data on (e.g., DIO2 for SX127x).
@ -162,7 +162,7 @@ class PagerClient {
int16_t readData(uint8_t* data, size_t* len, uint32_t* addr = NULL); int16_t readData(uint8_t* data, size_t* len, uint32_t* addr = NULL);
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
@ -180,7 +180,7 @@ class PagerClient {
void write(uint32_t* data, size_t len); void write(uint32_t* data, size_t len);
void write(uint32_t codeWord); void write(uint32_t codeWord);
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
uint32_t read(); uint32_t read();
#endif #endif

View file

@ -4,7 +4,7 @@
PhysicalLayer::PhysicalLayer(float step, size_t maxLen) { PhysicalLayer::PhysicalLayer(float step, size_t maxLen) {
this->freqStep = step; this->freqStep = step;
this->maxPacketLength = maxLen; this->maxPacketLength = maxLen;
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
this->bufferBitPos = 0; this->bufferBitPos = 0;
this->bufferWritePos = 0; this->bufferWritePos = 0;
#endif #endif
@ -24,7 +24,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
} }
// dynamically allocate memory // dynamically allocate memory
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
char str[RADIOLIB_STATIC_ARRAY_SIZE]; char str[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
char* str = new char[len]; char* str = new char[len];
@ -38,7 +38,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
// transmit string // transmit string
int16_t state = transmit(str, addr); int16_t state = transmit(str, addr);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] str; delete[] str;
#endif #endif
return(state); return(state);
@ -68,7 +68,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
size_t length = len; size_t length = len;
// build a temporary buffer // build a temporary buffer
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1]; uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
#else #else
uint8_t* data = NULL; uint8_t* data = NULL;
@ -101,7 +101,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
} }
// deallocate temporary buffer // deallocate temporary buffer
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] data; delete[] data;
#endif #endif
@ -175,7 +175,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
} }
// build a temporary buffer // build a temporary buffer
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1]; uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
#else #else
uint8_t* data = new uint8_t[length + 1]; uint8_t* data = new uint8_t[length + 1];
@ -198,7 +198,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
} }
// deallocate temporary buffer // deallocate temporary buffer
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] data; delete[] data;
#endif #endif
@ -366,7 +366,7 @@ int16_t PhysicalLayer::startDirect() {
return(state); return(state);
} }
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
int16_t PhysicalLayer::available() { int16_t PhysicalLayer::available() {
return(this->bufferWritePos); return(this->bufferWritePos);
} }
@ -477,7 +477,7 @@ void PhysicalLayer::clearChannelScanAction() {
} }
#if defined(RADIOLIB_INTERRUPT_TIMING) #if RADIOLIB_INTERRUPT_TIMING
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) { void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
Module* mod = getMod(); Module* mod = getMod();
mod->TimerSetupCb = func; mod->TimerSetupCb = func;

View file

@ -380,7 +380,7 @@ class PhysicalLayer {
*/ */
int16_t startDirect(); int16_t startDirect();
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
/*! /*!
\brief Set sync word to be used to determine start of packet in direct reception mode. \brief Set sync word to be used to determine start of packet in direct reception mode.
\param syncWord Sync word bits. \param syncWord Sync word bits.
@ -463,7 +463,7 @@ class PhysicalLayer {
*/ */
virtual void clearChannelScanAction(); virtual void clearChannelScanAction();
#if defined(RADIOLIB_INTERRUPT_TIMING) #if RADIOLIB_INTERRUPT_TIMING
/*! /*!
\brief Set function to be called to set up the timing interrupt. \brief Set function to be called to set up the timing interrupt.
@ -480,18 +480,18 @@ class PhysicalLayer {
#endif #endif
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
protected: protected:
void updateDirectBuffer(uint8_t bit); void updateDirectBuffer(uint8_t bit);
#endif #endif
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
float freqStep; float freqStep;
size_t maxPacketLength; size_t maxPacketLength;
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE) #if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
uint8_t bufferBitPos; uint8_t bufferBitPos;
uint8_t bufferWritePos; uint8_t bufferWritePos;
uint8_t bufferReadPos; uint8_t bufferReadPos;

View file

@ -4,7 +4,7 @@
ITA2String::ITA2String(char c) { ITA2String::ITA2String(char c) {
asciiLen = 1; asciiLen = 1;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
strAscii = new char[1]; strAscii = new char[1];
#endif #endif
strAscii[0] = c; strAscii[0] = c;
@ -13,7 +13,7 @@ ITA2String::ITA2String(char c) {
ITA2String::ITA2String(const char* str) { ITA2String::ITA2String(const char* str) {
asciiLen = strlen(str); asciiLen = strlen(str);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
strAscii = new char[asciiLen + 1]; strAscii = new char[asciiLen + 1];
#endif #endif
strcpy(strAscii, str); strcpy(strAscii, str);
@ -21,7 +21,7 @@ ITA2String::ITA2String(const char* str) {
} }
ITA2String::~ITA2String() { ITA2String::~ITA2String() {
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] strAscii; delete[] strAscii;
#endif #endif
} }
@ -40,7 +40,7 @@ size_t ITA2String::length() {
uint8_t* ITA2String::byteArr() { uint8_t* ITA2String::byteArr() {
// create temporary array 2x the string length (figures may be 3 bytes) // create temporary array 2x the string length (figures may be 3 bytes)
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
uint8_t temp[RADIOLIB_STATIC_ARRAY_SIZE*2 + 1]; uint8_t temp[RADIOLIB_STATIC_ARRAY_SIZE*2 + 1];
#else #else
uint8_t* temp = new uint8_t[asciiLen*2 + 1]; uint8_t* temp = new uint8_t[asciiLen*2 + 1];
@ -87,7 +87,7 @@ uint8_t* ITA2String::byteArr() {
uint8_t* arr = new uint8_t[arrayLen]; uint8_t* arr = new uint8_t[arrayLen];
memcpy(arr, temp, arrayLen); memcpy(arr, temp, arrayLen);
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] temp; delete[] temp;
#endif #endif

View file

@ -53,10 +53,10 @@ class ITA2String {
*/ */
uint8_t* byteArr(); uint8_t* byteArr();
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
char strAscii[RADIOLIB_STATIC_ARRAY_SIZE]; char strAscii[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
char* strAscii; char* strAscii;

View file

@ -42,7 +42,7 @@ size_t RadioLibPrint::print(const __FlashStringHelper* fstr) {
} }
// dynamically allocate memory // dynamically allocate memory
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
char str[RADIOLIB_STATIC_ARRAY_SIZE]; char str[RADIOLIB_STATIC_ARRAY_SIZE];
#else #else
char* str = new char[len]; char* str = new char[len];
@ -61,7 +61,7 @@ size_t RadioLibPrint::print(const __FlashStringHelper* fstr) {
} else { } else {
n = write((uint8_t*)str, len); n = write((uint8_t*)str, len);
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] str; delete[] str;
#endif #endif
return(n); return(n);

View file

@ -53,7 +53,7 @@ class RadioLibPrint {
size_t println(double, int = 2); size_t println(double, int = 2);
size_t println(void); size_t println(void);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
protected: protected:
#endif #endif
uint8_t encoding = RADIOLIB_ASCII_EXTENDED; uint8_t encoding = RADIOLIB_ASCII_EXTENDED;

View file

@ -2,17 +2,17 @@
#include <math.h> #include <math.h>
#if !defined(RADIOLIB_EXCLUDE_RTTY) #if !RADIOLIB_EXCLUDE_RTTY
RTTYClient::RTTYClient(PhysicalLayer* phy) { RTTYClient::RTTYClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
lineFeed = "\r\n"; lineFeed = "\r\n";
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
RTTYClient::RTTYClient(AFSKClient* audio) { RTTYClient::RTTYClient(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
lineFeed = "\r\n"; lineFeed = "\r\n";
@ -104,7 +104,7 @@ void RTTYClient::space() {
} }
int16_t RTTYClient::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t RTTYClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->tone(freqHz)); return(audioClient->tone(freqHz));
} }
@ -116,7 +116,7 @@ int16_t RTTYClient::standby() {
// ensure everything is stopped in interrupt timing mode // ensure everything is stopped in interrupt timing mode
Module* mod = phyLayer->getMod(); Module* mod = phyLayer->getMod();
mod->waitForMicroseconds(0, 0); mod->waitForMicroseconds(0, 0);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
return(audioClient->noTone()); return(audioClient->noTone());
} }

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RTTY) #if !RADIOLIB_EXCLUDE_RTTY
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -22,7 +22,7 @@ class RTTYClient: public RadioLibPrint {
*/ */
explicit RTTYClient(PhysicalLayer* phy); explicit RTTYClient(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -61,11 +61,11 @@ class RTTYClient: public RadioLibPrint {
*/ */
size_t write(uint8_t b); size_t write(uint8_t b);
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif

View file

@ -1,5 +1,5 @@
#include "SSTV.h" #include "SSTV.h"
#if !defined(RADIOLIB_EXCLUDE_SSTV) #if !RADIOLIB_EXCLUDE_SSTV
const SSTVMode_t Scottie1 { const SSTVMode_t Scottie1 {
.visCode = RADIOLIB_SSTV_SCOTTIE_1, .visCode = RADIOLIB_SSTV_SCOTTIE_1,
@ -156,19 +156,19 @@ const SSTVMode_t PasokonP7 {
SSTVClient::SSTVClient(PhysicalLayer* phy) { SSTVClient::SSTVClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
SSTVClient::SSTVClient(AFSKClient* audio) { SSTVClient::SSTVClient(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
audioClient = audio; audioClient = audio;
} }
#endif #endif
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
int16_t SSTVClient::begin(const SSTVMode_t& mode) { int16_t SSTVClient::begin(const SSTVMode_t& mode) {
if(audioClient == nullptr) { if(audioClient == nullptr) {
// this initialization method can only be used in AFSK mode // this initialization method can only be used in AFSK mode
@ -292,7 +292,7 @@ uint16_t SSTVClient::getPictureHeight() const {
void SSTVClient::tone(float freq, uint32_t len) { void SSTVClient::tone(float freq, uint32_t len) {
Module* mod = phyLayer->getMod(); Module* mod = phyLayer->getMod();
uint32_t start = mod->hal->micros(); uint32_t start = mod->hal->micros();
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
audioClient->tone(freq, false); audioClient->tone(freq, false);
} else { } else {

View file

@ -1,9 +1,9 @@
#if !defined(_RADIOLIB_RADIOLIB_SSTV_H) #if !defined(_RADIOLIB_SSTV_H)
#define _RADIOLIB_RADIOLIB_SSTV_H #define _RADIOLIB_SSTV_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SSTV) #if !RADIOLIB_EXCLUDE_SSTV
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -122,7 +122,7 @@ class SSTVClient {
*/ */
explicit SSTVClient(PhysicalLayer* phy); explicit SSTVClient(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -141,7 +141,7 @@ class SSTVClient {
*/ */
int16_t begin(float base, const SSTVMode_t& mode); int16_t begin(float base, const SSTVMode_t& mode);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Initialization method for AFSK. \brief Initialization method for AFSK.
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2, \param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2,
@ -182,11 +182,11 @@ class SSTVClient {
*/ */
uint16_t getPictureHeight() const; uint16_t getPictureHeight() const;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif

View file

@ -14,7 +14,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
this->n = n; this->n = n;
this->k = k; this->k = k;
this->poly = poly; this->poly = poly;
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
this->alphaTo = new int32_t[n + 1]; this->alphaTo = new int32_t[n + 1];
this->indexOf = new int32_t[n + 1]; this->indexOf = new int32_t[n + 1];
this->generator = new int32_t[n - k + 1]; this->generator = new int32_t[n - k + 1];
@ -115,7 +115,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
// Search for roots 1, 2, ..., m-1 in cycle sets // Search for roots 1, 2, ..., m-1 in cycle sets
int32_t rdncy = 0; int32_t rdncy = 0;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t min[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1]; int32_t min[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1];
#else #else
int32_t* min = new int32_t[this->n - this->k + 1]; int32_t* min = new int32_t[this->n - this->k + 1];
@ -139,7 +139,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
} }
int32_t noterms = kaux; int32_t noterms = kaux;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t zeros[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1]; int32_t zeros[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1];
#else #else
int32_t* zeros = new int32_t[this->n - this->k + 1]; int32_t* zeros = new int32_t[this->n - this->k + 1];
@ -153,7 +153,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
} }
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] min; delete[] min;
#endif #endif
@ -173,7 +173,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
this->generator[0] = this->alphaTo[(this->indexOf[this->generator[0]] + zeros[ii]) % this->n]; this->generator[0] = this->alphaTo[(this->indexOf[this->generator[0]] + zeros[ii]) % this->n];
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] zeros; delete[] zeros;
#endif #endif
} }
@ -185,7 +185,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
*/ */
uint32_t RadioLibBCH::encode(uint32_t dataword) { uint32_t RadioLibBCH::encode(uint32_t dataword) {
// we only use the "k" most significant bits // we only use the "k" most significant bits
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t data[RADIOLIB_BCH_MAX_K]; int32_t data[RADIOLIB_BCH_MAX_K];
#else #else
int32_t* data = new int32_t[this->k]; int32_t* data = new int32_t[this->k];
@ -200,7 +200,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
} }
// reset the M(x)+r array elements // reset the M(x)+r array elements
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t Mr[RADIOLIB_BCH_MAX_N]; int32_t Mr[RADIOLIB_BCH_MAX_N];
#else #else
int32_t* Mr = new int32_t[this->n]; int32_t* Mr = new int32_t[this->n];
@ -227,7 +227,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
} }
} }
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t bb[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1]; int32_t bb[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1];
#else #else
int32_t* bb = new int32_t[this->n - this->k + 1]; int32_t* bb = new int32_t[this->n - this->k + 1];
@ -238,12 +238,12 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
++j; ++j;
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] Mr; delete[] Mr;
#endif #endif
int32_t iEvenParity = 0; int32_t iEvenParity = 0;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t recd[RADIOLIB_BCH_MAX_N + 1]; int32_t recd[RADIOLIB_BCH_MAX_N + 1];
#else #else
int32_t* recd = new int32_t[this->n + 1]; int32_t* recd = new int32_t[this->n + 1];
@ -255,7 +255,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
} }
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] data; delete[] data;
#endif #endif
@ -266,7 +266,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
} }
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] bb; delete[] bb;
#endif #endif
@ -283,7 +283,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
} }
} }
#if !defined(RADIOLIB_STATIC_ONLY) #if !RADIOLIB_STATIC_ONLY
delete[] recd; delete[] recd;
#endif #endif

View file

@ -12,7 +12,7 @@
#define RADIOLIB_PAGER_BCH_K (21) #define RADIOLIB_PAGER_BCH_K (21)
#define RADIOLIB_PAGER_BCH_PRIMITIVE_POLY (0x25) #define RADIOLIB_PAGER_BCH_PRIMITIVE_POLY (0x25)
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
#define RADIOLIB_BCH_MAX_N (63) #define RADIOLIB_BCH_MAX_N (63)
#define RADIOLIB_BCH_MAX_K (31) #define RADIOLIB_BCH_MAX_K (31)
#endif #endif
@ -52,7 +52,7 @@ class RadioLibBCH {
uint32_t poly; uint32_t poly;
uint8_t m; uint8_t m;
#if defined(RADIOLIB_STATIC_ONLY) #if RADIOLIB_STATIC_ONLY
int32_t alphaTo[RADIOLIB_BCH_MAX_N + 1]; int32_t alphaTo[RADIOLIB_BCH_MAX_N + 1];
int32_t indexOf[RADIOLIB_BCH_MAX_N + 1]; int32_t indexOf[RADIOLIB_BCH_MAX_N + 1];
int32_t generator[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1]; int32_t generator[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1];