[SX126x] Reworked macro configuration system
This commit is contained in:
parent
77c9b2875d
commit
49feff6df2
13 changed files with 34 additions and 34 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue