From 40506b580c6a3553381a70ace5a1d060826d5122 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 08:35:00 +0100 Subject: [PATCH 1/7] Update to linux-embedded-hal v0.2.1 and remove hackinputpin --- examples/embedded_linux_epd1in54/Cargo.toml | 2 +- examples/embedded_linux_epd1in54/src/main.rs | 34 -------------------- examples/embedded_linux_epd2in9/Cargo.toml | 2 +- examples/embedded_linux_epd2in9/src/main.rs | 28 +--------------- examples/embedded_linux_epd4in2/Cargo.toml | 2 +- examples/embedded_linux_epd4in2/src/main.rs | 34 -------------------- 6 files changed, 4 insertions(+), 98 deletions(-) diff --git a/examples/embedded_linux_epd1in54/Cargo.toml b/examples/embedded_linux_epd1in54/Cargo.toml index d51c42e..fd70bc6 100644 --- a/examples/embedded_linux_epd1in54/Cargo.toml +++ b/examples/embedded_linux_epd1in54/Cargo.toml @@ -9,7 +9,7 @@ authors = ["Christoph Groß "] #eink_waveshare_rs = { path = "../../"} eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd1in54", "graphics"]} -linux-embedded-hal = "0.2.0" +linux-embedded-hal = "0.2.1" embedded-graphics = "0.4.3" diff --git a/examples/embedded_linux_epd1in54/src/main.rs b/examples/embedded_linux_epd1in54/src/main.rs index aef8786..3945817 100644 --- a/examples/embedded_linux_epd1in54/src/main.rs +++ b/examples/embedded_linux_epd1in54/src/main.rs @@ -34,40 +34,6 @@ use embedded_hal::prelude::*; // see https://github.com/rust-embedded/rust-sysfs-gpio/issues/5 and follow-up issues -// DigitalIn Hack as long as it's not in the linux_embedded_hal -// from https://github.com/rudihorn/max31865/blob/extra_examples/examples/rpi.rs -// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore) -use embedded_hal::digital::{InputPin}; - -//TODO: Remove when linux_embedded_hal implements InputPin -struct HackInputPin<'a> { - pin: &'a Pin -} - -//TODO: Remove when linux_embedded_hal implements InputPin -impl<'a> HackInputPin<'a> { - fn new(p : &'a Pin) -> HackInputPin { - HackInputPin { - pin: p - } - } -} - -//TODO: Remove when linux_embedded_hal implements InputPin -// for now it defaults to is_low if an error appears -// could be handled better! -impl<'a> InputPin for HackInputPin<'a> { - fn is_low(&self) -> bool { - self.pin.get_value().unwrap_or(0) == 0 - } - - fn is_high(&self) -> bool { - !self.is_low() - } -} - -//TODO: Test this implemenation -//BE CAREFUL: this wasn't tested yet fn main() { run().unwrap(); diff --git a/examples/embedded_linux_epd2in9/Cargo.toml b/examples/embedded_linux_epd2in9/Cargo.toml index b5eba5c..6286d56 100644 --- a/examples/embedded_linux_epd2in9/Cargo.toml +++ b/examples/embedded_linux_epd2in9/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Christoph Groß "] eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd2in9", "graphics"]} -linux-embedded-hal = "0.2.0" +linux-embedded-hal = "0.2.1" embedded-graphics = "0.4.3" diff --git a/examples/embedded_linux_epd2in9/src/main.rs b/examples/embedded_linux_epd2in9/src/main.rs index 65a3c45..d7a6b97 100644 --- a/examples/embedded_linux_epd2in9/src/main.rs +++ b/examples/embedded_linux_epd2in9/src/main.rs @@ -39,35 +39,9 @@ use embedded_hal::prelude::*; // (slightly changed now as OutputPin doesn't provide is_high and is_low anymore) use embedded_hal::digital::{InputPin}; -//TODO: Remove when linux_embedded_hal implements InputPin -struct HackInputPin<'a> { - pin: &'a Pin -} - -//TODO: Remove when linux_embedded_hal implements InputPin -impl<'a> HackInputPin<'a> { - fn new(p : &'a Pin) -> HackInputPin { - HackInputPin { - pin: p - } - } -} -//TODO: Remove when linux_embedded_hal implements InputPin -// for now it defaults to is_low if an error appears -// could be handled better! -impl<'a> InputPin for HackInputPin<'a> { - fn is_low(&self) -> bool { - self.pin.get_value().unwrap_or(0) == 0 - } - - fn is_high(&self) -> bool { - !self.is_low() - } -} -//TODO: Test this implemenation -//BE CAREFUL: this wasn't tested yet +//TODO: Test this implemenation with a new display fn main() { run().unwrap(); diff --git a/examples/embedded_linux_epd4in2/Cargo.toml b/examples/embedded_linux_epd4in2/Cargo.toml index 1731f4a..8f7ae2e 100644 --- a/examples/embedded_linux_epd4in2/Cargo.toml +++ b/examples/embedded_linux_epd4in2/Cargo.toml @@ -9,7 +9,7 @@ authors = ["Christoph Groß "] #eink_waveshare_rs = { path = "../../"} eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]} -linux-embedded-hal = "0.2.0" +linux-embedded-hal = "0.2.1" embedded-graphics = "0.4.3" # embedded-graphics = {git = "https://github.com/caemor/embedded-graphics", branch = "master"} diff --git a/examples/embedded_linux_epd4in2/src/main.rs b/examples/embedded_linux_epd4in2/src/main.rs index 8306cf4..8dfcf1e 100644 --- a/examples/embedded_linux_epd4in2/src/main.rs +++ b/examples/embedded_linux_epd4in2/src/main.rs @@ -30,40 +30,6 @@ use lin_hal::Delay; // 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 - -// DigitalIn Hack as long as it's not in the linux_embedded_hal -// from https://github.com/rudihorn/max31865/blob/extra_examples/examples/rpi.rs -// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore) -extern crate embedded_hal; -use embedded_hal::{ - digital::{InputPin}, -}; -use embedded_hal::prelude::*; - -struct HackInputPin<'a> { - pin: &'a Pin -} - -impl<'a> HackInputPin<'a> { - fn new(p : &'a Pin) -> HackInputPin { - HackInputPin { - pin: p - } - } -} - -impl<'a> InputPin for HackInputPin<'a> { - fn is_low(&self) -> bool { - self.pin.get_value().unwrap_or(0) == 0 - } - - fn is_high(&self) -> bool { - self.pin.get_value().unwrap_or(0) == 1 - } -} - - - fn main() { run().map_err(|e| println!("{}", e.to_string())).unwrap(); } From 86d1a9fa25e68b720f5088cff7bffda9c386ae25 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 08:54:37 +0100 Subject: [PATCH 2/7] Remove Hackinputpin completly --- examples/embedded_linux_epd1in54/Cargo.toml | 2 -- examples/embedded_linux_epd1in54/src/main.rs | 5 +---- examples/embedded_linux_epd2in9/src/main.rs | 13 +------------ examples/embedded_linux_epd4in2/Cargo.toml | 4 ---- examples/embedded_linux_epd4in2/src/main.rs | 5 +---- 5 files changed, 3 insertions(+), 26 deletions(-) diff --git a/examples/embedded_linux_epd1in54/Cargo.toml b/examples/embedded_linux_epd1in54/Cargo.toml index fd70bc6..caa16fa 100644 --- a/examples/embedded_linux_epd1in54/Cargo.toml +++ b/examples/embedded_linux_epd1in54/Cargo.toml @@ -5,8 +5,6 @@ authors = ["Christoph Groß "] [dependencies] -#eink_waveshare_rs = { git = "https://github.com/Caemor/eink-waveshare-rs"} -#eink_waveshare_rs = { path = "../../"} eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd1in54", "graphics"]} linux-embedded-hal = "0.2.1" diff --git a/examples/embedded_linux_epd1in54/src/main.rs b/examples/embedded_linux_epd1in54/src/main.rs index 3945817..1a2db86 100644 --- a/examples/embedded_linux_epd1in54/src/main.rs +++ b/examples/embedded_linux_epd1in54/src/main.rs @@ -33,9 +33,7 @@ use embedded_hal::prelude::*; // 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 - fn main() { - run().unwrap(); } @@ -63,7 +61,6 @@ fn run() -> Result<(), std::io::Error> { while !busy.is_exported() {} busy.set_direction(Direction::In).expect("busy Direction"); //busy.set_value(1).expect("busy Value set to 1"); - let busy_in = HackInputPin::new(&busy); // Configure Data/Command OutputPin let dc = Pin::new(6); //pin 31 //bcm6 @@ -85,7 +82,7 @@ fn run() -> Result<(), std::io::Error> { // Setup of the needed pins is finished here // Now the "real" usage of the eink-waveshare-rs crate begins - let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; + let mut epd = EPD1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?; // Clear the full screen epd.clear_frame(&mut spi).expect("clear frame 1"); diff --git a/examples/embedded_linux_epd2in9/src/main.rs b/examples/embedded_linux_epd2in9/src/main.rs index d7a6b97..ea3d04c 100644 --- a/examples/embedded_linux_epd2in9/src/main.rs +++ b/examples/embedded_linux_epd2in9/src/main.rs @@ -4,7 +4,6 @@ extern crate linux_embedded_hal as lin_hal; // the eink library extern crate eink_waveshare_rs; - use eink_waveshare_rs::{ epd2in9::{ EPD2in9, @@ -33,17 +32,8 @@ use embedded_hal::prelude::*; // 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 - -// DigitalIn Hack as long as it's not in the linux_embedded_hal -// from https://github.com/rudihorn/max31865/blob/extra_examples/examples/rpi.rs -// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore) -use embedded_hal::digital::{InputPin}; - - - //TODO: Test this implemenation with a new display fn main() { - run().unwrap(); } @@ -71,7 +61,6 @@ fn run() -> Result<(), std::io::Error> { while !busy.is_exported() {} busy.set_direction(Direction::In).expect("busy Direction"); //busy.set_value(1).expect("busy Value set to 1"); - let busy_in = HackInputPin::new(&busy); // Configure Data/Command OutputPin let dc = Pin::new(6); //pin 31 //bcm6 @@ -93,7 +82,7 @@ fn run() -> Result<(), std::io::Error> { // Setup of the needed pins is finished here // Now the "real" usage of the eink-waveshare-rs crate begins - let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; + let mut epd = EPD2in9::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?; // Clear the full screen epd.clear_frame(&mut spi).expect("clear frame 1"); diff --git a/examples/embedded_linux_epd4in2/Cargo.toml b/examples/embedded_linux_epd4in2/Cargo.toml index 8f7ae2e..e37a444 100644 --- a/examples/embedded_linux_epd4in2/Cargo.toml +++ b/examples/embedded_linux_epd4in2/Cargo.toml @@ -12,9 +12,5 @@ eink_waveshare_rs = { path = "../../", default-features = false, features = ["ep linux-embedded-hal = "0.2.1" embedded-graphics = "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"} - - embedded-hal = { version = "0.2.1", features = ["unproven"] } diff --git a/examples/embedded_linux_epd4in2/src/main.rs b/examples/embedded_linux_epd4in2/src/main.rs index 8dfcf1e..dd52db8 100644 --- a/examples/embedded_linux_epd4in2/src/main.rs +++ b/examples/embedded_linux_epd4in2/src/main.rs @@ -4,7 +4,6 @@ extern crate linux_embedded_hal as lin_hal; // the eink library extern crate eink_waveshare_rs; - use eink_waveshare_rs::{ epd4in2::{ EPD4in2, @@ -34,7 +33,6 @@ fn main() { run().map_err(|e| println!("{}", e.to_string())).unwrap(); } - fn run() -> Result<(), std::io::Error> { // Configure SPI @@ -59,7 +57,6 @@ fn run() -> Result<(), std::io::Error> { while !busy.is_exported() {} busy.set_direction(Direction::In).expect("busy Direction"); //busy.set_value(1).expect("busy Value set to 1"); - let busy_in = HackInputPin::new(&busy); let dc = Pin::new(6); //pin 31 //bcm6 dc.export().expect("dc export"); @@ -81,7 +78,7 @@ fn run() -> Result<(), std::io::Error> { //TODO: wait for Digital::InputPin //fixed currently with the HackInputPin, see further above - let mut epd4in2 = EPD4in2::new(&mut spi, cs, busy_in, dc, rst, &mut delay).expect("eink initalize error"); + let mut epd4in2 = EPD4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); println!("Test all the rotations"); let mut buffer = Buffer4in2::default(); From 550338a1ae7ec0c686f4413f14bbeaa34bd9ffb0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 09:00:13 +0100 Subject: [PATCH 3/7] Cleanup of imports --- examples/embedded_linux_epd1in54/src/main.rs | 13 ++++++------- examples/embedded_linux_epd2in9/src/main.rs | 12 ++++++------ examples/embedded_linux_epd4in2/src/main.rs | 13 ++++++++----- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/examples/embedded_linux_epd1in54/src/main.rs b/examples/embedded_linux_epd1in54/src/main.rs index 1a2db86..f3325d2 100644 --- a/examples/embedded_linux_epd1in54/src/main.rs +++ b/examples/embedded_linux_epd1in54/src/main.rs @@ -1,10 +1,12 @@ // the library for the embedded linux device extern crate linux_embedded_hal as lin_hal; +use lin_hal::spidev::{self, SpidevOptions}; +use lin_hal::{Pin, Spidev}; +use lin_hal::sysfs_gpio::Direction; +use lin_hal::Delay; // the eink library extern crate eink_waveshare_rs; - - use eink_waveshare_rs::{ epd1in54::{ EPD1in54, @@ -14,11 +16,7 @@ use eink_waveshare_rs::{ prelude::*, }; -use lin_hal::spidev::{self, SpidevOptions}; -use lin_hal::{Pin, Spidev}; -use lin_hal::sysfs_gpio::Direction; -use lin_hal::Delay; - +// Graphics extern crate embedded_graphics; use embedded_graphics::coord::Coord; use embedded_graphics::fonts::{Font6x8}; @@ -26,6 +24,7 @@ use embedded_graphics::prelude::*; //use embedded_graphics::primitives::{Circle, Line}; use embedded_graphics::Drawing; +// HAL (Traits) extern crate embedded_hal; use embedded_hal::prelude::*; diff --git a/examples/embedded_linux_epd2in9/src/main.rs b/examples/embedded_linux_epd2in9/src/main.rs index ea3d04c..97d1d84 100644 --- a/examples/embedded_linux_epd2in9/src/main.rs +++ b/examples/embedded_linux_epd2in9/src/main.rs @@ -1,9 +1,12 @@ // the library for the embedded linux device extern crate linux_embedded_hal as lin_hal; +use lin_hal::spidev::{self, SpidevOptions}; +use lin_hal::{Pin, Spidev}; +use lin_hal::sysfs_gpio::Direction; +use lin_hal::Delay; // the eink library extern crate eink_waveshare_rs; - use eink_waveshare_rs::{ epd2in9::{ EPD2in9, @@ -13,11 +16,7 @@ use eink_waveshare_rs::{ prelude::*, }; -use lin_hal::spidev::{self, SpidevOptions}; -use lin_hal::{Pin, Spidev}; -use lin_hal::sysfs_gpio::Direction; -use lin_hal::Delay; - +// Graphics extern crate embedded_graphics; use embedded_graphics::coord::Coord; use embedded_graphics::fonts::{Font6x8}; @@ -25,6 +24,7 @@ use embedded_graphics::prelude::*; //use embedded_graphics::primitives::{Circle, Line}; use embedded_graphics::Drawing; +// HAL (Traits) extern crate embedded_hal; use embedded_hal::prelude::*; diff --git a/examples/embedded_linux_epd4in2/src/main.rs b/examples/embedded_linux_epd4in2/src/main.rs index dd52db8..967f518 100644 --- a/examples/embedded_linux_epd4in2/src/main.rs +++ b/examples/embedded_linux_epd4in2/src/main.rs @@ -1,9 +1,12 @@ // the library for the embedded linux device extern crate linux_embedded_hal as lin_hal; +use lin_hal::spidev::{self, SpidevOptions}; +use lin_hal::{Pin, Spidev}; +use lin_hal::sysfs_gpio::Direction; +use lin_hal::Delay; // the eink library extern crate eink_waveshare_rs; - use eink_waveshare_rs::{ epd4in2::{ EPD4in2, @@ -13,6 +16,7 @@ use eink_waveshare_rs::{ prelude::*, }; +// Graphics extern crate embedded_graphics; use embedded_graphics::coord::Coord; use embedded_graphics::fonts::{Font6x8, Font12x16}; @@ -20,10 +24,9 @@ use embedded_graphics::prelude::*; use embedded_graphics::primitives::{Circle, Line}; use embedded_graphics::Drawing; -use lin_hal::spidev::{self, SpidevOptions}; -use lin_hal::{Pin, Spidev}; -use lin_hal::sysfs_gpio::Direction; -use lin_hal::Delay; +// HAL (Traits) +extern crate embedded_hal; +use embedded_hal::prelude::*; // activate spi, gpio in raspi-config // needs to be run with sudo because of some sysfs_gpio permission problems and follow-up timing problems From 297f92a99e97ae9e111a2027627dad73dee3ef91 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 09:50:50 +0100 Subject: [PATCH 4/7] Use clippy with travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e613f1c..3b2e995 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,11 +94,11 @@ install: - cargo install cargo-travis || true - rustup override set nightly - rustup target add thumbv7m-none-eabi + - rustup component add clippy-preview script: - cargo check - - cargo build --release - - cargo test + - cargo clippy --all-targets --all-features -- -D warnings - cargo test --all-features --release - cargo doc --all-features --release - cd examples/embedded_linux_epd4in2 && cargo check && cd ../../ From 30b0ee19f38b80831ef23a84dd4d16587e818cab Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 09:54:46 +0100 Subject: [PATCH 5/7] Fix travis by removing the deleted stm32-example --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b2e995..29ea930 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,7 +103,7 @@ script: - cargo doc --all-features --release - cd examples/embedded_linux_epd4in2 && cargo check && cd ../../ - cd examples/embedded_linux_epd1in54 && cargo check && cd ../../ - - cd examples/stm32f3discovery && cargo check --target thumbv7m-none-eabi && cd ../../ + # - cd examples/stm32f3discovery && cargo check --target thumbv7m-none-eabi && cd ../../ #- cd ../f3_stm32f30x && cargo build after_success: From a7d0f13d13a651ae571c151394bb2c8f40b2a578 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 10:42:56 +0100 Subject: [PATCH 6/7] Fix clippy lints --- src/color.rs | 6 +++--- src/epd4in2/constants.rs | 6 ++++++ src/epd4in2/mod.rs | 14 +++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/color.rs b/src/color.rs index 611965e..8c2ab0e 100644 --- a/src/color.rs +++ b/src/color.rs @@ -14,7 +14,7 @@ pub enum Color { impl Color { /// Get the color encoding of the color for one bit - pub fn get_bit_value(&self) -> u8 { + pub fn get_bit_value(self) -> u8 { match self { Color::White => 1u8, Color::Black => 0u8, @@ -22,7 +22,7 @@ impl Color { } /// Gets a full byte of black or white pixels - pub fn get_byte_value(&self) -> u8 { + pub fn get_byte_value(self) -> u8 { match self { Color::White => 0xff, Color::Black => 0x00, @@ -41,7 +41,7 @@ impl Color { /// Returns the inverse of the given color. /// /// Black returns White and White returns Black - pub fn inverse(&self) -> Color { + pub fn inverse(self) -> Color { match self { Color::White => Color::Black, Color::Black => Color::White, diff --git a/src/epd4in2/constants.rs b/src/epd4in2/constants.rs index 9e019cc..16423e3 100644 --- a/src/epd4in2/constants.rs +++ b/src/epd4in2/constants.rs @@ -4,6 +4,7 @@ pub const WIDTH: u32 = 400; pub const HEIGHT: u32 = 300; pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White; + pub(crate) const LUT_VCOM0: [u8; 44] = [ 0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x17, 0x17, 0x00, 0x00, 0x02, @@ -14,6 +15,7 @@ pub(crate) const LUT_VCOM0: [u8; 44] = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[allow(dead_code)] #[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [ 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, @@ -36,6 +38,7 @@ pub(crate) const LUT_WW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[allow(dead_code)] #[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, @@ -58,6 +61,7 @@ pub(crate) const LUT_BW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[allow(dead_code)] #[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, @@ -80,6 +84,7 @@ pub(crate) const LUT_BB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[allow(dead_code)] #[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, @@ -102,6 +107,7 @@ pub(crate) const LUT_WB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; +#[allow(dead_code)] #[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, diff --git a/src/epd4in2/mod.rs b/src/epd4in2/mod.rs index bbea54f..f45869d 100644 --- a/src/epd4in2/mod.rs +++ b/src/epd4in2/mod.rs @@ -323,18 +323,18 @@ where self.send_data(spi, &[h as u8]) } - /// Fill the look-up table for the EPD - //TODO: make public? - fn set_lut(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { + /// Fill the look-up table for the EPD for a full refresh (slower) + pub fn set_lut(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { self.set_lut_helper(spi, &LUT_VCOM0, &LUT_WW, &LUT_BW, &LUT_WB, &LUT_BB) } - /// Fill the look-up table for a quick display (partial refresh) + /// Fill the look-up table for a quick refresh (partial refresh) /// - /// Is automatically done by [EPD4in2::display_frame_quick()](EPD4in2::display_frame_quick()) - /// //TODO: make public? + /// WARNING: Might lead to ghosting-effects + #[allow(dead_code)] + #[deprecated(note = "Might lead to ghosting-effects/problems with your display. Use set_lut instead!")] #[cfg(feature = "epd4in2_fast_update")] - fn set_lut_quick(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { + pub fn set_lut_quick(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { self.set_lut_helper( spi, &LUT_VCOM0_QUICK, From af685277f14134e07de67667b05d7afe98aa85ac Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Oct 2018 11:10:45 +0100 Subject: [PATCH 7/7] Fix last clippy warning --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29ea930..c1cc455 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,9 +96,10 @@ install: - rustup target add thumbv7m-none-eabi - rustup component add clippy-preview + #TODO: remove -A clippy::new_ret_no_self when new version of clippy gets released! script: - cargo check - - cargo clippy --all-targets --all-features -- -D warnings + - cargo clippy --all-targets --all-features -- -D warnings -A clippy::new_ret_no_self - cargo test --all-features --release - cargo doc --all-features --release - cd examples/embedded_linux_epd4in2 && cargo check && cd ../../