Module epd_waveshare::epd2in9

source ·
Expand description

A simple Driver for the Waveshare 2.9“ E-Ink Display via SPI

Untested!

Example for the 2.9 in E-Ink Display

use epd_waveshare::{
    epd2in9::{EPD2in9, Buffer2in9},
    graphics::{Display, DisplayRotation},
    prelude::*,
};

// Setup EPD
let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;

// Use display graphics
let mut buffer = Buffer2in9::default();
let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);

// Write some hello world in the screenbuffer
display.draw(
    Font6x8::render_str("Hello World!")
        .with_stroke(Some(Color::Black))
        .with_fill(Some(Color::White))
        .translate(Coord::new(5, 50))
        .into_iter(),
);

// Display updated frame
epd.update_frame(&mut spi, &display.buffer()).unwrap();
epd.display_frame(&mut spi).expect("display frame new graphics");

// Set the EPD to sleep
epd.sleep(&mut spi).expect("sleep");

Structs

Full size buffer for use with the 2in9 EPD
EPD2in9 driver

Constants