Skip to content

Commit 1a7b361

Browse files
authored
Merge pull request #2388 from OhYou-0/lilygo-teth-elite-board-support
Add LilyGo T-ETH Elite SX1262 board support
2 parents 03a13ae + 6836015 commit 1a7b361

4 files changed

Lines changed: 172 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
3+
#include <helpers/ESP32Board.h>
4+
5+
class TETHEliteBoard : public ESP32Board {
6+
public:
7+
const char* getManufacturerName() const override {
8+
return "LilyGO T-ETH Elite";
9+
}
10+
};
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[LilyGo_TETH_Elite_sx1262]
2+
extends = esp32_base
3+
board = esp32s3box
4+
board_build.partitions = default_16MB.csv
5+
board_upload.flash_size = 16MB
6+
build_flags =
7+
${esp32_base.build_flags}
8+
-I variants/lilygo_teth_elite
9+
-D BOARD_HAS_PSRAM
10+
-D LILYGO_TETH_ELITE
11+
-D LILYGO_T_ETH_ELITE_ESP32S3
12+
-D ARDUINO_USB_CDC_ON_BOOT=1
13+
-D P_LORA_DIO_1=8
14+
-D P_LORA_NSS=40
15+
-D P_LORA_RESET=46
16+
-D P_LORA_BUSY=16
17+
-D P_LORA_SCLK=10
18+
-D P_LORA_MISO=9
19+
-D P_LORA_MOSI=11
20+
-D P_LORA_TX_LED=38
21+
-D SX126X_DIO2_AS_RF_SWITCH=true
22+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
23+
-D SX126X_CURRENT_LIMIT=140
24+
-D USE_SX1262
25+
-D RADIO_CLASS=CustomSX1262
26+
-D WRAPPER_CLASS=CustomSX1262Wrapper
27+
-D LORA_TX_POWER=8
28+
-D SX126X_RX_BOOSTED_GAIN=1
29+
build_src_filter = ${esp32_base.build_src_filter}
30+
+<../variants/lilygo_teth_elite>
31+
lib_deps =
32+
${esp32_base.lib_deps}
33+
34+
[env:LilyGo_TETH_Elite_sx1262_repeater]
35+
extends = LilyGo_TETH_Elite_sx1262
36+
build_flags =
37+
${LilyGo_TETH_Elite_sx1262.build_flags}
38+
-D ADVERT_NAME='"T-ETH Elite Repeater"'
39+
-D ADVERT_LAT=0.0
40+
-D ADVERT_LON=0.0
41+
-D ADMIN_PASSWORD='"password"'
42+
-D MAX_NEIGHBOURS=50
43+
; -D MESH_PACKET_LOGGING=1
44+
; -D MESH_DEBUG=1
45+
build_src_filter = ${LilyGo_TETH_Elite_sx1262.build_src_filter}
46+
+<../examples/simple_repeater>
47+
lib_deps =
48+
${LilyGo_TETH_Elite_sx1262.lib_deps}
49+
${esp32_ota.lib_deps}
50+
51+
[env:LilyGo_TETH_Elite_sx1262_room_server]
52+
extends = LilyGo_TETH_Elite_sx1262
53+
build_flags =
54+
${LilyGo_TETH_Elite_sx1262.build_flags}
55+
-D ADVERT_NAME='"T-ETH Elite Room"'
56+
-D ADVERT_LAT=0.0
57+
-D ADVERT_LON=0.0
58+
-D ADMIN_PASSWORD='"password"'
59+
-D ROOM_PASSWORD='"hello"'
60+
; -D MESH_PACKET_LOGGING=1
61+
; -D MESH_DEBUG=1
62+
build_src_filter = ${LilyGo_TETH_Elite_sx1262.build_src_filter}
63+
+<../examples/simple_room_server>
64+
lib_deps =
65+
${LilyGo_TETH_Elite_sx1262.lib_deps}
66+
${esp32_ota.lib_deps}
67+
68+
[env:LilyGo_TETH_Elite_sx1262_companion_radio_usb]
69+
extends = LilyGo_TETH_Elite_sx1262
70+
build_flags =
71+
${LilyGo_TETH_Elite_sx1262.build_flags}
72+
-D MAX_CONTACTS=350
73+
-D MAX_GROUP_CHANNELS=40
74+
-D OFFLINE_QUEUE_SIZE=256
75+
; -D MESH_PACKET_LOGGING=1
76+
; -D MESH_DEBUG=1
77+
build_src_filter = ${LilyGo_TETH_Elite_sx1262.build_src_filter}
78+
+<../examples/companion_radio/*.cpp>
79+
lib_deps =
80+
${LilyGo_TETH_Elite_sx1262.lib_deps}
81+
densaugeo/base64 @ ~1.4.0
82+
83+
[env:LilyGo_TETH_Elite_sx1262_companion_radio_ble]
84+
extends = LilyGo_TETH_Elite_sx1262
85+
build_flags =
86+
${LilyGo_TETH_Elite_sx1262.build_flags}
87+
-D MAX_CONTACTS=350
88+
-D MAX_GROUP_CHANNELS=40
89+
-D BLE_PIN_CODE=123456
90+
-D BLE_DEBUG_LOGGING=1
91+
-D OFFLINE_QUEUE_SIZE=256
92+
; -D MESH_PACKET_LOGGING=1
93+
; -D MESH_DEBUG=1
94+
build_src_filter = ${LilyGo_TETH_Elite_sx1262.build_src_filter}
95+
+<helpers/esp32/*.cpp>
96+
+<../examples/companion_radio/*.cpp>
97+
lib_deps =
98+
${LilyGo_TETH_Elite_sx1262.lib_deps}
99+
densaugeo/base64 @ ~1.4.0
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <Arduino.h>
2+
#include "target.h"
3+
4+
TETHEliteBoard board;
5+
6+
static SPIClass spi(HSPI);
7+
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
8+
WRAPPER_CLASS radio_driver(radio, board);
9+
10+
ESP32RTCClock fallback_clock;
11+
AutoDiscoverRTCClock rtc_clock(fallback_clock);
12+
SensorManager sensors;
13+
14+
#ifndef LORA_CR
15+
#define LORA_CR 5
16+
#endif
17+
18+
bool radio_init() {
19+
fallback_clock.begin();
20+
rtc_clock.begin(Wire);
21+
22+
return radio.std_init(&spi);
23+
}
24+
25+
uint32_t radio_get_rng_seed() {
26+
return radio.random(0x7FFFFFFF);
27+
}
28+
29+
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
30+
radio.setFrequency(freq);
31+
radio.setSpreadingFactor(sf);
32+
radio.setBandwidth(bw);
33+
radio.setCodingRate(cr);
34+
}
35+
36+
void radio_set_tx_power(int8_t dbm) {
37+
radio.setOutputPower(dbm);
38+
}
39+
40+
mesh::LocalIdentity radio_new_identity() {
41+
RadioNoiseListener rng(radio);
42+
return mesh::LocalIdentity(&rng);
43+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#define RADIOLIB_STATIC_ONLY 1
4+
#include <RadioLib.h>
5+
#include <helpers/radiolib/RadioLibWrappers.h>
6+
#include <helpers/radiolib/CustomSX1262Wrapper.h>
7+
#include <helpers/AutoDiscoverRTCClock.h>
8+
#include <helpers/SensorManager.h>
9+
#include "TETHEliteBoard.h"
10+
11+
extern TETHEliteBoard board;
12+
extern WRAPPER_CLASS radio_driver;
13+
extern AutoDiscoverRTCClock rtc_clock;
14+
extern SensorManager sensors;
15+
16+
bool radio_init();
17+
uint32_t radio_get_rng_seed();
18+
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
19+
void radio_set_tx_power(int8_t dbm);
20+
mesh::LocalIdentity radio_new_identity();

0 commit comments

Comments
 (0)