mirror of https://github.com/meshcore-dev/MeshCore
48 changed files with 726 additions and 407 deletions
@ -0,0 +1,31 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
HeltecV2Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/HeltecV2Board.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern HeltecV2Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,47 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
HeltecV3Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/HeltecV3Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern HeltecV3Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,47 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
ESP32Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,31 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
TBeamBoard board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/TBeamBoard.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern TBeamBoard board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,25 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
LilyGoTLoraBoard board; |
|||
|
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/LilyGoTLoraBoard.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern LilyGoTLoraBoard board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,46 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
FaketecBoard board; |
|||
|
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI); |
|||
SPI.begin(); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status == RADIOLIB_ERR_SPI_CMD_FAILED || status == RADIOLIB_ERR_SPI_CMD_INVALID) { |
|||
#define SX126X_DIO3_TCXO_VOLTAGE (0.0f); |
|||
tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
} |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
#pragma once |
|||
|
|||
#include <FaketecBoard.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
#include <helpers/CustomLLCC68Wrapper.h> |
|||
|
|||
extern FaketecBoard board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,41 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
RAK4631Board board; |
|||
|
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI); |
|||
SPI.begin(); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/nrf52/RAK4631Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern RAK4631Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,47 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
StationG2Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/StationG2Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern StationG2Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,41 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
T1000eBoard board; |
|||
|
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI); |
|||
SPI.begin(); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/nrf52/T1000eBoard.h> |
|||
#include <helpers/CustomLR1110Wrapper.h> |
|||
|
|||
extern T1000eBoard board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,41 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
T114Board board; |
|||
|
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI); |
|||
SPI.begin(); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/nrf52/T114Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern T114Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,41 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
TechoBoard board; |
|||
|
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI); |
|||
SPI.begin(); |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/nrf52/TechoBoard.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern TechoBoard board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,47 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
XiaoC3Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/XiaoC3Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
#include <helpers/CustomSX1268Wrapper.h> |
|||
|
|||
extern XiaoC3Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,47 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
ESP32Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
#ifndef LORA_CR |
|||
#define LORA_CR 5 |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
#ifdef SX126X_DIO3_TCXO_VOLTAGE |
|||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE; |
|||
#else |
|||
float tcxo = 1.6f; |
|||
#endif |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
#endif |
|||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); |
|||
if (status != RADIOLIB_ERR_NONE) { |
|||
Serial.print("ERROR: radio init failed: "); |
|||
Serial.println(status); |
|||
return false; // fail
|
|||
} |
|||
|
|||
radio.setCRC(1); |
|||
|
|||
#ifdef SX126X_CURRENT_LIMIT |
|||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT); |
|||
#endif |
|||
#ifdef SX126X_DIO2_AS_RF_SWITCH |
|||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); |
|||
#endif |
|||
#ifdef SX126X_RX_BOOSTED_GAIN |
|||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN); |
|||
#endif |
|||
|
|||
return true; // success
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern RADIO_CLASS radio; |
|||
|
|||
bool radio_init(); |
|||
Loading…
Reference in new issue