Add MeshCore relay_radio firmware for Heltec T114
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
Run Unit Tests / test (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (Tbeam_SX1276_repeater) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
PR Build Check / build (wio_wm1110_repeater) (push) Has been cancelled
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
Run Unit Tests / test (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (Tbeam_SX1276_repeater) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
PR Build Check / build (wio_wm1110_repeater) (push) Has been cancelled
This commit is contained in:
48
variants/rak3x72/platformio.ini
Normal file
48
variants/rak3x72/platformio.ini
Normal file
@@ -0,0 +1,48 @@
|
||||
[rak3x72]
|
||||
extends = stm32_base
|
||||
board = rak3172
|
||||
board_upload.maximum_size = 229376 ; 32kb for FS
|
||||
build_flags = ${stm32_base.build_flags}
|
||||
-D RAK_3X72
|
||||
-D RADIO_CLASS=CustomSTM32WLx
|
||||
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||
-D SPI_INTERFACES_COUNT=0
|
||||
-D RX_BOOSTED_GAIN=true
|
||||
; -D STM32WL_TCXO_VOLTAGE=1.6 ; defaults to 0 if undef
|
||||
; -D LORA_TX_POWER=14 ; Defaults to 22 for HP, 14 is for LP version
|
||||
-I variants/rak3x72
|
||||
build_src_filter = ${stm32_base.build_src_filter}
|
||||
+<../variants/rak3x72>
|
||||
|
||||
[env:RAK_3x72_repeater]
|
||||
extends = rak3x72
|
||||
build_flags = ${rak3x72.build_flags}
|
||||
-D ADVERT_NAME='"RAK3x72 Repeater"'
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${rak3x72.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
|
||||
[env:RAK_3x72_sensor]
|
||||
extends = rak3x72
|
||||
build_flags = ${rak3x72.build_flags}
|
||||
-D ADVERT_NAME='"RAK3x72 Sensor"'
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
build_src_filter = ${rak3x72.build_src_filter}
|
||||
+<../examples/simple_sensor>
|
||||
|
||||
[env:RAK_3x72_companion_radio_usb]
|
||||
extends = rak3x72
|
||||
build_flags = ${rak3x72.build_flags}
|
||||
; -D FORMAT_FS=true
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
build_src_filter = ${rak3x72.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps = ${rak3x72.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:RAK_3x72_kiss_modem]
|
||||
extends = rak3x72
|
||||
build_src_filter = ${rak3x72.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
61
variants/rak3x72/target.cpp
Normal file
61
variants/rak3x72/target.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
|
||||
RAK3x72Board board;
|
||||
|
||||
RADIO_CLASS radio = new STM32WLx_Module();
|
||||
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
static const uint32_t rfswitch_pins[] = {LORAWAN_RFSWITCH_PINS, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||
{STM32WLx::MODE_IDLE, {LOW, LOW}},
|
||||
{STM32WLx::MODE_RX, {HIGH, LOW}},
|
||||
{STM32WLx::MODE_TX_LP, {LOW, HIGH}},
|
||||
{STM32WLx::MODE_TX_HP, {LOW, HIGH}},
|
||||
END_OF_MODE_TABLE,
|
||||
};
|
||||
|
||||
VolatileRTCClock rtc_clock;
|
||||
SensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
#ifndef STM32WL_TCXO_VOLTAGE
|
||||
// TCXO set to 0 for RAK3172
|
||||
#define STM32WL_TCXO_VOLTAGE 0
|
||||
#endif
|
||||
|
||||
#ifndef LORA_TX_POWER
|
||||
#define LORA_TX_POWER 22
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
// rtc_clock.begin(Wire);
|
||||
|
||||
radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);
|
||||
|
||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, STM32WL_TCXO_VOLTAGE, 0);
|
||||
|
||||
if (status != RADIOLIB_ERR_NONE) {
|
||||
Serial.print("ERROR: radio init failed: ");
|
||||
Serial.println(status);
|
||||
return false; // fail
|
||||
}
|
||||
|
||||
#ifdef RX_BOOSTED_GAIN
|
||||
radio.setRxBoostedGainMode(RX_BOOSTED_GAIN);
|
||||
#endif
|
||||
|
||||
radio.setCRC(1);
|
||||
|
||||
return true; // success
|
||||
}
|
||||
|
||||
mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
53
variants/rak3x72/target.h
Normal file
53
variants/rak3x72/target.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
#include <helpers/stm32/STM32Board.h>
|
||||
#include <helpers/radiolib/CustomSTM32WLxWrapper.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
|
||||
#define PIN_VBAT_READ A0
|
||||
#define ADC_MULTIPLIER (5 * 1.73 * 1000)
|
||||
|
||||
class RAK3x72Board : public STM32Board {
|
||||
public:
|
||||
void begin() override {
|
||||
STM32Board::begin();
|
||||
pinMode(PA0, OUTPUT);
|
||||
pinMode(PA1, OUTPUT);
|
||||
}
|
||||
|
||||
const char* getManufacturerName() const override {
|
||||
return "RAK 3x72";
|
||||
}
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
analogReadResolution(12);
|
||||
uint32_t raw = 0;
|
||||
for (int i=0; i<8;i++) {
|
||||
raw += analogRead(PIN_VBAT_READ);
|
||||
}
|
||||
return ((double)raw) * ADC_MULTIPLIER / 8 / 4096;
|
||||
}
|
||||
|
||||
void setGpio(uint32_t values) override {
|
||||
// set led values
|
||||
digitalWrite(PA0, values & 1);
|
||||
digitalWrite(PA1, (values & 2) >> 1);
|
||||
}
|
||||
|
||||
uint32_t getGpio() override {
|
||||
// get led value
|
||||
return (digitalRead(PA1) << 1) | digitalRead(PA0);
|
||||
}
|
||||
};
|
||||
|
||||
extern RAK3x72Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern VolatileRTCClock rtc_clock;
|
||||
extern SensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
5
variants/rak3x72/variant.h
Normal file
5
variants/rak3x72/variant.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <variant_RAK3172_MODULE.h>
|
||||
|
||||
#undef RNG
|
||||
Reference in New Issue
Block a user