Skip to content

Commit a9fef1a

Browse files
authored
Merge pull request #723 from recrof/heltec_t114_refactor
tidy up heltec_t114 variant
2 parents 5782c2e + 1c91298 commit a9fef1a

File tree

7 files changed

+26
-41
lines changed

7 files changed

+26
-41
lines changed

src/helpers/nrf52/T114Board.cpp renamed to variants/heltec_t114/T114Board.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
#include <Arduino.h>
21
#include "T114Board.h"
32

4-
#include <bluefruit.h>
3+
#include <Arduino.h>
54
#include <Wire.h>
5+
#include <bluefruit.h>
66

77
static BLEDfu bledfu;
88

9-
static void connect_callback(uint16_t conn_handle)
10-
{
9+
static void connect_callback(uint16_t conn_handle) {
1110
(void)conn_handle;
1211
MESH_DEBUG_PRINTLN("BLE client connected");
1312
}
1413

15-
static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
16-
{
14+
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
1715
(void)conn_handle;
1816
(void)reason;
1917

@@ -60,7 +58,7 @@ void T114Board::begin() {
6058

6159
// Disable unused analog peripherals
6260
// SAADC channels - only keep what's needed for battery monitoring
63-
NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements
61+
NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements
6462

6563
// COMP - Comparator not used
6664
NRF_COMP->ENABLE = 0;
@@ -78,10 +76,10 @@ void T114Board::begin() {
7876

7977
pinMode(SX126X_POWER_EN, OUTPUT);
8078
digitalWrite(SX126X_POWER_EN, HIGH);
81-
delay(10); // give sx1262 some time to power up
79+
delay(10); // give sx1262 some time to power up
8280
}
8381

84-
bool T114Board::startOTAUpdate(const char* id, char reply[]) {
82+
bool T114Board::startOTAUpdate(const char *id, char reply[]) {
8583
// Config the peripheral connection with maximum bandwidth
8684
// more SRAM required by SoftDevice
8785
// Note: All config***() function must be called before begin()

src/helpers/nrf52/T114Board.h renamed to variants/heltec_t114/T114Board.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@
33
#include <MeshCore.h>
44
#include <Arduino.h>
55

6-
// LoRa radio module pins for Heltec T114
7-
#define P_LORA_DIO_1 20
8-
#define P_LORA_NSS 24
9-
#define P_LORA_RESET 25
10-
#define P_LORA_BUSY 17
11-
#define P_LORA_SCLK 19
12-
#define P_LORA_MISO 23
13-
#define P_LORA_MOSI 22
14-
#define SX126X_POWER_EN 37
15-
16-
#define SX126X_DIO2_AS_RF_SWITCH true
17-
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
18-
196
// built-ins
207
#define PIN_VBAT_READ 4
218
#define PIN_BAT_CTL 6

variants/t114/platformio.ini renamed to variants/heltec_t114/platformio.ini

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
[nrf52840_t114]
1+
[Heltec_t114]
22
extends = nrf52_base
3-
platform_packages = framework-arduinoadafruitnrf52
3+
board = heltec_t114
4+
board_build.ldscript = boards/nrf52840_s140_v6.ld
45
build_flags = ${nrf52_base.build_flags}
5-
-I src/helpers/nrf52
66
-I lib/nrf52/s140_nrf52_6.1.1_API/include
77
-I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
8-
lib_deps =
9-
${nrf52_base.lib_deps}
10-
rweather/Crypto @ ^0.4.0
11-
12-
[Heltec_t114]
13-
extends = nrf52840_t114
14-
board = heltec_t114
15-
board_build.ldscript = boards/nrf52840_s140_v6.ld
16-
build_flags = ${nrf52840_t114.build_flags}
17-
-I variants/t114
8+
-I variants/heltec_t114
189
-I src/helpers/ui
19-
-DHELTEC_T114
10+
-D HELTEC_T114
11+
-D P_LORA_DIO_1=20
12+
-D P_LORA_NSS=24
13+
-D P_LORA_RESET=25
14+
-D P_LORA_BUSY=17
15+
-D P_LORA_SCLK=19
16+
-D P_LORA_MISO=23
17+
-D P_LORA_MOSI=22
2018
-D P_LORA_TX_LED=35
2119
-D RADIO_CLASS=CustomSX1262
2220
-D WRAPPER_CLASS=CustomSX1262Wrapper
2321
-D LORA_TX_POWER=22
22+
-D SX126X_POWER_EN=37
23+
-D SX126X_DIO2_AS_RF_SWITCH=true
24+
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
2425
-D SX126X_CURRENT_LIMIT=140
2526
-D SX126X_RX_BOOSTED_GAIN=1
2627
-D ST7789
2728
-D DISPLAY_CLASS=ST7789Display
28-
build_src_filter = ${nrf52840_t114.build_src_filter}
29+
build_src_filter = ${nrf52_base.build_src_filter}
2930
+<helpers/*.cpp>
30-
+<helpers/nrf52/T114Board.cpp>
31-
+<../variants/t114>
31+
+<../variants/heltec_t114>
3232
+<helpers/ui/ST7789Display.cpp>
3333
+<helpers/ui/MomentaryButton.cpp>
3434
+<helpers/ui/OLEDDisplay.cpp>
3535
+<helpers/ui/OLEDDisplayFonts.cpp>
3636
lib_deps =
37-
${nrf52840_t114.lib_deps}
37+
${nrf52_base.lib_deps}
3838
stevemarple/MicroNMEA @ ^2.0.6
3939
adafruit/Adafruit GFX Library @ ^1.12.1
4040
debug_tool = jlink
File renamed without changes.

variants/t114/target.h renamed to variants/heltec_t114/target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define RADIOLIB_STATIC_ONLY 1
44
#include <RadioLib.h>
55
#include <helpers/radiolib/RadioLibWrappers.h>
6-
#include <helpers/nrf52/T114Board.h>
6+
#include <T114Board.h>
77
#include <helpers/radiolib/CustomSX1262Wrapper.h>
88
#include <helpers/AutoDiscoverRTCClock.h>
99
#include <helpers/SensorManager.h>
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)