Skip to content

Commit fe58fc5

Browse files
committed
Update examples
1 parent 19df3e8 commit fe58fc5

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

examples/epd1in54_no_graphics.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#![deny(warnings)]
22

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

19+
const BUFFER_LEN: usize = buffer_len(WIDTH as usize, HEIGHT as usize);
20+
1521
fn main() -> Result<(), std::io::Error> {
1622
// Configure SPI
1723
// SPI settings are from eink-waveshare-rs documenation
@@ -61,7 +67,11 @@ fn main() -> Result<(), std::io::Error> {
6167
let mut epd = Epd1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?;
6268

6369
// Clear the full screen
64-
epd.clear_frame(&mut spi, &mut delay)?;
70+
epd.update_frame(
71+
&mut spi,
72+
&[Color::White.get_byte_value(); BUFFER_LEN],
73+
&mut delay,
74+
)?;
6575
epd.display_frame(&mut spi, &mut delay)?;
6676

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

7787
// Clear the full screen
78-
epd.clear_frame(&mut spi, &mut delay)?;
88+
epd.update_frame(
89+
&mut spi,
90+
&[Color::White.get_byte_value(); BUFFER_LEN],
91+
&mut delay,
92+
)?;
7993
epd.display_frame(&mut spi, &mut delay)?;
8094

8195
// Draw some squares

examples/epd2in13_v2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ fn main() -> Result<(), std::io::Error> {
126126
epd2in13
127127
.set_refresh(&mut spi, &mut delay, RefreshLut::Quick)
128128
.unwrap();
129-
epd2in13.clear_frame(&mut spi, &mut delay).unwrap();
130129

131130
// a moving `Hello World!`
132131
let limit = 10;

examples/epd4in2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ fn main() -> Result<(), std::io::Error> {
128128
// a moving `Hello World!`
129129
let limit = 10;
130130
epd4in2.set_lut(&mut spi, Some(RefreshLut::Quick)).unwrap();
131-
epd4in2.clear_frame(&mut spi, &mut delay).unwrap();
132131
for i in 0..limit {
133132
//println!("Moving Hello World. Loop {} from {}", (i + 1), limit);
134133

0 commit comments

Comments
 (0)