From 47af2fc664bc4ebc5e81bc3c83aa11236993f130 Mon Sep 17 00:00:00 2001 From: Chris <11088935+caemor@users.noreply.github.com> Date: Thu, 4 Apr 2019 23:23:48 +0200 Subject: [PATCH] Make a few small updates to support TeXitoi rusty clock (#27) - add a feature gated alternative full lut for type_a displays - remove pub from set_lut_helper function - fix behaviour of set_lut for epd2in9. it always sets the LUT now! - better comments --- Cargo.toml | 2 ++ src/epd2in9/mod.rs | 1 + src/traits.rs | 1 + src/type_a/constants.rs | 11 ++++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7a13cff..163c49a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,8 @@ graphics = ["embedded-graphics"] epd1in54 = [] epd2in9 = [] epd4in2 = [] +# offers an alternative fast full lut for type_a displays, but the refresh isnt as clean looking +type_a_alternative_faster_lut = [] [dependencies.embedded-graphics] optional = true diff --git a/src/epd2in9/mod.rs b/src/epd2in9/mod.rs index f050c28..42f062c 100644 --- a/src/epd2in9/mod.rs +++ b/src/epd2in9/mod.rs @@ -325,6 +325,7 @@ where Ok(()) } + /// Set your own LUT, this function is also used internally for set_lut fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { assert!(buffer.len() == 30); self.interface diff --git a/src/traits.rs b/src/traits.rs index 68f1c4d..814e8cd 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -12,6 +12,7 @@ pub(crate) trait Command { } /// Seperates the different LUT for the Display Refresh process +#[derive(Debug, Clone, PartialEq, Eq)] pub enum RefreshLUT { /// The "normal" full Lookuptable for the Refresh-Sequence FULL, diff --git a/src/type_a/constants.rs b/src/type_a/constants.rs index f1afc9e..69116e8 100644 --- a/src/type_a/constants.rs +++ b/src/type_a/constants.rs @@ -1,5 +1,6 @@ -// Original Waveforms from Waveshare +#[cfg(not(any(feature = "type_a_alternative_faster_lut")))] #[rustfmt::skip] +// Original Waveforms from Waveshare pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[ 0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22, 0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88, @@ -14,3 +15,11 @@ pub(crate) const LUT_PARTIAL_UPDATE: [u8; 30] =[ 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]; + +#[cfg(feature = "type_a_alternative_faster_lut")] +#[rustfmt::skip] +// Waveform from TeXiToi/il3820 +pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[ + 0x50, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +];