Improved Documentation
parent
e51406b05f
commit
3fc25d71e5
|
|
@ -30,8 +30,6 @@ epd4in2_fast_update = []
|
|||
[dependencies.embedded-graphics]
|
||||
optional = true
|
||||
version = "0.4.3"
|
||||
# embedded-graphics = {git = "https://github.com/caemor/embedded-graphics", branch = "master"}
|
||||
# embedded-graphics = {git = "https://github.com/jamwaffles/embedded-graphics", branch = "master"}
|
||||
|
||||
[dependencies.embedded-hal]
|
||||
features = ["unproven"]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
use epd1in54::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
|
||||
|
||||
/// Full size buffer for use with the 1in54 EPD
|
||||
///
|
||||
/// Can also be manuall constructed:
|
||||
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
|
||||
pub struct Buffer1in54BlackWhite {
|
||||
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,34 @@
|
|||
//! # Examples from the 4.2" Display. It should work the same for the 1.54" one.
|
||||
//!
|
||||
//! ```ignore
|
||||
//! let mut epd4in2 = EPD4in2::new(spi, cs, busy, dc, rst, delay).unwrap();
|
||||
//! use eink_waveshare_rs::{
|
||||
//! epd1in54::{EPD1in54, Buffer1in54},
|
||||
//! graphics::{Display, DisplayRotation},
|
||||
//! prelude::*,
|
||||
//! };
|
||||
//!
|
||||
//! // Setup EPD
|
||||
//! let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||
//!
|
||||
//! let mut buffer = [0u8, epd4in2.get_width() / 8 * epd4in2.get_height()];
|
||||
//! // Use display graphics
|
||||
//! let mut buffer = Buffer1in54::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(),
|
||||
//! );
|
||||
//!
|
||||
//! // draw something into the buffer
|
||||
//!
|
||||
//! epd4in2.display_and_transfer_buffer(buffer, None);
|
||||
//!
|
||||
//! // wait and look at the image
|
||||
//!
|
||||
//! epd4in2.clear_frame(None);
|
||||
//!
|
||||
//! epd4in2.sleep();
|
||||
//! // 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");
|
||||
//! ```
|
||||
|
||||
pub const WIDTH: u32 = 200;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
use epd2in9::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
|
||||
|
||||
/// Full size buffer for use with the 2in9 EPD
|
||||
///
|
||||
/// Can also be manuall constructed:
|
||||
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
|
||||
pub struct Buffer2in9 {
|
||||
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
use epd4in2::constants::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
|
||||
|
||||
/// Full size buffer for use with the 4in2 EPD
|
||||
///
|
||||
/// Can also be manuall constructed:
|
||||
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
|
||||
pub struct Buffer4in2 {
|
||||
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue