From 73e144110269801493c893bc6cbe8e48b1785401 Mon Sep 17 00:00:00 2001 From: Brad Barnett <127794626+bdbarnett@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:43:42 -0600 Subject: [PATCH] board configs: board_peripherals for the Seeed Studio XIAO ESP32C5 seeed_xiao_esp32c5 is the XIAO ESP32C5's own package in nodisplay, so the board runs the remote-display config today and keeps its roles when a display's config is installed later: the user LED, the BOOT button (also as keypad()), the battery sense, I2C on D4/D5, Wi-Fi and Bluetooth LE. Ran tools/mark_tested.py for it and for remote-display on a XIAO ESP32C5 with nothing attached: every check passed. --- .../nodisplay/remote-display/tested.json | 18 +++ .../seeed_xiao_esp32c5/board_peripherals.py | 108 ++++++++++++++++++ .../nodisplay/seeed_xiao_esp32c5/manifest.py | 15 +++ .../nodisplay/seeed_xiao_esp32c5/package.json | 25 ++++ .../nodisplay/seeed_xiao_esp32c5/tested.json | 23 ++++ docs/boards/board-configs.md | 1 + 6 files changed, 190 insertions(+) create mode 100644 board_configs/nodisplay/seeed_xiao_esp32c5/board_peripherals.py create mode 100644 board_configs/nodisplay/seeed_xiao_esp32c5/manifest.py create mode 100644 board_configs/nodisplay/seeed_xiao_esp32c5/package.json create mode 100644 board_configs/nodisplay/seeed_xiao_esp32c5/tested.json diff --git a/board_configs/nodisplay/remote-display/tested.json b/board_configs/nodisplay/remote-display/tested.json index 0b0c3155..e5708b30 100644 --- a/board_configs/nodisplay/remote-display/tested.json +++ b/board_configs/nodisplay/remote-display/tested.json @@ -34,6 +34,24 @@ ], "skipped": [], "tool": "tools/mark_tested.py" + }, + { + "hardware": "Seeed Studio XIAO ESP32C5 (ESP32-C5HR8, 8 MB flash, 8 MB PSRAM) with its seeed_xiao_esp32c5 package, nothing attached", + "firmware": "micropython 1.30.0 (Seeed XIAO ESP32C5 with ESP32-C5), v1.30.0-preview.322.gb9620707e3 on 2026-11-25", + "date": "2026-11-25", + "smoke": "passed", + "checks": [ + "board_config imports", + "display draws", + "battery answers", + "ble answers", + "boot_button answers", + "i2c answers", + "led answers", + "wlan answers" + ], + "skipped": [], + "tool": "tools/mark_tested.py" } ] } diff --git a/board_configs/nodisplay/seeed_xiao_esp32c5/board_peripherals.py b/board_configs/nodisplay/seeed_xiao_esp32c5/board_peripherals.py new file mode 100644 index 00000000..ce32f751 --- /dev/null +++ b/board_configs/nodisplay/seeed_xiao_esp32c5/board_peripherals.py @@ -0,0 +1,108 @@ +# SPDX-FileCopyrightText: 2026 Brad Barnett +# +# SPDX-License-Identifier: MIT + +"""Lazy roles for the Seeed Studio XIAO ESP32C5. PERIPHERALS = lazy roles only. + +The XIAO ESP32C5 is an ESP32-C5 (dual-band Wi-Fi 6, Bluetooth LE) with 8 MB +of flash and 8 MB of PSRAM, a USB-C port on the chip's own USB Serial/JTAG, +and a LiPo charger. Pins are from Seeed's pin table and the firmware's: + + user LED GPIO27, yellow, low to light + BOOT button GPIO28, low when pressed + battery sense GPIO6, through a 1:2 divider that GPIO26 connects + I2C D4 SDA (GPIO23), D5 SCL (GPIO24) + antenna Wi-Fi and Bluetooth through the U.FL connector; fit + the antenna before using either + +It has no display and no audio. Install the ``remote-display`` board config +beside this package for a screen in a web browser, or a display's own board +config when one is fitted. + +Checked on a board with nothing attached: every role opens, BOOT reads high +when not pressed, the battery role reads the charger's 4.0 V with no battery +fitted, Wi-Fi joins on 2.4 GHz and on 5 GHz, BLE starts, and the +``remote-display`` board config draws beside this package. Not checked, for +want of hands or hardware: the LED by eye, a press of BOOT, a real battery, +and anything on the I2C pins. +""" + +import sys + +import boarddev + +PERIPHERALS = frozenset({"led", "boot_button", "battery", "i2c", "wlan", "ble"}) + +_LED = 27 +_BOOT = 28 +_BAT_ADC = 6 # battery divider tap +_BAT_EN = 26 # high connects the divider +_SDA = 23 # D4 +_SCL = 24 # D5 + + +def load_peripherals(ns): + boarddev.bind_lazy(ns, sys.modules[__name__]) + + +def led(): + """The yellow user LED as a ``machine.Signal``: ``on()`` lights it.""" + from machine import Pin, Signal + + return Signal(Pin(_LED, Pin.OUT, value=1), invert=True) + + +def boot_button(): + """The BOOT button (GPIO28, ``value()`` 0 when pressed).""" + from machine import Pin + + return Pin(_BOOT, Pin.IN, Pin.PULL_UP) + + +def keypad(): + """The BOOT button as the Enter key, for a board config to give the app as ``keypad``.""" + import keys + from keypad_gpio import GPIOButtons + from machine import Pin + + return GPIOButtons({"boot": (Pin(_BOOT, Pin.IN, Pin.PULL_UP), keys.K_RETURN)}) + + +def battery(): + """The LiPo's voltage through the 1:2 divider on GPIO6 (``voltage`` in volts). + + GPIO26 connects the divider; it stays connected once this role is opened, + which draws about 20 uA from the battery. Without a battery the reading is + the charger's output. + """ + from battery_adc import BatteryADC + from machine import Pin + + Pin(_BAT_EN, Pin.OUT, value=1) + return BatteryADC(_BAT_ADC, scale=2.0) + + +def i2c(): + """The I2C bus on D4 and D5, at 400 kHz.""" + from machine import I2C, Pin + + return I2C(0, sda=Pin(_SDA), scl=Pin(_SCL), freq=400_000) + + +def wlan(): + import network + + return network.WLAN(network.STA_IF) + + +def ble(): + # A bledev adapter (docs/guides/bluetooth-le.md). It also answers every + # bluetooth.BLE method, so code written for the raw radio keeps working. + # Without bledev (or aioble) installed, the raw radio. + try: + import bledev.mpble + except ImportError: + import bluetooth + + return bluetooth.BLE() + return bledev.mpble.get() diff --git a/board_configs/nodisplay/seeed_xiao_esp32c5/manifest.py b/board_configs/nodisplay/seeed_xiao_esp32c5/manifest.py new file mode 100644 index 00000000..3c6b3761 --- /dev/null +++ b/board_configs/nodisplay/seeed_xiao_esp32c5/manifest.py @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2026 Brad Barnett +# +# SPDX-License-Identifier: MIT + +# The seeed_xiao_esp32c5 board package: what mip.install("seeed_xiao_esp32c5") brings. +metadata( + description="board_peripherals for the Seeed Studio XIAO ESP32C5, on MicroPython", + version="0.1.0", +) + +require("omnipython") +require("battery_adc") +require("keypad_gpio") + +module("board_peripherals.py") diff --git a/board_configs/nodisplay/seeed_xiao_esp32c5/package.json b/board_configs/nodisplay/seeed_xiao_esp32c5/package.json new file mode 100644 index 00000000..cf417ec3 --- /dev/null +++ b/board_configs/nodisplay/seeed_xiao_esp32c5/package.json @@ -0,0 +1,25 @@ +{ + "urls": [ + [ + "board_peripherals.py", + "github:PyDevices/omnipython/board_configs/nodisplay/seeed_xiao_esp32c5/board_peripherals.py" + ], + [ + "battery_adc.py", + "github:PyDevices/omnipython/drivers/power/battery_adc.py" + ], + [ + "keypad_gpio.py", + "github:PyDevices/omnipython/drivers/input/keypad_gpio.py" + ] + ], + "deps": [ + [ + "omnipython", + "latest" + ] + ], + "version": "0.1.0", + "description": "board_peripherals for the Seeed Studio XIAO ESP32C5, on MicroPython", + "generated": "from manifest.py by tools/libbuild.py installers; edit manifest.py, not this" +} diff --git a/board_configs/nodisplay/seeed_xiao_esp32c5/tested.json b/board_configs/nodisplay/seeed_xiao_esp32c5/tested.json new file mode 100644 index 00000000..6fc55273 --- /dev/null +++ b/board_configs/nodisplay/seeed_xiao_esp32c5/tested.json @@ -0,0 +1,23 @@ +{ + "board": "seeed_xiao_esp32c5", + "runs": [ + { + "hardware": "Seeed Studio XIAO ESP32C5 (ESP32-C5HR8, 8 MB flash, 8 MB PSRAM), nothing attached, U.FL antenna", + "firmware": "micropython 1.30.0 (Seeed XIAO ESP32C5 with ESP32-C5), v1.30.0-preview.322.gb9620707e3 on 2026-11-25", + "date": "2026-11-25", + "smoke": "passed", + "checks": [ + "board_config imports", + "display draws", + "battery answers", + "ble answers", + "boot_button answers", + "i2c answers", + "led answers", + "wlan answers" + ], + "skipped": [], + "tool": "tools/mark_tested.py" + } + ] +} diff --git a/docs/boards/board-configs.md b/docs/boards/board-configs.md index 01c4b573..869c032f 100644 --- a/docs/boards/board-configs.md +++ b/docs/boards/board-configs.md @@ -223,6 +223,7 @@ that display's board config instead, and keeps its apps. | `nodisplay/qtpy_esp32_pico_audio_bff` | QT Py ESP32 Pico + Adafruit Audio BFF (MicroPython; `audio_out` on I2S, `boot_button`) | | `nodisplay/esp32-s31-zero` | Waveshare ESP32-S31-Zero (MicroPython; `pixels`, `boot_button`, `wlan`, `ble`) | | `nodisplay/pimoroni_pico_plus2_w` | Pimoroni Pico Plus 2 W (MicroPython; `led`, `i2c`, `wlan`, `ble`; the BOOT switch as `keypad()`) | +| `nodisplay/seeed_xiao_esp32c5` | Seeed Studio XIAO ESP32C5 (MicroPython; `led`, `boot_button`, `battery`, `i2c`, `wlan`, `ble`; BOOT as `keypad()`) | | `cp/nodisplay/qtpy_esp32_pico_audio_bff` | the same, on CircuitPython (`audio_out` is `audiobusio.I2SOut`) | ### Desktop and browser