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:
24
variants/wio-e5-mini/NullDisplayDriver.h
Normal file
24
variants/wio-e5-mini/NullDisplayDriver.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
|
||||
class NullDisplayDriver : public DisplayDriver {
|
||||
public:
|
||||
NullDisplayDriver() : DisplayDriver(128, 64) { }
|
||||
bool begin() { return false; } // not present
|
||||
|
||||
bool isOn() override { return false; }
|
||||
void turnOn() override { }
|
||||
void turnOff() override { }
|
||||
void clear() override { }
|
||||
void startFrame(Color bkg = DARK) override { }
|
||||
void setTextSize(int sz) override { }
|
||||
void setColor(Color c) override { }
|
||||
void setCursor(int x, int y) override { }
|
||||
void print(const char* str) override { }
|
||||
void fillRect(int x, int y, int w, int h) override { }
|
||||
void drawRect(int x, int y, int w, int h) override { }
|
||||
void drawXbm(int x, int y, const uint8_t* bits, int w, int h) override { }
|
||||
uint16_t getTextWidth(const char* str) override { return 0; }
|
||||
void endFrame() { }
|
||||
};
|
||||
56
variants/wio-e5-mini/platformio.ini
Normal file
56
variants/wio-e5-mini/platformio.ini
Normal file
@@ -0,0 +1,56 @@
|
||||
[lora_e5_mini]
|
||||
extends = stm32_base
|
||||
board = lora_e5_mini
|
||||
board_upload.maximum_size = 229376 ; 32kb for FS
|
||||
build_flags = ${stm32_base.build_flags}
|
||||
-D RADIO_CLASS=CustomSTM32WLx
|
||||
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||
-D SPI_INTERFACES_COUNT=0
|
||||
-D RX_BOOSTED_GAIN=true
|
||||
-D LORA_TX_POWER=22
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D P_LORA_TX_LED=LED_RED
|
||||
-D PIN_USER_BTN=USER_BTN
|
||||
-I variants/wio-e5-mini
|
||||
build_src_filter = ${stm32_base.build_src_filter}
|
||||
+<../variants/wio-e5-mini>
|
||||
lib_deps = ${stm32_base.lib_deps}
|
||||
finitespace/BME280 @ ^3.0.0
|
||||
|
||||
[env:wio-e5-mini_repeater]
|
||||
extends = lora_e5_mini
|
||||
build_flags = ${lora_e5_mini.build_flags}
|
||||
-D LORA_TX_POWER=22
|
||||
-D ADVERT_NAME='"wio-e5-mini Repeater"'
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
|
||||
[env:wio-e5-mini_sensor]
|
||||
extends = lora_e5_mini
|
||||
build_flags = ${lora_e5_mini.build_flags}
|
||||
-D LORA_TX_POWER=22
|
||||
-D ADVERT_NAME='"wio-e5-mini Sensor"'
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/simple_sensor>
|
||||
|
||||
[env:wio-e5-mini_companion_radio_usb]
|
||||
extends = lora_e5_mini
|
||||
build_flags = ${lora_e5_mini.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D LORA_TX_POWER=22
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-orig/*.cpp>
|
||||
lib_deps = ${lora_e5_mini.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:wio-e5-mini_kiss_modem]
|
||||
extends = lora_e5_mini
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
79
variants/wio-e5-mini/target.cpp
Normal file
79
variants/wio-e5-mini/target.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
|
||||
WIOE5Board board;
|
||||
|
||||
RADIO_CLASS radio = new STM32WLx_Module();
|
||||
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
static const uint32_t rfswitch_pins[] = {PA4, PA5, 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_HP, {LOW, HIGH}}, // for LoRa-E5 mini
|
||||
// {STM32WLx::MODE_TX_LP, {HIGH, HIGH}}, // for LoRa-E5-LE mini
|
||||
END_OF_MODE_TABLE,
|
||||
};
|
||||
|
||||
VolatileRTCClock rtc_clock;
|
||||
WIOE5SensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
NullDisplayDriver display;
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
Wire.begin();
|
||||
|
||||
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, 1.7, 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
|
||||
}
|
||||
|
||||
bool WIOE5SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||
if (!has_bme) return false;
|
||||
|
||||
float temp(NAN), hum(NAN), pres(NAN);
|
||||
|
||||
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
|
||||
BME280::PresUnit presUnit(BME280::PresUnit_hPa);
|
||||
|
||||
bme.read(pres, temp, hum, tempUnit, presUnit);
|
||||
|
||||
telemetry.addTemperature(TELEM_CHANNEL_SELF, temp);
|
||||
telemetry.addRelativeHumidity(TELEM_CHANNEL_SELF, hum);
|
||||
telemetry.addBarometricPressure(TELEM_CHANNEL_SELF, pres);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WIOE5SensorManager::begin() {
|
||||
has_bme = bme.begin();
|
||||
|
||||
return has_bme;
|
||||
}
|
||||
61
variants/wio-e5-mini/target.h
Normal file
61
variants/wio-e5-mini/target.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#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>
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include "NullDisplayDriver.h"
|
||||
#endif
|
||||
|
||||
#include <BME280I2C.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern NullDisplayDriver display;
|
||||
#endif
|
||||
|
||||
class WIOE5Board : public STM32Board {
|
||||
public:
|
||||
void begin() override {
|
||||
STM32Board::begin();
|
||||
|
||||
pinMode(LED_RED, OUTPUT);
|
||||
digitalWrite(LED_RED, HIGH);
|
||||
pinMode(USER_BTN, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
const char* getManufacturerName() const override {
|
||||
return "Seeed Wio E5 mini";
|
||||
}
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
analogReadResolution(12);
|
||||
uint32_t raw = 0;
|
||||
for (int i=0; i<8;i++) {
|
||||
raw += analogRead(PIN_A3);
|
||||
}
|
||||
return ((double)raw) * 1.73 * 5 * 1000 / 8 / 4096;
|
||||
}
|
||||
};
|
||||
|
||||
class WIOE5SensorManager : public SensorManager {
|
||||
BME280I2C bme;
|
||||
bool has_bme = false;
|
||||
|
||||
public:
|
||||
WIOE5SensorManager() {}
|
||||
bool begin() override;
|
||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||
};
|
||||
|
||||
extern WIOE5Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern VolatileRTCClock rtc_clock;
|
||||
extern WIOE5SensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
10
variants/wio-e5-mini/variant.h
Normal file
10
variants/wio-e5-mini/variant.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// UART Definitions
|
||||
// #ifndef SERIAL_UART_INSTANCE
|
||||
// #define SERIAL_UART_INSTANCE 101
|
||||
// #endif
|
||||
|
||||
#include <variant_LORA_E5_MINI.h>
|
||||
|
||||
#undef RNG
|
||||
Reference in New Issue
Block a user