Skip to content
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions boards/seeed_meshpager_x2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"build": {
"arduino": {
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [["0X303A", "0x1001"]],
"mcu": "esp32s3",
"variant": "esp32s3box"
},
"connectivity": ["wifi", "bluetooth"],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "SenseCAP MeshPager X2 (16 MB FLASH, 8 MB PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.seeedstudio.com",
"vendor": "Seeed Studio"
}
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ lib_deps =
[device-ui_base]
lib_deps =
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
https://github.com/meshtastic/device-ui/archive/95483d8c6e28fcda2160161d5d5a8825f729df62.zip
https://github.com/meshtastic/device-ui/archive/3171775c06743dcf6d8023a1f418bb75665ba317.zip
custom_sdkconfig =
# CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC is not set
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
Expand Down
16 changes: 10 additions & 6 deletions src/graphics/tftSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,8 @@ DeviceScreen *deviceScreen = nullptr;

#ifdef ARCH_ESP32
// Get notified when the system is entering light sleep
CallbackObserver<DeviceScreen, void *> tftSleepObserver =
CallbackObserver<DeviceScreen, void *>(deviceScreen, &DeviceScreen::prepareSleep);
CallbackObserver<DeviceScreen, esp_sleep_wakeup_cause_t> endSleepObserver =
CallbackObserver<DeviceScreen, esp_sleep_wakeup_cause_t>(deviceScreen, &DeviceScreen::wakeUp);
static CallbackObserver<DeviceScreen, void *> *tftSleepObserver = nullptr;
static CallbackObserver<DeviceScreen, esp_sleep_wakeup_cause_t> *endSleepObserver = nullptr;
#endif

/**
Expand Down Expand Up @@ -413,8 +411,14 @@ void tftSetup(void)

if (deviceScreen) {
#ifdef ARCH_ESP32
tftSleepObserver.observe(&notifyLightSleep);
endSleepObserver.observe(&notifyLightSleepEnd);
if (!tftSleepObserver) {
tftSleepObserver = new CallbackObserver<DeviceScreen, void *>(deviceScreen, &DeviceScreen::prepareSleep);
}
if (!endSleepObserver) {
endSleepObserver = new CallbackObserver<DeviceScreen, esp_sleep_wakeup_cause_t>(deviceScreen, &DeviceScreen::wakeUp);
}
tftSleepObserver->observe(&notifyLightSleep);
endSleepObserver->observe(&notifyLightSleepEnd);
xTaskCreatePinnedToCore(tft_task_handler, "tft", TFT_TASK_STACK_SIZE, NULL, 1, NULL, 0);
#elif defined(ARCH_PORTDUINO)
std::thread *tft_task = new std::thread([] { tft_task_handler(); });
Expand Down
3 changes: 2 additions & 1 deletion src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,8 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32);

#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR) || \
defined(ELECROW_PANEL) || defined(HELTEC_V4_TFT) || defined(HELTEC_V4_R8_TFT) || defined(RAK_WISMESH_TAP_V2)) && \
defined(ELECROW_PANEL) || defined(HELTEC_V4_TFT) || defined(HELTEC_V4_R8_TFT) || defined(RAK_WISMESH_TAP_V2) || \
defined(SEEED_MESHPAGER_X2)) && \
HAS_TFT
// switch BT off by default; use TFT programming mode or hotkey to enable
config.bluetooth.enabled = false;
Expand Down
34 changes: 34 additions & 0 deletions variants/esp32s3/seeed_mesh_pager_x2/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define USB_VID 0x303a
#define USB_PID 0x1001

static const uint8_t TX = 43;
static const uint8_t RX = 44;

static const uint8_t SDA = 17;
static const uint8_t SCL = 18;

static const uint8_t SS = -1;
static const uint8_t MOSI = 14;
static const uint8_t MISO = 16;
static const uint8_t SCK = 15;

static const uint8_t A8 = 9;
static const uint8_t A9 = 10;
static const uint8_t A10 = 11;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
static const uint8_t A13 = 14;

static const uint8_t T9 = 9;
static const uint8_t T10 = 10;
static const uint8_t T11 = 11;
static const uint8_t T12 = 12;
static const uint8_t T13 = 13;
static const uint8_t T14 = 14;

#endif /* Pins_Arduino_h */
99 changes: 99 additions & 0 deletions variants/esp32s3/seeed_mesh_pager_x2/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[env:seeed_meshpager_x2]
custom_meshtastic_hw_model = 144 ; TODO: assign a unique number for this hardware model
custom_meshtastic_hw_model_slug = SEEED_MESHPAGER_X2
custom_meshtastic_architecture = esp32s3
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 1
custom_meshtastic_display_name = Seeed MeshPager X2
custom_meshtastic_images = meshpager_x2.svg
custom_meshtastic_tags = Seeed
custom_meshtastic_requires_dfu = true
custom_meshtastic_partition_scheme = 16MB

extends = esp32s3_base
board = seeed_meshpager_x2
board_level = pr
board_check = true
upload_protocol = esptool
board_build.partitions = default_16MB.csv

; Build flags for MeshPager X2
build_flags = ${esp32s3_base.build_flags}
-I variants/esp32s3/seeed_mesh_pager_x2
-D SEEED_MESHPAGER_X2
-D CONFIG_ARDUHAL_ESP_LOG
-D CONFIG_ARDUHAL_LOG_COLORS=1
-D CONFIG_DISABLE_HAL_LOCKS=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D INPUTDRIVER_DIRECTIONALPAD_TYPE
-D INPUTDRIVER_DIRECTIONALPAD_INT=2
-D LV_USE_LOG=0
-D LV_BUILD_TEST=0
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D RADIOLIB_SPI_PARANOID=0
; Display Configuration
-D HAS_SCREEN=1
-D HAS_TFT=1
-D USE_I2S_BUZZER
; SD Card - 1-bit SDIO mode
-D HAS_SDCARD
-D HAS_SD_MMC
-D SD_SCLK_PIN=15
-D SD_MOSI_PIN=14
-D SD_MISO_PIN=16
-D SDCARD_CS=-1 ; control via IO Expander pin 13
-D SD_SPI_FREQUENCY=40000000
; Memory Configuration
-D RAM_SIZE=5120
-D LGFX_BUFSIZE=153600
-D LV_CACHE_DEF_SIZE=2097152
; Graphics/UI Configuration
-D LGFX_DRIVER_TEMPLATE
-D DISPLAY_SIZE=320x240
-D LGFX_DRIVER=LGFX_GENERIC
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\"
-D LGFX_PANEL=ST7789P3
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=true
-D LGFX_CFG_HOST=SPI2_HOST
-D LGFX_PIN_SCK=12
-D LGFX_PIN_MOSI=11
-D LGFX_PIN_MISO=-1
-D LGFX_PIN_DC=13
-D LGFX_PIN_CS=10
-D LGFX_PIN_RST=-1
-D LGFX_PIN_BL=46
-D LGFX_ROTATION=1
-D SPI_FREQUENCY=80000000
-D VIEW_320x240
-D MAP_FULL_REDRAW
-D USE_PACKET_API

build_src_filter = ${esp32s3_base.build_src_filter}
+<../variants/esp32s3/seeed_mesh_pager_x2>

lib_deps =
${esp32s3_base.lib_deps}
${device-ui_base.lib_deps}
; Audio processing and synthesis
# renovate: datasource=git-refs depName=ESP8266Audio packageName=https://github.com/meshtastic/ESP8266Audio gitBranch=meshtastic-2.0.0-dacfix
https://github.com/meshtastic/ESP8266Audio/archive/343024632ee78d6216907b2353fc943a62422d80.zip
# renovate: datasource=pio depName=ESP8266SAM packageName=earlephilhower/library/ESP8266SAM
earlephilhower/ESP8266SAM@1.1.0
# renovate: datasource=github-tags depName=pschatzmann_arduino-audio-driver packageName=pschatzmann/arduino-audio-driver
https://github.com/pschatzmann/arduino-audio-driver/archive/v0.2.1.zip
; IO Expander (TCA6424)
# renovate: datasource=pio depName=TCA9555 packageName=RobTillaart/library/TCA9555
RobTillaart/TCA9555@0.4.4
; Display driver (ST7789)
# renovate: datasource=pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX
lovyan03/LovyanGFX@1.2.26
; Sensors: ADS1115 (if used), BMM350, SHT4x, LSM6DSO, etc.
# renovate: datasource=github-tags depName=Adafruit_ADS1X15 packageName=adafruit/Adafruit_ADS1X15
https://github.com/adafruit/Adafruit_ADS1X15/archive/refs/tags/2.6.2.zip
20 changes: 20 additions & 0 deletions variants/esp32s3/seeed_mesh_pager_x2/rfswitch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "RadioLib.h"

// MeshPager X2 RF switch matrix for the Semtech LR2021 chip (Wio-LR2021 module).
// Derived from SenseCAP BSP components/lr20xx/src/ral_lr20xx_bsp.c:
// DIO5: active during RX_LF and TX_HF
// DIO6: active during all RF states (RX_LF, TX_LF, RX_HF, TX_HF)

static const uint32_t lr20x0_rfswitch_dio_pins[] = {
RADIOLIB_LR2021_DIO5, RADIOLIB_LR2021_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC,
};

static const Module::RfSwitchMode_t lr20x0_rfswitch_table[] = {
// mode DIO5 DIO6
{LR2021::MODE_STBY, {LOW, LOW}}, // standby: both off
{LR2021::MODE_RX, {HIGH, HIGH}}, // RX sub-GHz (LF): DIO5 on, DIO6 on
{LR2021::MODE_TX, {LOW, HIGH}}, // TX sub-GHz (LF): DIO5 off, DIO6 on
{LR2021::MODE_RX_HF, {LOW, HIGH}}, // RX 2.4 GHz (HF): DIO5 off, DIO6 on
{LR2021::MODE_TX_HF, {HIGH, HIGH}}, // TX 2.4 GHz (HF): DIO5 on, DIO6 on
END_OF_MODE_TABLE,
};
Loading
Loading