mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 21:25:46 +00:00
Merge pull request #350 from fdlamotte/wio-e5-adc
wio-e5 : make distinct targets for dev board and mini dev board
This commit is contained in:
@@ -7,9 +7,9 @@ build_flags = ${stm32_base.build_flags}
|
||||
-D WRAPPER_CLASS=CustomSTM32WLxWrapper
|
||||
-D SPI_INTERFACES_COUNT=0
|
||||
-D RX_BOOSTED_GAIN=true
|
||||
-I variants/wio-e5
|
||||
-I variants/wio-e5-dev
|
||||
build_src_filter = ${stm32_base.build_src_filter}
|
||||
+<../variants/wio-e5>
|
||||
+<../variants/wio-e5-dev>
|
||||
|
||||
[env:wio-e5-repeater]
|
||||
extends = lora_e5
|
||||
33
variants/wio-e5-dev/target.h
Normal file
33
variants/wio-e5-dev/target.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/RadioLibWrappers.h>
|
||||
#include <helpers/stm32/STM32Board.h>
|
||||
#include <helpers/CustomSTM32WLxWrapper.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
|
||||
class WIOE5Board : public STM32Board {
|
||||
public:
|
||||
const char* getManufacturerName() const override {
|
||||
return "Seeed Wio E5 Dev Board";
|
||||
}
|
||||
|
||||
// Just returns ADC value for now to test adc
|
||||
uint16_t getBattMilliVolts() override {
|
||||
uint32_t raw = analogRead(PIN_A3);
|
||||
return raw;
|
||||
}
|
||||
};
|
||||
|
||||
extern WIOE5Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern VolatileRTCClock 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();
|
||||
10
variants/wio-e5-dev/variant.h
Normal file
10
variants/wio-e5-dev/variant.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// UART Definitions
|
||||
// #ifndef SERIAL_UART_INSTANCE
|
||||
// #define SERIAL_UART_INSTANCE 101
|
||||
// #endif
|
||||
|
||||
#include <variant_generic.h>
|
||||
|
||||
#undef RNG
|
||||
32
variants/wio-e5-mini/platformio.ini
Normal file
32
variants/wio-e5-mini/platformio.ini
Normal file
@@ -0,0 +1,32 @@
|
||||
[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
|
||||
-I variants/wio-e5-mini
|
||||
build_src_filter = ${stm32_base.build_src_filter}
|
||||
+<../variants/wio-e5-mini>
|
||||
|
||||
[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"'
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/simple_repeater/main.cpp>
|
||||
|
||||
[env:wio-e5-mini_companion_radio_usb]
|
||||
extends = lora_e5_mini
|
||||
build_flags = ${lora_e5_mini.build_flags}
|
||||
-D LORA_TX_POWER=22
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
build_src_filter = ${lora_e5_mini.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps = ${lora_e5_mini.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
73
variants/wio-e5-mini/target.cpp
Normal file
73
variants/wio-e5-mini/target.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
#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;
|
||||
SensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
// rtc_clock.begin(Wire);
|
||||
|
||||
// #ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
// float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||
// #else
|
||||
// float tcxo = 1.6f;
|
||||
// #endif
|
||||
|
||||
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, 8, 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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -11,7 +11,13 @@
|
||||
class WIOE5Board : public STM32Board {
|
||||
public:
|
||||
const char* getManufacturerName() const override {
|
||||
return "Seeed Wio E5";
|
||||
return "Seeed Wio E5 mini";
|
||||
}
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
analogReadResolution(12);
|
||||
uint32_t raw = analogRead(PIN_A3);
|
||||
return raw;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// UART Definitions
|
||||
#ifndef SERIAL_UART_INSTANCE
|
||||
#define SERIAL_UART_INSTANCE 101
|
||||
#endif
|
||||
// #ifndef SERIAL_UART_INSTANCE
|
||||
// #define SERIAL_UART_INSTANCE 101
|
||||
// #endif
|
||||
|
||||
#include <variant_LORA_E5_MINI.h>
|
||||
|
||||
Reference in New Issue
Block a user