From d538ad170ce1fc3c7203d7c340d1c307ee873f59 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 17 Aug 2025 05:55:00 -0500 Subject: [PATCH 1/3] Add onboard message for devices with screens (#7655) * Add onboard message for devices with screens * Add message for TFT --- src/graphics/Screen.cpp | 2 +- src/graphics/draw/MenuHandler.cpp | 24 ++++++++++++++++++++++ src/graphics/draw/MenuHandler.h | 2 ++ src/graphics/draw/NotificationRenderer.cpp | 7 ++++++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 88955145a..fa71e17d8 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -692,7 +692,7 @@ int32_t Screen::runOnce() #ifndef DISABLE_WELCOME_UNSET if (!NotificationRenderer::isOverlayBannerShowing() && config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { - menuHandler::LoraRegionPicker(0); + menuHandler::OnboardMessage(); } #endif if (!NotificationRenderer::isOverlayBannerShowing() && rebootAtMsec != 0) { diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index fa738309a..512f650ec 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -26,6 +26,27 @@ menuHandler::screenMenus menuHandler::menuQueue = menu_none; bool test_enabled = false; uint8_t test_count = 0; +void menuHandler::OnboardMessage() +{ + static const char *optionsArray[] = {"OK", "Got it!"}; + enum optionsNumbers { OK, got }; + BannerOverlayOptions bannerOptions; +#if HAS_TFT + bannerOptions.message = "Welcome to Meshtastic!\nSwipe to navigate and\nlong press to select\nor open a menu."; +#elif defined(BUTTON_PIN) + bannerOptions.message = "Welcome to Meshtastic!\nClick to navigate and\nlong press to select\nor open a menu."; +#else + bannerOptions.message = "Welcome to Meshtastic!\nUse the Select button\nto open menus\nand make selections."; +#endif + bannerOptions.optionsArrayPtr = optionsArray; + bannerOptions.optionsCount = 2; + bannerOptions.bannerCallback = [](int selected) -> void { + menuHandler::menuQueue = menuHandler::no_timeout_lora_picker; + screen->runNow(); + }; + screen->showOverlayBanner(bannerOptions); +} + void menuHandler::LoraRegionPicker(uint32_t duration) { static const char *optionsArray[] = {"Back", @@ -1132,6 +1153,9 @@ void menuHandler::handleMenuSwitch(OLEDDisplay *display) case lora_picker: LoraRegionPicker(); break; + case no_timeout_lora_picker: + LoraRegionPicker(0); + break; case TZ_picker: TZPicker(); break; diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index 87a0b055e..b15cf237d 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -10,6 +10,7 @@ class menuHandler enum screenMenus { menu_none, lora_picker, + no_timeout_lora_picker, TZ_picker, twelve_hour_picker, clock_face_picker, @@ -41,6 +42,7 @@ class menuHandler }; static screenMenus menuQueue; + static void OnboardMessage(); static void LoraRegionPicker(uint32_t duration = 30000); static void handleMenuSwitch(OLEDDisplay *display); static void showConfirmationBanner(const char *message, std::function onConfirm); diff --git a/src/graphics/draw/NotificationRenderer.cpp b/src/graphics/draw/NotificationRenderer.cpp index d9cf280ac..3d635e588 100644 --- a/src/graphics/draw/NotificationRenderer.cpp +++ b/src/graphics/draw/NotificationRenderer.cpp @@ -383,7 +383,9 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp uint8_t firstOptionToShow = 0; if (alertBannerOptions > 0) { - if (curSelected > 1 && alertBannerOptions > visibleTotalLines - lineCount) { + if (visibleTotalLines - lineCount == 1) { + firstOptionToShow = curSelected; + } else if (curSelected > 1 && alertBannerOptions > visibleTotalLines - lineCount) { if (curSelected > alertBannerOptions - visibleTotalLines + lineCount) firstOptionToShow = alertBannerOptions - visibleTotalLines + lineCount; else @@ -392,6 +394,9 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp firstOptionToShow = 0; } } + // Useful log line for troubleshooting: + /* LOG_WARN("alertBannerOptions: %u, curSelected: %u, visibleTotalLines: %u, lineCount: %u, firstOptionToShow: %u", + alertBannerOptions, curSelected, visibleTotalLines, lineCount, firstOptionToShow); */ for (int i = firstOptionToShow; i < alertBannerOptions && linesShown < visibleTotalLines; i++, linesShown++) { if (i == curSelected) { From e5e8683cdba133e726033101586c3235a8678893 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 17 Aug 2025 05:56:06 -0500 Subject: [PATCH 2/3] Don't update the NodeDB if the nodeinfo has a mismatching public key (#7652) --- src/mesh/NodeDB.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 79361bb46..97a1e463c 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1631,24 +1631,33 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde printBytes("Incoming Pubkey: ", p.public_key.bytes, 32); // Alert the user if a remote node is advertising public key that matches our own - if (owner.public_key.size == 32 && memcmp(p.public_key.bytes, owner.public_key.bytes, 32) == 0 && !duplicateWarned) { - duplicateWarned = true; - char warning[] = "Remote device %s has advertised your public key. This may indicate a compromised key. You may need " - "to regenerate your public keys."; - LOG_WARN(warning, p.long_name); - meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); - cn->level = meshtastic_LogRecord_Level_WARNING; - cn->time = getValidTime(RTCQualityFromNet); - sprintf(cn->message, warning, p.long_name); - service->sendClientNotification(cn); + if (owner.public_key.size == 32 && memcmp(p.public_key.bytes, owner.public_key.bytes, 32) == 0) { + if (!duplicateWarned) { + duplicateWarned = true; + char warning[] = + "Remote device %s has advertised your public key. This may indicate a compromised key. You may need " + "to regenerate your public keys."; + LOG_WARN(warning, p.long_name); + meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); + cn->level = meshtastic_LogRecord_Level_WARNING; + cn->time = getValidTime(RTCQualityFromNet); + sprintf(cn->message, warning, p.long_name); + service->sendClientNotification(cn); + } + return false; } } - if (info->user.public_key.size > 0) { // if we have a key for this user already, don't overwrite with a new one + if (info->user.public_key.size == 32) { // if we have a key for this user already, don't overwrite with a new one + // if the key doesn't match, don't update nodeDB at all. + if (p.public_key.size != 32 || (memcmp(p.public_key.bytes, info->user.public_key.bytes, 32) != 0)) { + LOG_WARN("Public Key mismatch, dropping NodeInfo"); + return false; + } LOG_INFO("Public Key set for node, not updating!"); // we copy the key into the incoming packet, to prevent overwrite p.public_key.size = 32; memcpy(p.public_key.bytes, info->user.public_key.bytes, 32); - } else if (p.public_key.size > 0) { + } else if (p.public_key.size == 32) { LOG_INFO("Update Node Pubkey!"); } #endif From 9feb1d378edb2847cc12755beac9aa57a10c571f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 17 Aug 2025 13:37:12 +0200 Subject: [PATCH 3/3] Support for T-Echo Lite, credits to @Szetya for doing all the heavy lifting! (#7636) * Support for T-Echo Lite, credts to @Szetya for doing all the heavy lifting! * move define to ini file --- src/BluetoothStatus.h | 8 + src/graphics/EInkDisplay2.cpp | 4 +- src/main.cpp | 4 + src/modules/SerialModule.cpp | 14 +- src/nimble/NimbleBluetooth.cpp | 5 +- src/platform/nrf52/architecture.h | 2 + variants/nrf52840/t-echo-lite/platformio.ini | 25 +++ variants/nrf52840/t-echo-lite/variant.cpp | 44 ++++ variants/nrf52840/t-echo-lite/variant.h | 207 +++++++++++++++++++ 9 files changed, 303 insertions(+), 10 deletions(-) create mode 100644 variants/nrf52840/t-echo-lite/platformio.ini create mode 100644 variants/nrf52840/t-echo-lite/variant.cpp create mode 100644 variants/nrf52840/t-echo-lite/variant.h diff --git a/src/BluetoothStatus.h b/src/BluetoothStatus.h index f6bb43cc2..680aec929 100644 --- a/src/BluetoothStatus.h +++ b/src/BluetoothStatus.h @@ -89,14 +89,22 @@ class BluetoothStatus : public Status case ConnectionState::CONNECTED: LOG_DEBUG("BluetoothStatus CONNECTED"); #ifdef BLE_LED +#ifdef BLE_LED_INVERTED + digitalWrite(BLE_LED, LOW); +#else digitalWrite(BLE_LED, HIGH); +#endif #endif break; case ConnectionState::DISCONNECTED: LOG_DEBUG("BluetoothStatus DISCONNECTED"); #ifdef BLE_LED +#ifdef BLE_LED_INVERTED + digitalWrite(BLE_LED, HIGH); +#else digitalWrite(BLE_LED, LOW); +#endif #endif break; } diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index a627a42cc..1c9f290b6 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -140,13 +140,13 @@ bool EInkDisplay::connect() #endif #endif -#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) +#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) || defined(T_ECHO_LITE) { auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); adafruitDisplay = new GxEPD2_BW(*lowLevel); adafruitDisplay->init(); -#ifdef ELECROW_ThinkNode_M1 +#if defined(ELECROW_ThinkNode_M1) || defined(T_ECHO_LITE) adafruitDisplay->setRotation(4); #else adafruitDisplay->setRotation(3); diff --git a/src/main.cpp b/src/main.cpp index c5be175c4..c53877e37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -325,8 +325,12 @@ void setup() #ifdef BLE_LED pinMode(BLE_LED, OUTPUT); +#ifdef BLE_LED_INVERTED + digitalWrite(BLE_LED, HIGH); +#else digitalWrite(BLE_LED, LOW); #endif +#endif #if defined(T_DECK) // GPIO10 manages all peripheral power supplies diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 39b297965..866497ecc 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -60,7 +60,7 @@ SerialModule *serialModule; SerialModuleRadio *serialModuleRadio; -#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \ +#if defined(TTGO_T_ECHO) || defined(T_ECHO_LITE) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \ defined(ELECROW_ThinkNode_M5) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {} static Print *serialPrint = &Serial; @@ -179,8 +179,8 @@ int32_t SerialModule::runOnce() Serial.begin(baud); Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); } -#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && \ - !defined(ELECROW_ThinkNode_M5) +#elif !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \ + !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { #ifdef ARCH_RP2040 Serial2.setFIFOSize(RX_BUFFER); @@ -236,8 +236,8 @@ int32_t SerialModule::runOnce() } } -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && \ - !defined(ELECROW_ThinkNode_M5) +#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \ + !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) { processWXSerial(); @@ -496,8 +496,8 @@ ParsedLine parseLine(const char *line) */ void SerialModule::processWXSerial() { -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) && \ - !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) +#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \ + !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 834184292..95e191c8e 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -223,9 +223,12 @@ void NimbleBluetooth::deinit() LOG_INFO("Disable bluetooth until reboot"); #ifdef BLE_LED +#ifdef BLE_LED_INVERTED + digitalWrite(BLE_LED, HIGH); +#else digitalWrite(BLE_LED, LOW); #endif - +#endif NimBLEDevice::deinit(); #endif } diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index ce42bf849..064bd8ef0 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -60,6 +60,8 @@ #define HW_VENDOR meshtastic_HardwareModel_RAK4631 #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO +#elif defined(T_ECHO_LITE) +#define HW_VENDOR meshtastic_HardwareModel_T_ECHO_LITE #elif defined(ELECROW_ThinkNode_M1) #define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1 #elif defined(NANO_G2_ULTRA) diff --git a/variants/nrf52840/t-echo-lite/platformio.ini b/variants/nrf52840/t-echo-lite/platformio.ini new file mode 100644 index 000000000..68ae59dcb --- /dev/null +++ b/variants/nrf52840/t-echo-lite/platformio.ini @@ -0,0 +1,25 @@ +; Using original screen class +[env:t-echo-lite] +extends = nrf52840_base +board = t-echo +board_check = true +debug_tool = jlink + +# add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. +build_flags = ${nrf52840_base.build_flags} + -Ivariants/nrf52840/t-echo-lite + -D T_ECHO_LITE + -D GPS_POWER_TOGGLE + -D EINK_DISPLAY_MODEL=GxEPD2_122_T61 + -D EINK_WIDTH=192 + -D EINK_HEIGHT=176 + -D USE_EINK + -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -D EINK_LIMIT_FASTREFRESH=20 ; How many consecutive fast-refreshes are permitted + -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/t-echo-lite> +lib_deps = + ${nrf52840_base.lib_deps} + https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip +;upload_protocol = fs diff --git a/variants/nrf52840/t-echo-lite/variant.cpp b/variants/nrf52840/t-echo-lite/variant.cpp new file mode 100644 index 000000000..cae079b74 --- /dev/null +++ b/variants/nrf52840/t-echo-lite/variant.cpp @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 - pins 0 and 1 are hardwired for xtal and should never be enabled + 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, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); + + pinMode(PIN_LED3, OUTPUT); + ledOff(PIN_LED3); +} diff --git a/variants/nrf52840/t-echo-lite/variant.h b/variants/nrf52840/t-echo-lite/variant.h new file mode 100644 index 000000000..2e2cdce72 --- /dev/null +++ b/variants/nrf52840/t-echo-lite/variant.h @@ -0,0 +1,207 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_TTGO_EINK_V1_0_ +#define _VARIANT_TTGO_EINK_V1_0_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (1) +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +#define PIN_LED1 (32 + 7) // Green LED +#define PIN_LED2 (32 + 5) // Blue LED +// Unused(by firmware) LEDs: +#define PIN_LED3 (32 + 14) // Red LED inside, under the display. + +#define LED_RED PIN_LED3 +#define LED_BLUE PIN_LED2 +#define LED_GREEN PIN_LED1 + +#define BLE_LED LED_BLUE +#define BLE_LED_INVERTED 1 +#define LED_BUILTIN LED_GREEN +#define LED_CONN LED_GREEN +#define LED_STATE_ON 0 // State when LED is lit + +// Buttons +#define PIN_BUTTON1 (0 + 24) +#define PIN_BUTTON2 (0 + 18) // 0.18 is labeled on the board as RESET but we configure it in the bootloader as a regular GPIO + +#define BUTTON_CLICK_MS 400 + +// Analog pins +#define PIN_A0 (0 + 2) // Battery ADC + +#define BATTERY_PIN PIN_A0 + +static const uint8_t A0 = PIN_A0; + +#define ADC_RESOLUTION 14 + +#define ADC_CTRL (0 + 31) +#define ADC_CTRL_ENABLED HIGH + +// NFC +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +// Wire Interfaces +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (32 + 4) +#define PIN_WIRE_SCL (32 + 2) + +/* + Internal, PCB PAD interrupt PIN. Currently not used. (Not built in my device) +*/ +// #define PIN_IMU_INT (0 + 16) // Interrupt from the IMU, macro name correct?! + +// External serial flash ZD25WQ32CEIGR +// QSPI Pins +#define PIN_QSPI_SCK (0 + 4) +#define PIN_QSPI_CS (0 + 12) +#define PIN_QSPI_IO0 (0 + 6) // MOSI if using two bit interface +#define PIN_QSPI_IO1 (0 + 8) // MISO if using two bit interface +#define PIN_QSPI_IO2 (32 + 9) // WP if using two bit interface (i.e. not used) +#define PIN_QSPI_IO3 (0 + 26) // HOLD if using two bit interface (i.e. not used) + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR +#define EXTERNAL_FLASH_USE_QSPI + +// Lora radio + +#define USE_SX1262 +// #define USE_SX1268 // currently only available with XS1262. +#define SX126X_CS (0 + 11) +#define SX126X_DIO1 (32 + 8) +#define SX126X_DIO2 (0 + 5) +#define SX126X_BUSY (0 + 14) +#define SX126X_RESET (0 + 7) +#define SX126X_RXEN (32 + 1) +#define SX126X_TXEN (0 + 27) +// #define TCXO_OPTIONAL +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +// eink display pins +#define VEXT_ENABLE (32 + 12) +#define VEXT_ON_VALUE LOW +#define PIN_EINK_CS (0 + 22) +#define PIN_EINK_BUSY (0 + 3) +#define PIN_EINK_DC (0 + 21) +#define PIN_EINK_RES (0 + 28) +#define PIN_EINK_SCLK (0 + 19) +#define PIN_EINK_MOSI (0 + 20) + +// Controls power 3V3 for all peripherals (eink + GPS + LoRa + Sensor) +#define PIN_POWER_EN (0 + 30) // 3V3 POWER Enable + +#define PIN_SPI1_MISO (-1) // The display does not use MISO. +#define PIN_SPI1_MOSI PIN_EINK_MOSI +#define PIN_SPI1_SCK PIN_EINK_SCLK + +// GPS pins +// #define GPS_DEBUG +#define GPS_L76K +#define GPS_BAUDRATE 9600 +#define HAS_GPS 1 +// #define PIN_GPS_REINIT (32 + 5) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K + +#define PIN_GPS_STANDBY (32 + 10) // An output to wake GPS, low means allow sleep, high means force wake +// Seems to be missing on this new board +#define PIN_GPS_PPS (0 + 29) // Pulse per second input from the GPS +#define GPS_TX_PIN (32 + 15) // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN (32 + 13) // This is for bits going TOWARDS the GPS + +#define GPS_THREAD_INTERVAL 50 + +#define PIN_SERIAL1_RX GPS_TX_PIN +#define PIN_SERIAL1_TX GPS_RX_PIN + +// SPI Interfaces +#define SPI_INTERFACES_COUNT 2 + +// For LORA, SPI 0 +#define PIN_SPI_MISO (0 + 17) +#define PIN_SPI_MOSI (0 + 15) +#define PIN_SPI_SCK (0 + 13) + +// Battery +// The battery sense is hooked to pin A0 (2) +// it is defined in the analogue pin section of this file +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (2.0F) + +// #define NO_EXT_GPIO 1 +// PINs back side +// Batt & solar connector left up corner +/* +------------------------------- +| VDDH, VBAT, 0.23, SCL , 1.06 | +| GND , SDA , 0.09, 0.10, 0.25 | +------------------------------- + -------- + | VDDH | + | GND | + | 1.13 | - Wake Up/standby + | 1.15 | - PPS + | 0.29 | - TX + | 1.10 | - RX + | 1.11 | - EN + -------- +------------------------------- +| 3V3 , GND , 0.16, 1.03, G_WU | 0.16 internal solder pad interrupt PIN, +| G_EN, G_RX, G_TX, GND , PPS | +------------------------------- +*/ + +// To debug via the segger JLINK console rather than the CDC-ACM serial device +// #define USE_SEGGER + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file