From 435cfd9a1c471b04a9dd0681667c73149ff662da Mon Sep 17 00:00:00 2001 From: Johan Kristell Date: Sat, 28 Dec 2019 09:12:53 +0100 Subject: [PATCH] Rename trait and method and doc update --- src/epd1in54b/mod.rs | 6 +++--- src/lib.rs | 2 +- src/traits.rs | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/epd1in54b/mod.rs b/src/epd1in54b/mod.rs index 78e4244..abdd4b3 100644 --- a/src/epd1in54b/mod.rs +++ b/src/epd1in54b/mod.rs @@ -6,7 +6,7 @@ use embedded_hal::{ }; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareTwoColorDisplay}; +use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay}; //The Lookup Tables for the Display mod constants; @@ -83,7 +83,7 @@ where } } -impl WaveshareTwoColorDisplay +impl WaveshareThreeColorDisplay for EPD1in54b where SPI: Write, @@ -92,7 +92,7 @@ where DC: OutputPin, RST: OutputPin, { - fn update_both_planes( + fn update_color_frame( &mut self, spi: &mut SPI, black: &[u8], diff --git a/src/lib.rs b/src/lib.rs index b52d6c2..931e4dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,7 @@ pub(crate) mod type_a; pub mod prelude { pub use crate::color::Color; - pub use crate::traits::{RefreshLUT, WaveshareDisplay, WaveshareTwoColorDisplay}; + pub use crate::traits::{RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay}; pub use crate::SPI_MODE; #[cfg(feature = "graphics")] diff --git a/src/traits.rs b/src/traits.rs index aaceee3..9f5cdb8 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -53,8 +53,8 @@ where } -/// Functions to interact with two color panels -pub trait WaveshareTwoColorDisplay: +/// Functions to interact with three color panels +pub trait WaveshareThreeColorDisplay: WaveshareDisplay where SPI: Write, @@ -63,12 +63,14 @@ where DC: OutputPin, RST: OutputPin, { - /// Update both color planes - fn update_both_planes( + /// Transmit data to the SRAM of the EPD + /// + /// Updates both the black and the secondary color layers + fn update_color_frame( &mut self, spi: &mut SPI, black: &[u8], - color1: &[u8], + color: &[u8], ) -> Result<(), SPI::Error>; }