Add epd2in9bc to README, add example
parent
b5e647b0d0
commit
9167c643f9
|
|
@ -45,6 +45,7 @@ epd.update_and_display_frame(&mut spi, &display.buffer())?;
|
||||||
| [2.13 Inch B/W (A)](https://www.waveshare.com/product/2.13inch-e-paper-hat.htm) | Black, White | ✕ | ✔ | | |
|
| [2.13 Inch B/W (A)](https://www.waveshare.com/product/2.13inch-e-paper-hat.htm) | Black, White | ✕ | ✔ | | |
|
||||||
| [2.9 Inch B/W (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White | ✕ | ✔ | ✔ | ✔ |
|
| [2.9 Inch B/W (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White | ✕ | ✔ | ✔ | ✔ |
|
||||||
| [1.54 Inch B/W/R (B)](https://www.waveshare.com/product/modules/oleds-lcds/e-paper/1.54inch-e-paper-module-b.htm) | Black, White, Red | ✕ | ✕ | ✔ | ✔ |
|
| [1.54 Inch B/W/R (B)](https://www.waveshare.com/product/modules/oleds-lcds/e-paper/1.54inch-e-paper-module-b.htm) | Black, White, Red | ✕ | ✕ | ✔ | ✔ |
|
||||||
|
| [2.9 Inch B/W/R (B/C)](https://www.waveshare.com/product/displays/e-paper/epaper-2/2.9inch-e-paper-module-b.htm) | Black, White, Red | ✕ | ✕ | ✔ | ✔ |
|
||||||
|
|
||||||
### [1]: 7.5 Inch B/W V2 (A)
|
### [1]: 7.5 Inch B/W V2 (A)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,58 @@
|
||||||
//! A simple Driver for the Waveshare 2.9" (B/C) E-Ink Display via SPI
|
//! A simple Driver for the Waveshare 2.9" (B/C) E-Ink Display via SPI
|
||||||
|
//!
|
||||||
|
//! # Example for the 2.9" E-Ink Display
|
||||||
|
//!
|
||||||
|
//!```rust, no_run
|
||||||
|
//!# use embedded_hal_mock::*;
|
||||||
|
//!# fn main() -> Result<(), MockError> {
|
||||||
|
//!use embedded_graphics::{
|
||||||
|
//! pixelcolor::BinaryColor::On as Black, prelude::*, primitives::Line, style::PrimitiveStyle,
|
||||||
|
//!};
|
||||||
|
//!use epd_waveshare::{epd2in9bc::*, prelude::*};
|
||||||
|
//!#
|
||||||
|
//!# let expectations = [];
|
||||||
|
//!# let mut spi = spi::Mock::new(&expectations);
|
||||||
|
//!# let expectations = [];
|
||||||
|
//!# let cs_pin = pin::Mock::new(&expectations);
|
||||||
|
//!# let busy_in = pin::Mock::new(&expectations);
|
||||||
|
//!# let dc = pin::Mock::new(&expectations);
|
||||||
|
//!# let rst = pin::Mock::new(&expectations);
|
||||||
|
//!# let mut delay = delay::MockNoop::new();
|
||||||
|
//!
|
||||||
|
//!// 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)?;
|
||||||
|
//!
|
||||||
|
//!// Set the EPD to sleep
|
||||||
|
//!epd.sleep(&mut spi)?;
|
||||||
|
//!# Ok(())
|
||||||
|
//!# }
|
||||||
|
//!```
|
||||||
use embedded_hal::{
|
use embedded_hal::{
|
||||||
blocking::{delay::*, spi::Write},
|
blocking::{delay::*, spi::Write},
|
||||||
digital::v2::*,
|
digital::v2::*,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue