feat: variant seeed_xiao_nrf52840_kit: Diverisfy module options into variants/diy

Signed-off-by: Andrew Yong <me@ndoo.sg>
This commit is contained in:
Andrew Yong 2025-05-11 13:56:25 +08:00
parent 42a80d8aed
commit ab4f68fb01
3 changed files with 64 additions and 17 deletions

View File

@ -99,3 +99,25 @@ build_flags =
-D ARDUINO_USB_MODE=0
-D ARDUINO_USB_CDC_ON_BOOT=1
-I variants/diy/t-energy-s3_e22
; XIAO nRF52840 & Wio-SX1262 Kit for Meshtastic - DIY builds
; Make changes to pin definition overrides in ../seeed_xiao_nrf52840_kit/variant.h
; XIAO nRF52840 & Wio-SX1262 Kit, with L76K GNSS Module for Seeed Studio XIAO
; Store page: https://www.seeedstudio.com/L76K-GNSS-Module-for-Seeed-Studio-XIAO-p-5864.html
[env:seeed_xiao_nrf52840_kit_l76k]
extends = env:seeed_xiao_nrf52840_kit
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_L76K
board_level = extra
; XIAO nRF52840 & Wio-SX1262 Kit, with I2C (D6 -> SDA, D7 -> SCL)
[env:seeed_xiao_nrf52840_kit_i2c]
extends = env:seeed_xiao_nrf52840_kit
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_I2C
board_level = extra
; XIAO nRF52840 & Wio-SX1262 Kit, with I2C OLED (D6 -> SDA, D7 -> SCL)
[env:seeed_xiao_nrf52840_kit_oled]
extends = env:seeed_xiao_nrf52840_kit
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_OLED
board_level = extra

View File

@ -1,4 +1,5 @@
; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893
; XIAO nRF52840 & Wio-SX1262 Kit for Meshtastic
; Store page: https://www.seeedstudio.com/XIAO-nRF52840-Wio-SX1262-Kit-for-Meshtastic-p-6400.html
[env:seeed_xiao_nrf52840_kit]
extends = nrf52840_base
board = xiao_ble_sense

View File

@ -22,6 +22,14 @@ extern "C" {
#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference
#define NUM_ANALOG_OUTPUTS (0)
#ifdef SEEED_XIAO_D6D7_OLED
#define HAS_SCREEN 1
#define USE_SSD1306
#else
// Breaks build:
// #define HAS_SCREEN 0
#endif
// LEDs
#define LED_RED 11
@ -56,14 +64,11 @@ extern "C" {
#define D9 (9ul)
#define D10 (10ul)
/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button.
There are some technical solutions that can solve this problem,
and we are currently exploring and researching them*/
// #define BUTTON_PIN D0 // This is the Program Button
// // #define BUTTON_NEED_PULLUP 1
// #define BUTTON_ACTIVE_LOW true
// #define BUTTON_ACTIVE_PULLUP false
// Wio-SX1262 for XIAO
// Store page: https://www.seeedstudio.com/Wio-SX1262-for-XIAO-p-6379.html
// Schematic: https://files.seeedstudio.com/products/SenseCAP/Wio_SX1262/Wio-SX1262%20for%20XIAO%20V1.0_SCH.pdf
#define PIN_BUTTON1 D0
#define BUTTON_NEED_PULLUP
/*
* Analog pins
@ -85,6 +90,15 @@ static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
#define ADC_RESOLUTION 12
// RX and TX pins
#if defined(SEEED_XIAO_D6D7_SERIAL1) || defined(SEEED_XIAO_D6D7_L76K)
#define PIN_SERIAL1_RX D6
#define PIN_SERIAL1_TX D7
#else
#define PIN_SERIAL1_RX (-1)
#define PIN_SERIAL1_TX (-1)
#endif
#define PIN_SERIAL2_RX (-1)
#define PIN_SERIAL2_TX (-1)
@ -125,23 +139,33 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
#define WIRE_INTERFACES_COUNT 1 // 2
#define PIN_WIRE_SDA (24) // change to use the correct pins if needed
#define PIN_WIRE_SCL (25) // change to use the correct pins if needed
#if defined(SEEED_XIAO_D6D7_I2C) || defined(USE_SSD1306)
#define PIN_WIRE_SDA D6
#define PIN_WIRE_SCL D7
#else
// Invalid pins from original variant definition
#define PIN_WIRE_SDA (24)
#define PIN_WIRE_SCL (25)
#endif
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
// GPS L76KB
// L76K GNSS Module for Seeed Studio XIAO
// Store page: https://www.seeedstudio.com/L76K-GNSS-Module-for-Seeed-Studio-XIAO-p-5864.html
// Schematic:
// https://files.seeedstudio.com/wiki/Seeeduino-XIAO-Expansion-Board/GPS_Module/L76K/109100021-L76K-GNSS-Module-for-Seeed-Studio-XIAO-Schematic.pdf
// -------------------
#ifdef SEEED_XIAO_D6D7_L76K
#define GPS_L76K
#ifdef GPS_L76K
#define PIN_GPS_RX D6
#define PIN_GPS_TX D7
#define HAS_GPS 1
#define GPS_BAUDRATE 9600
#define GPS_THREAD_INTERVAL 50
#define PIN_SERIAL1_RX PIN_GPS_TX
#define PIN_SERIAL1_TX PIN_GPS_RX
#define PIN_GPS_STANDBY D0
#undef PIN_BUTTON1 // Overlapping assignment with Wio-SX1262 for XIAO user button
#define PIN_BUTTON1 (-1)
#else
#define HAS_GPS 0
#endif
// Battery