diff --git a/src/helpers/nrf52/T114Board.cpp b/variants/heltec_t114/T114Board.cpp similarity index 93% rename from src/helpers/nrf52/T114Board.cpp rename to variants/heltec_t114/T114Board.cpp index 78c21b33d..3b40e7cf5 100644 --- a/src/helpers/nrf52/T114Board.cpp +++ b/variants/heltec_t114/T114Board.cpp @@ -1,19 +1,17 @@ -#include #include "T114Board.h" -#include +#include #include +#include static BLEDfu bledfu; -static void connect_callback(uint16_t conn_handle) -{ +static void connect_callback(uint16_t conn_handle) { (void)conn_handle; MESH_DEBUG_PRINTLN("BLE client connected"); } -static void disconnect_callback(uint16_t conn_handle, uint8_t reason) -{ +static void disconnect_callback(uint16_t conn_handle, uint8_t reason) { (void)conn_handle; (void)reason; @@ -60,7 +58,7 @@ void T114Board::begin() { // Disable unused analog peripherals // SAADC channels - only keep what's needed for battery monitoring - NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements + NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements // COMP - Comparator not used NRF_COMP->ENABLE = 0; @@ -78,10 +76,10 @@ void T114Board::begin() { pinMode(SX126X_POWER_EN, OUTPUT); digitalWrite(SX126X_POWER_EN, HIGH); - delay(10); // give sx1262 some time to power up + delay(10); // give sx1262 some time to power up } -bool T114Board::startOTAUpdate(const char* id, char reply[]) { +bool T114Board::startOTAUpdate(const char *id, char reply[]) { // Config the peripheral connection with maximum bandwidth // more SRAM required by SoftDevice // Note: All config***() function must be called before begin() diff --git a/src/helpers/nrf52/T114Board.h b/variants/heltec_t114/T114Board.h similarity index 79% rename from src/helpers/nrf52/T114Board.h rename to variants/heltec_t114/T114Board.h index cf3459375..7a7a654b5 100644 --- a/src/helpers/nrf52/T114Board.h +++ b/variants/heltec_t114/T114Board.h @@ -3,19 +3,6 @@ #include #include -// LoRa radio module pins for Heltec T114 -#define P_LORA_DIO_1 20 -#define P_LORA_NSS 24 -#define P_LORA_RESET 25 -#define P_LORA_BUSY 17 -#define P_LORA_SCLK 19 -#define P_LORA_MISO 23 -#define P_LORA_MOSI 22 -#define SX126X_POWER_EN 37 - -#define SX126X_DIO2_AS_RF_SWITCH true -#define SX126X_DIO3_TCXO_VOLTAGE 1.8 - // built-ins #define PIN_VBAT_READ 4 #define PIN_BAT_CTL 6 diff --git a/variants/t114/platformio.ini b/variants/heltec_t114/platformio.ini similarity index 87% rename from variants/t114/platformio.ini rename to variants/heltec_t114/platformio.ini index e48ee121b..2cac2eaee 100644 --- a/variants/t114/platformio.ini +++ b/variants/heltec_t114/platformio.ini @@ -1,40 +1,40 @@ -[nrf52840_t114] +[Heltec_t114] extends = nrf52_base -platform_packages = framework-arduinoadafruitnrf52 +board = heltec_t114 +board_build.ldscript = boards/nrf52840_s140_v6.ld build_flags = ${nrf52_base.build_flags} - -I src/helpers/nrf52 -I lib/nrf52/s140_nrf52_6.1.1_API/include -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52 -lib_deps = - ${nrf52_base.lib_deps} - rweather/Crypto @ ^0.4.0 - -[Heltec_t114] -extends = nrf52840_t114 -board = heltec_t114 -board_build.ldscript = boards/nrf52840_s140_v6.ld -build_flags = ${nrf52840_t114.build_flags} - -I variants/t114 + -I variants/heltec_t114 -I src/helpers/ui - -DHELTEC_T114 + -D HELTEC_T114 + -D P_LORA_DIO_1=20 + -D P_LORA_NSS=24 + -D P_LORA_RESET=25 + -D P_LORA_BUSY=17 + -D P_LORA_SCLK=19 + -D P_LORA_MISO=23 + -D P_LORA_MOSI=22 -D P_LORA_TX_LED=35 -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper -D LORA_TX_POWER=22 + -D SX126X_POWER_EN=37 + -D SX126X_DIO2_AS_RF_SWITCH=true + -D SX126X_DIO3_TCXO_VOLTAGE=1.8 -D SX126X_CURRENT_LIMIT=140 -D SX126X_RX_BOOSTED_GAIN=1 -D ST7789 -D DISPLAY_CLASS=ST7789Display -build_src_filter = ${nrf52840_t114.build_src_filter} +build_src_filter = ${nrf52_base.build_src_filter} + - + - +<../variants/t114> + +<../variants/heltec_t114> + + + + lib_deps = - ${nrf52840_t114.lib_deps} + ${nrf52_base.lib_deps} stevemarple/MicroNMEA @ ^2.0.6 adafruit/Adafruit GFX Library @ ^1.12.1 debug_tool = jlink diff --git a/variants/t114/target.cpp b/variants/heltec_t114/target.cpp similarity index 100% rename from variants/t114/target.cpp rename to variants/heltec_t114/target.cpp diff --git a/variants/t114/target.h b/variants/heltec_t114/target.h similarity index 97% rename from variants/t114/target.h rename to variants/heltec_t114/target.h index 35e86f60e..053a7c44d 100644 --- a/variants/t114/target.h +++ b/variants/heltec_t114/target.h @@ -3,7 +3,7 @@ #define RADIOLIB_STATIC_ONLY 1 #include #include -#include +#include #include #include #include diff --git a/variants/t114/variant.cpp b/variants/heltec_t114/variant.cpp similarity index 100% rename from variants/t114/variant.cpp rename to variants/heltec_t114/variant.cpp diff --git a/variants/t114/variant.h b/variants/heltec_t114/variant.h similarity index 100% rename from variants/t114/variant.h rename to variants/heltec_t114/variant.h