Skip to content

Commit 045a0e7

Browse files
committed
feat: variants/seeed_xiao_nrf52840_kit: Diverisfy module options into variants
Signed-off-by: Andrew Yong <[email protected]>
1 parent b208e19 commit 045a0e7

File tree

2 files changed

+59
-17
lines changed

2 files changed

+59
-17
lines changed

variants/seeed_xiao_nrf52840_kit/platformio.ini

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893
1+
; XIAO nRF52840 & Wio-SX1262 Kit for Meshtastic
2+
; Store page: https://www.seeedstudio.com/XIAO-nRF52840-Wio-SX1262-Kit-for-Meshtastic-p-6400.html
23
[env:seeed_xiao_nrf52840_kit]
34
extends = nrf52840_base
45
board = xiao_ble_sense
@@ -10,3 +11,21 @@ lib_deps =
1011
debug_tool = jlink
1112
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
1213
;upload_protocol = jlink
14+
15+
; With L76K GNSS Module for Seeed Studio XIAO
16+
; Store page: https://www.seeedstudio.com/L76K-GNSS-Module-for-Seeed-Studio-XIAO-p-5864.html
17+
[env:seeed_xiao_nrf52840_kit_l76k]
18+
extends = env:seeed_xiao_nrf52840_kit
19+
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_L76K
20+
21+
; With I2C (D6 -> SDA, D7 -> SCL)
22+
[env:seeed_xiao_nrf52840_kit_i2c]
23+
extends = env:seeed_xiao_nrf52840_kit
24+
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_I2C
25+
board_level = extra
26+
27+
; With I2C OLED (D6 -> SDA, D7 -> SCL)
28+
[env:seeed_xiao_nrf52840_kit_oled]
29+
extends = env:seeed_xiao_nrf52840_kit
30+
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -DSEEED_XIAO_D6D7_OLED
31+
board_level = extra

variants/seeed_xiao_nrf52840_kit/variant.h

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ extern "C" {
2222
#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference
2323
#define NUM_ANALOG_OUTPUTS (0)
2424

25+
#ifdef SEEED_XIAO_D6D7_OLED
26+
#define HAS_SCREEN 1
27+
#define USE_SSD1306
28+
#else
29+
// Breaks build:
30+
// #define HAS_SCREEN 0
31+
#endif
32+
2533
// LEDs
2634

2735
#define LED_RED 11
@@ -56,14 +64,11 @@ extern "C" {
5664
#define D9 (9ul)
5765
#define D10 (10ul)
5866

59-
/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button.
60-
There are some technical solutions that can solve this problem,
61-
and we are currently exploring and researching them*/
62-
63-
// #define BUTTON_PIN D0 // This is the Program Button
64-
// // #define BUTTON_NEED_PULLUP 1
65-
// #define BUTTON_ACTIVE_LOW true
66-
// #define BUTTON_ACTIVE_PULLUP false
67+
// Wio-SX1262 for XIAO
68+
// Store page: https://www.seeedstudio.com/Wio-SX1262-for-XIAO-p-6379.html
69+
// Schematic: https://files.seeedstudio.com/products/SenseCAP/Wio_SX1262/Wio-SX1262%20for%20XIAO%20V1.0_SCH.pdf
70+
#define PIN_BUTTON1 D0
71+
#define BUTTON_NEED_PULLUP
6772

6873
/*
6974
* Analog pins
@@ -85,6 +90,15 @@ static const uint8_t A4 = PIN_A4;
8590
static const uint8_t A5 = PIN_A5;
8691
#define ADC_RESOLUTION 12
8792

93+
// RX and TX pins
94+
#if defined(SEEED_XIAO_D6D7_SERIAL1) || defined(SEEED_XIAO_D6D7_L76K)
95+
#define PIN_SERIAL1_RX D6
96+
#define PIN_SERIAL1_TX D7
97+
#else
98+
#define PIN_SERIAL1_RX (-1)
99+
#define PIN_SERIAL1_TX (-1)
100+
#endif
101+
88102
#define PIN_SERIAL2_RX (-1)
89103
#define PIN_SERIAL2_TX (-1)
90104

@@ -125,23 +139,32 @@ static const uint8_t SCK = PIN_SPI_SCK;
125139
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
126140
#define WIRE_INTERFACES_COUNT 1 // 2
127141

128-
#define PIN_WIRE_SDA (24) // change to use the correct pins if needed
129-
#define PIN_WIRE_SCL (25) // change to use the correct pins if needed
142+
#if defined(SEEED_XIAO_D6D7_I2C) || defined(USE_SSD1306)
143+
#define PIN_WIRE_SDA D6
144+
#define PIN_WIRE_SCL D7
145+
#else
146+
#define PIN_WIRE_SDA (-1)
147+
#define PIN_WIRE_SCL (-1)
148+
#endif
130149

131150
static const uint8_t SDA = PIN_WIRE_SDA;
132151
static const uint8_t SCL = PIN_WIRE_SCL;
133152

134-
// GPS L76KB
153+
// L76K GNSS Module for Seeed Studio XIAO
154+
// Store page: https://www.seeedstudio.com/L76K-GNSS-Module-for-Seeed-Studio-XIAO-p-5864.html
155+
// Schematic:
156+
// https://files.seeedstudio.com/wiki/Seeeduino-XIAO-Expansion-Board/GPS_Module/L76K/109100021-L76K-GNSS-Module-for-Seeed-Studio-XIAO-Schematic.pdf
157+
// -------------------
158+
#ifdef SEEED_XIAO_D6D7_L76K
135159
#define GPS_L76K
136-
#ifdef GPS_L76K
137-
#define PIN_GPS_RX D6
138-
#define PIN_GPS_TX D7
139160
#define HAS_GPS 1
140161
#define GPS_BAUDRATE 9600
141162
#define GPS_THREAD_INTERVAL 50
142-
#define PIN_SERIAL1_RX PIN_GPS_TX
143-
#define PIN_SERIAL1_TX PIN_GPS_RX
144163
#define PIN_GPS_STANDBY D0
164+
#undef PIN_BUTTON1 // Overlapping assignment with Wio-SX1262 for XIAO user button
165+
#define PIN_BUTTON1 (-1)
166+
#else
167+
#define HAS_GPS 0
145168
#endif
146169

147170
// Battery

0 commit comments

Comments
 (0)