mirror of https://github.com/meshcore-dev/MeshCore
committed by
GitHub
4 changed files with 253 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||
#pragma once |
|||
|
|||
#include <Arduino.h> |
|||
#include <helpers/ESP32Board.h> |
|||
|
|||
class XiaoS3Board : public ESP32Board { |
|||
public: |
|||
XiaoS3Board() { } |
|||
|
|||
const char* getManufacturerName() const override { |
|||
return "Xiao S3"; |
|||
} |
|||
}; |
|||
@ -0,0 +1,154 @@ |
|||
[Xiao_S3] |
|||
extends = esp32_base |
|||
board = seeed_xiao_esp32s3 |
|||
board_check = true |
|||
board_build.mcu = esp32s3 |
|||
build_flags = ${esp32_base.build_flags} |
|||
${sensor_base.build_flags} |
|||
-I variants/xiao_s3 |
|||
-UENV_INCLUDE_GPS |
|||
-D SEEED_XIAO_S3 |
|||
-D PIN_VBAT_READ=1 ; D0 |
|||
-D P_LORA_DIO_1=2 ; D1 |
|||
-D P_LORA_NSS=5 ; D4 |
|||
-D P_LORA_RESET=3 ; D2 |
|||
-D P_LORA_BUSY=4 ; D3 |
|||
-D P_LORA_SCLK=7 ; D8 |
|||
-D P_LORA_MISO=8 ; D0 |
|||
-D P_LORA_MOSI=9 ; D10 |
|||
-D PIN_USER_BTN=-1 ; NC |
|||
-D PIN_STATUS_LED=21 ; Orange user led, LOW=On |
|||
-D PIN_BOARD_SDA=D6 ; D6=43 |
|||
-D PIN_BOARD_SCL=D7 ; D7=44 |
|||
-D SX126X_RXEN=6 ; D5 |
|||
-D SX126X_TXEN=RADIOLIB_NC |
|||
-D SX126X_DIO2_AS_RF_SWITCH=true |
|||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8 |
|||
-D SX126X_CURRENT_LIMIT=140 |
|||
-D RADIO_CLASS=CustomSX1262 |
|||
-D WRAPPER_CLASS=CustomSX1262Wrapper |
|||
-D LORA_TX_POWER=22 |
|||
-D SX126X_RX_BOOSTED_GAIN=1 |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<../variants/xiao_s3> |
|||
+<helpers/sensors> |
|||
lib_deps = |
|||
${esp32_base.lib_deps} |
|||
${sensor_base.lib_deps} |
|||
|
|||
[env:Xiao_S3_repeater] |
|||
extends = Xiao_S3 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<../examples/simple_repeater/*.cpp> |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-D ADVERT_NAME='"Xiao S3 Repeater"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=50 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:Xiao_S3_repeater_bridge_espnow] |
|||
extends = Xiao_S3 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<helpers/bridges/ESPNowBridge.cpp> |
|||
+<../examples/simple_repeater/*.cpp> |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-D ADVERT_NAME='"ESPNow Bridge"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=50 |
|||
-D WITH_ESPNOW_BRIDGE=1 |
|||
; -D BRIDGE_DEBUG=1 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:Xiao_S3_room_server] |
|||
extends = Xiao_S3 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<../examples/simple_room_server> |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-D ADVERT_NAME='"Xiao S3 Room"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D ROOM_PASSWORD='"hello"' |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:Xiao_S3_companion_radio_ble] |
|||
extends = Xiao_S3 |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D BLE_PIN_CODE=123456 |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
; -D BLE_DEBUG_LOGGING=1 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
adafruit/Adafruit SSD1306 @ ^2.5.13 |
|||
|
|||
[env:Xiao_S3_companion_radio_usb] |
|||
extends = Xiao_S3 |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
; -D BLE_DEBUG_LOGGING=1 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
adafruit/Adafruit SSD1306 @ ^2.5.13 |
|||
|
|||
[env:Xiao_S3_sensor] |
|||
extends = Xiao_S3 |
|||
build_src_filter = ${Xiao_S3.build_src_filter} |
|||
+<../examples/simple_sensor> |
|||
build_flags = |
|||
${Xiao_S3.build_flags} |
|||
-D ADVERT_NAME='"Xiao S3 Sensor"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
lib_deps = |
|||
${Xiao_S3.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
@ -0,0 +1,56 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
XiaoS3Board 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); |
|||
EnvironmentSensorManager sensors; |
|||
|
|||
#ifdef DISPLAY_CLASS |
|||
DISPLAY_CLASS display; |
|||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true); |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
fallback_clock.begin(); |
|||
rtc_clock.begin(Wire); |
|||
pinMode(21, INPUT); |
|||
pinMode(48, OUTPUT); |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); |
|||
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(int8_t dbm) { |
|||
radio.setOutputPower(dbm); |
|||
} |
|||
|
|||
mesh::LocalIdentity radio_new_identity() { |
|||
RadioNoiseListener rng(radio); |
|||
return mesh::LocalIdentity(&rng); // create new random identity
|
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/radiolib/RadioLibWrappers.h> |
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/radiolib/CustomSX1262Wrapper.h> |
|||
#include <helpers/AutoDiscoverRTCClock.h> |
|||
#include <helpers/sensors/EnvironmentSensorManager.h> |
|||
#ifdef DISPLAY_CLASS |
|||
#include <helpers/ui/SSD1306Display.h> |
|||
#include <helpers/ui/MomentaryButton.h> |
|||
#endif |
|||
#include "XiaoS3Board.h" |
|||
|
|||
extern XiaoS3Board board; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
extern AutoDiscoverRTCClock rtc_clock; |
|||
extern EnvironmentSensorManager sensors; |
|||
|
|||
#ifdef DISPLAY_CLASS |
|||
extern DISPLAY_CLASS display; |
|||
extern MomentaryButton user_btn; |
|||
#endif |
|||
|
|||
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(int8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
Loading…
Reference in new issue