Merge branch 'master' into lora-type

This commit is contained in:
Thomas Göttgens
2025-07-13 18:13:08 +02:00
committed by GitHub
339 changed files with 20771 additions and 8730 deletions

View File

@@ -22,6 +22,9 @@
#include "graphics/niche/Drivers/EInk/GDEY0154D67.h"
#include "graphics/niche/Inputs/TwoButton.h"
// Button feedback
#include "buzz.h"
void setupNicheGraphics()
{
using namespace NicheGraphics;
@@ -53,7 +56,8 @@ void setupNicheGraphics()
inkhud->setDisplayResilience(10, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings
@@ -98,8 +102,14 @@ void setupNicheGraphics()
buttons->setWiring(1, PIN_BUTTON1);
buttons->setTiming(1, 50, 500); // 500ms before latch
buttons->setHandlerDown(1, [backlight]() { backlight->peek(); });
buttons->setHandlerLongPress(1, [backlight]() { backlight->latch(); });
buttons->setHandlerShortPress(1, [backlight]() { backlight->off(); });
buttons->setHandlerLongPress(1, [backlight]() {
backlight->latch();
playBoop();
});
buttons->setHandlerShortPress(1, [backlight]() {
backlight->off();
playChirp();
});
// Begin handling button events
buttons->start();

View File

@@ -63,6 +63,9 @@ extern "C" {
* Buttons
*/
#define PIN_BUTTON2 (32 + 10)
#define ALT_BUTTON_PIN PIN_BUTTON2
#define ALT_BUTTON_ACTIVE_LOW true
#define ALT_BUTTON_ACTIVE_PULLUP true
#define PIN_BUTTON1 (32 + 7)
// #define PIN_BUTTON1 (0 + 11)

View File

@@ -3,6 +3,9 @@
#define PIN_BUTTON1 47 // 功能键
#define PIN_BUTTON2 4 // 电源键
#define ALT_BUTTON_PIN PIN_BUTTON2
#define ALT_BUTTON_ACTIVE_LOW false
#define ALT_BUTTON_ACTIVE_PULLUP false
#define LED_POWER 6
#define ADC_V 42
@@ -60,4 +63,3 @@
#define HAS_GPS 0
#define BUTTON_PIN PIN_BUTTON1
#define BUTTON_PIN_ALT PIN_BUTTON2

View File

@@ -0,0 +1,24 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <stdint.h>
static const uint8_t TX = 21;
static const uint8_t RX = 20;
static const uint8_t SDA = 1;
static const uint8_t SCL = 0;
static const uint8_t SS = 8;
static const uint8_t MOSI = 7;
static const uint8_t MISO = 6;
static const uint8_t SCK = 10;
static const uint8_t A0 = 0;
static const uint8_t A1 = 1;
static const uint8_t A2 = 2;
static const uint8_t A3 = 3;
static const uint8_t A4 = 4;
static const uint8_t A5 = 5;
#endif /* Pins_Arduino_h */

View File

@@ -0,0 +1,61 @@
#ifndef _VARIANT_ESP32C3_SUPER_MINI_
#define _VARIANT_ESP32C3_SUPER_MINI_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// I2C (Wire) & OLED
#define WIRE_INTERFACES_COUNT (1)
#define I2C_SDA (1)
#define I2C_SCL (0)
#define USE_SSD1306
// GPS
#undef GPS_RX_PIN
#undef GPS_TX_PIN
#define GPS_RX_PIN (20)
#define GPS_TX_PIN (21)
// Button
#define BUTTON_PIN (9) // BOOT button
// LoRa
#define USE_LLCC68
#define USE_SX1262
// #define USE_RF95
#define USE_SX1268
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET (5)
#define LORA_DIO1 (3)
#define LORA_RXEN (2)
#define LORA_BUSY (4)
#define LORA_SCK (10)
#define LORA_MISO (6)
#define LORA_MOSI (7)
#define LORA_CS (8)
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET
#define SX126X_RXEN LORA_RXEN
#define SX126X_DIO3_TCXO_VOLTAGE (1.8)
#define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif

View File

@@ -36,8 +36,12 @@
#define SX126X_TXEN 13 // Schematic connects EBYTE module's TXEN pin to MCU
#define SX126X_RXEN 14 // Schematic connects EBYTE module's RXEN pin to MCU
#define LORA_CS SX126X_CS // Compatibility with variant file configuration structure
#define LORA_SCK SX126X_SCK // Compatibility with variant file configuration structure
#define LORA_MOSI SX126X_MOSI // Compatibility with variant file configuration structure
#define LORA_MISO SX126X_MISO // Compatibility with variant file configuration structure
#define LORA_DIO1 SX126X_DIO1 // Compatibility with variant file configuration structure
#define LORA_CS SX126X_CS // Compatibility with variant file configuration structure
#define LORA_SCK SX126X_SCK // Compatibility with variant file configuration structure
#define LORA_MOSI SX126X_MOSI // Compatibility with variant file configuration structure
#define LORA_MISO SX126X_MISO // Compatibility with variant file configuration structure
#define LORA_DIO1 SX126X_DIO1 // Compatibility with variant file configuration structure
#define LORA_TXEN SX126X_TXEN // Compatibility with variant file configuration structure
#define LORA_RXEN SX126X_RXEN // Compatibility with variant file configuration structure
#define LORA_RESET SX126X_RESET // Compatibility with variant file configuration structure
#define LORA_DIO2 SX126X_BUSY // Compatibility with variant file configuration structure

View File

@@ -55,8 +55,9 @@ void setupNicheGraphics()
// Set how many FAST updates per FULL update.
inkhud->setDisplayResilience(INKHUD_BUILDCONF_DISPLAYRESILIENCE); // Suggest roughly ten
// Prepare fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Init settings, and customize defaults

View File

@@ -89,6 +89,27 @@ extra_scripts =
${env.extra_scripts}
variants/diy/nrf52_promicro_diy_tcxo/custom_build_tasks.py ; Add to PIO's Project Tasks pane: preset builds for common displays
; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893
[env:xiao_ble]
extends = env:seeed_xiao_nrf52840_kit
board_level = extra
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -D PRIVATE_HW -DXIAO_BLE_LEGACY_PINOUT -DEBYTE_E22 -DEBYTE_E22_900M30S
build_unflags = -DGPS_L76K
; Seeed XIAO nRF52840 + EBYTE E22-900M30S - Pinout matching Wio-SX1262 (SKU 113010003)
[env:seeed_xiao_nrf52840_e22_900m30s]
extends = env:seeed_xiao_nrf52840_kit
board_level = extra
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -D PRIVATE_HW -DEBYTE_E22 -DEBYTE_E22_900M30S
build_unflags = -DGPS_L76K
; Seeed XIAO nRF52840 + EBYTE E22-900M33S - Pinout matching Wio-SX1262 (SKU 113010003)
[env:seeed_xiao_nrf52840_e22_900m33s]
extends = env:seeed_xiao_nrf52840_kit
board_level = extra
build_flags = ${env:seeed_xiao_nrf52840_kit.build_flags} -D PRIVATE_HW -DEBYTE_E22 -DEBYTE_E22_900M33S
build_unflags = -DGPS_L76K
; Seeed XIAO nRF52840 + XIAO Wio SX1262 DIY
[env:seeed-xiao-nrf52840-wio-sx1262]
board = xiao_ble_sense
@@ -120,3 +141,16 @@ build_flags =
-D ARDUINO_USB_MODE=0
-D ARDUINO_USB_CDC_ON_BOOT=1
-I variants/diy/t-energy-s3_e22
; ESP32 C3 Super Mini Development Board
; https://www.espboards.dev/esp32/esp32-c3-super-mini/
[env:esp32c3_super_mini]
extends = esp32c3_base
board = esp32-c3-devkitm-1
build_flags =
${esp32_base.build_flags}
-D PRIVATE_HW
-I variants/diy/esp32c3_super_mini
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
board_level = extra

View File

@@ -0,0 +1,168 @@
# XIAO nrf52840/nrf52840 Sense + Ebyte E22-900M30S
_A step-by-step guide for macOS and Linux._
## Introduction
This guide will walk you through everything needed to get the XIAO nrf52840 (or XIAO nrf52840 Sense) running Meshtastic using an Ebyte E22-900M30S LoRa module. The combination of the E22 with an nRF52840 MCU is desirable because it allows for both very low idle (Rx) power draw _and_ high transmit power.
The XIAO nrf52840 is a small but surprisingly well-appointed nRF52840 board, with enough GPIO for most Meshtastic applications and a built-in LiPo charger.
The E22, on the other hand, is a famously inscrutable and mysterious beast. It is one of the more readily available LoRa modules capable of transmitting at 30 dBm, and includes an LNA to boost its Rx sensitivity a few dB beyond that of the SX1262.
However, its documentation is relatively sparse overall, and seems to merely hint at (or completely omit) several key details regarding its functionality. Thus, much of what follows is a synthesis of my observations and inferences over the course of many hours of trial and error.
### Acknowledgement and Friendly Disclaimer
Huge thanks to those in the community who have forged the way with the E22, without whose hard work none of this would have been possible! (thebentern, riddick, rainer_vie, beegee-tokyo, geeksville, caveman99, Der_Bear, PlumRugOfDoom, BigCorvus, and many others.)
Please take the conclusions here as a tentative work in progress, representing my current (and fairly limited) understanding of the E22 when paired with this particular MCU. It is my hope that this guide will be helpful to others who are interested in trying a DIY Meshtastic build, and also be subject to revision by folks with more experience and better test equipment.
### Obligatory Liability Disclaimer
This guide and all associated content is for informational purposes only. The information presented is intended for consumption only by persons having appropriate technical skill and judgement, to be used entirely at their own discretion and risk. The authors of this guide in no way provide any warranty, express or implied, toward the content herein, nor its correctness, safety, or suitability to any particular purpose. By following the instructions in this guide in part or in full, you assume all responsibility for all potential risks, including but not limited to fire, property damage, bodily injury, and death.
## 1. Wire the board
Connecting the E22 to the XIAO nrf52840 is straightforward, but there are a few gotchas to be mindful of.
### On the XIAO nrf52840
- Pins D4 and D5 are currently mapped to `PIN_WIRE_SDA` and `PIN_WIRE_SCL`, respectively. If you are not using I²C and would like to free up pins D4 and D5 for use as GPIO, `PIN_WIRE_SDA` and `PIN_WIRE_SCL` can be reassigned to any two other unused pin numbers.
- Pins D6 and D7 were originally mapped to the TX and RX pins for serial interface 1 (`PIN_SERIAL1_RX` and `PIN_SERIAL1_TX`) but are currently set to -1 in `variant.h`. If you need to expose a serial interface, you can restore these pins and move e.g. `SX126X_RXEN` to pin 4 or 5 (the opposite should work too).
### On the E22
- There are two options for the E22's `TXEN` pin:
1. It can be connected to the MCU on the pin defined as `SX126X_TXEN` in `variant.h`. In this configuration, the MCU will control Tx/Rx switching "manually". As long as `SX126X_TXEN` and `SX126X_RXEN` are both defined in `variant.h` (and neither is set to `RADIOLIB_NC`), `SX126xInterface.cpp` will initialize the E22 correctly for this mode.
2. Alternately, it can be connected to the E22's `DIO2` pin only, with neither `TXEN` nor `DIO2` being connected to the MCU. In this configuration, the E22 will control Tx/Rx switching automatically. In `variant.h`, as long as `SX126X_TXEN` is defined as `RADIOLIB_NC`, and `SX126X_RXEN` is defined and connected to the E22's `RXEN` pin, and `E22_TXEN_CONNECTED_TO_DIO2` is defined, `SX126xInterface.cpp` will initialize the E22 correctly for this mode. This configuration frees up a GPIO, and presents no drawbacks that I have found.
- Note that any combination other than the two described above will likely result in unexpected behavior. In my testing, some of these other configurations appeared to "work" at first glance, but every one I tried had at least one of the following flaws: weak Tx power, extremely poor Rx sensitivity, or the E22 overheating because TXEN was never pulled low, causing its PA to stay on indefinitely.
- Along the same lines, it is a good idea to check the E22's temperature frequently by lightly touching the shield. If you feel the shield getting hot (i.e. approaching uncomfortable to touch) near pins 1, 2, and 3, something is probably misconfigured; disconnect both the XIAO nrf52840 and E22 from power and double check wiring and pin mapping.
- Whether you opt to let the E22 control Rx and Tx or handle this manually, **the E22's `RXEN` pin must always be connected to the MCU** on the pin defined as `SX126X_RXEN` in `variant.h`.
#### Note
The default pin mapping in `variant.h` uses "Automatic Tx/Rx switching" mode.
If you wire your board for Manual Tx/Rx Switching Mode, `SX126X_TXEN` must be defined (`#define #define SX126X_TXEN D6`) in `variants/seeed_xiao_nrf52840_kit/variant.h` in the code block following:
```c
#ifdef XIAO_BLE_LEGACY_PINOUT
// Legacy xiao_ble variant pinout for third-party SX126x modules e.g. EBYTE E22
```
### Example Wiring for Automatic Tx/Rx Switching Mode
#### MCU -> E22 Connections
| XIAO nrf52840 pin | variant.h definition | E22 pin | Notes |
| :---------------- | :------------------- | :-------- | :------------------------------------------------------------------------------------------------------------------- |
| D0 | SX126X_CS | 19 (NSS) | |
| D1 | SX126X_DIO1 | 13 (DIO1) | |
| D2 | SX126X_BUSY | 14 (BUSY) | |
| D3 | SX126X_RESET | 15 (NRST) | |
| D7 | SX126X_RXEN | 6 (RXEN) | These pins must still be connected, and `SX126X_RXEN` defined in `variant.h`, otherwise Rx sensitivity will be poor. |
| D8 | PIN_SPI_SCK | 18 (SCK) | |
| D9 | PIN_SPI_MISO | 16 (MISO) | |
| D10 | PIN_SPI_MOSI | 17 (MOSI) | |
#### E22 -> E22 Connections
| E22 pin | E22 pin | Notes |
| :------ | :------ | :------------------------------------------------------------------------ |
| TXEN | DIO2 | These must be physically connected for automatic Tx/Rx switching to work. |
#### Note
The schematic (`xiao-ble-e22-schematic.png`) in the `eagle-project` directory uses this wiring.
### Example Wiring for Manual Tx/Rx Switching Mode
#### MCU -> E22 Connections
| XIAO nrf52840 pin | variant.h definition | E22 pin | Notes |
| :---------------- | :------------------- | :-------- | :---- |
| D0 | SX126X_CS | 19 (NSS) | |
| D1 | SX126X_DIO1 | 13 (DIO1) | |
| D2 | SX126X_BUSY | 14 (BUSY) | |
| D3 | SX126X_RESET | 15 (NRST) | |
| D6 | SX126X_TXEN | 7 (TXEN) | |
| D7 | SX126X_RXEN | 6 (RXEN) | |
| D8 | PIN_SPI_SCK | 18 (SCK) | |
| D9 | PIN_SPI_MISO | 16 (MISO) | |
| D10 | PIN_SPI_MOSI | 17 (MOSI) | |
#### E22 -> E22 connections
_(none)_
## 2. Build Meshtastic
1. Follow the [Building Meshtastic Firmware](https://meshtastic.org/docs/development/firmware/build/) documentation, stop after **Build****Step 2**
2. For **Build****Step 3**, select `xiao_ble` as your target
3. Adjust source code if you:
- Wired your board for Manual Tx/Rx Switching Mode: see [Wire the Board](#1-wire-the-board)
- Used an E22-900M33S module
(this step is important to avoid **damaging the power amplifier** in the M33S module and **transmitting power above legal limits**!):
1. Open `variants/diy/platformio.ini`
2. Search for `[env:xiao_ble]`
3. In the line starting with `build_flags` within this section, change `-DEBYTE_E22_900M30S` to `-DEBYTE_E22_900M33S`
4. Follow **Build****Step 4** to build the firmware
5. Stop here, because the **PlatformIO: Upload** step does not work for factory-fresh XIAO nrf52840 (the automatic reset to bootloader only works if Meshtastic firmware is already running)
6. The built `firmware.uf2` binary can be found in the folder `.pio/build/xiao_ble/firmware.uf2` (relative to where you cloned the Git repository to), we will need it for [flashing the firmware](#3-flash-the-firmware-to-the-xiao-nrf52840) (manually)
## 3. Flash the Firmware to the XIAO nrf52840
1. Double press the XIAO nrf52840's `reset` button to put it in bootloader mode, and a USB volume named `XIAO SENSE` will appear
2. Copy the `firmware.uf2` file to the `XIAO SENSE` volume (refer to the last step of [Build Meshtastic](#2-build-meshtastic))
3. The XIAO nrf52840's red LED will flash for several seconds as the firmware is copied
4. Once Meshtastic firmware succesfully boots, the:
1. Green LED will turn on
2. Red LED will flash several times to indicate flash memory writes during initial settings file creation
3. Green LED will blink every second once the firmware is running normally
5. If you do not see the above LED patters, proceed to [Troubleshooting](#4-troubleshooting)
## 4. Troubleshooting
- If after flashing Meshtastic, the XIAO is bootlooped, look at the serial output (you can see this by running `meshtastic --noproto` with the device connected to your computer via USB).
- If you see that the SX1262 init result was -2, this likely indicates a wiring problem; double check your wiring and pin mapping in `variant.h`.
- If you see an error mentioning tinyFS, this may mean you need to reformat the XIAO's storage:
1. Open the [Meshtastic web flasher](https://flasher.meshtastic.org/)
2. Select the **_Seeed XIAO NRF52840 Kit_**
3. Click the **_trash can icon_** to the right of **_Flash_**
4. Follow the instructions on the screen
**Do not flash the Seeed XIAO NRF52840 Kit firmware** if you have wired the LoRa module according to this variant, as the Seeed XIAO NRF52840 Kit uses different wiring for the SX1262 LoRa chip
- If you don't see any specific error message, but the boot process is stuck or not proceeding as expected, this might also mean there is a conflict in `variant.h`. If you have made any changes to the pin mapping, ensure they do not result in a conflict. If all else fails, try reverting your changes and using the known-good configuration included here.
- The above might also mean something is wired incorrectly. Try reverting to one of the known-good example wirings in section 4.
- If the E22 gets hot to the touch:
- The power amplifier is likely running continually. Disconnect it and the XIAO from power immediately, and double check wiring and pin mapping. In my experimentation this occurred in cases where TXEN was inadvertenly high (usually due to a pin mapping conflict).
## 5. Notes
- **Transmit Power**
- There is a power amplifier after the SX1262's Tx, so the actual Tx power is just over 7 dB greater than the SX1262's set Tx power (the E22-900M30S actually tops out just over 29dB at 5V according to the datasheet)
- Meshtastic firmware is aware of the gain of the E22-900M30S module, so the Meshtastic clients' Tx power setting reflects the actual output power, i.e. setting 30 dBm in the Meshtastic app programs the E22 module to correctly output 30 dBm, setting 24 dBm will output 24 dBm, etc.
- **Adequate 5V Power Supply to the E22 Module**
- Have a bypass capacitor from its 5V supply to ground; 100 µF works well
- Voltage must be between 5V5.5V, lower supply voltage results in less output power; for example, with a fully charged LiPo at 4.2V, Tx power appears to max out around 26-27 dBm
### Additional Reading
- [S5NC/CDEBYTE_Modules](https://github.com/S5NC/CDEBYTE_Modules) has additional information about EBYTE E22 modules' internal workings, including photographs
- [RadioLib High power Radio Modules Guide](https://github.com/jgromes/RadioLib/wiki/High-power-Radio-Modules-Guide)
## 6. Testing Methodology
During what became a fairly long trial-and-error process, I did a lot of careful testing of Tx power and Rx sensitivity. My methodology in these tests was as follows:
- All tests were conducted between two nodes:
1. The XIAO nrf52840 + E22 coupled with an [Abracon ARRKP4065-S915A](https://www.digikey.com/en/products/detail/abracon-llc/ARRKP4065-S915A/8593263") ceramic patch antenna
2. A RAK 5005/4631 coupled with a [Laird MA9-5N](https://www.streakwave.com/laird-technologies-ma9-5n-55dbi-900mhz-mobile-omni-select-mount) antenna via a 4" U.FL to Type N pigtail.
- No other nodes were powered up onsite or nearby.
- Each node and its antenna was kept in exactly the same position and orientation throughout testing.
- Other environmental factors (e.g. the location and resting position of my body in the room while testing) were controlled as carefully as possible.
- Each test comprised at least five (and often ten) runs, after which the results were averaged.
- All testing was done by sending single-character messages between nodes and observing the received RSSI reported in the message acknowledgement. Messages were sent one by one, waiting for each to be acknowledged or time out before sending the next.
- The E22's Tx power was observed by sending messages from the RAK to the XIAO nrf52840 + E22 and recording the received RSSI.
- The opposite was done to observe the E22's Rx sensitivity: messages were sent from the XIAO nrf52840 + E22 to the RAK, and the received RSSI was recorded.
While this cannot match the level of accuracy achievable with actual test equipment in a lab setting, it was nonetheless sufficient to demonstrate the (sometimes very large) differences in Tx power and Rx sensitivity between various configurations.

View File

@@ -79,6 +79,7 @@ build_flags =
-D SPI_FREQUENCY=80000000
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_PANEL=ST7789
-D LGFX_ROTATION=1
-D LGFX_CFG_HOST=SPI2_HOST
@@ -103,6 +104,7 @@ build_flags =
-D SPI_FREQUENCY=60000000
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_PANEL=ILI9488
-D LGFX_ROTATION=0
-D LGFX_CFG_HOST=SPI2_HOST
@@ -126,3 +128,4 @@ extends = crowpanel_large_esp32s3_base
build_flags =
${crowpanel_large_esp32s3_base.build_flags}
-D VIEW_320x240
-D DISPLAY_SIZE=800x480 ; landscape mode

View File

@@ -3,6 +3,8 @@
#define EXT_PWR_DETECT 35
#define BUTTON_PIN 18
#define BUTTON_ACTIVE_LOW false
#define BUTTON_ACTIVE_PULLUP false
#define BATTERY_PIN 7 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO7_CHANNEL

View File

@@ -56,8 +56,9 @@ void setupNicheGraphics()
// Set how many FAST updates per FULL update.
inkhud->setDisplayResilience(INKHUD_BUILDCONF_DISPLAYRESILIENCE); // Suggest roughly ten
// Prepare fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Init settings, and customize defaults

View File

@@ -56,6 +56,10 @@ extern "C" {
#define TFT_WIDTH 240
#define TFT_OFFSET_X 0
#define TFT_OFFSET_Y 0
// T114 gets a muted yellow on black display
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 128)
// #define TFT_OFFSET_ROTATION 0
// #define SCREEN_ROTATE
// #define SCREEN_TRANSITION_FRAMERATE 5

View File

@@ -50,7 +50,8 @@ void setupNicheGraphics()
inkhud->setDisplayResilience(10, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings

View File

@@ -1,6 +1,8 @@
#define EXT_PWR_DETECT 20
#define BUTTON_PIN 17
#define BUTTON_ACTIVE_LOW false
#define BUTTON_ACTIVE_PULLUP false
#define BATTERY_PIN 7 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO7_CHANNEL

View File

@@ -0,0 +1,35 @@
#pragma once
#include "configuration.h"
enum class EInkDetectionResult : uint8_t {
LCMEN213EFC1 = 0, // Initial version
E0213A367 = 1, // E213 PCB marked V1.1 (Mid 2025)
};
EInkDetectionResult detectEInk()
{
// Test 1: Logic of BUSY pin
// Determines controller IC manufacturer
// Fitipower: busy when LOW
// Solomon Systech: busy when HIGH
// Force display BUSY by holding reset pin active
pinMode(PIN_EINK_RES, OUTPUT);
digitalWrite(PIN_EINK_RES, LOW);
delay(10);
// Read whether pin is HIGH or LOW while busy
pinMode(PIN_EINK_BUSY, INPUT);
bool busyLogic = digitalRead(PIN_EINK_BUSY);
// Test complete. Release pin
pinMode(PIN_EINK_RES, INPUT);
if (busyLogic == LOW)
return EInkDetectionResult::LCMEN213EFC1;
else // busy HIGH
return EInkDetectionResult::E0213A367;
}

View File

@@ -18,13 +18,22 @@
// Shared NicheGraphics components
// --------------------------------
#include "graphics/niche/Drivers/EInk/E0213A367.h"
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
#include "graphics/niche/Inputs/TwoButton.h"
#include "buzz.h" // Button feedback
#include "einkDetect.h" // Detect display model at runtime
void setupNicheGraphics()
{
using namespace NicheGraphics;
// Detect E-Ink Model
// -------------------
EInkDetectionResult displayModel = detectEInk();
// SPI
// -----------------------------
@@ -35,7 +44,13 @@ void setupNicheGraphics()
// E-Ink Driver
// -----------------------------
Drivers::EInk *driver = new Drivers::LCMEN213EFC1;
Drivers::EInk *driver;
if (displayModel == EInkDetectionResult::LCMEN213EFC1) // V1 (unmarked)
driver = new Drivers::LCMEN213EFC1;
else if (displayModel == EInkDetectionResult::E0213A367) // V1.1
driver = new Drivers::E0213A367;
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
// InkHUD
@@ -48,10 +63,15 @@ void setupNicheGraphics()
// Set how many FAST updates per FULL update
// Set how unhealthy additional FAST updates beyond this number are
inkhud->setDisplayResilience(10, 1.5);
if (displayModel == EInkDetectionResult::LCMEN213EFC1) // V1 (unmarked)
inkhud->setDisplayResilience(10, 1.5);
else if (displayModel == EInkDetectionResult::E0213A367) // V1.1
inkhud->setDisplayResilience(15, 3);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings
@@ -84,8 +104,11 @@ void setupNicheGraphics()
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
// #1: Aux Button
buttons->setWiring(1, BUTTON_PIN_SECONDARY);
buttons->setHandlerShortPress(1, [inkhud]() { inkhud->nextTile(); });
buttons->setWiring(1, PIN_BUTTON2);
buttons->setHandlerShortPress(1, [inkhud]() {
inkhud->nextTile();
playChirp();
});
// Begin handling button events
buttons->start();

View File

@@ -7,7 +7,8 @@ build_flags =
-Ivariants/heltec_vision_master_e213
-DHELTEC_VISION_MASTER_E213
-DUSE_EINK
-DEINK_DISPLAY_MODEL=GxEPD2_213_FC1
-DGXEPD2_DRIVER_0=GxEPD2_213_FC1
-DGXEPD2_DRIVER_1=GxEPD2_213_E0213A367
-DEINK_WIDTH=250
-DEINK_HEIGHT=122
-DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk
@@ -16,7 +17,7 @@ build_flags =
-DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
lib_deps =
${esp32s3_base.lib_deps}
https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip
https://github.com/meshtastic/GxEPD2/archive/1655054ba298e0e29fc2044741940f927f9c2a43.zip
lewisxhe/PCF8563_Library@^1.0.1
upload_speed = 115200
@@ -32,7 +33,6 @@ build_flags =
${inkhud.build_flags}
-I variants/heltec_vision_master_e213
-D HELTEC_VISION_MASTER_E213
-D MAX_THREADS=40 ; Required if used with WiFi
lib_deps =
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
${esp32s3_base.lib_deps}

View File

@@ -1,7 +1,7 @@
#define LED_PIN 45 // LED is not populated on earliest board variant
#define BUTTON_PIN 0
#define BUTTON_PIN_SECONDARY 21 // Second built-in button
#define BUTTON_SECONDARY_CANNEDMESSAGES // By default, use the secondary button as canned message input
#define PIN_BUTTON2 21 // Second built-in button
#define ALT_BUTTON_PIN PIN_BUTTON2 // Send the up event
// I2C
#define I2C_SDA SDA

View File

@@ -34,6 +34,9 @@ Different NicheGraphics UIs and different hardware variants will each have their
#include "graphics/niche/Drivers/EInk/DEPG0290BNS800.h"
#include "graphics/niche/Inputs/TwoButton.h"
// Button feedback
#include "buzz.h"
void setupNicheGraphics()
{
using namespace NicheGraphics;
@@ -64,7 +67,8 @@ void setupNicheGraphics()
inkhud->setDisplayResilience(7, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings
@@ -97,8 +101,11 @@ void setupNicheGraphics()
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
// #1: Aux Button
buttons->setWiring(1, BUTTON_PIN_SECONDARY);
buttons->setHandlerShortPress(1, [inkhud]() { inkhud->nextTile(); });
buttons->setWiring(1, PIN_BUTTON2);
buttons->setHandlerShortPress(1, [inkhud]() {
inkhud->nextTile();
playChirp();
});
// Begin handling button events
buttons->start();

View File

@@ -36,7 +36,6 @@ build_flags =
${inkhud.build_flags}
-I variants/heltec_vision_master_e290
-D HELTEC_VISION_MASTER_E290
-D MAX_THREADS=40 ; Required if used with WiFi
lib_deps =
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
${esp32s3_base.lib_deps}

View File

@@ -1,7 +1,7 @@
#define LED_PIN 45 // LED is not populated on earliest board variant
#define BUTTON_PIN 0
#define BUTTON_PIN_SECONDARY 21 // Second built-in button
#define BUTTON_SECONDARY_CANNEDMESSAGES // By default, use the secondary button as canned message input
#define PIN_BUTTON2 21 // Second built-in button
#define ALT_BUTTON_PIN PIN_BUTTON2 // Send the up event
// I2C
#define I2C_SDA SDA

View File

@@ -1,6 +1,7 @@
#ifndef HAS_TFT
#define BUTTON_PIN 0
#define BUTTON_PIN_SECONDARY 21 // Second built-in button
#define BUTTON_SECONDARY_CANNEDMESSAGES // By default, use the secondary button as canned message input
#define PIN_BUTTON2 21 // Second built-in button
#define ALT_BUTTON_PIN PIN_BUTTON2 // Send the up event
// I2C
#define I2C_SDA SDA
@@ -68,4 +69,5 @@
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif // HAS_TFT

View File

@@ -0,0 +1,35 @@
#pragma once
#include "configuration.h"
enum class EInkDetectionResult : uint8_t {
LCMEN213EFC1 = 0, // V1.1
E0213A367 = 1, // V1.1.1, V1.2
};
EInkDetectionResult detectEInk()
{
// Test 1: Logic of BUSY pin
// Determines controller IC manufacturer
// Fitipower: busy when LOW
// Solomon Systech: busy when HIGH
// Force display BUSY by holding reset pin active
pinMode(PIN_EINK_RES, OUTPUT);
digitalWrite(PIN_EINK_RES, LOW);
delay(10);
// Read whether pin is HIGH or LOW while busy
pinMode(PIN_EINK_BUSY, INPUT);
bool busyLogic = digitalRead(PIN_EINK_BUSY);
// Test complete. Release pin
pinMode(PIN_EINK_RES, INPUT);
if (busyLogic == LOW)
return EInkDetectionResult::LCMEN213EFC1;
else // busy HIGH
return EInkDetectionResult::E0213A367;
}

View File

@@ -18,13 +18,21 @@
// Shared NicheGraphics components
// --------------------------------
#include "graphics/niche/Drivers/EInk/E0213A367.h"
#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h"
#include "graphics/niche/Inputs/TwoButton.h"
#include "einkDetect.h" // Detect display model at runtime
void setupNicheGraphics()
{
using namespace NicheGraphics;
// Detect E-Ink Model
// -------------------
EInkDetectionResult displayModel = detectEInk();
// SPI
// -----------------------------
@@ -35,7 +43,13 @@ void setupNicheGraphics()
// E-Ink Driver
// -----------------------------
Drivers::EInk *driver = new Drivers::LCMEN213EFC1;
Drivers::EInk *driver;
if (displayModel == EInkDetectionResult::LCMEN213EFC1) // V1.1
driver = new Drivers::LCMEN213EFC1;
else if (displayModel == EInkDetectionResult::E0213A367) // V1.1.1, V1.2
driver = new Drivers::E0213A367;
driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
// InkHUD
@@ -48,10 +62,15 @@ void setupNicheGraphics()
// Set how many FAST updates per FULL update
// Set how unhealthy additional FAST updates beyond this number are
inkhud->setDisplayResilience(10, 1.5);
if (displayModel == EInkDetectionResult::LCMEN213EFC1) // V1.1 (unmarked)
inkhud->setDisplayResilience(10, 1.5);
else if (displayModel == EInkDetectionResult::E0213A367) // V1.1.1, V1.2
inkhud->setDisplayResilience(15, 3);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings

View File

@@ -7,7 +7,8 @@ build_flags =
${esp32s3_base.build_flags}
-I variants/heltec_wireless_paper
-D HELTEC_WIRELESS_PAPER
-D EINK_DISPLAY_MODEL=GxEPD2_213_FC1
-D GXEPD2_DRIVER_0=GxEPD2_213_FC1
-D GXEPD2_DRIVER_1=GxEPD2_213_E0213A367
-D EINK_WIDTH=250
-D EINK_HEIGHT=122
-D USE_EINK
@@ -17,7 +18,7 @@ build_flags =
-D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
lib_deps =
${esp32s3_base.lib_deps}
https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip
https://github.com/meshtastic/GxEPD2/archive/1655054ba298e0e29fc2044741940f927f9c2a43.zip
lewisxhe/PCF8563_Library@^1.0.1
upload_speed = 115200
@@ -33,7 +34,6 @@ build_flags =
${inkhud.build_flags}
-I variants/heltec_wireless_paper
-D HELTEC_WIRELESS_PAPER
-D MAX_THREADS=40 ; Required if used with WiFi
lib_deps =
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
${esp32s3_base.lib_deps}

View File

@@ -6,7 +6,9 @@
#define USE_SSD1306
#define BUTTON_PIN 0 // Button pin for this board
#define BUTTON_PIN_ALT 36
#define CANCEL_BUTTON_PIN 36
#define CANCEL_BUTTON_ACTIVE_LOW true
#define CANCEL_BUTTON_ACTIVE_PULLUP true
#define HAS_NEOPIXEL // If defined, we will use the neopixel library
#define NEOPIXEL_DATA 35 // Neopixel pin for this board

View File

@@ -28,7 +28,6 @@ build_flags = ${esp32s3_base.build_flags}
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D RADIOLIB_SPI_PARANOID=0
-D MAX_THREADS=40
-D HAS_SCREEN=0
-D HAS_TFT=1
-D USE_PIN_BUZZER
@@ -86,6 +85,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_PANEL=ST7789
-D LGFX_INVERT_COLOR=false
-D LGFX_ROTATION=3
@@ -98,6 +98,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_PANEL=ILI9341
-D LGFX_ROTATION=1
-D LGFX_TOUCH_ROTATION=4
@@ -110,6 +111,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_PANEL=ILI9488
-D LGFX_ROTATION=0
-D LGFX_TOUCH_ROTATION=0
@@ -122,6 +124,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_PANEL=HX8357B
-D LGFX_INVERT_COLOR=false
-D LGFX_ROTATION=4
@@ -134,6 +137,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
-D SPI_FREQUENCY=75000000 ; may go higher upto 60/80 MHz
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_PANEL=ILI9341
-D LGFX_ROTATION=1
-D LGFX_TOUCH_X_MIN=0
@@ -150,6 +154,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_PANEL=ILI9488
-D LGFX_ROTATION=2
-D LGFX_TOUCH_X_MIN=0
@@ -166,6 +171,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_PANEL=HX8357B
-D LGFX_ROTATION=4
-D LGFX_TOUCH_X_MIN=0

View File

@@ -3,9 +3,7 @@
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON_PIN 36 // The user button (information button) GPIO on the Nano G1 explorer
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
// anywhere.
#define BUTTON_PIN 36 // The user button (information button) GPIO on the Nano G1 explorer
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
// common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if

View File

@@ -3,9 +3,7 @@
#define I2C_SDA 21
#define I2C_SCL 22
#define BUTTON_PIN 36 // The middle button GPIO on the Nano G1
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
// anywhere.
#define BUTTON_PIN 36 // The middle button GPIO on the Nano G1
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
// common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if

View File

@@ -2,5 +2,5 @@
extends = esp32s3_base
board = lolin_s3_mini
board_level = extra
build_flags =
${esp32s3_base.build_flags} -D PRIVATE_HW -I variants/nugget_s3_lora
build_flags =
${esp32s3_base.build_flags} -D ARDUINO_USB_CDC_ON_BOOT=1 -D PRIVATE_HW -I variants/nugget_s3_lora

View File

@@ -1,5 +1,8 @@
#define I2C_SDA 34 // I2C pins for this board
#define I2C_SCL 38
#define I2C_SDA 35 // I2C pins for this board
#define I2C_SCL 36
#define USE_SSD1306
#define DISPLAY_FLIP_SCREEN
#define LED_PIN 15 // If defined we will blink this LED
@@ -8,7 +11,8 @@
#define NEOPIXEL_DATA 10 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define BUTTON_PIN 0 // If defined, this will be used for user button presses
// Button A (44), B (43), R (12), U (13), L (11), D (18)
#define BUTTON_PIN 44 // If defined, this will be used for user button presses
#define BUTTON_NEED_PULLUP
#define USE_RF95

View File

@@ -26,21 +26,15 @@ extends = env:picomputer-s3
build_flags =
${env:picomputer-s3.build_flags}
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_BLUETOOTH=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1
-D INPUTDRIVER_MATRIX_TYPE=1
-D USE_PIN_BUZZER=PIN_BUZZER
-D USE_SX127x
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D HAS_TFT=1
-D RAM_SIZE=1024
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D RAM_SIZE=1560
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D LV_USE_SYSMON=0
-D LV_USE_PROFILER=0
-D LV_USE_PERF_MONITOR=0
@@ -48,10 +42,13 @@ build_flags =
-D LV_USE_LOG=0
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_DRIVER=LGFX_PICOMPUTER_S3
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_PICOMPUTER_S3.h\"
-D VIEW_320x240
; -D USE_DOUBLE_BUFFER
; -D USE_DOUBLE_BUFFER
-D USE_PACKET_API
lib_deps =

View File

@@ -49,7 +49,7 @@
#define SCREEN_TRANSITION_FRAMERATE 5
// Picomputer gets a white on black display
#define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF)
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 255)
#define CANNED_MESSAGE_MODULE_ENABLE 1

View File

@@ -22,11 +22,11 @@ lib_deps =
${native_base.lib_deps}
${device-ui_base.lib_deps}
build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D RAM_SIZE=16384
-D USE_X11=1
-D HAS_TFT=1
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D LV_CACHE_DEF_SIZE=6291456
-D LV_BUILD_TEST=0
-D LV_USE_LIBINPUT=1
@@ -41,7 +41,6 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio
!pkg-config --libs openssl --silence-errors || :
build_src_filter =
${native_base.build_src_filter}
-<graphics/TFTDisplay.cpp>
[env:native-fb]
extends = native_base
@@ -51,12 +50,11 @@ lib_deps =
${device-ui_base.lib_deps}
board_level = extra
build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -Wl,--gc-sections
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D RAM_SIZE=8192
-D USE_FRAMEBUFFER=1
-D LV_COLOR_DEPTH=32
-D HAS_TFT=1
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D LV_BUILD_TEST=0
-D LV_USE_LOG=0
-D LV_USE_EVDEV=1
@@ -72,7 +70,6 @@ build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections
!pkg-config --libs openssl --silence-errors || :
build_src_filter =
${native_base.build_src_filter}
-<graphics/TFTDisplay.cpp>
[env:native-tft-debug]
extends = native_base
@@ -82,7 +79,6 @@ lib_deps =
${device-ui_base.lib_deps}
board_level = extra
build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D DEBUG_HEAP
-D RAM_SIZE=16384
-D USE_X11=1

View File

@@ -5,6 +5,8 @@ board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem
build_flags =
${stm32_base.build_flags}
-Ivariants/rak3172
-DPIN_WIRE_SDA=PA11
-DPIN_WIRE_SCL=PA12
-DHAL_DAC_MODULE_ONLY
-DHAL_RNG_MODULE_ENABLED
-DRADIOLIB_EXCLUDE_SX128X=1
@@ -18,6 +20,5 @@ build_flags =
-DMESHTASTIC_EXCLUDE_SCREEN=1
-DMESHTASTIC_EXCLUDE_MQTT=1
-DMESHTASTIC_EXCLUDE_POWERMON=1
;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
;-DCFG_DEBUG
upload_port = stlink

View File

@@ -0,0 +1,28 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include "variant.h"
#include <stdint.h>
#define USB_VID 0x303a
#define USB_PID 0x1001
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 9;
static const uint8_t SCL = 40;
// Default SPI will be mapped to Radio
static const uint8_t SS = 12;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 10;
static const uint8_t SCK = 13;
#define SPI_MOSI (11)
#define SPI_SCK (13)
#define SPI_MISO (10)
#define SPI_CS (12)
// LEDs
#define LED_BUILTIN LED_GREEN
#endif /* Pins_Arduino_h */

View File

@@ -0,0 +1,8 @@
[env:rak3312]
extends = esp32s3_base
board = wiscore_rak3312
board_check = true
upload_protocol = esptool
build_flags =
${esp32_base.build_flags} -D RAK3312 -I variants/rak3312

View File

@@ -0,0 +1,44 @@
#define I2C_SDA 9
#define I2C_SCL 40
#define USE_SX1262
#define LORA_SCK 5
#define LORA_MISO 3
#define LORA_MOSI 6
#define LORA_CS 7
#define LORA_RESET 8
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 47
#define SX126X_BUSY 48
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
#define SX126X_POWER_EN (4)
#define PIN_POWER_EN PIN_3V3_EN
#define PIN_3V3_EN (14)
#define LED_GREEN 46
#define LED_BLUE 45
#define PIN_LED1 LED_GREEN
#define PIN_LED2 LED_BLUE
#define LED_CONN LED_BLUE
#define LED_PIN LED_GREEN
#define ledOff(pin) pinMode(pin, INPUT)
#define LED_STATE_ON 1 // State when LED is litted
#define HAS_GPS 1
#define GPS_TX_PIN 43
#define GPS_RX_PIN 44
#define BATTERY_PIN 1
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
#define ADC_MULTIPLIER 1.667

View File

@@ -18,6 +18,7 @@ lib_deps =
melopero/Melopero RV3028@^1.1.0
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
https://github.com/RAKWireless/RAK12034-BMX160/archive/dcead07ffa267d3c906e9ca4a1330ab989e957e2.zip
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
@@ -51,4 +52,4 @@ lib_deps =
upload_protocol = stlink
; eventually use platformio/tool-pyocd@^2.3600.0 instad
;upload_protocol = custom
;upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE
;upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE

View File

@@ -88,8 +88,13 @@ static const uint8_t A7 = PIN_A7;
#define ADC_RESOLUTION 14
// Other pins
#define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT
#define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT
#define PIN_AREF (2)
#define PIN_NFC1 (9)
#define WB_IO5 PIN_NFC1
#define WB_IO4 (4)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
@@ -143,8 +148,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (13)
#define PIN_WIRE_SCL (14)
#define PIN_WIRE_SDA (WB_I2C1_SDA)
#define PIN_WIRE_SCL (WB_I2C1_SCL)
// QSPI Pins
#define PIN_QSPI_SCK 3
@@ -227,6 +232,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
// enables 3.3V periphery like GPS or IO Module
// Do not toggle this for GPS power savings
#define PIN_3V3_EN (34)
#define WB_IO2 PIN_3V3_EN
// RAK1910 GPS module
// If using the wisblock GPS module and pluged into Port A on WisBlock base
@@ -280,4 +286,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
#endif

View File

@@ -16,6 +16,7 @@ lib_deps =
melopero/Melopero RV3028@^1.1.0
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@@ -90,6 +90,8 @@ static const uint8_t A7 = PIN_A7;
// Other pins
#define PIN_AREF (2)
#define PIN_NFC1 (9)
#define WB_IO5 PIN_NFC1
#define WB_IO4 (4)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
@@ -188,6 +190,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
// enables 3.3V periphery like GPS or IO Module
#define PIN_3V3_EN (34)
#define WB_IO2 PIN_3V3_EN
// RAK1910 GPS module
// If using the wisblock GPS module and pluged into Port A on WisBlock base
@@ -231,4 +234,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
#endif

View File

@@ -18,6 +18,7 @@ lib_deps =
melopero/Melopero RV3028@^1.1.0
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@@ -69,7 +69,9 @@ static const uint8_t A7 = PIN_A7;
// Other pins
#define PIN_AREF (2)
// #define PIN_NFC1 (9)
#define PIN_NFC1 (9)
#define WB_IO5 PIN_NFC1
#define WB_IO4 (4)
// #define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
@@ -160,6 +162,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
// enables 3.3V periphery like GPS or IO Module
#define PIN_3V3_EN (34)
#define WB_IO2 PIN_3V3_EN
// NO GPS
#undef GPS_RX_PIN
@@ -202,4 +205,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
#endif

View File

@@ -90,6 +90,8 @@ static const uint8_t A7 = PIN_A7;
// Other pins
#define PIN_AREF (2)
#define PIN_NFC1 (9)
#define WB_IO5 PIN_NFC1
#define WB_IO4 (4)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
@@ -217,6 +219,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
// enables 3.3V periphery like GPS or IO Module
// Do not toggle this for GPS power savings
#define PIN_3V3_EN (34)
#define WB_IO2 PIN_3V3_EN
// RAK1910 GPS module
// If using the wisblock GPS module and pluged into Port A on WisBlock base
@@ -270,4 +273,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
#endif

View File

@@ -22,6 +22,7 @@ lib_deps =
bodmer/TFT_eSPI
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK14014-FT6336U @ 1.0.1
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@@ -90,6 +90,8 @@ static const uint8_t A7 = PIN_A7;
// Other pins
#define PIN_AREF (2)
#define PIN_NFC1 (9)
#define WB_IO5 PIN_NFC1
#define WB_IO4 (4)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
@@ -176,11 +178,11 @@ static const uint8_t SCK = PIN_SPI_SCK;
// No reason not to have the RAK Wireless pin defs here too. This allows code from example RAK sketches to run without
// modification.
static const uint8_t WB_IO1 = 17; // SLOT_A SLOT_B
static const uint8_t WB_IO2 = 34; // SLOT_A SLOT_B
static const uint8_t WB_IO3 = 21; // SLOT_C
static const uint8_t WB_IO4 = 4; // SLOT_C
static const uint8_t WB_IO5 = 9; // SLOT_D
static const uint8_t WB_IO1 = 17; // SLOT_A SLOT_B
static const uint8_t WB_IO2 = 34; // SLOT_A SLOT_B
static const uint8_t WB_IO3 = 21; // SLOT_C
// static const uint8_t WB_IO4 = 4; // SLOT_C <- already defined above (ln. 94)
// static const uint8_t WB_IO5 = 9; // SLOT_D <- already defined above (ln. 93)
static const uint8_t WB_IO6 = 10; // SLOT_D
static const uint8_t WB_SW1 = 33; // IO_SLOT
static const uint8_t WB_A0 = 5; // IO_SLOT
@@ -314,4 +316,4 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
#endif

View File

@@ -36,17 +36,9 @@ upload_speed = 460800
build_flags =
${env:seeed-sensecap-indicator.build_flags}
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_SCREEN=1
-D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1
-D INPUTDRIVER_BUTTON_TYPE=38
-D HAS_TELEMETRY=0
-D CONFIG_DISABLE_HAL_LOCKS=1
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D HAS_TFT=1
-D DISPLAY_SET_RESOLUTION
-D RAM_SIZE=4096
@@ -61,6 +53,9 @@ build_flags =
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D CUSTOM_TOUCH_DRIVER
-D LGFX_SCREEN_WIDTH=480
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=480x480
-D LGFX_DRIVER=LGFX_INDICATOR
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\"
-D VIEW_320x240

View File

@@ -7,9 +7,10 @@
#define SENSOR_PORT_NUM 2
#define SENSOR_BAUD_RATE 115200
#if !HAS_TFT
#define BUTTON_PIN 38
#endif
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP true
// #define BUTTON_NEED_PULLUP
// #define BATTERY_PIN 27 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage

View File

@@ -59,8 +59,8 @@ const uint32_t g_ADigitalPinMap[] = {
// D16 - Battery voltage ADC input
31, // D16 P0.31 VBAT_ADC
// GROVE
0, // D17 P0.00 GROVESDA
1, // D18 P0.01 GROVESCL
43, // D17 P0.00 GROVESDA
44, // D18 P0.01 GROVESCL
// FLASH
21, // D19 P0.21 (QSPI_SCK)

View File

@@ -33,15 +33,15 @@
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Button Configuration
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define BUTTON_PIN D13 // This is the Program Button
#define CANCEL_BUTTON_PIN D13 // This is the Program Button
// #define BUTTON_NEED_PULLUP 1
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP false
#define CANCEL_BUTTON_ACTIVE_LOW true
#define CANCEL_BUTTON_ACTIVE_PULLUP false
#define BUTTON_PIN_TOUCH 13 // Touch button
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Digital Pin Mapping (D0-D10)
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// #define BUTTON_PIN_TOUCH 13 // Touch button
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Digital Pin Mapping (D0-D10)
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define D0 0 // P1.06 GNSS_WAKEUP/IO0
#define D1 1 // P0.07 LORA_DIO1
#define D2 2 // P1.07 LORA_RESET
@@ -74,10 +74,12 @@
// Communication Interfaces
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// I2C Configuration
#define HAS_WIRE 1
// #define HAS_WIRE 1
#define PIN_WIRE_SDA D14 // P0.09
#define PIN_WIRE_SCL D15 // P0.10
#define WIRE_INTERFACES_COUNT 1
#define WIRE_INTERFACES_COUNT 2
#define PIN_WIRE1_SDA D18
#define PIN_WIRE1_SCL D17
#define I2C_NO_RESCAN
static const uint8_t SDA = PIN_WIRE_SDA;
@@ -167,6 +169,7 @@ static const uint8_t SCL = PIN_WIRE_SCL;
#define TB_LEFT 27
#define TB_RIGHT 28
#define TB_PRESS 29
#define TB_DIRECTION FALLING
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Compatibility Definitions
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

View File

@@ -0,0 +1,106 @@
#pragma once
#include "configuration.h"
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
// InkHUD-specific components
// ---------------------------
#include "graphics/niche/InkHUD/InkHUD.h"
// Applets
#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h"
#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h"
#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h"
#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h"
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
// Shared NicheGraphics components
// --------------------------------
#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h"
#include "graphics/niche/Drivers/EInk/GDEY0213B74.h"
#include "graphics/niche/Inputs/TwoButton.h"
// Special case - fix T-Echo's touch button
// ----------------------------------------
// On a handful of T-Echos, LoRa TX triggers the capacitive touch
// To avoid this, we lockout the button during TX
#include "mesh/RadioLibInterface.h"
void setupNicheGraphics()
{
using namespace NicheGraphics;
// SPI
// -----------------------------
// For NRF52 platforms, SPI pins are defined in variant.h
SPI1.begin();
// E-Ink Driver
// -----------------------------
Drivers::EInk *driver = new Drivers::GDEY0213B74;
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
// InkHUD
// ----------------------------
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
// Set the E-Ink driver
inkhud->setDriver(driver);
// Set how many FAST updates per FULL update
// Set how unhealthy additional FAST updates beyond this number are
inkhud->setDisplayResilience(7, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings
inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side
// 270 degrees clockwise
inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery
inkhud->persistence->settings.optionalMenuItems.backlight = true; // Until proves capacitive button works by touching it
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
// Setup backlight controller
// Note: AUX button attached further down
Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance();
backlight->setPin(PIN_EINK_EN);
// Pick applets
// Note: order of applets determines priority of "auto-show" feature
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
inkhud->persistence->settings.rotation = 1;
// inkhud->persistence->printSettings(&inkhud->persistence->settings);
// Start running InkHUD
inkhud->begin();
// inkhud->persistence->printSettings(&inkhud->persistence->settings);
// Buttons
// --------------------------
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
// #0: Main User Button
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
buttons->setTiming(0, 75, 500);
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
// Begin handling button events
buttons->start();
}
#endif

View File

@@ -0,0 +1,14 @@
[env:seeed_wio_tracker_L1_eink]
board = seeed_wio_tracker_L1
extends = nrf52840_base, inkhud
;board_level = extra
build_flags = ${nrf52840_base.build_flags} ${inkhud.build_flags}
-I $PROJECT_DIR/variants/seeed_wio_tracker_L1_eink
-D SEEED_WIO_TRACKER_L1
-Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52
board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_wio_tracker_L1_eink> ${inkhud.build_src_filter}
lib_deps =
${inkhud.lib_deps}
${nrf52840_base.lib_deps}
debug_tool = jlink

View File

@@ -0,0 +1,103 @@
/*
* variant.cpp - Digital pin mapping for TRACKER L1
*
* This file defines the pin mapping array that maps logical digital pins (D0-D17)
* to physical GPIO ports/pins on the Nordic nRF52 series microcontroller.
*
* Board: [Seeed Studio WIO TRACKER L1]
* Hardware Features:
* - LoRa module (CS/SCK/MISO/MOSI control pins)
* - GNSS module (TX/RX/Reset/Wakeup)
* - User LEDs (D11-D12)
* - User button (D13)
* - Grove/NFC interface (D14-D15)
* - Battery voltage monitoring (D16)
*
* Created [20250521]
* By [Dylan]
*/
#include "variant.h"
#include "nrf.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
/**
* @brief Digital pin to GPIO port/pin mapping table
*
* Format: Logical Pin (Dx) -> nRF Port.Pin (Px.xx)
*
*/
extern "C" {
const uint32_t g_ADigitalPinMap[] = {
// D0 .. D10 - Peripheral control pins
41, // D0 P1.09 GNSS_WAKEUP
7, // D1 P0.07 LORA_DIO1
39, // D2 P1.07 LORA_RESET
42, // D3 P1.10 LORA_BUSY
46, // D4 P1.14 (A4/SDA) LORA_CS
40, // D5 P1.08 (A5/SCL) LORA_SW
27, // D6 P0.27 (UART_TX) GNSS_TX
26, // D7 P0.26 (UART_RX) GNSS_RX
30, // D8 P0.30 (SPI_SCK) LORA_SCK
3, // D9 P0.3 (SPI_MISO) LORA_MISO
28, // D10 P0.28 (SPI_MOSI) LORA_MOSI
// D11-D12 - LED outputs
33, // D11 P1.1 User LED
// Buzzer
32, // D12 P1.0 Buzzer
// D13 - User input
8, // D13 P0.08 User Button
// D14-D15 - Grove interface
6, // D14 P0.06 OLED SDA
5, // D15 P0.05 OLED SCL
// D16 - Battery voltage ADC input
31, // D16 P0.31 VBAT_ADC
// GROVE
43, // D17 P0.00 GROVESDA
44, // D18 P0.01 GROVESCL
// FLASH
21, // D19 P0.21 (QSPI_SCK)
25, // D20 P0.25 (QSPI_CSN)
20, // D21 P0.20 (QSPI_SIO_0 DI)
24, // D22 P0.24 (QSPI_SIO_1 DO)
22, // D23 P0.22 (QSPI_SIO_2 WP)
23, // D24 P0.23 (QSPI_SIO_3 HOLD)
36, // D25 TB_UP
12, // D26 TB_DOWN
11, // D27 TB_LEFT
35, // D28 TB_RIGHT
37, // D29 TB_PRESS
4, // D30 BAT_CTL
13, // D31 EINK_SCK
14, // D32 EINK_RST
15, // D33 EINK_MOSI
16, // D34 EINK_DC
17, // D35 EINK_BUSY
19, // D36 EINK_CS
};
}
void initVariant()
{
pinMode(PIN_QSPI_CS, OUTPUT);
digitalWrite(PIN_QSPI_CS, HIGH);
// This setup is crucial for ensuring low power consumption and proper initialization of the hardware components.
// VBAT_ENABLE
pinMode(BAT_READ, OUTPUT);
digitalWrite(BAT_READ, HIGH);
pinMode(PIN_LED1, OUTPUT);
digitalWrite(PIN_LED1, LOW);
pinMode(PIN_LED2, OUTPUT);
digitalWrite(PIN_LED2, LOW);
}

View File

@@ -0,0 +1,194 @@
#ifndef _SEEED_TRACKER_L1_H_
#define _SEEED_TRACKER_L1_H_
#include "WVariant.h"
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Clock Configuration
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define VARIANT_MCK (64000000ul) // Master clock frequency
#define USE_LFXO // 32.768kHz crystal for LFCLK
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Pin Capacity Definitions
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define PINS_COUNT (38u) // Total GPIO pins
#define NUM_DIGITAL_PINS (38u) // Digital I/O pins
#define NUM_ANALOG_INPUTS (8u) // Analog inputs (A0-A5 + VBAT + AREF)
#define NUM_ANALOG_OUTPUTS (0u)
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// LED Configuration
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// LEDs
// LEDs
#define PIN_LED1 (11) // LED P1.15
#define PIN_LED2 (12) //
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
#define LED_GREEN PIN_LED1
#define LED_BLUE PIN_LED2
// #define LED_PIN PIN_LED2
#define LED_STATE_ON 1 // State when LED is litted
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Button Configuration
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#ifdef BUTTON_PIN
#undef BUTTON_PIN
#endif
#define BUTTON_PIN D13 // This is the Program Button
// #define BUTTON_NEED_PULLUP 1
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP false
#define BUTTON_PIN_TOUCH 13 // Touch button
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Digital Pin Mapping (D0-D10)
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define D0 0 // P1.06 GNSS_WAKEUP/IO0
#define D1 1 // P0.07 LORA_DIO1
#define D2 2 // P1.07 LORA_RESET
#define D3 3 // P1.10 LORA_BUSY
#define D4 4 // P1.14 LORA_CS
#define D5 5 // P1.08 LORA_SW
#define D6 6 // P0.27 GNSS_TX
#define D7 7 // P0.26 GNSS_RX
#define D8 8 // P0.30 SPI_SCK
#define D9 9 // P0.03 SPI_MISO
#define D10 10 // P0.28 SPI_MOSI
#define D12 12 // P1.00 Buzzer
#define D13 13 // P0.08 User Button
#define D14 14 // P0.05 OLED SCL
#define D15 15 // P0.06 OLED SDA
#define D16 16 // P0.31 VBAT_ADC
#define D17 17 // P0.00 GROVE SDA
#define D18 18 // P0.01 GROVE_SCL
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Analog Pin Definitions
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define PIN_A0 0 // P0.02 Analog Input 0
#define PIN_A1 1 // P0.03 Analog Input 1
#define PIN_A2 2 // P0.28 Analog Input 2
#define PIN_A3 3 // P0.29 Analog Input 3
#define PIN_A4 4 // P0.04 Analog Input 4
#define PIN_A5 5 // P0.05 Analog Input 5
#define PIN_VBAT D16 // P0.31 Battery voltage sense
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Communication Interfaces
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// I2C Configuration
#define HAS_WIRE 1
#define PIN_WIRE_SDA D18 // P0.09
#define PIN_WIRE_SCL D17 // P0.10
#define WIRE_INTERFACES_COUNT 1
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
// SPI Configuration (SX1262)
// #define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO 9 // P0.03 (D9)
#define PIN_SPI_MOSI 10 // P0.28 (D10)
#define PIN_SPI_SCK 8 // P0.30 (D8)
// SX1262 LoRa Module Pins
#define USE_SX1262
#define SX126X_CS D4 // Chip select
#define SX126X_DIO1 D1 // Digital IO 1 (Interrupt)
#define SX126X_BUSY D3 // Busy status
#define SX126X_RESET D2 // Reset control
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // TCXO supply voltage
#define SX126X_RXEN D5 // RX enable control
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_DIO2_AS_RF_SWITCH // This Line is really necessary for SX1262 to work with RF switch or will loss TX power
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// EINK
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define SPI_INTERFACES_COUNT 2
#define PIN_EINK_CS 36
#define PIN_EINK_BUSY 35
#define PIN_EINK_DC 34
#define PIN_EINK_RES 32
#define PIN_EINK_SCLK 31
#define PIN_EINK_MOSI 33
#define PIN_EINK_EN 14 // unused
#define PIN_SPI1_MISO 15 // unused
#define PIN_SPI1_MOSI PIN_EINK_MOSI
#define PIN_SPI1_SCK PIN_EINK_SCLK
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Power Management
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define BAT_READ 30 // D30 = P0.04 Reads battery voltage from divider on signal board.
#define BATTERY_SENSE_RESOLUTION_BITS 12
#define ADC_MULTIPLIER 2.0
#define BATTERY_PIN PIN_VBAT // PIN_A7
#define AREF_VOLTAGE 3.6
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// GPS L76KB
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define GPS_L76K
#ifdef GPS_L76K
#define PIN_GPS_RX D6 // P0.26
#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 GPS_RX_PIN PIN_GPS_TX
#define GPS_TX_PIN PIN_GPS_RX
#define PIN_GPS_STANDBY D0
// #define GPS_DEBUG
// #define GPS_EN D18 // P1.05
#endif
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// On-board QSPI Flash
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// On-board QSPI Flash
#define PIN_QSPI_SCK (21)
#define PIN_QSPI_CS (22)
#define PIN_QSPI_IO0 (23)
#define PIN_QSPI_IO1 (24)
#define PIN_QSPI_IO2 (25)
#define PIN_QSPI_IO3 (26)
#define EXTERNAL_FLASH_DEVICES P25Q16H
#define EXTERNAL_FLASH_USE_QSPI
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Buzzer
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Buzzer
#define PIN_BUZZER D12 // P1.00, pwm output
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// joystick
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#define CANNED_MESSAGE_MODULE_ENABLE 1
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Compatibility Definitions
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#ifdef __cplusplus
extern "C" {
#endif
// Serial port placeholders
#define PIN_SERIAL2_RX (-1)
#define PIN_SERIAL2_TX (-1)
#ifdef __cplusplus
}
#endif
#endif // _SEEED_TRACKER_L1_H_

View File

@@ -1,8 +1,8 @@
; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893
; Seeed Xiao BLE: https://wiki.seeedstudio.com/XIAO_BLE/
[env:seeed_xiao_nrf52840_kit]
extends = nrf52840_base
board = xiao_ble_sense
build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DSEEED_XIAO_NRF52840_KIT
build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DSEEED_XIAO_NRF52840_KIT -DGPS_L76K
board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_xiao_nrf52840_kit>
lib_deps =

View File

@@ -1,5 +1,5 @@
#ifndef _SEEED_XIAO_NRF52840_SENSE_H_
#define _SEEED_XIAO_NRF52840_SENSE_H_
#ifndef _SEEED_XIAO_NRF52840_KIT_H_
#define _SEEED_XIAO_NRF52840_KIT_H_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
@@ -79,9 +79,8 @@ static const uint8_t A5 = PIN_A5;
*/
/*
* D0 is shared with PIN_GPS_STANDBY on the L76K GNSS Module.
* There are some technical solutions that can solve this problem, and we are
* currently exploring and researching them.
* D0 is shared with PIN_GPS_STANDBY on the L76K GNSS Module, so refer to
* GPS_L76K definition preventing this conflict
*/
// #define BUTTON_PIN D0
@@ -93,51 +92,60 @@ static const uint8_t A5 = PIN_A5;
#define PIN_SERIAL2_TX (-1)
/*
* SPI Interfaces
* Pinout for SX126x
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (9)
#define PIN_SPI_MOSI (10)
#define PIN_SPI_SCK (8)
static const uint8_t SS = D4;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
#define USE_SX1262
// Pinout for SX126X
#ifdef XIAO_BLE_LEGACY_PINOUT
// Legacy xiao_ble variant pinout for third-party SX126x modules e.g. EBYTE E22
#define SX126X_CS D0
#define SX126X_DIO1 D1
#define SX126X_BUSY D2
#define SX126X_RESET D3
#define SX126X_RXEN D7
#elif defined(SEEED_XIAO_WIO_BTB)
// Wio-SX1262 for XIAO with 30-pin board-to-board connector
// https://files.seeedstudio.com/products/SenseCAP/Wio_SX1262/Schematic_Diagram_Wio-SX1262_for_XIAO.pdf
#define SX126X_CS D3
#define SX126X_DIO1 D0
#define SX126X_BUSY D1
#define SX126X_RESET D2
#define SX126X_RXEN D4
#else
// Wio-SX1262 for XIAO (standalone SKU 113010003 or nRF52840 kit SKU 102010710)
// https://files.seeedstudio.com/products/SenseCAP/Wio_SX1262/Wio-SX1262%20for%20XIAO%20V1.0_SCH.pdf
#define SX126X_CS D4
#define SX126X_DIO1 D1
#define SX126X_BUSY D3
#define SX126X_RESET D2
#define SX126X_RXEN D5
#endif
// Common pinouts for all SX126x pinouts above
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_RXEN D5 // This is used to control the RX side of the RF switch
#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the TX side of the RF switch
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
/*
* Wire Interfaces
* SPI Interfaces
* Defined after pinout for SX1262x to factor in CS pinout variations
*/
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
#define WIRE_INTERFACES_COUNT 1 // 2
#define SPI_INTERFACES_COUNT 1
// LSM6DS3TR on XIAO nRF52840 Series
#define PIN_WIRE_SDA (17)
#define PIN_WIRE_SCL (16)
#define PIN_SPI_MISO D9
#define PIN_SPI_MOSI D10
#define PIN_SPI_SCK D8
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
static const uint8_t SS = SX126X_CS;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
/*
* GPS
*/
// GPS L76KB
#define GPS_L76K
// GPS L76K
#ifdef GPS_L76K
#define PIN_GPS_RX D6
#define PIN_GPS_TX D7
@@ -146,6 +154,9 @@ static const uint8_t SCL = PIN_WIRE_SCL;
#define PIN_SERIAL1_RX PIN_GPS_TX
#define PIN_SERIAL1_TX PIN_GPS_RX
#define PIN_GPS_STANDBY D0
#else
#define PIN_SERIAL1_RX (-1)
#define PIN_SERIAL1_TX (-1)
#endif
/*
@@ -161,6 +172,43 @@ static const uint8_t SCL = PIN_WIRE_SCL;
#define BATTERY_SENSE_RESOLUTION_BITS (10)
/*
* Wire Interfaces
* Keep this section after potentially conflicting pin definitions
*/
#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much
#define WIRE_INTERFACES_COUNT 1
#if defined(XIAO_BLE_LEGACY_PINOUT)
// Used for I2C by DIY xiao_ble variant
#define PIN_WIRE_SDA D4
#define PIN_WIRE_SCL D5
#elif !defined(GPS_L76K)
// If D6 and D7 are free, I2C is probably the most versatile assignment
#define PIN_WIRE_SDA D6
#define PIN_WIRE_SCL D7
#else
// Internal LSM6DS3TR on XIAO nRF52840 Series
#define PIN_WIRE_SDA (17)
#define PIN_WIRE_SCL (16)
#endif
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
/*
* Buttons
* Keep this section after potentially conflicting pin definitions
* because D0 has multiple possible conflicts with various XIAO modules:
* - PIN_GPS_STANDBY on the L76K GNSS Module
* - DIO1 on the Wio-SX1262 - 30-pin board-to-board connector version
* - SX1262X CS on XIAO BLE legacy pinout
*/
#if !defined(GPS_L76K) && !defined(SEEED_XIAO_WIO_BTB) && !defined(XIAO_BLE_LEGACY_PINOUT)
#define BUTTON_PIN D0
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -6,9 +6,7 @@
#define I2C_SDA1 14 // Second i2c channel on external IO connector
#define I2C_SCL1 15 // Second i2c channel on external IO connector
#define BUTTON_PIN 36 // The middle button GPIO on the Nano G1
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
// anywhere.
#define BUTTON_PIN 36 // The middle button GPIO on the Nano G1
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
// common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if

View File

@@ -9,7 +9,6 @@ upload_protocol = esptool
build_flags = ${esp32s3_base.build_flags}
-DT_DECK
-DBOARD_HAS_PSRAM
-DMAX_THREADS=40
-DGPS_POWER_TOGGLE
-Ivariants/t-deck
@@ -25,11 +24,6 @@ extends = env:t-deck
build_flags =
${env:t-deck.build_flags}
-D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1
-D INPUTDRIVER_I2C_KBD_TYPE=0x55
-D INPUTDRIVER_ENCODER_TYPE=3
-D INPUTDRIVER_ENCODER_LEFT=1
@@ -39,7 +33,7 @@ build_flags =
-D INPUTDRIVER_ENCODER_BTN=0
-D INPUTDRIVER_BUTTON_TYPE=0
-D HAS_SDCARD
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D HAS_TFT=1
-D USE_I2S_BUZZER
-D RAM_SIZE=5120
@@ -57,7 +51,10 @@ build_flags =
-D RADIOLIB_DEBUG_SPI=0
-D RADIOLIB_DEBUG_PROTOCOL=0
-D RADIOLIB_SPI_PARANOID=0
-D CALIBRATE_TOUCH=0
; -D CALIBRATE_TOUCH=0
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D DISPLAY_SIZE=320x240 ; landscape mode
-D LGFX_DRIVER=LGFX_TDECK
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_T_DECK.h\"
; -D LVGL_DRIVER=LVGL_TDECK

View File

@@ -1,7 +1,5 @@
#define TFT_CS 12
#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui
#define BUTTON_PIN 0
// ST7789 TFT LCD
#define ST7789_CS TFT_CS
@@ -24,7 +22,6 @@
#define SCREEN_ROTATE
#define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
#endif
#define HAS_TOUCHSCREEN 1
#define SCREEN_TOUCH_INT 16
@@ -34,10 +31,10 @@
#define USE_POWERSAVE
#define SLEEP_TIME 120
#ifndef HAS_TFT
#define BUTTON_PIN 0
// #define BUTTON_NEED_PULLUP
#endif
#define TB_PRESS 0
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP true
#define GPS_DEFAULT_NOT_PRESENT 1
#define GPS_RX_PIN 44
#define GPS_TX_PIN 43
@@ -71,6 +68,7 @@
#define TB_LEFT 1
#define TB_RIGHT 2
#define TB_PRESS 0 // BUTTON_PIN
#define TB_DIRECTION FALLING
// microphone
#define ES7210_SCK 47

View File

@@ -57,7 +57,8 @@ void setupNicheGraphics()
inkhud->setDisplayResilience(20, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings

View File

@@ -61,8 +61,12 @@ extern "C" {
* Buttons
*/
#define PIN_BUTTON1 (32 + 10)
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP true
#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 PIN_BUTTON_TOUCH (0 + 11) // 0.11 is the soft touch button on T-Echo
#define BUTTON_TOUCH_ACTIVE_LOW true
#define BUTTON_TOUCH_ACTIVE_PULLUP true
#define BUTTON_CLICK_MS 400
#define BUTTON_TOUCH_MS 200
@@ -139,6 +143,7 @@ External serial flash WP25R1635FZUIL0
// Not really an E22 but TTGO seems to be trying to clone that
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define TCXO_OPTIONAL
// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
// code)
@@ -214,7 +219,7 @@ External serial flash WP25R1635FZUIL0
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
#define ADC_MULTIPLIER (2.0F)
#define NO_EXT_GPIO 1
// #define NO_EXT_GPIO 1
#define HAS_RTC 1

View File

@@ -7,8 +7,6 @@
#define I2C_SCL 18 // For QMC6310 sensors and screens
#define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
// anywhere.
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
#define LED_STATE_ON 0 // State when LED is lit

View File

@@ -4,8 +4,8 @@
#define I2C_SCL 22
#define BUTTON_PIN 38 // The middle button GPIO on the T-Beam
// #define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented
// anywhere.
#define BUTTON_ACTIVE_LOW true
#define BUTTON_ACTIVE_PULLUP true
#define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
#define LED_STATE_ON 0 // State when LED is lit

View File

@@ -51,7 +51,8 @@ void setupNicheGraphics()
inkhud->setDisplayResilience(15, 1.5);
// Select fonts
InkHUD::Applet::fontLarge = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
// Customize default settings

View File

@@ -31,7 +31,6 @@ build_flags =
${inkhud.build_flags}
-I variants/tlora_t3s3_epaper
-D TLORA_T3S3_EPAPER
-D MAX_THREADS=40 ; Required if used with WiFi
lib_deps =
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
${esp32s3_base.lib_deps}

View File

@@ -72,7 +72,7 @@
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Picomputer gets a white on black display
#define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF)
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 255)
// keyboard changes

View File

@@ -96,7 +96,7 @@
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Picomputer gets a white on black display
#define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF)
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 255)
// keyboard changes

View File

@@ -74,7 +74,7 @@
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Picomputer gets a white on black display
#define TFT_MESH COLOR565(0xFF, 0xFF, 0xFF)
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 255)
// keyboard changes

View File

@@ -36,21 +36,16 @@ extends = env:unphone
build_flags =
${env:unphone.build_flags}
-D CONFIG_DISABLE_HAL_LOCKS=1
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1
-D INPUTDRIVER_BUTTON_TYPE=21
-D HAS_SCREEN=0
-D HAS_SCREEN=1
-D HAS_TFT=1
-D HAS_SDCARD
-D DISPLAY_SET_RESOLUTION
-D RAM_SIZE=6144
-D LV_CACHE_DEF_SIZE=2097152
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D LV_BUILD_TEST=0
-D LV_USE_SYSMON=0
-D LV_USE_PROFILER=0
@@ -59,6 +54,9 @@ build_flags =
-D LV_USE_LOG=0
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D DISPLAY_SIZE=320x480 ; portrait mode
-D LGFX_DRIVER=LGFX_UNPHONE_V9
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_UNPHONE.h\"
-D VIEW_320x240

View File

@@ -57,9 +57,12 @@
#define LED_PIN 13 // the red part of the RGB LED
#define LED_STATE_ON 0 // State when LED is lit
#define BUTTON_PIN 21 // Button 3 - square - top button in landscape mode
#define BUTTON_NEED_PULLUP // we do need a helping hand up
#define BUTTON_PIN_ALT 45 // Button 1 - triangle - bottom button in landscape mode
#define ALT_BUTTON_PIN 21 // Button 3 - square - top button in landscape mode
#define BUTTON_PIN 0 // Circle button
#define BUTTON_NEED_PULLUP // we do need a helping hand up
#define CANCEL_BUTTON_PIN 45 // Button 1 - triangle - bottom button in landscape mode
#define CANCEL_BUTTON_ACTIVE_LOW true
#define CANCEL_BUTTON_ACTIVE_PULLUP true
#define I2C_SDA 3 // I2C pins for this board
#define I2C_SCL 4

View File

@@ -8,20 +8,17 @@ build_flags =
-DSERIAL_UART_INSTANCE=1
-DPIN_SERIAL_RX=PB7
-DPIN_SERIAL_TX=PB6
-DPIN_WIRE_SDA=PA15
-DPIN_WIRE_SCL=PB15
-DHAL_DAC_MODULE_ONLY
-DHAL_RNG_MODULE_ENABLED
-DRADIOLIB_EXCLUDE_SX128X=1
-DRADIOLIB_EXCLUDE_SX127X=1
-DRADIOLIB_EXCLUDE_LR11X0=1
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1
-DMESHTASTIC_EXCLUDE_I2C=1
-DMESHTASTIC_EXCLUDE_WIFI=1
-DMESHTASTIC_EXCLUDE_BLUETOOTH=1
-DMESHTASTIC_EXCLUDE_GPS=1
-DMESHTASTIC_EXCLUDE_SCREEN=1
-DMESHTASTIC_EXCLUDE_MQTT=1
-DMESHTASTIC_EXCLUDE_POWERMON=1
;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
;-DCFG_DEBUG
-DHAS_SENSOR
upload_port = stlink
upload_port = stlink
lib_deps =
${stm32_base.lib_deps}
# Add your custom sensor here!

View File

@@ -1,264 +0,0 @@
#
<p align="center" style="font-size: 28px;">
Xiao BLE/BLE Sense + Ebyte E22-900M30S
</p>
<p align="center" style="font-size: 20px;">
A step-by-step guide for macOS and Linux
</p>
## Introduction
This guide will walk you through everything needed to get the Xiao BLE (or BLE Sense) running Meshtastic using an Ebyte E22-900M30S LoRa module. The combination of the E22 with an nRF52840 MCU is desirable because it allows for both very low idle (Rx) power draw <i>and</i> high transmit power. The Xiao BLE is a small but surprisingly well-appointed nRF52840 board, with enough GPIO for most Meshtastic applications and a built-in LiPo charger. The E22, on the other hand, is a famously inscrutable and mysterious beast. It is one of the more readily available LoRa modules capable of transmitting at 30 dBm, and includes an LNA to boost its Rx sensitivity a few dB beyond that of the SX1262. However, its documentation is relatively sparse overall, and seems to merely hint at (or completely omit) several key details regarding its functionality. Thus, much of what follows is a synthesis of my observations and inferences over the course of many hours of trial and error.
<h3>Acknowledgement and friendly disclaimer</h3>
Huge thanks to those in the community who have forged the way with the E22, without whose hard work none of this would have been possible! (thebentern, riddick, rainer_vie, beegee-tokyo, geeksville, caveman99, Der_Bear, PlumRugOfDoom, BigCorvus, and many others.)
<br>
Please take the conclusions here as a tentative work in progress, representing my current (and fairly limited) understanding of the E22 when paired with this particular MCU. It is my hope that this guide will be helpful to others who are interested in trying a DIY Meshtastic build, and also be subject to revision by folks with more experience and better test equipment.
### Obligatory liability disclaimer
This guide and all associated content is for informational purposes only. The information presented is intended for consumption only by persons having appropriate technical skill and judgement, to be used entirely at their own discretion and risk. The authors of this guide in no way provide any warranty, express or implied, toward the content herein, nor its correctness, safety, or suitability to any particular purpose. By following the instructions in this guide in part or in full, you assume all responsibility for all potential risks, including but not limited to fire, property damage, bodily injury, and death.
### Note
These instructions assume you are running macOS or Linux, but it should be relatively easy to translate each command for Windows. (In this case, in step 2 below, each line of `xiao_ble.sh` would also need to be converted to the equivalent Windows CLI command and run individually.)
## 1. Update Bootloader
The first thing you will need to do is update the Xiao BLE's bootloader. The stock bootloader is functionally very similar to the Adafruit nRF52 UF2 bootloader, but apparently not quite enough so to work with Meshtastic out of the box.
1. Connect the Xiao BLE to your computer via USB-C.
2. Install `adafruit-nrfutil` by following the instructions <a href="https://github.com/adafruit/Adafruit_nRF52_nrfutil">here</a>.
3. Open a terminal window and navigate to `firmware/variants/xiao_ble` (where `firmware` is the directory into which you have cloned the <a href="https://github.com/meshtastic/firmware">Meshtastic firmware repo</a>).
4. Run the following command, replacing `/dev/cu.usbmodem2101` with the serial port your Xiao BLE is connected to:
```bash
adafruit-nrfutil --verbose dfu serial --package xiao_nrf52840_ble_bootloader-0.7.0-22-g277a0c8_s140_7.3.0.zip --port /dev/cu.usbmodem2101 -b 115200 --singlebank --touch 1200
```
5. If all goes well, the Xiao BLE's red LED should start to pulse slowly, and you should see a new USB storage device called `XIAO-BOOT` appear under `Locations` in Finder.
&nbsp;
## 2. PlatformIO Environment Preparation
Before building Meshtastic for the Xiao BLE + E22, it is necessary to pull in SoftDevice 7.3.0 and its associated linker script (nrf52840_s140_v7.ld) from Seeed Studio's Arduino core. The `xiao_ble.sh` script does this.
1. In your terminal window, run the following command:
```bash
sudo ./xiao_ble.sh
```
&nbsp;
## 3. Build Meshtastic
At this point, you should be able to build the firmware successfully.
1. In VS Code, press `Command Shift P` to bring up the command palette.
2. Search for and run the `Developer: Reload Window` command.
3. Bring up the command palette again with `Command Shift P`. Search for and run the `PlatformIO: Pick Project Environment` command.
4. In the list of environments, select `env:xiao_ble`. PlatformIO may update itself for a minute or two, and should let you know once done.
5. Return to the command palette once again (`Command Shift P`). Search for and run the `PlatformIO: Build` command.
6. PlatformIO will build the project. After a few minutes you should see a green `SUCCESS` message.
&nbsp;
## 4. Wire the board
Connecting the E22 to the Xiao BLE is straightforward, but there are a few gotchas to be mindful of.
- <strong>On the Xiao BLE:</strong>
- Pins D4 and D5 are currently mapped to `PIN_WIRE_SDA` and `PIN_WIRE_SCL`, respectively. If you are not using I²C and would like to free up pins D4 and D5 for use as GPIO, `PIN_WIRE_SDA` and `PIN_WIRE_SCL` can be reassigned to any two other unused pin numbers.
- Pins D6 and D7 were originally mapped to the TX and RX pins for serial interface 1 (`PIN_SERIAL1_RX` and `PIN_SERIAL1_TX`) but are currently set to -1 in `variant.h`. If you need to expose a serial interface, you can restore these pins and move e.g. `SX126X_RXEN` to pin 4 or 5 (the opposite should work too).
- <strong>On the E22:</strong>
- There are two options for the E22's `TXEN` pin:
1. It can be connected to the MCU on the pin defined as `SX126X_TXEN` in `variant.h`. In this configuration, the MCU will control Tx/Rx switching "manually". As long as `SX126X_TXEN` and `SX126X_RXEN` are both defined in `variant.h` (and neither is set to `RADIOLIB_NC`), `SX126xInterface.cpp` will initialize the E22 correctly for this mode.
2. Alternately, it can be connected to the E22's `DIO2` pin only, with neither `TXEN` nor `DIO2` being connected to the MCU. In this configuration, the E22 will control Tx/Rx switching automatically. In `variant.h`, as long as `SX126X_TXEN` is defined as `RADIOLIB_NC`, and `SX126X_RXEN` is defined and connected to the E22's `RXEN` pin, and `E22_TXEN_CONNECTED_TO_DIO2` is defined, `SX126xInterface.cpp` will initialize the E22 correctly for this mode. This configuration frees up a GPIO, and presents no drawbacks that I have found.
- Note that any combination other than the two described above will likely result in unexpected behavior. In my testing, some of these other configurations appeared to "work" at first glance, but every one I tried had at least one of the following flaws: weak Tx power, extremely poor Rx sensitivity, or the E22 overheating because TXEN was never pulled low, causing its PA to stay on indefinitely.
- Along the same lines, it is a good idea to check the E22's temperature frequently by lightly touching the shield. If you feel the shield getting hot (i.e. approaching uncomfortable to touch) near pins 1, 2, and 3, something is probably misconfigured; disconnect both the Xiao BLE and E22 from power and double check wiring and pin mapping.
- Whether you opt to let the E22 control Rx and Tx or handle this manually, <strong>the E22's `RXEN` pin must always be connected to the MCU</strong> on the pin defined as `SX126X_RXEN` in `variant.h`.
<h3>Note</h3>
The default pin mapping in `variant.h` uses 'automatic Tx/Rx switching' mode. If you wire your board for manual Rx/Tx switching, make sure to update `variant.h` accordingly by commenting/uncommenting the necessary lines in the 'E22 Tx/Rx control options' section.
&nbsp;
---
&nbsp;
<h3>Example wiring for "E22 automatic Tx/Rx switching" mode:</h3>
&nbsp;
<strong>MCU -> E22 connections</strong>
| Xiao BLE pin | variant.h definition | E22 pin | Notes |
| :----------- | :------------------- | :-------- | :------------------------------------------------------------------------------------------------------------------- |
| D0 | SX126X_CS | 19 (NSS) | |
| D1 | SX126X_DIO1 | 13 (DIO1) | |
| D2 | SX126X_BUSY | 14 (BUSY) | |
| D3 | SX126X_RESET | 15 (NRST) | |
| D7 | SX126X_RXEN | 6 (RXEN) | These pins must still be connected, and `SX126X_RXEN` defined in `variant.h`, otherwise Rx sensitivity will be poor. |
| D8 | PIN_SPI_SCK | 18 (SCK) | |
| D9 | PIN_SPI_MISO | 16 (MISO) | |
| D10 | PIN_SPI_MOSI | 17 (MOSI) | |
&nbsp;
&nbsp;
<strong>E22 -> E22 connections:</strong>
| E22 pin | E22 pin | Notes |
| :------ | :------ | :------------------------------------------------------------------------ |
| TXEN | DIO2 | These must be physically connected for automatic Tx/Rx switching to work. |
<h3>Note</h3>
The schematic (`xiao-ble-e22-schematic.png`) in the `eagle-project` directory uses this wiring.
&nbsp;
---
&nbsp;
<h3>Example wiring for "Manual Tx/Rx switching" mode:</h3>
<strong>MCU -> E22 connections</strong>
| Xiao BLE pin | variant.h definition | E22 pin | Notes |
| :----------- | :------------------- | :-------- | :---- |
| D0 | SX126X_CS | 19 (NSS) | |
| D1 | SX126X_DIO1 | 13 (DIO1) | |
| D2 | SX126X_BUSY | 14 (BUSY) | |
| D3 | SX126X_RESET | 15 (NRST) | |
| D6 | SX126X_TXEN | 7 (TXEN) | |
| D7 | SX126X_RXEN | 6 (RXEN) | |
| D8 | PIN_SPI_SCK | 18 (SCK) | |
| D9 | PIN_SPI_MISO | 16 (MISO) | |
| D10 | PIN_SPI_MOSI | 17 (MOSI) | |
<strong>E22 -> E22 connections:</strong> (none)
&nbsp;
## 5. Flash the firmware to the Xiao BLE
1. Double press the Xiao's `reset` button to put it in bootloader mode.
2. In a terminal window, navigate to the Meshtastic firmware repo's root directory, and from there to `.pio/build/xiao_ble`.
3. Convert the generated `.hex` file into a `.uf2` file:
```bash
../../../bin/uf2conv.py firmware.hex -c -o firmware.uf2 -f 0xADA52840
```
4. Copy the new `.uf2` file to the Xiao's mass storage volume:
```bash
cp firmware.uf2 /Volumes/XIAO-BOOT
```
5. The Xiao's red LED will flash for several seconds as the firmware is copied.
6. Once the firmware is copied, to verify it is running, run the following command:
```bash
meshtastic --noproto
```
7. Then, press the Xiao's `reset` button again. You should see a lot of debug output logged in the terminal window.
&nbsp;
## 6. Troubleshooting
- If after flashing Meshtastic, the Xiao is bootlooped, look at the serial output (you can see this by running `meshtastic --noproto` with the device connected to your computer via USB).
- If you see that the SX1262 init result was -2, this likely indicates a wiring problem; double check your wiring and pin mapping in `variant.h`.
- If you see an error mentioning tinyFS, this may mean you need to reformat the Xiao's storage:
1. Double press the `reset` button to put the Xiao in bootloader mode.
2. In a terminal window, navigate to the Meshtastic firmware repo's root directory, and from there to `variants/xiao_ble`.
3. Run the following command: &nbsp;`cp xiao-ble-internal-format.uf2 /Volumes/XIAO-BOOT`
4. The Xiao's red LED will flash briefly as the filesystem format firmware is copied.
5. Run the following command: &nbsp;`meshtastic --noproto`
6. In the output of the above command, you should see a message saying "Formatting...done".
7. To flash Meshtastic again, repeat the steps in section 5 above.
- If you don't see any specific error message, but the boot process is stuck or not proceeding as expected, this might also mean there is a conflict in `variant.h`. If you have made any changes to the pin mapping, ensure they do not result in a conflict. If all else fails, try reverting your changes and using the known-good configuration included here.
- The above might also mean something is wired incorrectly. Try reverting to one of the known-good example wirings in section 4.
- If the E22 gets hot to the touch:
- The power amplifier is likely running continually. Disconnect it and the Xiao from power immediately, and double check wiring and pin mapping. In my experimentation this occurred in cases where TXEN was inadvertenly high (usually due to a pin mapping conflict).
&nbsp;
## 7. Notes
- There are several anecdotal recommendations regarding the Tx power the E22's internal SX1262 should be set to in order to achieve the advertised output of 30 dBm, ranging from 4 (per <a href="https://github.com/jgromes/RadioLib/wiki/High-power-Radio-Modules-Guide">this article</a> in the RadioLib github repo) to 22 (per <a href="https://discord.com/channels/867578229534359593/871539930852130866/976472577545490482">this conversation</a> from the Meshtastic Discord). When paired with the Xiao BLE in the configurations described above, I observed that the output is at its maximum when Tx power is set to 22.
- To achieve its full output, the E22 should have a bypass capacitor from its 5V supply to ground. 100 µF works well.
- The E22 will happily run on voltages lower than 5V, but the full output power will not be realized. For example, with a fully charged LiPo at 4.2V, Tx power appears to max out around 26-27 dBm.
&nbsp;
## 8. Testing Methodology
During what became a fairly long trial-and-error process, I did a lot of careful testing of Tx power and Rx sensitivity. My methodology in these tests was as follows:
- All tests were conducted between two nodes:
1. The Xiao BLE + E22 coupled with an <a href="https://www.digikey.com/en/products/detail/abracon-llc/ARRKP4065-S915A/8593263">Abracon ARRKP4065-S915A</a> ceramic patch antenna
2. A RAK 5005/4631 coupled with a <a href="https://www.streakwave.com/laird-technologies-ma9-5n-55dbi-900mhz-mobile-omni-select-mount">Laird MA9-5N</a> antenna via a 4" U.FL to Type N pigtail.
- No other nodes were powered up onsite or nearby.
<br>
- Each node and its antenna was kept in exactly the same position and orientation throughout testing.
- Other environmental factors (e.g. the location and resting position of my body in the room while testing) were controlled as carefully as possible.
- Each test comprised at least five (and often ten) runs, after which the results were averaged.
- All testing was done by sending single-character messages between nodes and observing the received RSSI reported in the message acknowledgement. Messages were sent one by one, waiting for each to be acknowledged or time out before sending the next.
- The E22's Tx power was observed by sending messages from the RAK to the Xiao BLE + E22 and recording the received RSSI.
- The opposite was done to observe the E22's Rx sensitivity: messages were sent from the Xiao BLE + E22 to the RAK, and the received RSSI was recorded.
While this cannot match the level of accuracy achievable with actual test equipment in a lab setting, it was nonetheless sufficient to demonstrate the (sometimes very large) differences in Tx power and Rx sensitivity between various configurations.

View File

@@ -1,13 +0,0 @@
; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893
[env:xiao_ble]
extends = nrf52840_base
board = xiao_ble_sense
board_level = extra
build_flags = ${nrf52840_base.build_flags} -Ivariants/xiao_ble -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -D EBYTE_E22 -DEBYTE_E22_900M30S -DPRIVATE_HW
board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/xiao_ble>
lib_deps =
${nrf52840_base.lib_deps}
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@@ -1,62 +0,0 @@
#include "variant.h"
#include "nrf.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
const uint32_t g_ADigitalPinMap[] = {
// D0 .. D13
2, // D0 is P0.02 (A0)
3, // D1 is P0.03 (A1)
28, // D2 is P0.28 (A2)
29, // D3 is P0.29 (A3)
4, // D4 is P0.04 (A4,SDA)
5, // D5 is P0.05 (A5,SCL)
43, // D6 is P1.11 (TX)
44, // D7 is P1.12 (RX)
45, // D8 is P1.13 (SCK)
46, // D9 is P1.14 (MISO)
47, // D10 is P1.15 (MOSI)
// LEDs
26, // D11 is P0.26 (LED RED)
6, // D12 is P0.06 (LED BLUE)
30, // D13 is P0.30 (LED GREEN)
14, // D14 is P0.14 (READ_BAT)
// LSM6DS3TR
40, // D15 is P1.08 (6D_PWR)
27, // D16 is P0.27 (6D_I2C_SCL)
7, // D17 is P0.07 (6D_I2C_SDA)
11, // D18 is P0.11 (6D_INT1)
// MIC
42, // 17,//42, // D19 is P1.10 (MIC_PWR)
32, // 26,//32, // D20 is P1.00 (PDM_CLK)
16, // 25,//16, // D21 is P0.16 (PDM_DATA)
// BQ25100
13, // D22 is P0.13 (HICHG)
17, // D23 is P0.17 (~CHG)
//
21, // D24 is P0.21 (QSPI_SCK)
25, // D25 is P0.25 (QSPI_CSN)
20, // D26 is P0.20 (QSPI_SIO_0 DI)
24, // D27 is P0.24 (QSPI_SIO_1 DO)
22, // D28 is P0.22 (QSPI_SIO_2 WP)
23, // D29 is P0.23 (QSPI_SIO_3 HOLD)
// NFC
9, // D30 is P0.09 (NFC1)
10, // D31 is P0.10 (NFC2)
// VBAT
31, // D32 is P0.10 (VBAT)
};
void initVariant()
{
// Set BQ25101 ISET to 100mA instead of 50mA
pinMode(HICHG, OUTPUT);
digitalWrite(HICHG, LOW);
}

View File

@@ -1,212 +0,0 @@
#ifndef _SEEED_XIAO_NRF52840_SENSE_H_
#define _SEEED_XIAO_NRF52840_SENSE_H_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
// #define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define PINS_COUNT (33)
#define NUM_DIGITAL_PINS (33)
#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define LED_RED 11
#define LED_BLUE 12
#define LED_GREEN 13
#define PIN_LED1 LED_GREEN
#define PIN_LED2 LED_BLUE
#define PIN_LED3 LED_RED
#define PIN_LED PIN_LED1
#define LED_PWR (PINS_COUNT)
#define LED_BUILTIN PIN_LED
#define LED_STATE_ON 1 // State when LED is lit
/*
* Buttons
*/
#define PIN_BUTTON1 (PINS_COUNT)
// Digital PINs
#define D0 (0ul)
#define D1 (1ul)
#define D2 (2ul)
#define D3 (3ul)
#define D4 (4ul)
#define D5 (5ul)
#define D6 (6ul)
#define D7 (7ul)
#define D8 (8ul)
#define D9 (9ul)
#define D10 (10ul)
/*
* Analog pins
*/
#define PIN_A0 (0)
#define PIN_A1 (1)
#define PIN_A2 (2)
#define PIN_A3 (3)
#define PIN_A4 (4)
#define PIN_A5 (5)
#define PIN_VBAT (32)
#define VBAT_ENABLE (14)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
#define ADC_RESOLUTION 12
// Other pins
#define PIN_NFC1 (30)
#define PIN_NFC2 (31)
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX (-1) // (7)
#define PIN_SERIAL1_TX (-1) // (6)
#define PIN_SERIAL2_RX (-1)
#define PIN_SERIAL2_TX (-1)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (9)
#define PIN_SPI_MOSI (10)
#define PIN_SPI_SCK (8)
static const uint8_t SS = D0;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
// supported modules list
#define USE_SX1262
// common pinouts for SX126X modules
#define SX126X_CS D0
#define SX126X_DIO1 D1
#define SX126X_BUSY D2
#define SX126X_RESET D3
// ----------------------------------------------------------------
// E22 Tx/Rx control options:
// 1. Let the E22 control Tx and Rx automagically via DIO2.
// * The E22's TXEN and DIO2 pins are connected to each other, but not to the MCU.
// * The E22's RXEN pin *is* connected to the MCU.
// * E22_TXEN_CONNECTED_TO_DIO2 is defined so the logic in SX126XInterface.cpp handles this configuration correctly.
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_RXEN D7
// ------------------------------ OR ------------------------------
// 2. Control Tx and Rx manually.
// * The E22's TXEN and RXEN pins are both connected to the MCU.
// #define SX126X_TXEN D6
// #define SX126X_RXEN D7
// ----------------------------------------------------------------
#ifdef EBYTE_E22
// Internally the TTGO module hooks the SX126x-DIO2 in to control the TX/RX switch
// (which is the default for the sx1262interface code)
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#ifdef EBYTE_E22_900M30S
// 10dB PA gain and 30dB rated output; based on measurements from
// https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt
#define TX_GAIN_LORA 7
#define SX126X_MAX_POWER 22
#endif
#ifdef EBYTE_E22_900M33S
// 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf
#define TX_GAIN_LORA 25
#define SX126X_MAX_POWER 8
#endif
#endif
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1 // 2
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)
static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;
#define PIN_LSM6DS3TR_C_POWER (15)
#define PIN_LSM6DS3TR_C_INT1 (18)
// PDM Interfaces
// ---------------
#define PIN_PDM_PWR (19)
#define PIN_PDM_CLK (20)
#define PIN_PDM_DIN (21)
// QSPI Pins
#define PIN_QSPI_SCK (24)
#define PIN_QSPI_CS (25)
#define PIN_QSPI_IO0 (26)
#define PIN_QSPI_IO1 (27)
#define PIN_QSPI_IO2 (28)
#define PIN_QSPI_IO3 (29)
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES P25Q16H
#define EXTERNAL_FLASH_USE_QSPI
// Battery
#define ADC_CTRL VBAT_ENABLE // P0.14: VBAT voltage divider
#define ADC_CTRL_ENABLED LOW // ... sink
#define BATTERY_SENSE_RESOLUTION_BITS 10
#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED
#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge
// The battery sense is hooked to pin A0 (5)
#define BATTERY_PIN PIN_VBAT // PIN_A0
// ratio of voltage divider = 3.0 (R17=1M, R18=510k)
#define ADC_MULTIPLIER 3 // 3.0 + a bit for being optimistic
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif

View File

@@ -1,15 +0,0 @@
#!/bin/bash
# adapted from the script linked in this very helpful article: https://enzolombardi.net/low-power-bluetooth-advertising-with-xiao-ble-and-platformio-e8e7d0da80d2
# source: https://gist.githubusercontent.com/turing-complete-labs/b3105ee653782183c54b4fdbe18f411f/raw/d86779ba7702775d3b79781da63d85442acd9de6/xiao_ble.sh
# download the core for arduino from seeedstudio. Softdevice 7.3.0, linker and variants folder are what we need
curl https://files.seeedstudio.com/arduino/core/nRF52840/Arduino_core_nRF52840.tar.bz2 -o arduino.core.1.0.0.tar.bz2
tar -xjf arduino.core.1.0.0.tar.bz2
rm arduino.core.1.0.0.tar.bz2
# copy the needed files
cp 1.0.0/cores/nRF5/linker/nrf52840_s140_v7.ld ~/.platformio/packages/framework-arduinoadafruitnrf52/cores/nRF5/linker
cp -r 1.0.0/cores/nRF5/nordic/softdevice/s140_nrf52_7.3.0_API ~/.platformio/packages/framework-arduinoadafruitnrf52/cores/nRF5/nordic/softdevice
rm -rf 1.0.0
echo done!