mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
Adapted examples to previous commit
This commit is contained in:
@@ -108,7 +108,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||
|
||||
//TODO: wait for Digital::InputPin
|
||||
//fixed currently with the HackInputPin, see further above
|
||||
let mut epd4in2 = EPD4in2::new(spi, cs, busy_in, dc, rst, &mut delay).expect("eink inialize error");
|
||||
let mut epd4in2 = EPD4in2::new(&mut spi, cs, busy_in, dc, rst, &mut delay).expect("eink inialize error");
|
||||
|
||||
//let mut buffer = [0u8, epd4in2.get_width() / 8 * epd4in2.get_height()];
|
||||
let mut buffer = [0u8; 15000];
|
||||
@@ -129,29 +129,29 @@ fn main() -> Result<(), std::io::Error> {
|
||||
|
||||
graphics.draw_vertical_line(200, 50, 200, &Color::Black);
|
||||
|
||||
epd4in2.update_frame(graphics.get_buffer()).expect("display and transfer error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_frame(&mut spi, graphics.get_buffer())?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
delay.delay_ms(3000u16);
|
||||
|
||||
epd4in2.clear_frame().expect("clear frame error");
|
||||
epd4in2.clear_frame(&mut spi)?;
|
||||
|
||||
//Test fast updating a bit more
|
||||
let mut small_buffer = [0x00; 128];
|
||||
let mut circle_graphics = Graphics::new(32,32, &mut small_buffer);
|
||||
circle_graphics.draw_circle(16,16, 10, &Color::Black);
|
||||
|
||||
epd4in2.update_partial_frame(circle_graphics.get_buffer(), 16,16, 32, 32).expect("Partial Window Error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 16,16, 32, 32)?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
epd4in2.update_partial_frame(circle_graphics.get_buffer(), 128,64, 32, 32).expect("Partial Window Error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 128,64, 32, 32)?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
epd4in2.update_partial_frame(circle_graphics.get_buffer(), 320,24, 32, 32).expect("Partial Window Error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 320,24, 32, 32)?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
epd4in2.update_partial_frame(circle_graphics.get_buffer(), 160,240, 32, 32).expect("Partial Window Error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 160,240, 32, 32)?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
delay.delay_ms(3000u16);
|
||||
|
||||
@@ -162,10 +162,10 @@ fn main() -> Result<(), std::io::Error> {
|
||||
graphics.draw_string_8x8(16, 16, "hello", &Color::Black);
|
||||
graphics.draw_char_8x8(250, 250, '#', &Color::Black);
|
||||
graphics.draw_char_8x8(300, 16, '7', &Color::Black);
|
||||
epd4in2.update_frame(graphics.get_buffer()).expect("display and transfer error");
|
||||
epd4in2.display_frame().expect("Display Frame Error");
|
||||
epd4in2.update_frame(&mut spi, graphics.get_buffer())?;
|
||||
epd4in2.display_frame(&mut spi)?;
|
||||
|
||||
delay.delay_ms(3000u16);
|
||||
|
||||
epd4in2.sleep()
|
||||
epd4in2.sleep(&mut spi)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user