Module epd_waveshare::epd2in9bc [−][src]
Expand description
A simple Driver for the Waveshare 2.9“ (B/C) E-Ink Display via SPI
Example for the 2.9“ E-Ink Display
use embedded_graphics::{
pixelcolor::BinaryColor::On as Black, prelude::*, primitives::{Line, PrimitiveStyle},
};
use epd_waveshare::{epd2in9bc::*, prelude::*};
// Setup EPD
let mut epd = Epd2in9bc::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
// Use display graphics from embedded-graphics
// This display is for the black/white pixels
let mut mono_display = Display2in9bc::default();
// Use embedded graphics for drawing
// A black line
let _ = Line::new(Point::new(0, 120), Point::new(0, 200))
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
.draw(&mut mono_display);
// Use a second display for red/yellow
let mut chromatic_display = Display2in9bc::default();
// We use `Black` but it will be shown as red/yellow
let _ = Line::new(Point::new(15, 120), Point::new(15, 200))
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
.draw(&mut chromatic_display);
// Display updated frame
epd.update_color_frame(
&mut spi,
&mono_display.buffer(),
&chromatic_display.buffer()
)?;
epd.display_frame(&mut spi, &mut delay)?;
// Set the EPD to sleep
epd.sleep(&mut spi, &mut delay)?;
Structs
Full size buffer for use with the 2in9b/c EPD
Epd2in9bc driver
Constants
Default background color (white) of epd2in9bc display
Height of epd2in9bc in pixels
Width of epd2in9bc in pixels