Skip to content

Commit 5a8ce60

Browse files
Quency-DCopilotthebentern
committed
add heltec_mesh_node_t096 board. (#9960)
* add heltec_mesh_node_t096 board. * Fixed the GPS reset pin comments. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Added compiles if NUM_PA_POINTS is not defined. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Correct the pin description. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Specify the version of the dependency library TFT_eSPI. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Adding fields missing from the .ini file. * Modify the screen SPI frequency to 40 MHz. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
1 parent c77b10a commit 5a8ce60

File tree

7 files changed

+389
-10
lines changed

7 files changed

+389
-10
lines changed

boards/heltec_mesh_node_t096.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "nrf52840_s140_v6.ld"
5+
},
6+
"core": "nRF5",
7+
"cpu": "cortex-m4",
8+
"extra_flags": "-DNRF52840_XXAA",
9+
"f_cpu": "64000000L",
10+
"hwids": [
11+
["0x239A", "0x4405"],
12+
["0x239A", "0x0029"],
13+
["0x239A", "0x002A"],
14+
["0x2886", "0x1667"]
15+
],
16+
"usb_product": "HT-n5262G",
17+
"mcu": "nrf52840",
18+
"variant": "heltec_mesh_node_t096",
19+
"variants_dir": "variants",
20+
"bsp": {
21+
"name": "adafruit"
22+
},
23+
"softdevice": {
24+
"sd_flags": "-DS140",
25+
"sd_name": "s140",
26+
"sd_version": "6.1.1",
27+
"sd_fwid": "0x00B6"
28+
},
29+
"bootloader": {
30+
"settings_addr": "0xFF000"
31+
}
32+
},
33+
"connectivity": ["bluetooth"],
34+
"debug": {
35+
"jlink_device": "nRF52840_xxAA",
36+
"onboard_tools": ["jlink"],
37+
"svd_path": "nrf52840.svd",
38+
"openocd_target": "nrf52840-mdk-rs"
39+
},
40+
"frameworks": ["arduino"],
41+
"name": "Heltec nrf (Adafruit BSP)",
42+
"upload": {
43+
"maximum_ram_size": 248832,
44+
"maximum_size": 815104,
45+
"speed": 115200,
46+
"protocol": "nrfutil",
47+
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
48+
"use_1200bps_touch": true,
49+
"require_upload_port": true,
50+
"wait_for_upload_port": true
51+
},
52+
"url": "https://heltec.org/",
53+
"vendor": "Heltec"
54+
}

src/configuration.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
151151

152152
#ifdef USE_KCT8103L_PA
153153
// Power Amps are often non-linear, so we can use an array of values for the power curve
154+
#if defined(HELTEC_WIRELESS_TRACKER_V2)
154155
#define NUM_PA_POINTS 22
155156
#define TX_GAIN_LORA 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 12, 12, 11, 10, 9, 8, 7
157+
#elif defined(HELTEC_MESH_NODE_T096)
158+
#define NUM_PA_POINTS 22
159+
#define TX_GAIN_LORA 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 12, 11, 10, 9, 8, 7
160+
#else
161+
// If a board enables USE_KCT8103L_PA but does not match a known variant and has
162+
// not already provided a PA curve, fail at compile time to avoid unsafe defaults.
163+
#if !defined(NUM_PA_POINTS) || !defined(TX_GAIN_LORA)
164+
#error "USE_KCT8103L_PA is defined, but no PA gain curve (NUM_PA_POINTS / TX_GAIN_LORA) is configured for this board."
165+
#endif
166+
#endif
156167
#endif
157168

158169
#ifdef RAK13302

