Rust driver support for the Waveshare 5.83" e-Paper HAT V2, built around the current Waveshare demo flow and embedded-hal 1.0 traits.
- SPI/GPIO driver for the 5.83" V2 display
- Optional async driver API via
embedded-hal-async - Standard, fast, partial, and 4-gray initialization flows
- Full-frame, partial-frame, clear, and sleep operations
- Higher-level
MonoImageabstraction for packed full-frame rendering - Pure framebuffer packing helper for 1-bit images
- Criterion benchmark for bitmap packing
- Optional
rppalintegration for Raspberry Pi Linux targets
- Waveshare 5.83" e-Paper HAT V2: supported
- Other Waveshare e-Paper panels/HATs: not yet implemented in this crate
- Raspberry Pi (Linux) via
rppal: supported (example included) - Generic embedded targets with
embedded-hal1.0 SPI/GPIO/delay implementations: supported - Desktop simulation/testing with fake HAL backends: supported for protocol validation
- Synchronous driver (
Epaper583V2): supported - Asynchronous driver (
Epaper583V2Async, featureasync): supported - High-level full-frame mono abstraction (
MonoImage): supported
- Normal init + full refresh: supported
- Fast init: supported
- Partial init + partial window updates: supported
- 4-gray init + 4-gray frame path: supported
The crate exports a small surface area:
Epaper583V2for SPI/GPIO control of the displayInitModefor choosing the Waveshare initialization flowpack_mono_bitmapandpacked_mono_lenfor preparing 1-bit framesMonoImagefor higher-level full-frame mono workflowsDriverErrorandFramePackingErrorfor fallible operationsThreadDelayas a simple std-backed delay implementation for examples and tests
This crate follows the Waveshare 5.83" V2 manual and demo code.
- Resolution: 648 × 480
- Interface: SPI mode 0
- Control pins:
DC,RST,BUSY, andPWR - The Waveshare demo drives
PWRhigh during initialization and low on sleep
Compatibility note:
- Command timings and register sequences are tuned for 5.83" V2 behavior and may not be correct for other controller variants.
use rppal::gpio::Gpio;
use rppal::spi::{Bus, Mode, SlaveSelect, Spi};
use waveshare_epaper::{Epaper583V2, ThreadDelay, MONO_FRAME_BYTES};
let spi = Spi::new(Bus::Spi0, SlaveSelect::Ss0, 2_000_000, Mode::Mode0)?;
let gpio = Gpio::new()?;
let busy = gpio.get(24)?.into_input();
let dc = gpio.get(25)?.into_output();
let rst = gpio.get(17)?.into_output();
let pwr = gpio.get(18)?.into_output();
let mut display = Epaper583V2::new(spi, busy, dc, rst, pwr, ThreadDelay);
display.initialize()?;
let frame = [0xFFu8; MONO_FRAME_BYTES];
display.display_frame(&frame)?;
display.sleep()?;For higher-level frame preparation from a byte-per-pixel bitmap:
use waveshare_epaper::{MonoImage, Epaper583V2};
# fn show<SPI, BUSY, DC, RST, PWR, DELAY>(
# display: &mut Epaper583V2<SPI, BUSY, DC, RST, PWR, DELAY>,
# source: &[u8],
# ) -> Result<(), waveshare_epaper::DriverError<(), ()>>
# where
# SPI: embedded_hal::spi::SpiBus<u8, Error = ()>,
# BUSY: embedded_hal::digital::InputPin<Error = ()>,
# DC: embedded_hal::digital::OutputPin<Error = ()>,
# RST: embedded_hal::digital::OutputPin<Error = ()>,
# PWR: embedded_hal::digital::OutputPin<Error = ()>,
# DELAY: embedded_hal::delay::DelayNs,
# {
let image = MonoImage::from_bitmap(source)?;
display.display_image(&image)?;
# Ok(())
# }Enable the Raspberry Pi example with:
cargo run --example rppal_full_refresh --features rppalEnable async support with:
cargo test --features asynccargo test
cargo benchThe test suite covers the framebuffer packing helpers, initialization command sequences, partial-update validation, and sleep behavior.
This repository includes an mdBook source under docs/.
Build it with:
mdbook buildServe it locally with live reload:
mdbook serveYou can also generate crate API docs with:
cargo doc --no-deps --openThe repository includes additional markdown-first structure commonly used in modern projects:
.github/copilot-instructions.md: repository-wide Copilot guidance.github/instructions/*.instructions.md: path-specific AI instructionsAGENTS.md: agent-oriented repository guidancedocs/adr/: architecture decision records and templatesdocs/runbooks/: developer runbooksdocs/operations/: operational/release process docsCONTRIBUTING.md: contributor workflow and expectationsCHANGELOG.md: Keep a Changelog style release notes