Browse Source

Minor cleanup, added HiZ as color

main
Mitch Souders 5 years ago
parent
commit
231cc63009
  1. 6
      src/color.rs
  2. 2
      src/epd5in65f/mod.rs
  3. 4
      src/lib.rs

6
src/color.rs

@ -30,7 +30,7 @@ pub enum TriColor {
Chromatic, Chromatic,
} }
/// For the 5in65 8 Color Display /// For the 5in65 7 Color Display
#[derive(Clone, Copy, PartialEq, Debug)] #[derive(Clone, Copy, PartialEq, Debug)]
pub enum OctColor { pub enum OctColor {
/// Black Color /// Black Color
@ -47,6 +47,8 @@ pub enum OctColor {
Yellow = 0x05, Yellow = 0x05,
/// Orange Color /// Orange Color
Orange = 0x06, Orange = 0x06,
/// HiZ / Clean Color
HiZ = 0x07,
} }
impl From<()> for OctColor { impl From<()> for OctColor {
@ -80,6 +82,7 @@ impl OctColor {
0x04 => Ok(OctColor::Red), 0x04 => Ok(OctColor::Red),
0x05 => Ok(OctColor::Yellow), 0x05 => Ok(OctColor::Yellow),
0x06 => Ok(OctColor::Orange), 0x06 => Ok(OctColor::Orange),
0x07 => Ok(OctColor::HiZ),
_ => Err(()) _ => Err(())
} }
} }
@ -99,6 +102,7 @@ impl OctColor {
OctColor::Red => (0xff, 0x00, 0x00), OctColor::Red => (0xff, 0x00, 0x00),
OctColor::Yellow => (0xff, 0xff, 0x00), OctColor::Yellow => (0xff, 0xff, 0x00),
OctColor::Orange => (0xff, 0x80, 0x00), OctColor::Orange => (0xff, 0x80, 0x00),
OctColor::HiZ => (0x80, 0x80, 0x80), /* looks greyish */
} }
} }
} }

2
src/epd5in65f/mod.rs

@ -155,7 +155,7 @@ where
} }
fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
let bg = 0x77; /*clear frame */ //OctColor::colors_byte(self.color, self.color); let bg = OctColor::colors_byte(self.color, self.color);
self.wait_busy_high(); self.wait_busy_high();
self.send_resolution(spi)?; self.send_resolution(spi)?;
self.command(spi, Command::DATA_START_TRANSMISSION_1)?; self.command(spi, Command::DATA_START_TRANSMISSION_1)?;

4
src/lib.rs

@ -86,13 +86,13 @@ pub(crate) mod type_a;
/// Includes everything important besides the chosen Display /// Includes everything important besides the chosen Display
pub mod prelude { pub mod prelude {
pub use crate::color::{Color, TriColor}; pub use crate::color::{Color, TriColor, OctColor};
pub use crate::traits::{RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay}; pub use crate::traits::{RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay};
pub use crate::SPI_MODE; pub use crate::SPI_MODE;
#[cfg(feature = "graphics")] #[cfg(feature = "graphics")]
pub use crate::graphics::{Display, DisplayRotation}; pub use crate::graphics::{OctDisplay, Display, DisplayRotation};
} }
/// Computes the needed buffer length. Takes care of rounding up in case width /// Computes the needed buffer length. Takes care of rounding up in case width

Loading…
Cancel
Save