mirror of https://github.com/meshcore-dev/MeshCore
committed by
GitHub
13 changed files with 183 additions and 35 deletions
@ -0,0 +1,65 @@ |
|||
[Tenstar_esp32_C3] |
|||
extends = esp32_base |
|||
board = esp32-c3-devkitm-1 |
|||
build_flags = |
|||
${esp32_base.build_flags} |
|||
-I variants/tenstar_c3 |
|||
-D ESP32_CPU_FREQ=80 |
|||
-D LORA_TX_BOOST_PIN=4 |
|||
-D P_LORA_TX_NEOPIXEL_LED=10 |
|||
-D PIN_VBAT_READ=1 |
|||
-D P_LORA_MISO=9 |
|||
-D P_LORA_SCLK=8 |
|||
-D P_LORA_MOSI=7 |
|||
-D P_LORA_DIO_1=2 |
|||
-D P_LORA_NSS=6 |
|||
-D P_LORA_RESET=RADIOLIB_NC |
|||
-D P_LORA_BUSY=3 |
|||
; -D PIN_BOARD_SDA=18 |
|||
; -D PIN_BOARD_SCL=19 |
|||
-D SX126X_DIO2_AS_RF_SWITCH=true |
|||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8 |
|||
-D SX126X_CURRENT_LIMIT=140 |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<../variants/tenstar_c3> |
|||
|
|||
[env:Tenstar_C3_Repeater_sx1262] |
|||
extends = Tenstar_esp32_C3 |
|||
build_src_filter = ${Tenstar_esp32_C3.build_src_filter} |
|||
+<../examples/simple_repeater/main.cpp> |
|||
build_flags = |
|||
${Tenstar_esp32_C3.build_flags} |
|||
-D RADIO_CLASS=CustomSX1262 |
|||
-D WRAPPER_CLASS=CustomSX1262Wrapper |
|||
-D SX126X_RX_BOOSTED_GAIN=1 |
|||
-D LORA_TX_POWER=22 |
|||
-D ADVERT_NAME='"Tenstar C3 Repeater"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=8 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Tenstar_esp32_C3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:Tenstar_C3_Repeater_sx1268] |
|||
extends = Tenstar_esp32_C3 |
|||
build_src_filter = ${Tenstar_esp32_C3.build_src_filter} |
|||
+<../examples/simple_repeater/main.cpp> |
|||
build_flags = |
|||
${Tenstar_esp32_C3.build_flags} |
|||
-D RADIO_CLASS=CustomSX1268 |
|||
-D WRAPPER_CLASS=CustomSX1268Wrapper |
|||
-D LORA_TX_POWER=22 |
|||
-D ADVERT_NAME='"Tenstar C3 Repeater"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=8 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Tenstar_esp32_C3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
@ -0,0 +1,48 @@ |
|||
#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 |
|||
|
|||
WRAPPER_CLASS radio_driver(radio, board); |
|||
|
|||
ESP32RTCClock fallback_clock; |
|||
AutoDiscoverRTCClock rtc_clock(fallback_clock); |
|||
SensorManager sensors; |
|||
|
|||
bool radio_init() { |
|||
fallback_clock.begin(); |
|||
rtc_clock.begin(Wire); |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
return radio.std_init(&spi); |
|||
#else |
|||
return radio.std_init(); |
|||
#endif |
|||
} |
|||
|
|||
uint32_t radio_get_rng_seed() { |
|||
return radio.random(0x7FFFFFFF); |
|||
} |
|||
|
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { |
|||
radio.setFrequency(freq); |
|||
radio.setSpreadingFactor(sf); |
|||
radio.setBandwidth(bw); |
|||
radio.setCodingRate(cr); |
|||
} |
|||
|
|||
void radio_set_tx_power(uint8_t dbm) { |
|||
radio.setOutputPower(dbm); |
|||
} |
|||
|
|||
mesh::LocalIdentity radio_new_identity() { |
|||
RadioNoiseListener rng(radio); |
|||
return mesh::LocalIdentity(&rng); // create new random identity
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/XiaoC3Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
#include <helpers/CustomSX1268Wrapper.h> |
|||
#include <helpers/AutoDiscoverRTCClock.h> |
|||
#include <helpers/SensorManager.h> |
|||
|
|||
extern XiaoC3Board board; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
extern AutoDiscoverRTCClock rtc_clock; |
|||
extern SensorManager sensors; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
Loading…
Reference in new issue