Merge branch 'jgromes:master' into master
This commit is contained in:
commit
fc8d80c9de
94 changed files with 466 additions and 464 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"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).",
|
||||
"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",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name=RadioLib
|
||||
version=6.2.0
|
||||
version=6.3.0
|
||||
author=Jan Gromes <gromes.jan@gmail.com>
|
||||
maintainer=Jan Gromes <gromes.jan@gmail.com>
|
||||
sentence=Universal wireless communication library
|
||||
|
|
|
@ -62,7 +62,7 @@ class ArduinoHal : public RadioLibHal {
|
|||
void yield() override;
|
||||
uint32_t pinToInterrupt(uint32_t pin) override;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
SPIClass* spi = NULL;
|
||||
|
|
296
src/BuildOpt.h
296
src/BuildOpt.h
|
@ -1,6 +1,132 @@
|
|||
#if !defined(_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
|
||||
// Arduino build
|
||||
#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
|
||||
// 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.
|
||||
//#define RADIOLIB_EXCLUDE_CC1101
|
||||
//#define RADIOLIB_EXCLUDE_NRF24
|
||||
//#define RADIOLIB_EXCLUDE_RF69
|
||||
//#define RADIOLIB_EXCLUDE_SX1231 // dependent on RADIOLIB_EXCLUDE_RF69
|
||||
//#define RADIOLIB_EXCLUDE_SI443X
|
||||
//#define RADIOLIB_EXCLUDE_RFM2X // dependent on RADIOLIB_EXCLUDE_SI443X
|
||||
//#define RADIOLIB_EXCLUDE_SX127X
|
||||
//#define RADIOLIB_EXCLUDE_SX126X
|
||||
//#define RADIOLIB_EXCLUDE_STM32WLX // dependent on RADIOLIB_EXCLUDE_SX126X
|
||||
//#define RADIOLIB_EXCLUDE_SX128X
|
||||
//#define RADIOLIB_EXCLUDE_AFSK
|
||||
//#define RADIOLIB_EXCLUDE_AX25
|
||||
//#define RADIOLIB_EXCLUDE_HELLSCHREIBER
|
||||
//#define RADIOLIB_EXCLUDE_MORSE
|
||||
//#define RADIOLIB_EXCLUDE_RTTY
|
||||
//#define RADIOLIB_EXCLUDE_SSTV
|
||||
//#define RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
//#define RADIOLIB_EXCLUDE_CC1101 (1)
|
||||
//#define RADIOLIB_EXCLUDE_NRF24 (1)
|
||||
//#define RADIOLIB_EXCLUDE_RF69 (1)
|
||||
//#define RADIOLIB_EXCLUDE_SX1231 (1) // dependent on RADIOLIB_EXCLUDE_RF69
|
||||
//#define RADIOLIB_EXCLUDE_SI443X (1)
|
||||
//#define RADIOLIB_EXCLUDE_RFM2X (1) // dependent on RADIOLIB_EXCLUDE_SI443X
|
||||
//#define RADIOLIB_EXCLUDE_SX127X (1)
|
||||
//#define RADIOLIB_EXCLUDE_SX126X (1)
|
||||
//#define RADIOLIB_EXCLUDE_STM32WLX (1) // dependent on RADIOLIB_EXCLUDE_SX126X
|
||||
//#define RADIOLIB_EXCLUDE_SX128X (1)
|
||||
//#define RADIOLIB_EXCLUDE_AFSK (1)
|
||||
//#define RADIOLIB_EXCLUDE_AX25 (1)
|
||||
//#define RADIOLIB_EXCLUDE_HELLSCHREIBER (1)
|
||||
//#define RADIOLIB_EXCLUDE_MORSE (1)
|
||||
//#define RADIOLIB_EXCLUDE_RTTY (1)
|
||||
//#define RADIOLIB_EXCLUDE_SSTV (1)
|
||||
//#define RADIOLIB_EXCLUDE_DIRECT_RECEIVE (1)
|
||||
|
||||
#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.
|
||||
|
@ -337,137 +463,13 @@
|
|||
|
||||
#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
|
||||
// include when generating docs
|
||||
#if (!defined(ARDUINO_ARCH_STM32) || !defined(SUBGHZSPI_BASE)) && !defined(DOXYGEN)
|
||||
#define RADIOLIB_EXCLUDE_STM32WLX
|
||||
#define RADIOLIB_EXCLUDE_STM32WLX (1)
|
||||
#endif
|
||||
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||
#define RADIOLIB_DEBUG_PRINT(...) Module::serialPrintf(__VA_ARGS__)
|
||||
#define RADIOLIB_DEBUG_PRINTLN(M, ...) Module::serialPrintf(M "\n", ##__VA_ARGS__)
|
||||
|
@ -491,7 +493,7 @@
|
|||
#define RADIOLIB_DEBUG_HEXDUMP(...) {}
|
||||
#endif
|
||||
|
||||
#if defined(RADIOLIB_VERBOSE)
|
||||
#if RADIOLIB_VERBOSE
|
||||
#define RADIOLIB_VERBOSE_PRINT(...) RADIOLIB_DEBUG_PRINT(__VA_ARGS__)
|
||||
#define RADIOLIB_VERBOSE_PRINTLN(...) RADIOLIB_DEBUG_PRINTLN(__VA_ARGS__)
|
||||
#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
|
||||
*/
|
||||
#if defined(RADIOLIB_CHECK_PARAMS)
|
||||
#if RADIOLIB_CHECK_PARAMS
|
||||
#define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) { if(!(((VAR) >= (MIN)) && ((VAR) <= (MAX)))) { return(ERR); } }
|
||||
#else
|
||||
#define RADIOLIB_CHECK_RANGE(VAR, MIN, MAX, ERR) {}
|
||||
#endif
|
||||
|
||||
#if defined(RADIOLIB_FIX_ERRATA_SX127X)
|
||||
#if RADIOLIB_FIX_ERRATA_SX127X
|
||||
#define RADIOLIB_ERRATA_SX127X(...) { errataFix(__VA_ARGS__); }
|
||||
#else
|
||||
#define RADIOLIB_ERRATA_SX127X(...) {}
|
||||
|
@ -526,7 +528,7 @@
|
|||
|
||||
// version definitions
|
||||
#define RADIOLIB_VERSION_MAJOR 6
|
||||
#define RADIOLIB_VERSION_MINOR 2
|
||||
#define RADIOLIB_VERSION_MINOR 3
|
||||
#define RADIOLIB_VERSION_PATCH 0
|
||||
#define RADIOLIB_VERSION_EXTRA 0
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// most commonly, RADIOLIB_EXCLUDE_* macros
|
||||
// or enabling debug output
|
||||
|
||||
//#define RADIOLIB_DEBUG
|
||||
//#define RADIOLIB_VERBOSE
|
||||
//#define RADIOLIB_DEBUG (1)
|
||||
//#define RADIOLIB_VERBOSE (1)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
// needed for debug print
|
||||
#include <stdarg.h>
|
||||
#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);
|
||||
SPIwriteRegister(reg, newValue);
|
||||
|
||||
#if defined(RADIOLIB_SPI_PARANOID)
|
||||
#if RADIOLIB_SPI_PARANOID
|
||||
// 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)
|
||||
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) {
|
||||
// prepare the buffers
|
||||
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 buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
|
@ -182,7 +182,7 @@ void Module::SPItransfer(uint8_t cmd, uint16_t reg, uint8_t* dataOut, uint8_t* d
|
|||
}
|
||||
|
||||
// print debug information
|
||||
#if defined(RADIOLIB_VERBOSE)
|
||||
#if RADIOLIB_VERBOSE
|
||||
uint8_t* debugBuffPtr = NULL;
|
||||
if(cmd == SPIwriteCommand) {
|
||||
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();
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buffOut;
|
||||
delete[] buffIn;
|
||||
#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 state = RADIOLIB_ERR_NONE;
|
||||
|
||||
#if defined(RADIOLIB_SPI_PARANOID)
|
||||
#if RADIOLIB_SPI_PARANOID
|
||||
// get the status
|
||||
uint8_t spiStatus = 0;
|
||||
uint8_t cmd = this->SPIstatusCommand;
|
||||
|
@ -262,7 +262,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
if(!write) {
|
||||
buffLen++;
|
||||
}
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
|
@ -292,7 +292,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
this->hal->yield();
|
||||
if(this->hal->millis() - start >= timeout) {
|
||||
RADIOLIB_DEBUG_PRINTLN("GPIO pre-transfer timeout, is it connected?");
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buffOut;
|
||||
delete[] buffIn;
|
||||
#endif
|
||||
|
@ -319,7 +319,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
this->hal->yield();
|
||||
if(this->hal->millis() - start >= timeout) {
|
||||
RADIOLIB_DEBUG_PRINTLN("GPIO post-transfer timeout, is it connected?");
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buffOut;
|
||||
delete[] buffIn;
|
||||
#endif
|
||||
|
@ -342,7 +342,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
}
|
||||
|
||||
// print debug information
|
||||
#if defined(RADIOLIB_VERBOSE)
|
||||
#if RADIOLIB_VERBOSE
|
||||
// print command byte(s)
|
||||
RADIOLIB_VERBOSE_PRINT("CMD");
|
||||
if(write) {
|
||||
|
@ -369,7 +369,7 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
RADIOLIB_VERBOSE_PRINTLN();
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buffOut;
|
||||
delete[] buffIn;
|
||||
#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) {
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
#if RADIOLIB_INTERRUPT_TIMING
|
||||
(void)start;
|
||||
if((this->TimerSetupCb != nullptr) && (len != this->prevTimingLen)) {
|
||||
prevTimingLen = len;
|
||||
|
@ -403,7 +403,7 @@ uint32_t Module::reflect(uint32_t in, uint8_t bits) {
|
|||
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) {
|
||||
size_t rem_len = len;
|
||||
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) {
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t buff[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
uint8_t* buff = new uint8_t[len];
|
||||
#endif
|
||||
SPIreadRegisterBurst(start, len, buff);
|
||||
hexdump(buff, len, start);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buff;
|
||||
#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
|
||||
size_t Module::serialPrintf(const char* format, ...) {
|
||||
va_list arg;
|
||||
|
|
10
src/Module.h
10
src/Module.h
|
@ -168,7 +168,7 @@ class Module {
|
|||
*/
|
||||
SPIparseStatusCb_t SPIparseStatusCb = nullptr;
|
||||
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
#if RADIOLIB_INTERRUPT_TIMING
|
||||
|
||||
/*!
|
||||
\brief Timer interrupt setup callback typedef.
|
||||
|
@ -468,7 +468,7 @@ class Module {
|
|||
*/
|
||||
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.
|
||||
\param data Data to dump.
|
||||
|
@ -486,11 +486,11 @@ class Module {
|
|||
void regdump(uint16_t start, size_t len);
|
||||
#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, ...);
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
uint32_t csPin = RADIOLIB_NC;
|
||||
|
@ -502,7 +502,7 @@ class Module {
|
|||
uint32_t rfSwitchPins[RFSWITCH_MAX_PINS] = { RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC };
|
||||
const RfSwitchMode_t *rfSwitchTable = nullptr;
|
||||
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
#if RADIOLIB_INTERRUPT_TIMING
|
||||
uint32_t prevTimingLen = 0;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -47,12 +47,12 @@
|
|||
// warnings are printed in this file since BuildOpt.h is compiled in multiple places
|
||||
|
||||
// check God mode
|
||||
#if defined(RADIOLIB_GODMODE)
|
||||
#if RADIOLIB_GODMODE
|
||||
#warning "God mode active, I hope it was intentional. Buckle up, lads."
|
||||
#endif
|
||||
|
||||
// print debug info
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
#define RADIOLIB_VALUE_TO_STRING(x) #x
|
||||
#define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
|
||||
#pragma message("\nRadioLib Debug Info\nVersion: \"" \
|
||||
|
@ -120,7 +120,7 @@
|
|||
#include "utils/Cryptography.h"
|
||||
|
||||
// only create Radio class when using RadioShield
|
||||
#if defined(RADIOLIB_RADIOSHIELD)
|
||||
#if RADIOLIB_RADIOSHIELD
|
||||
|
||||
// RadioShield pin definitions
|
||||
#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);
|
||||
}
|
||||
|
||||
#if defined(RADIOLIB_GODMODE)
|
||||
#if RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "CC1101.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) {
|
||||
this->mod = module;
|
||||
|
@ -935,7 +935,7 @@ int16_t CC1101::getChipVersion() {
|
|||
return(SPIgetRegValue(RADIOLIB_CC1101_REG_VERSION));
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void CC1101::setDirectAction(void (*func)(void)) {
|
||||
setGdo0Action(func, this->mod->hal->GpioInterruptRising);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
@ -922,7 +922,7 @@ class CC1101: public PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\param func Pointer to interrupt service routine.
|
||||
|
@ -944,7 +944,7 @@ class CC1101: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setDIOMapping(uint32_t pin, uint32_t value);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
@ -959,7 +959,7 @@ class CC1101: public PhysicalLayer {
|
|||
|
||||
void SPIsendCommand(uint8_t cmd);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "LLCC68.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
LLCC68::LLCC68(Module* mod) : SX1262(mod) {
|
||||
chipType = RADIOLIB_LLCC68_CHIP_TYPE;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "../SX126x/SX1262.h"
|
||||
|
@ -56,7 +56,7 @@ class LLCC68: public SX1262 {
|
|||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "RF69.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) {
|
||||
this->mod = module;
|
||||
|
@ -960,7 +960,7 @@ uint8_t RF69::randomByte() {
|
|||
return(randByte);
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void RF69::setDirectAction(void (*func)(void)) {
|
||||
setDio1Action(func);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_RF69)
|
||||
#if !RADIOLIB_EXCLUDE_RF69
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -973,7 +973,7 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\param func Pointer to interrupt service routine.
|
||||
|
@ -995,12 +995,12 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setDIOMapping(uint32_t pin, uint32_t value);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ class RF69: public PhysicalLayer {
|
|||
int16_t directMode();
|
||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
int16_t setMode(uint8_t mode);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_RFM2X)
|
||||
#if !RADIOLIB_EXCLUDE_RFM2X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "../Si443x/Si443x.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_RFM2X)
|
||||
#if !RADIOLIB_EXCLUDE_RFM2X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "../Si443x/Si443x.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1231.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX1231)
|
||||
#if !RADIOLIB_EXCLUDE_SX1231
|
||||
|
||||
SX1231::SX1231(Module* mod) : RF69(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX1231)
|
||||
#if !RADIOLIB_EXCLUDE_SX1231
|
||||
|
||||
#include "../../Module.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);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
uint8_t chipRevision = 0;
|
||||
|
|
|
@ -6,7 +6,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
|
|||
*/
|
||||
|
||||
#include "STM32WLx.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#if !RADIOLIB_EXCLUDE_STM32WLX
|
||||
|
||||
STM32WLx::STM32WLx(STM32WLx_Module* mod) : SX1262(mod) { }
|
||||
|
||||
|
@ -150,4 +150,4 @@ void STM32WLx::clearChannelScanAction() {
|
|||
this->clearDio1Action();
|
||||
}
|
||||
|
||||
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#if !RADIOLIB_EXCLUDE_STM32WLX
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX1262.h"
|
||||
|
@ -153,16 +153,16 @@ class STM32WLx : public SX1262 {
|
|||
*/
|
||||
void clearChannelScanAction();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
virtual int16_t clearIrqStatus(uint16_t clearIrqParams) override;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#endif
|
||||
|
||||
#endif // _RADIOLIB_STM32WLX_MODULE_H
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
|
|||
|
||||
#include "STM32WLx_Module.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#if !RADIOLIB_EXCLUDE_STM32WLX
|
||||
|
||||
#include "../../ArduinoHal.h"
|
||||
|
||||
|
@ -103,4 +103,4 @@ STM32WLx_Module::STM32WLx_Module():
|
|||
RADIOLIB_STM32WLx_VIRTUAL_PIN_BUSY
|
||||
) {}
|
||||
|
||||
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,7 @@ This file is licensed under the MIT License: https://opensource.org/licenses/MIT
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#if !RADIOLIB_EXCLUDE_STM32WLX
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -33,6 +33,6 @@ class STM32WLx_Module : public Module {
|
|||
STM32WLx_Module();
|
||||
};
|
||||
|
||||
#endif // !defined(RADIOLIB_EXCLUDE_STM32WLX)
|
||||
#endif
|
||||
|
||||
#endif // _RADIOLIB_STM32WLX_MODULE_H
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1261.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
SX1261::SX1261(Module* mod): SX1262(mod) {
|
||||
chipType = RADIOLIB_SX1261_CHIP_TYPE;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX126x.h"
|
||||
|
@ -34,7 +34,7 @@ class SX1261 : public SX1262 {
|
|||
*/
|
||||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1262.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
SX1262::SX1262(Module* mod) : SX126x(mod) {
|
||||
chipType = RADIOLIB_SX1262_CHIP_TYPE;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX126x.h"
|
||||
|
@ -87,7 +87,7 @@ class SX1262: public SX126x {
|
|||
*/
|
||||
virtual int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1268.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
SX1268::SX1268(Module* mod) : SX126x(mod) {
|
||||
chipType = RADIOLIB_SX1268_CHIP_TYPE;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX126x.h"
|
||||
|
@ -85,7 +85,7 @@ class SX1268: public SX126x {
|
|||
*/
|
||||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "SX126x.h"
|
||||
#include <string.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) {
|
||||
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));
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void SX126x::setDirectAction(void (*func)(void)) {
|
||||
setDio1Action(func);
|
||||
}
|
||||
|
@ -1563,7 +1563,7 @@ int16_t SX126x::uploadPatch(const uint32_t* patch, size_t len, bool nonvolatile)
|
|||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check the version
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
char ver_pre[16];
|
||||
this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)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);
|
||||
|
||||
// check the version again
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
char ver_post[16];
|
||||
this->mod->SPIreadRegisterBurst(RADIOLIB_SX126X_REG_VERSION_STRING, 16, (uint8_t*)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);
|
||||
|
||||
// if something failed, show the device errors
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
if(state != RADIOLIB_ERR_NONE) {
|
||||
// unless mode is forced to standby, device errors will be 0
|
||||
standby();
|
||||
|
@ -2099,7 +2099,7 @@ int16_t SX126x::config(uint8_t modem) {
|
|||
state = this->mod->SPIcheckStream();
|
||||
|
||||
// if something failed, show the device errors
|
||||
#if defined(RADIOLIB_DEBUG)
|
||||
#if RADIOLIB_DEBUG
|
||||
if(state != RADIOLIB_ERR_NONE) {
|
||||
// unless mode is forced to standby, device errors will be 0
|
||||
standby();
|
||||
|
@ -2142,7 +2142,7 @@ bool SX126x::findChip(const char* verStr) {
|
|||
RADIOLIB_DEBUG_PRINTLN();
|
||||
flagFound = true;
|
||||
} 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_HEXDUMP((uint8_t*)version, 16, RADIOLIB_SX126X_REG_VERSION_STRING);
|
||||
RADIOLIB_DEBUG_PRINTLN("Expected string: %s", verStr);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -1039,7 +1039,7 @@ class SX126x: public PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\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);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
// SX126x SPI command implementations
|
||||
|
@ -1146,7 +1146,7 @@ class SX126x: public PhysicalLayer {
|
|||
int16_t fixImplicitTimeout();
|
||||
int16_t fixInvertedIQ(uint8_t iqConfig);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
@ -1154,7 +1154,7 @@ class SX126x: public PhysicalLayer {
|
|||
// common low-level SPI interface
|
||||
static int16_t SPIparseStatus(uint8_t in);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "../../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX126X)
|
||||
#if !RADIOLIB_EXCLUDE_SX126X
|
||||
|
||||
// the following is a binary patch to the SX1262
|
||||
// this patch is needed to enable spectral scan functionality
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SX1272.h"
|
||||
#include <math.h>
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1272::SX1272(Module* mod) : SX127x(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX127x.h"
|
||||
|
@ -271,7 +271,7 @@ class SX1272: public SX127x {
|
|||
*/
|
||||
int16_t explicitHeader();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
int16_t setBandwidthRaw(uint8_t newBandwidth);
|
||||
|
@ -282,7 +282,7 @@ class SX1272: public SX127x {
|
|||
int16_t configFSK();
|
||||
void errataFix(bool rx);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
bool ldroAuto = true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1273.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1273::SX1273(Module* mod) : SX1272(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "SX1272.h"
|
||||
|
||||
|
@ -56,7 +56,7 @@ class SX1273: public SX1272 {
|
|||
*/
|
||||
int16_t setDataRate(DataRate_t dr) override;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1276.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1276::SX1276(Module* mod) : SX1278(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "SX1278.h"
|
||||
|
||||
|
@ -63,7 +63,7 @@ class SX1276: public SX1278 {
|
|||
*/
|
||||
int16_t setFrequency(float freq);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1277.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1277::SX1277(Module* mod) : SX1278(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "SX1278.h"
|
||||
|
||||
|
@ -77,7 +77,7 @@ class SX1277: public SX1278 {
|
|||
*/
|
||||
int16_t setDataRate(DataRate_t dr) override;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SX1278.h"
|
||||
#include <math.h>
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1278::SX1278(Module* mod) : SX127x(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX127x.h"
|
||||
|
@ -282,7 +282,7 @@ class SX1278: public SX127x {
|
|||
*/
|
||||
int16_t explicitHeader();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
int16_t setBandwidthRaw(uint8_t newBandwidth);
|
||||
|
@ -293,7 +293,7 @@ class SX1278: public SX127x {
|
|||
int16_t configFSK();
|
||||
void errataFix(bool rx);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
bool ldroAuto = true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1279.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
SX1279::SX1279(Module* mod) : SX1278(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "SX1278.h"
|
||||
|
||||
|
@ -63,7 +63,7 @@ class SX1279: public SX1278 {
|
|||
*/
|
||||
int16_t setFrequency(float freq);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SX127x.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) {
|
||||
this->mod = mod;
|
||||
|
@ -1628,7 +1628,7 @@ int16_t SX127x::invertIQ(bool enable) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void SX127x::setDirectAction(void (*func)(void)) {
|
||||
setDio1Action(func, this->mod->hal->GpioInterruptRising);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX127X)
|
||||
#if !RADIOLIB_EXCLUDE_SX127X
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ class SX127x: public PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\param func Pointer to interrupt service routine.
|
||||
|
@ -1218,12 +1218,12 @@ class SX127x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setRSSIThreshold(float dbm);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
@ -1245,7 +1245,7 @@ class SX127x: public PhysicalLayer {
|
|||
int16_t directMode();
|
||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
float dataRate = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SX1280.h"
|
||||
#include <string.h>
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
SX1280::SX1280(Module* mod) : SX1281(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX128x.h"
|
||||
|
@ -45,7 +45,7 @@ class SX1280: public SX1281 {
|
|||
*/
|
||||
float getRangingResult();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1281.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
SX1281::SX1281(Module* mod) : SX128x(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX128x.h"
|
||||
|
@ -20,7 +20,7 @@ class SX1281: public SX128x {
|
|||
*/
|
||||
SX1281(Module* mod);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SX1282.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
/// \todo implement advanced ranging
|
||||
SX1282::SX1282(Module* mod) : SX1280(mod) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "SX128x.h"
|
||||
|
@ -21,7 +21,7 @@ class SX1282: public SX1280 {
|
|||
*/
|
||||
SX1282(Module* mod);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "SX128x.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) {
|
||||
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));
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void SX128x::setDirectAction(void (*func)(void)) {
|
||||
// SX128x is unable to perform direct mode reception
|
||||
// this method is implemented only for PhysicalLayer compatibility
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SX128X)
|
||||
#if !RADIOLIB_EXCLUDE_SX128X
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -310,7 +310,7 @@
|
|||
#define RADIOLIB_SX128X_PACKET_STATUS_SYNC_DET_3 0b00000100 // 2 0 detected sync word 3
|
||||
|
||||
//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_RX_TX_TIMEOUT 0x4000 // 14 14 Rx or Tx timeout
|
||||
#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);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
/*!
|
||||
\brief Dummy method, to ensure PhysicalLayer compatibility.
|
||||
\param func Ignored.
|
||||
|
@ -779,12 +779,12 @@ class SX128x: public PhysicalLayer {
|
|||
void readBit(uint32_t pin);
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
@ -817,14 +817,14 @@ class SX128x: public PhysicalLayer {
|
|||
|
||||
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:
|
||||
#endif
|
||||
|
||||
// common low-level SPI interface
|
||||
static int16_t SPIparseStatus(uint8_t in);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
// common parameters
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "Si4430.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
Si4430::Si4430(Module* mod) : Si4432(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "Si4432.h"
|
||||
|
@ -53,11 +53,11 @@ class Si4430: public Si4432 {
|
|||
*/
|
||||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "Si4431.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
Si4431::Si4431(Module* mod) : Si4432(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "Si4432.h"
|
||||
|
@ -46,11 +46,11 @@ class Si4431: public Si4432 {
|
|||
*/
|
||||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "Si4432.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
Si4432::Si4432(Module* mod) : Si443x(mod) {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
#include "../../Module.h"
|
||||
#include "Si443x.h"
|
||||
|
@ -53,11 +53,11 @@ class Si4432: public Si443x {
|
|||
*/
|
||||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "Si443x.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) {
|
||||
this->mod = mod;
|
||||
|
@ -623,7 +623,7 @@ int16_t Si443x::getChipVersion() {
|
|||
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)) {
|
||||
setIrqAction(func);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SI443X)
|
||||
#if !RADIOLIB_EXCLUDE_SI443X
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -797,7 +797,7 @@ class Si443x: public PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\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);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
@ -845,7 +845,7 @@ class Si443x: public PhysicalLayer {
|
|||
int16_t setFrequencyRaw(float newFreq);
|
||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
bool findChip();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "nRF24.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) {
|
||||
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) {
|
||||
// prepare the buffers
|
||||
size_t buffLen = 1 + numBytes;
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t buffOut[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
uint8_t buffIn[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
|
@ -648,7 +648,7 @@ void nRF24::SPItransfer(uint8_t cmd, bool write, uint8_t* dataOut, uint8_t* data
|
|||
memcpy(dataIn, &buffIn[1], numBytes);
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] buffOut;
|
||||
delete[] buffIn;
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
||||
#include "../../Module.h"
|
||||
|
@ -467,7 +467,7 @@ class nRF24: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setEncoding(uint8_t encoding) override;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
|
||||
protected:
|
||||
#endif
|
||||
Module* mod;
|
||||
|
@ -476,7 +476,7 @@ class nRF24: public PhysicalLayer {
|
|||
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);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "AFSK.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
|
||||
AFSKClient::AFSKClient(PhysicalLayer* phy, uint32_t pin): outPin(pin) {
|
||||
phyLayer = phy;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
|
||||
#include "../../Module.h"
|
||||
|
||||
|
@ -49,7 +49,7 @@ class AFSKClient {
|
|||
*/
|
||||
int16_t noTone(bool keepOn = false);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#if !defined(RADIOLIB_EXCLUDE_APRS)
|
||||
#if !RADIOLIB_EXCLUDE_APRS
|
||||
|
||||
APRSClient::APRSClient(AX25Client* ax) {
|
||||
axClient = ax;
|
||||
|
@ -42,7 +42,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
|
|||
if(time != NULL) {
|
||||
len += strlen(time);
|
||||
}
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
char* info = new char[len + 1];
|
||||
#else
|
||||
char info[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
|
@ -66,7 +66,7 @@ int16_t APRSClient::sendPosition(char* destCallsign, uint8_t destSSID, char* lat
|
|||
|
||||
// send the frame
|
||||
int16_t state = sendFrame(destCallsign, destSSID, info);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] info;
|
||||
#endif
|
||||
return(state);
|
||||
|
@ -89,7 +89,7 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
|
|||
|
||||
// prepare buffers
|
||||
char destCallsign[7];
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
size_t infoLen = 10;
|
||||
if(telemLen > 0) {
|
||||
infoLen += 1 + telemLen;
|
||||
|
@ -231,7 +231,7 @@ int16_t APRSClient::sendMicE(float lat, float lon, uint16_t heading, uint16_t sp
|
|||
destSSID = 1;
|
||||
}
|
||||
int16_t state = sendFrame(destCallsign, destSSID, info);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] info;
|
||||
#endif
|
||||
return(state);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#if !defined(_RADIOLIB_RADIOLIB_APRS_H)
|
||||
#define _RADIOLIB_RADIOLIB_APRS_H
|
||||
#if !defined(_RADIOLIB_APRS_H)
|
||||
#define _RADIOLIB_APRS_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_APRS)
|
||||
#if !RADIOLIB_EXCLUDE_APRS
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AX25/AX25.h"
|
||||
|
@ -128,7 +128,7 @@ class APRSClient {
|
|||
*/
|
||||
int16_t sendFrame(char* destCallsign, uint8_t destSSID, char* info);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
AX25Client* axClient;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "AX25.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(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
|
||||
this->numRepeaters = 0;
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
this->repeaterCallsigns = NULL;
|
||||
this->repeaterSSIDs = NULL;
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ AX25Frame::AX25Frame(const char* destCallsign, uint8_t destSSID, const char* src
|
|||
// info field
|
||||
this->infoLen = infoLen;
|
||||
if(infoLen > 0) {
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
this->info = new uint8_t[infoLen];
|
||||
#endif
|
||||
memcpy(this->info, info, infoLen);
|
||||
|
@ -55,7 +55,7 @@ AX25Frame::AX25Frame(const AX25Frame& frame) {
|
|||
}
|
||||
|
||||
AX25Frame::~AX25Frame() {
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
// deallocate info field
|
||||
if(infoLen > 0) {
|
||||
delete[] this->info;
|
||||
|
@ -124,7 +124,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs
|
|||
}
|
||||
|
||||
// create buffers
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
this->repeaterCallsigns = new char*[numRepeaters];
|
||||
for(uint8_t i = 0; i < numRepeaters; i++) {
|
||||
this->repeaterCallsigns[i] = new char[strlen(repeaterCallsigns[i]) + 1];
|
||||
|
@ -153,12 +153,12 @@ void AX25Frame::setSendSequence(uint8_t seqNumber) {
|
|||
|
||||
AX25Client::AX25Client(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
bellModem = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AX25Client::AX25Client(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
bellModem = new BellClient(audio);
|
||||
|
@ -194,7 +194,7 @@ int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t preL
|
|||
preambleLen = preLen;
|
||||
|
||||
// configure for direct mode
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(bellModem != nullptr) {
|
||||
return(phyLayer->startDirect());
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
|||
}
|
||||
|
||||
// check repeater configuration
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
if(!(((frame->repeaterCallsigns == NULL) && (frame->repeaterSSIDs == NULL) && (frame->numRepeaters == 0)) ||
|
||||
((frame->repeaterCallsigns != NULL) && (frame->repeaterSSIDs != NULL) && (frame->numRepeaters != 0)))) {
|
||||
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)
|
||||
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
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
uint8_t* frameBuff = new uint8_t[frameBuffLen + 2];
|
||||
#else
|
||||
uint8_t frameBuff[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
|
@ -323,7 +323,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
|||
*(frameBuffPtr++) = (uint8_t)(fcs & 0xFF);
|
||||
|
||||
// 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
|
||||
uint8_t* stuffedFrameBuff = new uint8_t[preambleLen + 1 + (6*frameBuffLen)/5 + 2];
|
||||
#else
|
||||
|
@ -367,7 +367,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
|||
}
|
||||
|
||||
// deallocate memory
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] frameBuff;
|
||||
#endif
|
||||
|
||||
|
@ -413,7 +413,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
|||
|
||||
// transmit
|
||||
int16_t state = RADIOLIB_ERR_NONE;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(bellModem != nullptr) {
|
||||
bellModem->idle();
|
||||
|
||||
|
@ -427,12 +427,12 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
|||
} else {
|
||||
#endif
|
||||
state = phyLayer->transmit(stuffedFrameBuff, stuffedFrameBuffLen);
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
}
|
||||
#endif
|
||||
|
||||
// deallocate memory
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] stuffedFrameBuff;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#if !defined(_RADIOLIB_RADIOLIB_AX25_H)
|
||||
#define _RADIOLIB_RADIOLIB_AX25_H
|
||||
#if !defined(_RADIOLIB_AX25_H)
|
||||
#define _RADIOLIB_AX25_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AX25)
|
||||
#if !RADIOLIB_EXCLUDE_AX25
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -125,7 +125,7 @@ class AX25Frame {
|
|||
*/
|
||||
uint16_t sendSeqNumber;
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
/*!
|
||||
\brief The info field.
|
||||
*/
|
||||
|
@ -243,7 +243,7 @@ class AX25Client {
|
|||
*/
|
||||
explicit AX25Client(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\param audio Pointer to the AFSK instance providing audio.
|
||||
|
@ -303,13 +303,13 @@ class AX25Client {
|
|||
*/
|
||||
int16_t sendFrame(AX25Frame* frame);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
friend class APRSClient;
|
||||
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
BellClient* bellModem;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "BellModem.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_BELL)
|
||||
#if !RADIOLIB_EXCLUDE_BELL
|
||||
|
||||
const struct BellModem_t Bell101 {
|
||||
.freqMark = 1270,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "../../ArduinoHal.h"
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_BELL)
|
||||
#if !RADIOLIB_EXCLUDE_BELL
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -116,7 +116,7 @@ class BellClient: public AFSKClient, public RadioLibPrint {
|
|||
*/
|
||||
int16_t standby();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
BellModem_t modemType;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#include "FSK4.h"
|
||||
#include <math.h>
|
||||
#if !defined(RADIOLIB_EXCLUDE_FSK4)
|
||||
#if !RADIOLIB_EXCLUDE_FSK4
|
||||
|
||||
FSK4Client::FSK4Client(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
audioClient = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
FSK4Client::FSK4Client(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
audioClient = audio;
|
||||
|
@ -87,7 +87,7 @@ void FSK4Client::tone(uint8_t i) {
|
|||
}
|
||||
|
||||
int16_t FSK4Client::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->tone(freqHz));
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ int16_t FSK4Client::standby() {
|
|||
// ensure everything is stopped in interrupt timing mode
|
||||
Module* mod = phyLayer->getMod();
|
||||
mod->waitForMicroseconds(0, 0);
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->noTone());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_FSK4)
|
||||
#if !RADIOLIB_EXCLUDE_FSK4
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -20,7 +20,7 @@ class FSK4Client {
|
|||
*/
|
||||
explicit FSK4Client(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\param audio Pointer to the AFSK instance providing audio.
|
||||
|
@ -74,11 +74,11 @@ class FSK4Client {
|
|||
*/
|
||||
int16_t standby();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AFSKClient* audioClient;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "Hellschreiber.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER)
|
||||
#if !RADIOLIB_EXCLUDE_HELLSCHREIBER
|
||||
|
||||
HellClient::HellClient(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
lineFeed = " ";
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
audioClient = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
HellClient::HellClient(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
lineFeed = " ";
|
||||
|
@ -82,7 +82,7 @@ size_t HellClient::write(uint8_t b) {
|
|||
}
|
||||
|
||||
int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->tone(freqHz));
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
|||
}
|
||||
|
||||
int16_t HellClient::standby() {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->noTone(invert));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_HELLSCHREIBER)
|
||||
#if !RADIOLIB_EXCLUDE_HELLSCHREIBER
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -95,7 +95,7 @@ class HellClient: public RadioLibPrint {
|
|||
*/
|
||||
explicit HellClient(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\param audio Pointer to the AFSK instance providing audio.
|
||||
|
@ -132,11 +132,11 @@ class HellClient: public RadioLibPrint {
|
|||
*/
|
||||
size_t write(uint8_t b);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AFSKClient* audioClient;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "LoRaWAN.h"
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_LORAWAN)
|
||||
#if !RADIOLIB_EXCLUDE_LORAWAN
|
||||
|
||||
#if defined(RADIOLIB_EEPROM_UNSUPPORTED)
|
||||
#warning "Persistent storage not supported!"
|
||||
|
@ -65,7 +65,7 @@ int16_t LoRaWANNode::restore() {
|
|||
|
||||
// check the magic value
|
||||
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("first 16 bytes of NVM:");
|
||||
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 fcntBuffEnd = mod->hal->getPersistentAddr(RADIOLIB_PERSISTENT_PARAM_LORAWAN_FCNT_UP_ID + 1);
|
||||
uint8_t buffSize = fcntBuffEnd - fcntBuffStart;
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t fcntBuff[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
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;
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] fcntBuff;
|
||||
#endif
|
||||
|
||||
|
@ -764,7 +764,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
|
|||
// build the uplink message
|
||||
// the first 16 bytes are reserved for MIC calculation blocks
|
||||
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];
|
||||
#else
|
||||
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();
|
||||
RADIOLIB_DEBUG_PRINTLN("Uplink sent <-- Rx Delay start");
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] uplinkMsg;
|
||||
#endif
|
||||
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
|
||||
// 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];
|
||||
#else
|
||||
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 !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] downlinkMsg;
|
||||
#endif
|
||||
return(state);
|
||||
|
@ -1127,7 +1127,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
|
|||
uint32_t fcnt32 = fcnt16;
|
||||
if(fcntDownPrev > 0) {
|
||||
if((fcnt16 <= fcntDownPrev) && ((0xFFFF - (uint16_t)fcntDownPrev + fcnt16) > RADIOLIB_LORAWAN_MAX_FCNT_GAP)) {
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] downlinkMsg;
|
||||
#endif
|
||||
if (isAppDownlink) {
|
||||
|
@ -1143,7 +1143,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
|
|||
|
||||
// check the MIC
|
||||
if(!verifyMIC(downlinkMsg, RADIOLIB_AES128_BLOCK_SIZE + downlinkMsgLen, this->sNwkSIntKey)) {
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] downlinkMsg;
|
||||
#endif
|
||||
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]);
|
||||
if(addr != this->devAddr) {
|
||||
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;
|
||||
#endif
|
||||
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(this->commandsUp.len > 15) {
|
||||
size_t foptsBufSize = this->commandsUp.len;
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t foptsBuff[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
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->uplink(foptsBuff, foptsBufSize, RADIOLIB_LORAWAN_FPORT_MAC_COMMAND);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] foptsBuff;
|
||||
#endif
|
||||
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t strDown[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
uint8_t* strDown = new uint8_t[this->band->payloadLenMax[this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK]]];
|
||||
#endif
|
||||
size_t lenDown = 0;
|
||||
state = this->downlink(strDown, &lenDown);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] strDown;
|
||||
#endif
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
@ -1274,7 +1274,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
|
|||
if(payLen <= 0) {
|
||||
// no payload
|
||||
*len = 0;
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] downlinkMsg;
|
||||
#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
|
||||
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;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
@ -350,7 +350,7 @@ class LoRaWANNode {
|
|||
public:
|
||||
|
||||
// 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
|
||||
LoRaWANChannel_t rx2;
|
||||
|
@ -578,7 +578,7 @@ class LoRaWANNode {
|
|||
*/
|
||||
void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer = NULL;
|
||||
|
@ -622,7 +622,7 @@ class LoRaWANNode {
|
|||
uint32_t adrFcnt = 0;
|
||||
|
||||
// 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
|
||||
bool isJoinedFlag = false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "LoRaWAN.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_LORAWAN)
|
||||
#if !RADIOLIB_EXCLUDE_LORAWAN
|
||||
|
||||
const LoRaWANBand_t EU868 = {
|
||||
.bandType = RADIOLIB_LORAWAN_BAND_DYNAMIC,
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_MORSE)
|
||||
#if !RADIOLIB_EXCLUDE_MORSE
|
||||
|
||||
MorseClient::MorseClient(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
lineFeed = "^";
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
audioClient = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
MorseClient::MorseClient(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
lineFeed = "^";
|
||||
|
@ -59,7 +59,7 @@ char MorseClient::decode(uint8_t symbol, uint8_t len) {
|
|||
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) {
|
||||
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) {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->tone(freqHz));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ int16_t MorseClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
|||
}
|
||||
|
||||
int16_t MorseClient::standby() {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->noTone(true));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#if !defined(_RADIOLIB_RADIOLIB_MORSE_H) && !defined(RADIOLIB_EXCLUDE_MORSE)
|
||||
#define _RADIOLIB_RADIOLIB_MORSE_H
|
||||
#if !defined(_RADIOLIB_MORSE_H) && !RADIOLIB_EXCLUDE_MORSE
|
||||
#define _RADIOLIB_MORSE_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
|
@ -98,7 +98,7 @@ class MorseClient: public RadioLibPrint {
|
|||
*/
|
||||
explicit MorseClient(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\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,
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
@ -150,11 +150,11 @@ class MorseClient: public RadioLibPrint {
|
|||
*/
|
||||
size_t write(uint8_t b);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AFSKClient* audioClient;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "Pager.h"
|
||||
#include <string.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
|
||||
// let's hope nobody ever tries running two POCSAG receivers at the same time
|
||||
static PhysicalLayer* readBitInstance = NULL;
|
||||
|
@ -21,7 +21,7 @@ static void PagerClientReadBit(void) {
|
|||
|
||||
PagerClient::PagerClient(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
readBitInstance = phyLayer;
|
||||
#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
|
||||
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];
|
||||
#else
|
||||
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
|
||||
PagerClient::write(msg, msgLen);
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] msg;
|
||||
#endif
|
||||
|
||||
|
@ -235,7 +235,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
|
|||
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) {
|
||||
// save the variables
|
||||
readBitPin = pin;
|
||||
|
@ -289,7 +289,7 @@ int16_t PagerClient::readData(String& str, size_t len, uint32_t* addr) {
|
|||
}
|
||||
|
||||
// build a temporary buffer
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
||||
#else
|
||||
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
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] data;
|
||||
#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 codeWord = 0;
|
||||
codeWord |= (uint32_t)phyLayer->read() << 24;
|
||||
|
|
|
@ -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
|
||||
|
||||
#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);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
/*!
|
||||
\brief Start reception of POCSAG packets.
|
||||
\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);
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
|
@ -180,7 +180,7 @@ class PagerClient {
|
|||
void write(uint32_t* data, size_t len);
|
||||
void write(uint32_t codeWord);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
uint32_t read();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
PhysicalLayer::PhysicalLayer(float step, size_t maxLen) {
|
||||
this->freqStep = step;
|
||||
this->maxPacketLength = maxLen;
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
this->bufferBitPos = 0;
|
||||
this->bufferWritePos = 0;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
|
|||
}
|
||||
|
||||
// dynamically allocate memory
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
char* str = new char[len];
|
||||
|
@ -38,7 +38,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
|
|||
|
||||
// transmit string
|
||||
int16_t state = transmit(str, addr);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] str;
|
||||
#endif
|
||||
return(state);
|
||||
|
@ -68,7 +68,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
|
|||
size_t length = len;
|
||||
|
||||
// build a temporary buffer
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
||||
#else
|
||||
uint8_t* data = NULL;
|
||||
|
@ -101,7 +101,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
|
|||
}
|
||||
|
||||
// deallocate temporary buffer
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] data;
|
||||
#endif
|
||||
|
||||
|
@ -175,7 +175,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
|
|||
}
|
||||
|
||||
// build a temporary buffer
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
||||
#else
|
||||
uint8_t* data = new uint8_t[length + 1];
|
||||
|
@ -198,7 +198,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
|
|||
}
|
||||
|
||||
// deallocate temporary buffer
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] data;
|
||||
#endif
|
||||
|
||||
|
@ -366,7 +366,7 @@ int16_t PhysicalLayer::startDirect() {
|
|||
return(state);
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
int16_t PhysicalLayer::available() {
|
||||
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)) {
|
||||
Module* mod = getMod();
|
||||
mod->TimerSetupCb = func;
|
||||
|
|
|
@ -380,7 +380,7 @@ class PhysicalLayer {
|
|||
*/
|
||||
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.
|
||||
\param syncWord Sync word bits.
|
||||
|
@ -463,7 +463,7 @@ class PhysicalLayer {
|
|||
*/
|
||||
virtual void clearChannelScanAction();
|
||||
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
#if RADIOLIB_INTERRUPT_TIMING
|
||||
|
||||
/*!
|
||||
\brief Set function to be called to set up the timing interrupt.
|
||||
|
@ -480,18 +480,18 @@ class PhysicalLayer {
|
|||
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
protected:
|
||||
void updateDirectBuffer(uint8_t bit);
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
float freqStep;
|
||||
size_t maxPacketLength;
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
uint8_t bufferBitPos;
|
||||
uint8_t bufferWritePos;
|
||||
uint8_t bufferReadPos;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
ITA2String::ITA2String(char c) {
|
||||
asciiLen = 1;
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
strAscii = new char[1];
|
||||
#endif
|
||||
strAscii[0] = c;
|
||||
|
@ -13,7 +13,7 @@ ITA2String::ITA2String(char c) {
|
|||
|
||||
ITA2String::ITA2String(const char* str) {
|
||||
asciiLen = strlen(str);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
strAscii = new char[asciiLen + 1];
|
||||
#endif
|
||||
strcpy(strAscii, str);
|
||||
|
@ -21,7 +21,7 @@ ITA2String::ITA2String(const char* str) {
|
|||
}
|
||||
|
||||
ITA2String::~ITA2String() {
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] strAscii;
|
||||
#endif
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ size_t ITA2String::length() {
|
|||
|
||||
uint8_t* ITA2String::byteArr() {
|
||||
// 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];
|
||||
#else
|
||||
uint8_t* temp = new uint8_t[asciiLen*2 + 1];
|
||||
|
@ -87,7 +87,7 @@ uint8_t* ITA2String::byteArr() {
|
|||
|
||||
uint8_t* arr = new uint8_t[arrayLen];
|
||||
memcpy(arr, temp, arrayLen);
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] temp;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,10 +53,10 @@ class ITA2String {
|
|||
*/
|
||||
uint8_t* byteArr();
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
char strAscii[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
char* strAscii;
|
||||
|
|
|
@ -42,7 +42,7 @@ size_t RadioLibPrint::print(const __FlashStringHelper* fstr) {
|
|||
}
|
||||
|
||||
// dynamically allocate memory
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||
#else
|
||||
char* str = new char[len];
|
||||
|
@ -61,7 +61,7 @@ size_t RadioLibPrint::print(const __FlashStringHelper* fstr) {
|
|||
} else {
|
||||
n = write((uint8_t*)str, len);
|
||||
}
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] str;
|
||||
#endif
|
||||
return(n);
|
||||
|
|
|
@ -53,7 +53,7 @@ class RadioLibPrint {
|
|||
size_t println(double, int = 2);
|
||||
size_t println(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
uint8_t encoding = RADIOLIB_ASCII_EXTENDED;
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_RTTY)
|
||||
#if !RADIOLIB_EXCLUDE_RTTY
|
||||
|
||||
RTTYClient::RTTYClient(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
lineFeed = "\r\n";
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
audioClient = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
RTTYClient::RTTYClient(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
lineFeed = "\r\n";
|
||||
|
@ -104,7 +104,7 @@ void RTTYClient::space() {
|
|||
}
|
||||
|
||||
int16_t RTTYClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->tone(freqHz));
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ int16_t RTTYClient::standby() {
|
|||
// ensure everything is stopped in interrupt timing mode
|
||||
Module* mod = phyLayer->getMod();
|
||||
mod->waitForMicroseconds(0, 0);
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
return(audioClient->noTone());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_RTTY)
|
||||
#if !RADIOLIB_EXCLUDE_RTTY
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -22,7 +22,7 @@ class RTTYClient: public RadioLibPrint {
|
|||
*/
|
||||
explicit RTTYClient(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\param audio Pointer to the AFSK instance providing audio.
|
||||
|
@ -61,11 +61,11 @@ class RTTYClient: public RadioLibPrint {
|
|||
*/
|
||||
size_t write(uint8_t b);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AFSKClient* audioClient;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "SSTV.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_SSTV)
|
||||
#if !RADIOLIB_EXCLUDE_SSTV
|
||||
|
||||
const SSTVMode_t Scottie1 {
|
||||
.visCode = RADIOLIB_SSTV_SCOTTIE_1,
|
||||
|
@ -156,19 +156,19 @@ const SSTVMode_t PasokonP7 {
|
|||
|
||||
SSTVClient::SSTVClient(PhysicalLayer* phy) {
|
||||
phyLayer = phy;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
audioClient = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
SSTVClient::SSTVClient(AFSKClient* audio) {
|
||||
phyLayer = audio->phyLayer;
|
||||
audioClient = audio;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
int16_t SSTVClient::begin(const SSTVMode_t& mode) {
|
||||
if(audioClient == nullptr) {
|
||||
// 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) {
|
||||
Module* mod = phyLayer->getMod();
|
||||
uint32_t start = mod->hal->micros();
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
if(audioClient != nullptr) {
|
||||
audioClient->tone(freq, false);
|
||||
} else {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#if !defined(_RADIOLIB_RADIOLIB_SSTV_H)
|
||||
#define _RADIOLIB_RADIOLIB_SSTV_H
|
||||
#if !defined(_RADIOLIB_SSTV_H)
|
||||
#define _RADIOLIB_SSTV_H
|
||||
|
||||
#include "../../TypeDef.h"
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_SSTV)
|
||||
#if !RADIOLIB_EXCLUDE_SSTV
|
||||
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
@ -122,7 +122,7 @@ class SSTVClient {
|
|||
*/
|
||||
explicit SSTVClient(PhysicalLayer* phy);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Constructor for AFSK mode.
|
||||
\param audio Pointer to the AFSK instance providing audio.
|
||||
|
@ -141,7 +141,7 @@ class SSTVClient {
|
|||
*/
|
||||
int16_t begin(float base, const SSTVMode_t& mode);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
/*!
|
||||
\brief Initialization method for AFSK.
|
||||
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2,
|
||||
|
@ -182,11 +182,11 @@ class SSTVClient {
|
|||
*/
|
||||
uint16_t getPictureHeight() const;
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
#if !RADIOLIB_GODMODE
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* phyLayer;
|
||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||
#if !RADIOLIB_EXCLUDE_AFSK
|
||||
AFSKClient* audioClient;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
|
|||
this->n = n;
|
||||
this->k = k;
|
||||
this->poly = poly;
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
this->alphaTo = new int32_t[n + 1];
|
||||
this->indexOf = new int32_t[n + 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
|
||||
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];
|
||||
#else
|
||||
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;
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
int32_t zeros[RADIOLIB_BCH_MAX_N - RADIOLIB_BCH_MAX_K + 1];
|
||||
#else
|
||||
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;
|
||||
#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];
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] zeros;
|
||||
#endif
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void RadioLibBCH::begin(uint8_t n, uint8_t k, uint32_t poly) {
|
|||
*/
|
||||
uint32_t RadioLibBCH::encode(uint32_t dataword) {
|
||||
// we only use the "k" most significant bits
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
int32_t data[RADIOLIB_BCH_MAX_K];
|
||||
#else
|
||||
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
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
int32_t Mr[RADIOLIB_BCH_MAX_N];
|
||||
#else
|
||||
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];
|
||||
#else
|
||||
int32_t* bb = new int32_t[this->n - this->k + 1];
|
||||
|
@ -238,12 +238,12 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
|
|||
++j;
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] Mr;
|
||||
#endif
|
||||
|
||||
int32_t iEvenParity = 0;
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
int32_t recd[RADIOLIB_BCH_MAX_N + 1];
|
||||
#else
|
||||
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;
|
||||
#endif
|
||||
|
||||
|
@ -266,7 +266,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] bb;
|
||||
#endif
|
||||
|
||||
|
@ -283,7 +283,7 @@ uint32_t RadioLibBCH::encode(uint32_t dataword) {
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
delete[] recd;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define RADIOLIB_PAGER_BCH_K (21)
|
||||
#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_K (31)
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@ class RadioLibBCH {
|
|||
uint32_t poly;
|
||||
uint8_t m;
|
||||
|
||||
#if defined(RADIOLIB_STATIC_ONLY)
|
||||
#if RADIOLIB_STATIC_ONLY
|
||||
int32_t alphaTo[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];
|
||||
|
|
Loading…
Add table
Reference in a new issue