src/graphics/TFTDisplay.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ void TFTDisplay::sendCommand(uint8_t com)
13481348
digitalWrite(portduino_config.displayBacklight.pin, TFT_BACKLIGHT_ON);
13491349
#elif defined(HACKADAY_COMMUNICATOR)
13501350
tft->displayOn();
1351-
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
1351+
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) && !defined(HELTEC_MESH_NODE_T096)
13521352
tft->wakeup();
13531353
tft->powerSaveOff();
13541354
#endif
@@ -1359,7 +1359,7 @@ void TFTDisplay::sendCommand(uint8_t com)
13591359
#ifdef UNPHONE
13601360
unphone.backlight(true); // using unPhone library
13611361
#endif
1362-
#ifdef RAK14014
1362+
#if defined(RAK14014) || defined(HELTEC_MESH_NODE_T096)
13631363
#elif !defined(M5STACK) && !defined(ST7789_CS) && \
13641364
!defined(HACKADAY_COMMUNICATOR) // T-Deck gets brightness set in Screen.cpp in the handleSetOn function
13651365
tft->setBrightness(172);
@@ -1375,7 +1375,7 @@ void TFTDisplay::sendCommand(uint8_t com)
13751375
digitalWrite(portduino_config.displayBacklight.pin, !TFT_BACKLIGHT_ON);
13761376
#elif defined(HACKADAY_COMMUNICATOR)
13771377
tft->displayOff();
1378-
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
1378+
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) && !defined(HELTEC_MESH_NODE_T096)
13791379
tft->sleep();
13801380
tft->powerSaveOn();
13811381
#endif
@@ -1386,7 +1386,7 @@ void TFTDisplay::sendCommand(uint8_t com)
13861386
#ifdef UNPHONE
13871387
unphone.backlight(false); // using unPhone library
13881388
#endif
1389-
#ifdef RAK14014
1389+
#if defined(RAK14014) || defined(HELTEC_MESH_NODE_T096)
13901390
#elif !defined(M5STACK) && !defined(HACKADAY_COMMUNICATOR)
13911391
tft->setBrightness(0);
13921392
#endif
@@ -1401,7 +1401,7 @@ void TFTDisplay::sendCommand(uint8_t com)
14011401

14021402
void TFTDisplay::setDisplayBrightness(uint8_t _brightness)
14031403
{
1404-
#ifdef RAK14014
1404+
#if defined(RAK14014) || defined(HELTEC_MESH_NODE_T096)
14051405
// todo
14061406
#elif !defined(HACKADAY_COMMUNICATOR)
14071407
tft->setBrightness(_brightness);
@@ -1421,7 +1421,7 @@ bool TFTDisplay::hasTouch(void)
14211421
{
14221422
#ifdef RAK14014
14231423
return true;
1424-
#elif !defined(M5STACK) && !defined(HACKADAY_COMMUNICATOR)
1424+
#elif !defined(M5STACK) && !defined(HACKADAY_COMMUNICATOR) && !defined(HELTEC_MESH_NODE_T096)
14251425
return tft->touch() != nullptr;
14261426
#else
14271427
return false;
@@ -1440,7 +1440,7 @@ bool TFTDisplay::getTouch(int16_t *x, int16_t *y)
14401440
} else {
14411441
return false;
14421442
}
1443-
#elif !defined(M5STACK) && !defined(HACKADAY_COMMUNICATOR)
1443+
#elif !defined(M5STACK) && !defined(HACKADAY_COMMUNICATOR) && !defined(HELTEC_MESH_NODE_T096)
14441444
return tft->getTouch(x, y);
14451445
#else
14461446
return false;
@@ -1457,7 +1457,7 @@ bool TFTDisplay::connect()
14571457
{
14581458
concurrency::LockGuard g(spiLock);
14591459
LOG_INFO("Do TFT init");
1460-
#ifdef RAK14014
1460+
#if defined(RAK14014) || defined(HELTEC_MESH_NODE_T096)
14611461
tft = new TFT_eSPI;
14621462
#elif defined(HACKADAY_COMMUNICATOR)
14631463
bus = new Arduino_ESP32SPI(TFT_DC, TFT_CS, 38 /* SCK */, 21 /* MOSI */, GFX_NOT_DEFINED /* MISO */, HSPI /* spi_num */);
@@ -1494,7 +1494,7 @@ bool TFTDisplay::connect()
14941494
ft6336u.begin();
14951495
pinMode(SCREEN_TOUCH_INT, INPUT_PULLUP);
14961496
attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING);
1497-
#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2)
1497+
#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2) || defined(HELTEC_MESH_NODE_T096)
14981498
tft->setRotation(1); // T-Deck has the TFT in landscape
14991499
#elif defined(T_WATCH_S3)
15001500
tft->setRotation(2); // T-Watch S3 left-handed orientation

src/mesh/LoRaFEMInterface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,16 @@ void LoRaFEMInterface::setRxModeEnableWhenMCUSleep(void)
173173
#endif
174174
#elif defined(USE_KCT8103L_PA)
175175
digitalWrite(LORA_KCT8103L_PA_CSD, HIGH);
176-
rtc_gpio_hold_en((gpio_num_t)LORA_KCT8103L_PA_CSD);
177176
if (lna_enabled) {
178177
digitalWrite(LORA_KCT8103L_PA_CTX, LOW);
179178
} else {
180179
digitalWrite(LORA_KCT8103L_PA_CTX, HIGH);
181180
}
181+
#if defined(ARCH_ESP32)
182+
rtc_gpio_hold_en((gpio_num_t)LORA_KCT8103L_PA_CSD);
182183
rtc_gpio_hold_en((gpio_num_t)LORA_KCT8103L_PA_CTX);
183184
#endif
185+
#endif
184186
}
185187

