Lampadina Wi-Fi Matter in modalità Rust su Raspberry Pi Pico 2 W
Sintesi redazionale: URL dell'articolo: https://github.com/melastmohican/rust-rpico2-embassy-examples URL dei commenti: https://news.ycombinator.com/item?id=48440008 Punti: 66 # Commenti: 4. Fonte originale: https://github.com/melastmohican/rust-rpico2-embassy-examples
<p>This repository contains examples for the Raspberry Pi Pico 2 (RP2350) board, written in Rust using the Embassy async framework.</p><p>🎉 Featured on the Adafruit blog (June 2026).</p><p>`cargo generate --git https://github.com/ImplFerris/pico2-template.git --name rust-rpico2-embassy-examples`</p><p>**Board:** Raspberry Pi Pico 2</p><p>**MCU:**RP2350 (Dual-core Arm Cortex-M33 and RISC-V cores)**On-board peripherals:**- LED on GPIO25</p><p>**I2C pins:****I2C0 SDA:**GPIO4**I2C0 SCL:**GPIO5**I2C1 SDA:**GPIO2**I2C1 SCL:**GPIO3</p><p>**UART pins:****UART0 TX:**GPIO0,**UART0 RX:**GPIO1**UART1 TX:**GPIO8,**UART1 RX:**GPIO9</p><p>Reads temperature and humidity from an HS3003 sensor using the Embassy async framework.</p><p>`cargo run --example hs3003_i2c`</p><p>**Wiring (Arduino Modulino Thermo):**</p><p>```<br>Modulino -> RPi Pico 2<br>---------- --------------<br>GND (black) -> GND<br>VCC (red) -> 3.3V<br>SCL (yellow)-> GPIO5 (Pin 7) (I2C0 SCL)<br>SDA (blue) -> GPIO4 (Pin 6) (I2C0 SDA)<br>```</p><p>**About HS3003:**</p><p>The Renesas HS3003 is a high-performance temperature and humidity sensor:</p><p>- Temperature range: -40°C to +125°C (±0.2°C accuracy)<br>- Humidity range: 0% to 100% RH (±1.5% accuracy)<br>- 14-bit resolution for both measurements<br>- Ultra-low power consumption</p><p>Reads accelerometer data from an ADXL345 sensor over I2C0 using Embassy.</p><p>`cargo run --example adxl345_i2c`</p><p>**Wiring:**</p><p>```<br>ADXL345 -> RPi Pico 2<br>---------- --------------<br>GND (black) -> GND<br>VCC (red) -> 3.3V<br>SCL (yellow)-> GPIO5 (Pin 7) (I2C0 SCL)<br>SDA (blue) -> GPIO4 (Pin 6) (I2C0 SDA)<br>```</p><p>**About ADXL345:**</p><p>The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either an SPI (3- or 4-wire) or I2C digital interface.</p><p>Displays a 320x240 image of Zermatt on the Adafruit 2.2" TFT LCD display in landscape mode.</p><p>`cargo run --example zermatt`</p><p>**Wiring (Eye-SPI Breakout):**</p><p>```<br>Raspberry Pi Pico 2 Eye-SPI Breakout<br>+-----------------------+ +---------------------------+<br>| | | |<br>| 3V3 (Pin 36) --------+------+-> VIN (Red Wire) |<br>| GND (Pin 38) --------+------+-> GND (Black Wire) |<br>| GPIO18 (Pin 24) -----+------+-> SCK (Blue Wire) |<br>| GPIO19 (Pin 25) -----+------+-> MOSI (Green Wire) |<br>| GPIO16 (Pin 21) -----+------+-> MISO (Yellow Wire) |<br>| GPIO20 (Pin 26) -----+------+-> DC (White Wire) |<br>| GPIO21 (Pin 27) -----+------+-> RST (Orange Wire) |<br>| GPIO17 (Pin 22) -----+------+-> TCS (Blue Wire) |<br>| | | |<br>+-----------------------+ +---------------------------+<br>```</p><p>Displays a 320x240 image of Zermatt on the Adafruit 2.2" TFT LCD display with animated falling snow, utilizing a physics engine and the Embassy async framework to draw to an off-screen `lcd-async`</p><p>framebuffer and dispatch via DMA without blocking the CPU.</p><p>`cargo run --example zermatt_snow`</p><p>Wiring is identical to the `zermatt`</p><p>example.</p><p>The workspace includes examples for the Waveshare 0.96" 80x160 ST7735S LCD module built with both the ** display-driver** async framework (</p><p>`st7735_dd_*`</p><p>) and the **driver crate (**</p><p>`mipidsi`</p><p>`st7735_mipi_*`</p><p>).**Common Wiring for Waveshare 0.96" ST7735S LCD:**</p><p>```<br>Raspberry Pi Pico 2 Waveshare 0.96" ST7735S LCD<br>+-----------------------+ +---------------------------+<br>| | | |<br>| 3V3 (Pin 36) --------+------+-> VCC |<br>| GND (Pin 38) --------+------+-> GND |<br>| GPIO17 (Pin 22) -----+------+-> CS |<br>| GPIO21 (Pin 27) -----+------+-> RST |<br>| GPIO20 (Pin 26) -----+------+-> DC |<br>| GPIO19 (Pin 25) -----+------+-> DIN(MOSI) |<br>| GPIO18 (Pin 24) -----+------+-> CLK(SCK) |<br>| GPIO14 (Pin 19) -----+------+-> BL (Backlight) |<br>| | | |<br>+-----------------------+ +---------------------------+<br>```</p><p>Draws the Ferris mascot and Rust logo BMP images on the 80x160 ST7735S display using the async `display-driver`</p><p>crate stack (`display-driver`</p><p>, `display-driver-spi`</p><p>, `display-driver-st7735`</p><p>).</p><p>`cargo run --example st7735_dd_ferris`</p><p>Runs a smooth 30 FPS geometric pattern animation (rotating circles, pulsating center ring, and expanding corner accents) rendered into a 160x80 framebuffer and flushed asynchronously via `display-driver`</p><p>.</p><p>`cargo run --example st7735_dd_animation`</p><p>Draws the Ferris mascot and Rust logo BMP images using the `mipidsi`</p><p>display driver crate and `display-interface-spi`</p><p>.</p><p>`cargo run --example st7735_mipi_ferris`</p><p>Draws text header banners, a separator line, colored geometric shapes, and bottom text labels using `mipidsi`</p><p>and `display-interface-spi`</p><p>.</p><p>`cargo run --example st7735_mipi_text`</p><p>Runs the **Slint UI framework** in `no_std`</p><p>mode using its built-in software renderer, rendering an interactive animated Slint component (custom colors, typography, properties, and layout) flushed via `display-driver`</p><p>.</p><p>**Slint Website:**https://slint.dev/**Slint Documentation:**https://slint.dev/docs**Slint Software Renderer Docs:**https://slint.dev/docs/rust/slint/platform/software_renderer/index.html</p><p>`cargo run --example st7735_slint`</p><p>The workspace includes examples for 240x240 GC9A01 round LCD displays built with both the ** display-driver** async framework (</p><p>`gc9a01_dd_*`</p><p>) and the **driver crate (**</p><p>`mipidsi`</p><p>`gc9a01_mipi_*`</p><p>).**Common Wiring for GC9A01 240x240 Round LCD:**</p><p>```<br>Raspberry Pi Pico 2 GC9A01 240x240 Round LCD<br>+-----------------------+ +---------------------------+<br>| | | |<br>| 3V3 (Pin 36) --------+------+-> VCC |<br>| GND (Pin 38) --------+------+-> GND |<br>| GPIO17 (Pin 22) -----+------+-> CS |<br>| GPIO21 (Pin 27) -----+------+-> RST |<br>| GPIO20 (Pin 26) -----+------+-> DC |<br>| GPIO19 (Pin 25) -----+------+-> SDA(MOSI) |<br>| GPIO18 (Pin 24) -----+------+-> SCL(SCK) |<br>| | | |<br>+-----------------------+ +---------------------------+<br>```</p><p>**Breadboard Layout:**</p><p>Draws the Ferris mascot and Rust logo BMP images on the round 240x240 GC9A01 display using the async `display-driver`</p><p>crate stack (`display-driver`</p><p>, `display-driver-spi`</p><p>, `display-driver-gc9a01`</p><p>).</p><p>`cargo run --example gc9a01_dd_ferris`</p><p>Renders a 4x4 Bayer dithered concentric radial gradient (golden-yellow to purple) with a shadow text overlay on the 240x240 GC9A01 display using `display-driver`</p><p>.</p><p>`cargo run --example gc9a01_dd_concentric`</p><p>Draws the Ferris mascot and Rust logo BMP images on the 240x240 GC9A01 display using `mipidsi`</p><p>and `display-interface-spi`</p><p>.</p><p>`cargo run --example gc9a01_mipi_ferris`</p><p>Reads temperature and pressure from an Adafruit BMP580 sensor over I2C and displays an analog-style thermometer graphic with cycling digital measurements (Fahrenheit, Celsius, pressure hPa, sensor ID) on an Adafruit 1.14" 240x135 ST7789 display using `display-driver`</p><p>(`display-driver-st7789`</p><p>).</p><p>`cargo run --example newxie_dd_thermometer`</p><p>Async twins of every e-paper example in `rust-rpico2-discovery`</p><p>— same board, same panels, same wiring, same content and phases; only the transport differs (`embassy-rp`</p><p>'s async SPI/GPIO instead of `rp235x-hal`</p><p>'s blocking API, `epdsi`</p><p>built with `default-features = false, features = ["graphics"]`</p><p>). See that repo's README for full per-panel narrative (refresh-mode behavior, ink polarity, timing notes, provenance caveats) — not repeated here.</p><p>Fourteen use the Good Display DESPI-C02 adapter board; four (the Pervasive Displays panels) use the EXT3-1 board with a 10-way rainbow cable.</p><p>**Wiring (DESPI-C02 adapter board):**</p><p>| Pico 2 Pin | DESPI-C02 Pin / Function |<br>|---|---|<br>| 3V3 (Pin 36) | VCC |<br>| GND (Pin 38) | GND |<br>| GPIO11 (Pin 15) | RST |<br>| GPIO12 (Pin 16) | DC |<br>| GPIO13 (Pin 17) | BUSY |<br>| GPIO16 (Pin 21) | MISO |<br>| GPIO17 (Pin 22) | CS |<br>| GPIO18 (Pin 24) | SCK |<br>| GPIO19 (Pin 25) | MOSI |</p><p>**Wiring (EXT3-1/EPDK, 10-way rainbow cable):**</p><p>| Pico Pin | Cable Color | EXT3 Pin / Function |<br>|---|---|---|<br>| 3V3 (Pin 36) | Black | 1 / VCC |<br>| GPIO18 (Pin 24) | Brown | 2 / SCK (SPI Clock) |<br>| GPIO13 (Pin 17) | Red | 3 / BUSY |<br>| GPIO12 (Pin 16) | Orange | 4 / DC (Data/Cmd) |<br>| GPIO11 (Pin 15) | Yellow | 5 / RST (Reset) |<br>| GPIO16 (Pin 21) | Green | 6 / MISO |<br>| GPIO19 (Pin 25) | Blue | 7 / MOSI |<br>| NC | Violet | 8 / FCSM (Flash CS, unused) |<br>| GPIO17 (Pin 22) | Grey | 9 / ECSM (Display CS) |<br>| GND (Pin 38) | White | 10 / GND |</p><p>EXT3-1 J3 jumper:OPEN (10 µH) for panels ≤ 3.7" (`E2266KS0C1`</p><p>,`E2290KS0F1`</p><p>,`E2154QS0F1`</p><p>); CLOSED (47 µH) for`E2417QS0A3`</p><p>(4.2"). Wrong setting chokes the DC-DC booster on current bursts, causing voltage sags and BUSY hangs.</p><p>Good Display ZJY122250-0213AJH-E5 2.13" Quad-Color (Black/White/Yellow/Red, 122×250), `Jd79661Controller`</p><p>. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_jd79661_zjy122250`</p><p>Good Display GDEM0154F51H 1.54" Quad-Color (Black/White/Yellow/Red, 200×200, Waveshare *1.54inch e-Paper (G)*), `Jd79660Controller`</p><p>— shares its SPI register table with `Jd79661Controller`</p><p>(both wrap `Jd7966xController`</p><p>), differing only in which registers `init_sequence`</p><p>writes. Wiring: DESPI-C02, above.</p><p>Not independently confirmed on hardware in this repo or in</p><p>`rust-rpico2-discovery`</p><p>'s own doc for the blocking twin — build and flash to verify before relying on it.</p><p>`cargo run --example epdsi_jd79660_gdem0154f51h`</p><p>Dalian Good Display GDEM0154Z90 1.54" Tri-Color (200×200), `Ssd1681Controller`</p><p>. Full Tri-Color content plus a partial *window* refresh loop — no fast/differential waveform on this panel, every update takes ~14 s. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1681_gdem0154z90`</p><p>Full-parity companion to `epdsi_ssd1681_gdem0154z90`</p><p>— same content, same hardware — drawn entirely through `PageBufferPair`</p><p>/`TriColor`</p><p>instead of two separate `PageBuffer`</p><p>s. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1681_gdem0154z90_tri_epd`</p><p>Dalian Good Display GDEM0213B74 2.13" Monochrome (122×250), `Ssd1680Controller`</p><p>. Full refresh, then a fast *differential* partial-window logo-swap loop, then a full-waveform cleanup pass. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1680_gdem0213b74`</p><p>Good Display GDEY0266Z90 2.66" Tri-Color (Black/White/Red, 152×296), `Ssd1680Controller`</p><p>. Demonstrates every refresh mode the SSD1680 exposes for a Tri-Color panel: `Full`</p><p>, a partial window loop, `FastFull`</p><p>, and `BaseMap`</p><p>/`Partial`</p><p>at their real (non-differential on colour glass) cost. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1680_gdey0266z90`</p><p>Full-parity companion to `epdsi_ssd1680_gdey0266z90`</p><p>— drawn entirely through `PageBufferPair`</p><p>/`TriColor`</p><p>. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1680_gdey0266z90_tri_epd`</p><p>Good Display GDEY0266T90 / Waveshare 2.66" e-Paper, Monochrome (152×296), `Ssd1680Controller`</p><p>— a different, monochrome-only glass from the Tri-Color `GDEY0266Z90`</p><p>above, same nominal size and controller. Genuinely fast: real Full and Partial (differential) refresh. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1680_gdey0266t90`</p><p>Companion to `epdsi_ssd1680_gdey0266t90`</p><p>— drives the panel's 4-level grayscale mode (White/Light/Dark/Black) instead of plain monochrome. `GDEY0266T90::GRAY4`</p><p>is Adafruit_EPD-sourced, not Good Display/Waveshare material. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_ssd1680_gdey0266t90_gray4`</p><p>Dalian Good Display GDEY037T03 3.7" Monochrome (240×416), `Uc8253Controller`</p><p>. Full refresh, a partial-window logo-swap loop, and a full-waveform cleanup pass. BUSY is active-**low** on this controller. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_uc8253_gdey037t03`</p><p>Waveshare 3.52" e-Paper (B) SE0352N14-TNG-A0 Tri-Color (240×360), `Uc8253Controller`</p><p>with `Uc8253Variant::Se0352n14`</p><p>— the variant is not optional: this panel disagrees with `GDEY037T03`</p><p>on RAM plane routing and ink polarity despite sharing the same controller. Full refresh only (~16-20 s); do not loop, Waveshare specify ≥180 s between refreshes. Wiring: DESPI-C02, above.</p><p>`cargo run --example epdsi_uc8253_se0352n14`</p><p>Full-parity companion to `epdsi_uc8253_se0352n14`</p><p>— drawn entirely through `PageBufferPair`</p><p>/`TriColor`</p><p>; uses `PlanePolarity::UC8253`</p><p>_(testo troncato)_</p>
