Browse Source

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
main
pi 5 years ago
parent
commit
ba1243137d
  1. 1
      CHANGELOG.md
  2. 1
      README.md
  3. 11
      src/epd7in5_hd/mod.rs

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added ### Added
- Added QuickRefresh Trait and implemented it for EPD4in2 in #62 (thanks to @David-OConnor) - 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 2in7 (B) support in #60 (thanks to @pjsier)
- Added Epd 7in5 HD support
### Changed ### Changed
- Use specific ParseColorError instead of () - Use specific ParseColorError instead of ()

1
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 | | 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 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 | ✕ | ✕ | ✔ | ✔ | | [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)] | ✔ | ✔ | | [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)] | ✔ | ✔ |

11
src/epd7in5_hd/mod.rs

@ -1,5 +1,9 @@
//! A simple Driver for the Waveshare 7.5" E-Ink Display (HD) via SPI //! 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 //! # References
//! //!
//! - [Datasheet](https://www.waveshare.com/w/upload/2/27/7inch_HD_e-Paper_Specification.pdf) //! - [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 /// Height of the display
pub const HEIGHT: u32 = 528; pub const HEIGHT: u32 = 528;
/// Default Background Color /// 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; const IS_BUSY_LOW: bool = false;
/// EPD7in5 (HD) driver /// EPD7in5 (HD) driver
@ -171,13 +175,14 @@ where
fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
let pixel_count = WIDTH * HEIGHT / 8; let pixel_count = WIDTH * HEIGHT / 8;
let background_color_byte = self.color.get_byte_value();
self.wait_until_idle(); self.wait_until_idle();
self.cmd_with_data(spi, Command::SET_RAM_Y_AC, &[0x00, 0x00])?; self.cmd_with_data(spi, Command::SET_RAM_Y_AC, &[0x00, 0x00])?;
for cmd in &[Command::WRITE_RAM_BW, Command::WRITE_RAM_RED] { for cmd in &[Command::WRITE_RAM_BW, Command::WRITE_RAM_RED] {
self.command(spi, *cmd)?; 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])?; self.cmd_with_data(spi, Command::DISPLAY_UPDATE_CONTROL_2, &[0xF7])?;
@ -249,6 +254,6 @@ mod tests {
fn epd_size() { fn epd_size() {
assert_eq!(WIDTH, 880); assert_eq!(WIDTH, 880);
assert_eq!(HEIGHT, 528); assert_eq!(HEIGHT, 528);
assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::Black); assert_eq!(DEFAULT_BACKGROUND_COLOR, Color::White);
} }
} }

Loading…
Cancel
Save