186188
void LoRaFEMInterface::setLNAEnable(bool enabled)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; First prototype nrf52840/sx1262 device
2+
[env:heltec-mesh-node-t096]
3+
custom_meshtastic_hw_model = 127
4+
custom_meshtastic_hw_model_slug = HELTEC_MESH_NODE_T096
5+
custom_meshtastic_architecture = nrf52840
6+
custom_meshtastic_actively_supported = true
7+
custom_meshtastic_support_level = 1
8+
custom_meshtastic_display_name = Heltec Mesh Node 096
9+
custom_meshtastic_images = heltec-mesh-node-t096.svg, heltec-mesh-node-t096-case.svg
10+
custom_meshtastic_tags = Heltec
11+
12+
extends = nrf52840_base
13+
board = heltec_mesh_node_t096
14+
board_level = pr
15+
debug_tool = jlink
16+
17+
build_flags = ${nrf52840_base.build_flags}
18+
-Ivariants/nrf52840/heltec_mesh_node_t096
19+
-D HAS_LORA_FEM=1
20+
-D HELTEC_MESH_NODE_T096
21+
-D USE_TFTDISPLAY=1
22+
-D USER_SETUP_LOADED
23+
-D ST7735_DRIVER
24+
-D ST7735_REDTAB160x80
25+
-D TFT_SPI_PORT=SPI1
26+
-D TFT_CS=ST7735_CS ; Chip select control
27+
-D TFT_DC=ST7735_RS ; Data Command control pin
28+
-D TFT_RST=ST7735_RESET ; Reset pin
29+
-D TFT_BL=ST7735_BL ; LED back-light
30+
-D TFT_BACKLIGHT_ON=LOW
31+
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/heltec_mesh_node_t096>
32+
lib_deps =
33+
${nrf52840_base.lib_deps}
34+
bodmer/TFT_eSPI@2.5.43 ; renovate: datasource=platformio-registry depName=bodmer/TFT_eSPI
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
Copyright (c) 2018, Adafruit Industries (adafruit.com)
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
See the GNU Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#include "variant.h"
22+
#include "nrf.h"
23+
#include "wiring_constants.h"
24+
#include "wiring_digital.h"
25+
26+
const uint32_t g_ADigitalPinMap[] = {
27+
// P0 - pins 0 and 1 are hardwired for xtal and should never be enabled
28+
0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
29+
30+
// P1
31+
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
32+
33+
void initVariant()
34+
{
35+
// LED1
36+
pinMode(PIN_LED1, OUTPUT);
37+
ledOff(PIN_LED1);
38+
}
39+
40+
void variant_shutdown()
41+
{
42+
nrf_gpio_cfg_default(VEXT_ENABLE);
43+
nrf_gpio_cfg_default(ST7735_CS);
44+
nrf_gpio_cfg_default(ST7735_RS);
45+
nrf_gpio_cfg_default(ST7735_SDA);
46+
nrf_gpio_cfg_default(ST7735_SCK);
47+
nrf_gpio_cfg_default(ST7735_RESET);
48+
nrf_gpio_cfg_default(ST7735_BL);
49+
50+
nrf_gpio_cfg_default(PIN_LED1);
51+
52+
// nrf_gpio_cfg_default(LORA_PA_POWER);
53+
pinMode(LORA_PA_POWER, OUTPUT);
54+
digitalWrite(LORA_PA_POWER, LOW);
55+
56+
nrf_gpio_cfg_default(LORA_KCT8103L_PA_CSD);
57+
nrf_gpio_cfg_default(LORA_KCT8103L_PA_CTX);
58+
59+
pinMode(ADC_CTRL, OUTPUT);
60+
digitalWrite(ADC_CTRL, LOW);
61+
62+
nrf_gpio_cfg_default(SX126X_CS);
63+
nrf_gpio_cfg_default(SX126X_DIO1);
64+
nrf_gpio_cfg_default(SX126X_BUSY);
65+
nrf_gpio_cfg_default(SX126X_RESET);
66+
67+
nrf_gpio_cfg_default(PIN_SPI_MISO);
68+
nrf_gpio_cfg_default(PIN_SPI_MOSI);
69+
nrf_gpio_cfg_default(PIN_SPI_SCK);
70+
71+
nrf_gpio_cfg_default(PIN_GPS_PPS);
72+
nrf_gpio_cfg_default(PIN_GPS_RESET);
73+
nrf_gpio_cfg_default(PIN_GPS_EN);
74+
nrf_gpio_cfg_default(GPS_TX_PIN);
75+
nrf_gpio_cfg_default(GPS_RX_PIN);
76+
}

0 commit comments

Comments
 (0)