From ba1243137d70d149a210d05b2b6ca6b119bdc146 Mon Sep 17 00:00:00 2001 From: pi Date: Wed, 14 Apr 2021 14:59:23 +0100 Subject: [PATCH] EPD 7in5 HD: Added more documentation Updated README to include the driver. Updated CHANGELOG. Added note about the default background color of the HD driver --- CHANGELOG.md | 1 + README.md | 1 + src/epd7in5_hd/mod.rs | 11 ++++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3eeac2..73104ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Added QuickRefresh Trait and implemented it for EPD4in2 in #62 (thanks to @David-OConnor) - Added Epd 2in7 (B) support in #60 (thanks to @pjsier) + - Added Epd 7in5 HD support ### Changed - Use specific ParseColorError instead of () diff --git a/README.md b/README.md index 200e601..e2a83b4 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ epd.update_and_display_frame(&mut spi, &display.buffer())?; | Device (with Link) | Colors | Flexible Display | Partial Refresh | Supported | Tested | | :---: | --- | :---: | :---: | :---: | :---: | +| [7.5 Inch B/W HD (A)](https://www.waveshare.com/product/displays/e-paper/epaper-1/7.5inch-hd-e-paper-hat.htm) | Black, White | ✕ | ✕ | ✔ | ✔ | | [7.5 Inch B/W V2 (A)](https://www.waveshare.com/product/7.5inch-e-paper-hat.htm) [[1](#1-75-inch-bw-v2-a)] | Black, White | ✕ | ✕ | ✔ | ✔ | | [7.5 Inch B/W (A)](https://www.waveshare.com/product/7.5inch-e-paper-hat.htm) | Black, White | ✕ | ✕ | ✔ | ✔ | | [4.2 Inch B/W (A)](https://www.waveshare.com/product/4.2inch-e-paper-module.htm) | Black, White | ✕ | Not officially [[2](#2-42-inch-e-ink-blackwhite---partial-refresh)] | ✔ | ✔ | diff --git a/src/epd7in5_hd/mod.rs b/src/epd7in5_hd/mod.rs index d0728b9..90eb746 100644 --- a/src/epd7in5_hd/mod.rs +++ b/src/epd7in5_hd/mod.rs @@ -1,5 +1,9 @@ //! A simple Driver for the Waveshare 7.5" E-Ink Display (HD) via SPI //! +//! Color values for this driver are inverted compared to the [EPD 7in5 V2 driver](crate::epd7in5_v2) +//! *EPD 7in5 HD:* White = 1/0xFF, Black = 0/0x00 +//! *EPD 7in5 V2:* White = 0/0x00, Black = 1/0xFF +//! //! # References //! //! - [Datasheet](https://www.waveshare.com/w/upload/2/27/7inch_HD_e-Paper_Specification.pdf) @@ -27,7 +31,7 @@ pub const WIDTH: u32 = 880; /// Height of the display pub const HEIGHT: u32 = 528; /// Default Background Color -pub const DEFAULT_BACKGROUND_COLOR: Color = Color::Black; // Inverted for HD (0xFF = White) +pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White; // Inverted for HD as compared to 7in5 v2 (HD: 0xFF = White) const IS_BUSY_LOW: bool = false; /// EPD7in5 (HD) driver @@ -171,13 +175,14 @@ where fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { let pixel_count = WIDTH * HEIGHT / 8; + let background_color_byte = self.color.get_byte_value(); self.wait_until_idle(); self.cmd_with_data(spi, Command::SET_RAM_Y_AC, &[0x00, 0x00])?; for cmd in &[Command::WRITE_RAM_BW, Command::WRITE_RAM_RED] { self.command(spi, *cmd)?; - self.interface.data_x_times(spi, 0xFF, pixel_count)?; + self.interface.data_x_times(spi, background_color_byte, pixel_count)?; } self.cmd_with_data(spi, Command::DISPLAY_UPDATE_CONTROL_2, &[0xF7])?; @@ -249,6 +254,6 @@ mod tests { fn epd_size() { assert_eq!(WIDTH, 880); assert_eq!(HEIGHT, 528); - assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::Black); + assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::White); } }