Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Liamolucko committed Apr 18, 2022
1 parent 96d3370 commit 9316024
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
20 changes: 17 additions & 3 deletions examples/epd1in54_no_graphics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#![deny(warnings)]

use embedded_hal::prelude::*;
use epd_waveshare::{epd1in54::Epd1in54, prelude::*};
use epd_waveshare::{
buffer_len,
epd1in54::{Epd1in54, HEIGHT, WIDTH},
prelude::*,
};
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Expand All @@ -12,6 +16,8 @@ use linux_embedded_hal::{
// needs to be run with sudo because of some sysfs_gpio permission problems and follow-up timing problems
// see https://github.com/rust-embedded/rust-sysfs-gpio/issues/5 and follow-up issues

const BUFFER_LEN: usize = buffer_len(WIDTH as usize, HEIGHT as usize);

fn main() -> Result<(), std::io::Error> {
// Configure SPI
// SPI settings are from eink-waveshare-rs documenation
Expand Down Expand Up @@ -61,7 +67,11 @@ fn main() -> Result<(), std::io::Error> {
let mut epd = Epd1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?;

// Clear the full screen
epd.clear_frame(&mut spi, &mut delay)?;
epd.update_frame(
&mut spi,
&[Color::White.get_byte_value(); BUFFER_LEN],
&mut delay,
)?;
epd.display_frame(&mut spi, &mut delay)?;

// Speeddemo
Expand All @@ -75,7 +85,11 @@ fn main() -> Result<(), std::io::Error> {
}

// Clear the full screen
epd.clear_frame(&mut spi, &mut delay)?;
epd.update_frame(
&mut spi,
&[Color::White.get_byte_value(); BUFFER_LEN],
&mut delay,
)?;
epd.display_frame(&mut spi, &mut delay)?;

// Draw some squares
Expand Down
1 change: 0 additions & 1 deletion examples/epd2in13_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ fn main() -> Result<(), std::io::Error> {
epd2in13
.set_refresh(&mut spi, &mut delay, RefreshLut::Quick)
.unwrap();
epd2in13.clear_frame(&mut spi, &mut delay).unwrap();

// a moving `Hello World!`
let limit = 10;
Expand Down
1 change: 0 additions & 1 deletion examples/epd4in2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ fn main() -> Result<(), std::io::Error> {
// a moving `Hello World!`
let limit = 10;
epd4in2.set_lut(&mut spi, Some(RefreshLut::Quick)).unwrap();
epd4in2.clear_frame(&mut spi, &mut delay).unwrap();
for i in 0..limit {
//println!("Moving Hello World. Loop {} from {}", (i + 1), limit);

Expand Down

0 comments on commit 9316024

Please sign in to comment.