diff --git a/Cargo.toml b/Cargo.toml index 03689f8..6535ebd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,12 @@ name = "eink_waveshare_rs" version = "0.1.0" authors = ["Christoph Groß "] + +[features] +default = [] +# Activates the fast LUT for EPD4in2 +epd4in2_fast_update = [] + [dependencies] diff --git a/src/epd4in2/constants.rs b/src/epd4in2/constants.rs index ea703e5..190181f 100644 --- a/src/epd4in2/constants.rs +++ b/src/epd4in2/constants.rs @@ -11,7 +11,7 @@ pub(crate) const LUT_VCOM0: [u8; 44] = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; - +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [ 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -33,7 +33,7 @@ pub(crate) const LUT_WW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; - +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -55,7 +55,7 @@ pub(crate) const LUT_BW: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; - +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BW_QUICK: [u8; 42] =[ 0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -77,7 +77,7 @@ pub(crate) const LUT_BB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; - +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_BB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -99,7 +99,7 @@ pub(crate) const LUT_WB: [u8; 42] =[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; - +#[cfg(feature = "epd4in2_fast_update")] pub(crate) const LUT_WB_QUICK: [u8; 42] =[ 0x50, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/src/epd4in2/mod.rs b/src/epd4in2/mod.rs index 4874e34..0f5ee76 100644 --- a/src/epd4in2/mod.rs +++ b/src/epd4in2/mod.rs @@ -44,8 +44,7 @@ //! //! //! -//! BE CAREFUL! The Partial Drawing can "destroy" your display. -//! It needs more testing first. +//! BE CAREFUL! The screen can get ghosting/burn-ins through the Partial Fast Update Drawing. use hal::{ blocking::{delay::*, spi::Write}, @@ -222,7 +221,6 @@ where self.send_command(Command::VCOM_AND_DATA_INTERVAL_SETTING)?; //TODO: this was a send_command instead of a send_data. check if it's alright and doing what it should do (setting the default values) - //oldTODO is this really a command here or shouldn't that be data? //self.send_command_u8(0x97)?; //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 self.send_data(0x97)?; @@ -372,9 +370,10 @@ where } /// Fill the look-up table for a quick display (partial refresh) - /// - /// Is automatically done by [EPD4in2::display_frame_quick()](EPD4in2::display_frame_quick()) + /// + /// Is automatically done by [EPD4in2::display_frame_quick()](EPD4in2::display_frame_quick()) /// //TODO: make public? + #[cfg(feature = "epd4in2_fast_update")] fn set_lut_quick(&mut self) -> Result<(), E> { self.set_lut_helper( &LUT_VCOM0_QUICK,