diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a4ae72..37fbb31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,13 @@ 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 QuickRefresh Trait and implemented it for Epd4in2 in #62 (thanks to @David-OConnor) - Added Epd 2in7 (B) support in #60 (thanks to @pjsier) ### Changed - Use specific ParseColorError instead of () -- EPD4in2: Don't set the resolution (and some more) over and over again (#48) +- Epd4in2: Don't set the resolution (and some more) over and over again (#48) - Removed `#[allow(non_camel_case_types)]` to fix various issues around it ### Fixed diff --git a/README.md b/README.md index 99fcb1b..1b72247 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ There are multiple examples in the examples folder. Use `cargo run --example exa ```Rust // Setup the epd -let mut epd = EPD4in2::new( & mut spi, cs, busy, dc, rst, & mut delay) ?; +let mut epd = Epd4in2::new( & mut spi, cs, busy, dc, rst, & mut delay) ?; // Setup the graphics let mut display = Display4in2::default (); diff --git a/examples/epd1in54_no_graphics.rs b/examples/epd1in54_no_graphics.rs index 7fd30ae..4782622 100644 --- a/examples/epd1in54_no_graphics.rs +++ b/examples/epd1in54_no_graphics.rs @@ -1,7 +1,7 @@ #![deny(warnings)] use embedded_hal::prelude::*; -use epd_waveshare::{epd1in54::EPD1in54, prelude::*}; +use epd_waveshare::{epd1in54::Epd1in54, prelude::*}; use linux_embedded_hal::{ spidev::{self, SpidevOptions}, sysfs_gpio::Direction, @@ -58,14 +58,14 @@ fn main() -> Result<(), std::io::Error> { // Setup of the needed pins is finished here // Now the "real" usage of the eink-waveshare-rs crate begins - let mut epd = EPD1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?; + let mut epd = Epd1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay)?; // Clear the full screen epd.clear_frame(&mut spi)?; epd.display_frame(&mut spi)?; // Speeddemo - epd.set_lut(&mut spi, Some(RefreshLUT::QUICK))?; + epd.set_lut(&mut spi, Some(RefreshLut::Quick))?; let small_buffer = [Color::Black.get_byte_value(); 32]; //16x16 let number_of_runs = 1; for i in 0..number_of_runs { diff --git a/examples/epd2in13_v2.rs b/examples/epd2in13_v2.rs index ac509c3..3fc7472 100644 --- a/examples/epd2in13_v2.rs +++ b/examples/epd2in13_v2.rs @@ -10,7 +10,7 @@ use embedded_graphics::{ use embedded_hal::prelude::*; use epd_waveshare::{ color::*, - epd2in13_v2::{Display2in13, EPD2in13}, + epd2in13_v2::{Display2in13, Epd2in13}, graphics::{Display, DisplayRotation}, prelude::*, }; @@ -63,7 +63,7 @@ fn main() -> Result<(), std::io::Error> { let mut delay = Delay {}; let mut epd2in13 = - EPD2in13::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); + Epd2in13::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); //println!("Test all the rotations"); let mut display = Display2in13::default(); @@ -121,7 +121,7 @@ fn main() -> Result<(), std::io::Error> { // Demonstrating how to use the partial refresh feature of the screen. // Real animations can be used. epd2in13 - .set_refresh(&mut spi, &mut delay, RefreshLUT::QUICK) + .set_refresh(&mut spi, &mut delay, RefreshLut::Quick) .unwrap(); epd2in13.clear_frame(&mut spi).unwrap(); diff --git a/examples/epd4in2.rs b/examples/epd4in2.rs index 04730ed..b986828 100644 --- a/examples/epd4in2.rs +++ b/examples/epd4in2.rs @@ -10,7 +10,7 @@ use embedded_graphics::{ use embedded_hal::prelude::*; use epd_waveshare::{ color::*, - epd4in2::{Display4in2, EPD4in2}, + epd4in2::{Display4in2, Epd4in2}, graphics::{Display, DisplayRotation}, prelude::*, }; @@ -63,7 +63,7 @@ fn main() -> Result<(), std::io::Error> { let mut delay = Delay {}; let mut epd4in2 = - EPD4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); + Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); //println!("Test all the rotations"); let mut display = Display4in2::default(); @@ -120,7 +120,7 @@ fn main() -> Result<(), std::io::Error> { // a moving `Hello World!` let limit = 10; - epd4in2.set_lut(&mut spi, Some(RefreshLUT::QUICK)).unwrap(); + epd4in2.set_lut(&mut spi, Some(RefreshLut::Quick)).unwrap(); epd4in2.clear_frame(&mut spi).unwrap(); for i in 0..limit { //println!("Moving Hello World. Loop {} from {}", (i + 1), limit); diff --git a/examples/epd4in2_variable_size.rs b/examples/epd4in2_variable_size.rs index 6c03851..554c707 100644 --- a/examples/epd4in2_variable_size.rs +++ b/examples/epd4in2_variable_size.rs @@ -11,7 +11,7 @@ use embedded_graphics::{ use embedded_hal::prelude::*; use epd_waveshare::{ color::*, - epd4in2::{self, EPD4in2}, + epd4in2::{self, Epd4in2}, graphics::{Display, DisplayRotation, VarDisplay}, prelude::*, }; @@ -64,7 +64,7 @@ fn main() -> Result<(), std::io::Error> { let mut delay = Delay {}; let mut epd4in2 = - EPD4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); + Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error"); println!("Test all the rotations"); diff --git a/src/epd1in54/mod.rs b/src/epd1in54/mod.rs index 99f0d4c..315899b 100644 --- a/src/epd1in54/mod.rs +++ b/src/epd1in54/mod.rs @@ -20,7 +20,7 @@ //!# let mut delay = delay::MockNoop::new(); //! //!// Setup EPD -//!let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +//!let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; //! //!// Use display graphics from embedded-graphics //!let mut display = Display1in54::default(); @@ -61,7 +61,7 @@ use crate::type_a::{ use crate::color::Color; -use crate::traits::{RefreshLUT, WaveshareDisplay}; +use crate::traits::{RefreshLut, WaveshareDisplay}; use crate::interface::DisplayInterface; @@ -70,18 +70,18 @@ mod graphics; #[cfg(feature = "graphics")] pub use crate::epd1in54::graphics::Display1in54; -/// EPD1in54 driver +/// Epd1in54 driver /// -pub struct EPD1in54 { +pub struct Epd1in54 { /// SPI interface: DisplayInterface, /// Color background_color: Color, /// Refresh LUT - refresh: RefreshLUT, + refresh: RefreshLut, } -impl EPD1in54 +impl Epd1in54 where SPI: Write, CS: OutputPin, @@ -140,7 +140,7 @@ where } impl WaveshareDisplay - for EPD1in54 + for Epd1in54 where SPI: Write, CS: OutputPin, @@ -167,10 +167,10 @@ where ) -> Result { let interface = DisplayInterface::new(cs, busy, dc, rst); - let mut epd = EPD1in54 { + let mut epd = Epd1in54 { interface, background_color: DEFAULT_BACKGROUND_COLOR, - refresh: RefreshLUT::FULL, + refresh: RefreshLut::Full, }; epd.init(spi, delay)?; @@ -232,7 +232,7 @@ where self.interface.cmd(spi, Command::MasterActivation)?; // MASTER Activation should not be interupted to avoid currption of panel images // therefore a terminate command is send - self.interface.cmd(spi, Command::NOP)?; + self.interface.cmd(spi, Command::Nop)?; Ok(()) } @@ -266,14 +266,14 @@ where fn set_lut( &mut self, spi: &mut SPI, - refresh_rate: Option, + refresh_rate: Option, ) -> Result<(), SPI::Error> { if let Some(refresh_lut) = refresh_rate { self.refresh = refresh_lut; } match self.refresh { - RefreshLUT::FULL => self.set_lut_helper(spi, &LUT_FULL_UPDATE), - RefreshLUT::QUICK => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE), + RefreshLut::Full => self.set_lut_helper(spi, &LUT_FULL_UPDATE), + RefreshLut::Quick => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE), } } @@ -282,7 +282,7 @@ where } } -impl EPD1in54 +impl Epd1in54 where SPI: Write, CS: OutputPin, diff --git a/src/epd1in54b/command.rs b/src/epd1in54b/command.rs index 392fd19..fd1e35d 100644 --- a/src/epd1in54b/command.rs +++ b/src/epd1in54b/command.rs @@ -24,7 +24,7 @@ pub(crate) enum Command { LutRed1 = 0x27, PllControl = 0x30, - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, TemperatureSensorSelection = 0x41, VcomAndDataIntervalSetting = 0x50, ResolutionSetting = 0x61, diff --git a/src/epd1in54b/mod.rs b/src/epd1in54b/mod.rs index 25a5b48..0f871ba 100644 --- a/src/epd1in54b/mod.rs +++ b/src/epd1in54b/mod.rs @@ -7,7 +7,7 @@ use embedded_hal::{ use crate::interface::DisplayInterface; use crate::traits::{ - InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay, + InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay, }; //The Lookup Tables for the Display @@ -32,14 +32,14 @@ mod graphics; #[cfg(feature = "graphics")] pub use self::graphics::Display1in54b; -/// EPD1in54b driver -pub struct EPD1in54b { +/// Epd1in54b driver +pub struct Epd1in54b { interface: DisplayInterface, color: Color, } impl InternalWiAdditions - for EPD1in54b + for Epd1in54b where SPI: Write, CS: OutputPin, @@ -89,7 +89,7 @@ where } impl WaveshareThreeColorDisplay - for EPD1in54b + for Epd1in54b where SPI: Write, CS: OutputPin, @@ -132,7 +132,7 @@ where } impl WaveshareDisplay - for EPD1in54b + for Epd1in54b where SPI: Write, CS: OutputPin, @@ -152,7 +152,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD1in54b { interface, color }; + let mut epd = Epd1in54b { interface, color }; epd.init(spi, delay)?; @@ -165,7 +165,7 @@ where .cmd_with_data(spi, Command::VcomAndDataIntervalSetting, &[0x17])?; //border floating self.interface - .cmd_with_data(spi, Command::VcmDcSetting, &[0x00])?; // VCOM to 0V + .cmd_with_data(spi, Command::VcmDcSetting, &[0x00])?; // Vcom to 0V self.interface .cmd_with_data(spi, Command::PowerSetting, &[0x02, 0x00, 0x00, 0x00])?; //VG&VS to 0V fast @@ -276,7 +276,7 @@ where fn set_lut( &mut self, spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { self.interface .cmd_with_data(spi, Command::LutForVcom, LUT_VCOM0)?; @@ -301,7 +301,7 @@ where } } -impl EPD1in54b +impl Epd1in54b where SPI: Write, CS: OutputPin, diff --git a/src/epd1in54c/command.rs b/src/epd1in54c/command.rs index eef7aec..5913986 100644 --- a/src/epd1in54c/command.rs +++ b/src/epd1in54c/command.rs @@ -22,7 +22,7 @@ pub(crate) enum Command { LutBlackToBlack = 0x24, PllControl = 0x30, - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, TemperatureSensorSelection = 0x41, VcomAndDataIntervalSetting = 0x50, ResolutionSetting = 0x61, diff --git a/src/epd1in54c/mod.rs b/src/epd1in54c/mod.rs index 77b5325..6ff0508 100644 --- a/src/epd1in54c/mod.rs +++ b/src/epd1in54c/mod.rs @@ -7,7 +7,7 @@ use embedded_hal::{ use crate::interface::DisplayInterface; use crate::traits::{ - InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay, + InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay, }; /// Width of epd1in54 in pixels @@ -30,14 +30,14 @@ mod graphics; #[cfg(feature = "graphics")] pub use self::graphics::Display1in54c; -/// EPD1in54c driver -pub struct EPD1in54c { +/// Epd1in54c driver +pub struct Epd1in54c { interface: DisplayInterface, color: Color, } impl InternalWiAdditions - for EPD1in54c + for Epd1in54c where SPI: Write, CS: OutputPin, @@ -77,7 +77,7 @@ where } impl WaveshareThreeColorDisplay - for EPD1in54c + for Epd1in54c where SPI: Write, CS: OutputPin, @@ -115,7 +115,7 @@ where } impl WaveshareDisplay - for EPD1in54c + for Epd1in54c where SPI: Write, CS: OutputPin, @@ -135,7 +135,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD1in54c { interface, color }; + let mut epd = Epd1in54c { interface, color }; epd.init(spi, delay)?; @@ -233,7 +233,7 @@ where fn set_lut( &mut self, _spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { Ok(()) } @@ -243,7 +243,7 @@ where } } -impl EPD1in54c +impl Epd1in54c where SPI: Write, CS: OutputPin, diff --git a/src/epd2in13_v2/command.rs b/src/epd2in13_v2/command.rs index e94c43e..850fd16 100644 --- a/src/epd2in13_v2/command.rs +++ b/src/epd2in13_v2/command.rs @@ -5,7 +5,7 @@ use crate::traits; extern crate bit_field; use bit_field::BitField; -/// EPD2in13 v2 +/// Epd2in13 v2 /// /// For more infos about the addresses and what they are doing look into the pdfs #[allow(dead_code)] @@ -54,7 +54,7 @@ pub(crate) enum Command { SetAnalogBlockControl = 0x74, SetDigitalBlockControl = 0x7E, - NOP = 0x7F, + Nop = 0x7F, } pub(crate) struct DriverOutput { @@ -151,34 +151,34 @@ pub(crate) enum DataEntryModeDir { #[allow(dead_code)] #[derive(Copy, Clone)] -pub(crate) enum BorderWaveFormVBD { - GS = 0x0, +pub(crate) enum BorderWaveFormVbd { + Gs = 0x0, FixLevel = 0x1, - VCOM = 0x2, + Vcom = 0x2, } #[allow(dead_code)] #[derive(Copy, Clone)] pub(crate) enum BorderWaveFormFixLevel { - VSS = 0x0, - VSH1 = 0x1, - VSL = 0x2, - VSH2 = 0x3, + Vss = 0x0, + Vsh1 = 0x1, + Vsl = 0x2, + Vsh2 = 0x3, } #[allow(dead_code)] #[derive(Copy, Clone)] -pub(crate) enum BorderWaveFormGS { - LUT0 = 0x0, - LUT1 = 0x1, - LUT2 = 0x2, - LUT3 = 0x3, +pub(crate) enum BorderWaveFormGs { + Lut0 = 0x0, + Lut1 = 0x1, + Lut2 = 0x2, + Lut3 = 0x3, } pub(crate) struct BorderWaveForm { - pub vbd: BorderWaveFormVBD, + pub vbd: BorderWaveFormVbd, pub fix_level: BorderWaveFormFixLevel, - pub gs_trans: BorderWaveFormGS, + pub gs_trans: BorderWaveFormGs, } impl BorderWaveForm { @@ -204,10 +204,10 @@ pub enum DeepSleepMode { pub(crate) struct GateDrivingVoltage(pub u8); pub(crate) struct SourceDrivingVoltage(pub u8); -pub(crate) struct VCOM(pub u8); +pub(crate) struct Vcom(pub u8); pub(crate) trait I32Ext { - fn vcom(self) -> VCOM; + fn vcom(self) -> Vcom; fn gate_driving_decivolt(self) -> GateDrivingVoltage; fn source_driving_decivolt(self) -> SourceDrivingVoltage; } @@ -215,7 +215,7 @@ pub(crate) trait I32Ext { impl I32Ext for i32 { // This is really not very nice. Until I find something better, this will be // a placeholder. - fn vcom(self) -> VCOM { + fn vcom(self) -> Vcom { assert!((-30..=-2).contains(&self)); let u = match -self { 2 => 0x08, @@ -249,7 +249,7 @@ impl I32Ext for i32 { 30 => 0x78, _ => 0, }; - VCOM(u) + Vcom(u) } fn gate_driving_decivolt(self) -> GateDrivingVoltage { diff --git a/src/epd2in13_v2/mod.rs b/src/epd2in13_v2/mod.rs index cd5481d..4705c1f 100644 --- a/src/epd2in13_v2/mod.rs +++ b/src/epd2in13_v2/mod.rs @@ -16,13 +16,13 @@ use embedded_hal::{ use crate::buffer_len; use crate::color::Color; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay}; +use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay}; pub(crate) mod command; use self::command::{ - BorderWaveForm, BorderWaveFormFixLevel, BorderWaveFormGS, BorderWaveFormVBD, Command, + BorderWaveForm, BorderWaveFormFixLevel, BorderWaveFormGs, BorderWaveFormVbd, Command, DataEntryModeDir, DataEntryModeIncr, DeepSleepMode, DisplayUpdateControl2, DriverOutput, - GateDrivingVoltage, I32Ext, SourceDrivingVoltage, VCOM, + GateDrivingVoltage, I32Ext, SourceDrivingVoltage, Vcom, }; pub(crate) mod constants; @@ -43,9 +43,9 @@ pub const HEIGHT: u32 = 250; pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White; const IS_BUSY_LOW: bool = false; -/// EPD2in13 (V2) driver +/// Epd2in13 (V2) driver /// -pub struct EPD2in13 { +pub struct Epd2in13 { /// Connection Interface interface: DisplayInterface, @@ -53,11 +53,11 @@ pub struct EPD2in13 { /// Background Color background_color: Color, - refresh: RefreshLUT, + refresh: RefreshLut, } impl InternalWiAdditions - for EPD2in13 + for Epd2in13 where SPI: Write, CS: OutputPin, @@ -73,7 +73,7 @@ where // HW reset self.interface.reset(delay, 10); - if self.refresh == RefreshLUT::QUICK { + if self.refresh == RefreshLut::Quick { self.set_vcom_register(spi, (-9).vcom())?; self.wait_until_idle(); @@ -94,9 +94,9 @@ where self.set_border_waveform( spi, BorderWaveForm { - vbd: BorderWaveFormVBD::GS, - fix_level: BorderWaveFormFixLevel::VSS, - gs_trans: BorderWaveFormGS::LUT1, + vbd: BorderWaveFormVbd::Gs, + fix_level: BorderWaveFormFixLevel::Vss, + gs_trans: BorderWaveFormGs::Lut1, }, )?; } else { @@ -127,9 +127,9 @@ where self.set_border_waveform( spi, BorderWaveForm { - vbd: BorderWaveFormVBD::GS, - fix_level: BorderWaveFormFixLevel::VSS, - gs_trans: BorderWaveFormGS::LUT3, + vbd: BorderWaveFormVbd::Gs, + fix_level: BorderWaveFormFixLevel::Vss, + gs_trans: BorderWaveFormGs::Lut3, }, )?; @@ -154,7 +154,7 @@ where } impl WaveshareDisplay - for EPD2in13 + for Epd2in13 where SPI: Write, CS: OutputPin, @@ -171,11 +171,11 @@ where rst: RST, delay: &mut DELAY, ) -> Result { - let mut epd = EPD2in13 { + let mut epd = Epd2in13 { interface: DisplayInterface::new(cs, busy, dc, rst), sleep_mode: DeepSleepMode::Mode1, background_color: DEFAULT_BACKGROUND_COLOR, - refresh: RefreshLUT::FULL, + refresh: RefreshLut::Full, }; epd.init(spi, delay)?; @@ -215,7 +215,7 @@ where self.cmd_with_data(spi, Command::WriteRam, buffer)?; - if self.refresh == RefreshLUT::FULL { + if self.refresh == RefreshLut::Full { // Always keep the base buffer equal to current if not doing partial refresh. self.set_ram_area(spi, 0, 0, WIDTH - 1, HEIGHT - 1)?; self.set_ram_address_counters(spi, 0, 0)?; @@ -245,14 +245,14 @@ where // RAM content). Using this function will most probably make the actual // display incorrect as the controler will compare with something // incorrect. - assert!(self.refresh == RefreshLUT::FULL); + assert!(self.refresh == RefreshLut::Full); self.set_ram_area(spi, x, y, x + width, y + height)?; self.set_ram_address_counters(spi, x, y)?; self.cmd_with_data(spi, Command::WriteRam, buffer)?; - if self.refresh == RefreshLUT::FULL { + if self.refresh == RefreshLut::Full { // Always keep the base buffer equals to current if not doing partial refresh. self.set_ram_area(spi, x, y, x + width, y + height)?; self.set_ram_address_counters(spi, x, y)?; @@ -266,7 +266,7 @@ where /// Never use directly this function when using partial refresh, or also /// keep the base buffer in syncd using `set_partial_base_buffer` function. fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { - if self.refresh == RefreshLUT::FULL { + if self.refresh == RefreshLut::Full { self.set_display_update_control_2( spi, DisplayUpdateControl2::new() @@ -289,7 +289,7 @@ where self.update_frame(spi, buffer)?; self.display_frame(spi)?; - if self.refresh == RefreshLUT::QUICK { + if self.refresh == RefreshLut::Quick { self.set_partial_base_buffer(spi, buffer)?; } Ok(()) @@ -309,7 +309,7 @@ where )?; // Always keep the base buffer equals to current if not doing partial refresh. - if self.refresh == RefreshLUT::FULL { + if self.refresh == RefreshLut::Full { self.set_ram_area(spi, 0, 0, WIDTH - 1, HEIGHT - 1)?; self.set_ram_address_counters(spi, 0, 0)?; @@ -342,11 +342,11 @@ where fn set_lut( &mut self, spi: &mut SPI, - refresh_rate: Option, + refresh_rate: Option, ) -> Result<(), SPI::Error> { let buffer = match refresh_rate { - Some(RefreshLUT::FULL) | None => &LUT_FULL_UPDATE, - Some(RefreshLUT::QUICK) => &LUT_PARTIAL_UPDATE, + Some(RefreshLut::Full) | None => &LUT_FULL_UPDATE, + Some(RefreshLut::Quick) => &LUT_PARTIAL_UPDATE, }; self.cmd_with_data(spi, Command::WriteLutRegister, buffer) @@ -357,7 +357,7 @@ where } } -impl EPD2in13 +impl Epd2in13 where SPI: Write, CS: OutputPin, @@ -391,7 +391,7 @@ where &mut self, spi: &mut SPI, delay: &mut DELAY, - refresh: RefreshLUT, + refresh: RefreshLut, ) -> Result<(), SPI::Error> { if self.refresh != refresh { self.refresh = refresh; @@ -425,7 +425,7 @@ where ) } - fn set_vcom_register(&mut self, spi: &mut SPI, vcom: VCOM) -> Result<(), SPI::Error> { + fn set_vcom_register(&mut self, spi: &mut SPI, vcom: Vcom) -> Result<(), SPI::Error> { self.cmd_with_data(spi, Command::WriteVcomRegister, &[vcom.0]) } diff --git a/src/epd2in7b/command.rs b/src/epd2in7b/command.rs index b228d22..e32365c 100644 --- a/src/epd2in7b/command.rs +++ b/src/epd2in7b/command.rs @@ -71,7 +71,7 @@ pub(crate) enum Command { /// This command reads the temperature sensed by the temperature sensor. /// /// Doesn't work! Waveshare doesn't connect the read pin - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, /// This command selects Internal or External temperature sensor. TemperatureSensorCalibration = 0x41, /// Write External Temperature Sensor diff --git a/src/epd2in7b/mod.rs b/src/epd2in7b/mod.rs index 37ae3b5..cbe07fe 100644 --- a/src/epd2in7b/mod.rs +++ b/src/epd2in7b/mod.rs @@ -9,7 +9,7 @@ use embedded_hal::{ use crate::interface::DisplayInterface; use crate::traits::{ - InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay, + InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay, }; // The Lookup Tables for the Display @@ -34,8 +34,8 @@ mod graphics; #[cfg(feature = "graphics")] pub use self::graphics::Display2in7b; -/// EPD2in7b driver -pub struct EPD2in7b { +/// Epd2in7b driver +pub struct Epd2in7b { /// Connection Interface interface: DisplayInterface, /// Background Color @@ -43,7 +43,7 @@ pub struct EPD2in7b { } impl InternalWiAdditions - for EPD2in7b + for Epd2in7b where SPI: Write, CS: OutputPin, @@ -112,7 +112,7 @@ where } impl WaveshareDisplay - for EPD2in7b + for Epd2in7b where SPI: Write, CS: OutputPin, @@ -132,7 +132,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD2in7b { interface, color }; + let mut epd = Epd2in7b { interface, color }; epd.init(spi, delay)?; @@ -247,7 +247,7 @@ where fn set_lut( &mut self, spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { self.wait_until_idle(); self.cmd_with_data(spi, Command::LutForVcom, &LUT_VCOM_DC)?; @@ -264,7 +264,7 @@ where } impl WaveshareThreeColorDisplay - for EPD2in7b + for Epd2in7b where SPI: Write, CS: OutputPin, @@ -316,7 +316,7 @@ where } } -impl EPD2in7b +impl Epd2in7b where SPI: Write, CS: OutputPin, diff --git a/src/epd2in9/mod.rs b/src/epd2in9/mod.rs index 99d003c..8658789 100644 --- a/src/epd2in9/mod.rs +++ b/src/epd2in9/mod.rs @@ -21,7 +21,7 @@ //!# let mut delay = delay::MockNoop::new(); //! //!// Setup EPD -//!let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +//!let mut epd = Epd2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; //! //!// Use display graphics from embedded-graphics //!let mut display = Display2in9::default(); @@ -70,18 +70,18 @@ mod graphics; #[cfg(feature = "graphics")] pub use crate::epd2in9::graphics::Display2in9; -/// EPD2in9 driver +/// Epd2in9 driver /// -pub struct EPD2in9 { +pub struct Epd2in9 { /// SPI interface: DisplayInterface, /// Color background_color: Color, /// Refresh LUT - refresh: RefreshLUT, + refresh: RefreshLut, } -impl EPD2in9 +impl Epd2in9 where SPI: Write, CS: OutputPin, @@ -136,7 +136,7 @@ where } impl WaveshareDisplay - for EPD2in9 + for Epd2in9 where SPI: Write, CS: OutputPin, @@ -163,10 +163,10 @@ where ) -> Result { let interface = DisplayInterface::new(cs, busy, dc, rst); - let mut epd = EPD2in9 { + let mut epd = Epd2in9 { interface, background_color: DEFAULT_BACKGROUND_COLOR, - refresh: RefreshLUT::FULL, + refresh: RefreshLut::Full, }; epd.init(spi, delay)?; @@ -231,7 +231,7 @@ where self.interface.cmd(spi, Command::MasterActivation)?; // MASTER Activation should not be interupted to avoid currption of panel images // therefore a terminate command is send - self.interface.cmd(spi, Command::NOP)?; + self.interface.cmd(spi, Command::Nop)?; Ok(()) } @@ -265,14 +265,14 @@ where fn set_lut( &mut self, spi: &mut SPI, - refresh_rate: Option, + refresh_rate: Option, ) -> Result<(), SPI::Error> { if let Some(refresh_lut) = refresh_rate { self.refresh = refresh_lut; } match self.refresh { - RefreshLUT::FULL => self.set_lut_helper(spi, &LUT_FULL_UPDATE), - RefreshLUT::QUICK => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE), + RefreshLut::Full => self.set_lut_helper(spi, &LUT_FULL_UPDATE), + RefreshLut::Quick => self.set_lut_helper(spi, &LUT_PARTIAL_UPDATE), } } @@ -281,7 +281,7 @@ where } } -impl EPD2in9 +impl Epd2in9 where SPI: Write, CS: OutputPin, diff --git a/src/epd2in9bc/command.rs b/src/epd2in9bc/command.rs index 9414c5a..7121c50 100644 --- a/src/epd2in9bc/command.rs +++ b/src/epd2in9bc/command.rs @@ -22,7 +22,7 @@ pub(crate) enum Command { LutBlackToBlack = 0x24, PllControl = 0x30, - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, TemperatureSensorSelection = 0x41, VcomAndDataIntervalSetting = 0x50, ResolutionSetting = 0x61, diff --git a/src/epd2in9bc/mod.rs b/src/epd2in9bc/mod.rs index 6f76602..ff8face 100644 --- a/src/epd2in9bc/mod.rs +++ b/src/epd2in9bc/mod.rs @@ -20,7 +20,7 @@ //!# let mut delay = delay::MockNoop::new(); //! //!// Setup EPD -//!let mut epd = EPD2in9bc::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +//!let mut epd = Epd2in9bc::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; //! //!// Use display graphics from embedded-graphics //!// This display is for the black/white pixels @@ -60,7 +60,7 @@ use embedded_hal::{ use crate::interface::DisplayInterface; use crate::traits::{ - InternalWiAdditions, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay, + InternalWiAdditions, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay, }; /// Width of epd2in9bc in pixels @@ -89,14 +89,14 @@ mod graphics; #[cfg(feature = "graphics")] pub use self::graphics::Display2in9bc; -/// EPD2in9bc driver -pub struct EPD2in9bc { +/// Epd2in9bc driver +pub struct Epd2in9bc { interface: DisplayInterface, color: Color, } impl InternalWiAdditions - for EPD2in9bc + for Epd2in9bc where SPI: Write, CS: OutputPin, @@ -143,7 +143,7 @@ where } impl WaveshareThreeColorDisplay - for EPD2in9bc + for Epd2in9bc where SPI: Write, CS: OutputPin, @@ -187,7 +187,7 @@ where } impl WaveshareDisplay - for EPD2in9bc + for Epd2in9bc where SPI: Write, CS: OutputPin, @@ -207,7 +207,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD2in9bc { interface, color }; + let mut epd = Epd2in9bc { interface, color }; epd.init(spi, delay)?; @@ -317,7 +317,7 @@ where fn set_lut( &mut self, _spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { Ok(()) } @@ -327,7 +327,7 @@ where } } -impl EPD2in9bc +impl Epd2in9bc where SPI: Write, CS: OutputPin, diff --git a/src/epd4in2/command.rs b/src/epd4in2/command.rs index 3a31a69..4d3a9fe 100644 --- a/src/epd4in2/command.rs +++ b/src/epd4in2/command.rs @@ -92,7 +92,7 @@ pub(crate) enum Command { /// This command reads the temperature sensed by the temperature sensor. /// /// Doesn't work! Waveshare doesn't connect the read pin - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, /// Selects the Internal or External temperature sensor and offset TemperatureSensorSelection = 0x41, /// Write External Temperature Sensor @@ -114,7 +114,7 @@ pub(crate) enum Command { /// The LUT_REV / Chip Revision is read from OTP address = 0x001. /// /// Doesn't work! Waveshare doesn't connect the read pin - REVISION = 0x70, + Revision = 0x70, /// Read Flags. This command reads the IC status /// PTL, I2C_ERR, I2C_BUSY, DATA, PON, POF, BUSY /// diff --git a/src/epd4in2/mod.rs b/src/epd4in2/mod.rs index 4e155a5..2f75539 100644 --- a/src/epd4in2/mod.rs +++ b/src/epd4in2/mod.rs @@ -25,7 +25,7 @@ //!# let mut delay = delay::MockNoop::new(); //! //!// Setup EPD -//!let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +//!let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; //! //!// Use display graphics from embedded-graphics //!let mut display = Display4in2::default(); @@ -55,7 +55,7 @@ use embedded_hal::{ }; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, QuickRefresh, RefreshLUT, WaveshareDisplay}; +use crate::traits::{InternalWiAdditions, QuickRefresh, RefreshLut, WaveshareDisplay}; //The Lookup Tables for the Display mod constants; @@ -79,19 +79,19 @@ mod graphics; #[cfg(feature = "graphics")] pub use self::graphics::Display4in2; -/// EPD4in2 driver +/// Epd4in2 driver /// -pub struct EPD4in2 { +pub struct Epd4in2 { /// Connection Interface interface: DisplayInterface, /// Background Color color: Color, /// Refresh LUT - refresh: RefreshLUT, + refresh: RefreshLut, } impl InternalWiAdditions - for EPD4in2 + for Epd4in2 where SPI: Write, CS: OutputPin, @@ -149,7 +149,7 @@ where } impl WaveshareDisplay - for EPD4in2 + for Epd4in2 where SPI: Write, CS: OutputPin, @@ -169,10 +169,10 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD4in2 { + let mut epd = Epd4in2 { interface, color, - refresh: RefreshLUT::FULL, + refresh: RefreshLut::Full, }; epd.init(spi, delay)?; @@ -313,16 +313,16 @@ where fn set_lut( &mut self, spi: &mut SPI, - refresh_rate: Option, + refresh_rate: Option, ) -> Result<(), SPI::Error> { if let Some(refresh_lut) = refresh_rate { self.refresh = refresh_lut; } match self.refresh { - RefreshLUT::FULL => { + RefreshLut::Full => { self.set_lut_helper(spi, &LUT_VCOM0, &LUT_WW, &LUT_BW, &LUT_WB, &LUT_BB) } - RefreshLUT::QUICK => self.set_lut_helper( + RefreshLut::Quick => self.set_lut_helper( spi, &LUT_VCOM0_QUICK, &LUT_WW_QUICK, @@ -338,7 +338,7 @@ where } } -impl EPD4in2 +impl Epd4in2 where SPI: Write, CS: OutputPin, @@ -435,7 +435,7 @@ where } impl QuickRefresh - for EPD4in2 + for Epd4in2 where SPI: Write, CS: OutputPin, diff --git a/src/epd5in65f/command.rs b/src/epd5in65f/command.rs index 89af89e..23d2246 100644 --- a/src/epd5in65f/command.rs +++ b/src/epd5in65f/command.rs @@ -64,7 +64,7 @@ pub(crate) enum Command { DisplayRefresh = 0x12, /// Image Process Command - ImageProcessCommand = 0x13, + ImageProcess = 0x13, /// This command builds the VCOM Look-Up Table (LUTC). LutForVcom = 0x20, @@ -91,7 +91,7 @@ pub(crate) enum Command { PllControl = 0x30, /// This command reads the temperature sensed by the temperature sensor. - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, /// This command selects the Internal or External temperature sensor. TemperatureCalibration = 0x41, /// This command could write data to the external temperature sensor. @@ -115,7 +115,7 @@ pub(crate) enum Command { //SpiFlashControl = 0x65, /// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000. - //REVISION = 0x70, + //Revision = 0x70, /// This command reads the IC status. GetStatus = 0x71, diff --git a/src/epd5in65f/mod.rs b/src/epd5in65f/mod.rs index 6e8e7b4..9f94930 100644 --- a/src/epd5in65f/mod.rs +++ b/src/epd5in65f/mod.rs @@ -13,7 +13,7 @@ use embedded_hal::{ use crate::color::OctColor; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay}; +use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay}; pub(crate) mod command; use self::command::Command; @@ -31,9 +31,9 @@ pub const HEIGHT: u32 = 448; pub const DEFAULT_BACKGROUND_COLOR: OctColor = OctColor::White; const IS_BUSY_LOW: bool = true; -/// EPD5in65f driver +/// Epd5in65f driver /// -pub struct EPD5in65f { +pub struct Epd5in65f { /// Connection Interface interface: DisplayInterface, /// Background Color @@ -41,7 +41,7 @@ pub struct EPD5in65f { } impl InternalWiAdditions - for EPD5in65f + for Epd5in65f where SPI: Write, CS: OutputPin, @@ -62,7 +62,7 @@ where self.cmd_with_data(spi, Command::PowerOffSequenceSetting, &[0x00])?; self.cmd_with_data(spi, Command::BoosterSoftStart, &[0xC7, 0xC7, 0x1D])?; self.cmd_with_data(spi, Command::PllControl, &[0x3C])?; - self.cmd_with_data(spi, Command::TemperatureSensorCommand, &[0x00])?; + self.cmd_with_data(spi, Command::TemperatureSensor, &[0x00])?; self.cmd_with_data(spi, Command::VcomAndDataIntervalSetting, &[0x37])?; self.cmd_with_data(spi, Command::TconSetting, &[0x22])?; self.send_resolution(spi)?; @@ -77,7 +77,7 @@ where } impl WaveshareDisplay - for EPD5in65f + for Epd5in65f where SPI: Write, CS: OutputPin, @@ -97,7 +97,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD5in65f { interface, color }; + let mut epd = Epd5in65f { interface, color }; epd.init(spi, delay)?; @@ -182,7 +182,7 @@ where fn set_lut( &mut self, _spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { unimplemented!(); } @@ -192,7 +192,7 @@ where } } -impl EPD5in65f +impl Epd5in65f where SPI: Write, CS: OutputPin, diff --git a/src/epd7in5/command.rs b/src/epd7in5/command.rs index cb1aa1c..8615269 100644 --- a/src/epd7in5/command.rs +++ b/src/epd7in5/command.rs @@ -2,7 +2,7 @@ use crate::traits; -/// EPD7in5 commands +/// Epd7in5 commands /// /// Should rarely (never?) be needed directly. /// @@ -93,7 +93,7 @@ pub(crate) enum Command { PllControl = 0x30, /// This command reads the temperature sensed by the temperature sensor. - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, /// This command selects the Internal or External temperature sensor. TemperatureCalibration = 0x41, /// This command could write data to the external temperature sensor. @@ -117,7 +117,7 @@ pub(crate) enum Command { SpiFlashControl = 0x65, /// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000. - REVISION = 0x70, + Revision = 0x70, /// This command reads the IC status. GetStatus = 0x71, @@ -128,7 +128,7 @@ pub(crate) enum Command { /// This command sets `VCOM_DC` value. VcmDcSetting = 0x82, - /// This is in all the Waveshare controllers for EPD7in5, but it's not documented + /// This is in all the Waveshare controllers for Epd7in5, but it's not documented /// anywhere in the datasheet `¯\_(ツ)_/¯` FlashMode = 0xE5, } diff --git a/src/epd7in5/mod.rs b/src/epd7in5/mod.rs index 16d902a..c93bf1e 100644 --- a/src/epd7in5/mod.rs +++ b/src/epd7in5/mod.rs @@ -13,7 +13,7 @@ use embedded_hal::{ use crate::color::Color; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay}; +use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay}; pub(crate) mod command; use self::command::Command; @@ -31,9 +31,9 @@ pub const HEIGHT: u32 = 384; pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White; const IS_BUSY_LOW: bool = true; -/// EPD7in5 driver +/// Epd7in5 driver /// -pub struct EPD7in5 { +pub struct Epd7in5 { /// Connection Interface interface: DisplayInterface, /// Background Color @@ -41,7 +41,7 @@ pub struct EPD7in5 { } impl InternalWiAdditions - for EPD7in5 + for Epd7in5 where SPI: Write, CS: OutputPin, @@ -91,7 +91,7 @@ where // Set VCOM_DC to -1.5V self.cmd_with_data(spi, Command::VcmDcSetting, &[0x1E])?; - // This is in all the Waveshare controllers for EPD7in5 + // This is in all the Waveshare controllers for Epd7in5 self.cmd_with_data(spi, Command::FlashMode, &[0x03])?; self.wait_until_idle(); @@ -100,7 +100,7 @@ where } impl WaveshareDisplay - for EPD7in5 + for Epd7in5 where SPI: Write, CS: OutputPin, @@ -120,7 +120,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD7in5 { interface, color }; + let mut epd = Epd7in5 { interface, color }; epd.init(spi, delay)?; @@ -214,7 +214,7 @@ where fn set_lut( &mut self, _spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { unimplemented!(); } @@ -224,7 +224,7 @@ where } } -impl EPD7in5 +impl Epd7in5 where SPI: Write, CS: OutputPin, diff --git a/src/epd7in5_v2/command.rs b/src/epd7in5_v2/command.rs index 599c080..95292d3 100644 --- a/src/epd7in5_v2/command.rs +++ b/src/epd7in5_v2/command.rs @@ -2,7 +2,7 @@ use crate::traits; -/// EPD7in5 commands +/// Epd7in5 commands /// /// Should rarely (never?) be needed directly. /// @@ -94,7 +94,7 @@ pub(crate) enum Command { PllControl = 0x30, /// This command reads the temperature sensed by the temperature sensor. - TemperatureSensorCommand = 0x40, + TemperatureSensor = 0x40, /// This command selects the Internal or External temperature sensor. TemperatureCalibration = 0x41, /// This command could write data to the external temperature sensor. @@ -118,7 +118,7 @@ pub(crate) enum Command { SpiFlashControl = 0x65, /// The LUT_REV / Chip Revision is read from OTP address = 25001 and 25000. - REVISION = 0x70, + Revision = 0x70, /// This command reads the IC status. GetStatus = 0x71, @@ -128,7 +128,7 @@ pub(crate) enum Command { ReadVcomValue = 0x81, /// This command sets `VCOM_DC` value. VcmDcSetting = 0x82, - // /// This is in all the Waveshare controllers for EPD7in5, but it's not documented + // /// This is in all the Waveshare controllers for Epd7in5, but it's not documented // /// anywhere in the datasheet `¯\_(ツ)_/¯` // FlashMode = 0xE5, } diff --git a/src/epd7in5_v2/mod.rs b/src/epd7in5_v2/mod.rs index e4c60e0..b3ab5de 100644 --- a/src/epd7in5_v2/mod.rs +++ b/src/epd7in5_v2/mod.rs @@ -17,7 +17,7 @@ use embedded_hal::{ use crate::color::Color; use crate::interface::DisplayInterface; -use crate::traits::{InternalWiAdditions, RefreshLUT, WaveshareDisplay}; +use crate::traits::{InternalWiAdditions, RefreshLut, WaveshareDisplay}; pub(crate) mod command; use self::command::Command; @@ -35,9 +35,9 @@ pub const HEIGHT: u32 = 480; pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White; const IS_BUSY_LOW: bool = true; -/// EPD7in5 (V2) driver +/// Epd7in5 (V2) driver /// -pub struct EPD7in5 { +pub struct Epd7in5 { /// Connection Interface interface: DisplayInterface, /// Background Color @@ -45,7 +45,7 @@ pub struct EPD7in5 { } impl InternalWiAdditions - for EPD7in5 + for Epd7in5 where SPI: Write, CS: OutputPin, @@ -82,7 +82,7 @@ where } impl WaveshareDisplay - for EPD7in5 + for Epd7in5 where SPI: Write, CS: OutputPin, @@ -102,7 +102,7 @@ where let interface = DisplayInterface::new(cs, busy, dc, rst); let color = DEFAULT_BACKGROUND_COLOR; - let mut epd = EPD7in5 { interface, color }; + let mut epd = Epd7in5 { interface, color }; epd.init(spi, delay)?; @@ -188,7 +188,7 @@ where fn set_lut( &mut self, _spi: &mut SPI, - _refresh_rate: Option, + _refresh_rate: Option, ) -> Result<(), SPI::Error> { unimplemented!(); } @@ -198,7 +198,7 @@ where } } -impl EPD7in5 +impl Epd7in5 where SPI: Write, CS: OutputPin, diff --git a/src/interface.rs b/src/interface.rs index 58fbebb..4ba1eb3 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -51,7 +51,7 @@ where /// Basic function for sending an array of u8-values of data over spi /// - /// Enables direct interaction with the device with the help of [command()](EPD4in2::command()) + /// Enables direct interaction with the device with the help of [command()](Epd4in2::command()) pub(crate) fn data(&mut self, spi: &mut SPI, data: &[u8]) -> Result<(), SPI::Error> { // high for data let _ = self.dc.set_high(); @@ -157,7 +157,7 @@ where /// Resets the device. /// - /// Often used to awake the module from deep sleep. See [EPD4in2::sleep()](EPD4in2::sleep()) + /// Often used to awake the module from deep sleep. See [Epd4in2::sleep()](Epd4in2::sleep()) /// /// The timing of keeping the reset pin low seems to be important and different per device. /// Most displays seem to require keeping it low for 10ms, but the 7in5_v2 only seems to reset diff --git a/src/lib.rs b/src/lib.rs index 60a816e..b96e6fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,7 +28,7 @@ //!# let mut delay = delay::MockNoop::new(); //! //!// Setup EPD -//!let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +//!let mut epd = Epd1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; //! //!// Use display graphics from embedded-graphics //!let mut display = Display1in54::default(); @@ -90,7 +90,7 @@ pub(crate) mod type_a; pub mod prelude { pub use crate::color::{Color, OctColor, TriColor}; pub use crate::traits::{ - QuickRefresh, RefreshLUT, WaveshareDisplay, WaveshareThreeColorDisplay, + QuickRefresh, RefreshLut, WaveshareDisplay, WaveshareThreeColorDisplay, }; pub use crate::SPI_MODE; diff --git a/src/traits.rs b/src/traits.rs index d4877b5..7c21c10 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -12,17 +12,17 @@ pub(crate) trait Command { /// Seperates the different LUT for the Display Refresh process #[derive(Debug, Clone, PartialEq, Eq, Copy)] -pub enum RefreshLUT { +pub enum RefreshLut { /// The "normal" full Lookuptable for the Refresh-Sequence - FULL, + Full, /// The quick LUT where not the full refresh sequence is followed. /// This might lead to some - QUICK, + Quick, } -impl Default for RefreshLUT { +impl Default for RefreshLut { fn default() -> Self { - RefreshLUT::FULL + RefreshLut::Full } } @@ -108,7 +108,7 @@ where ///# let mut delay = delay::MockNoop::new(); /// ///// Setup EPD -///let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +///let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; /// ///// Use display graphics from embedded-graphics ///let mut display = Display4in2::default(); @@ -219,7 +219,7 @@ where fn set_lut( &mut self, spi: &mut SPI, - refresh_rate: Option, + refresh_rate: Option, ) -> Result<(), SPI::Error>; /// Checks if the display is busy transmitting data @@ -258,7 +258,7 @@ where ///# let mut delay = delay::MockNoop::new(); ///# ///# // Setup EPD -///# let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; +///# let mut epd = Epd4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?; ///let (x, y, frame_width, frame_height) = (20, 40, 80,80); /// ///let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 80 / 8 * 80]; diff --git a/src/type_a/command.rs b/src/type_a/command.rs index d12dd2c..71a106b 100644 --- a/src/type_a/command.rs +++ b/src/type_a/command.rs @@ -2,7 +2,7 @@ use crate::traits; -/// EPD1in54 and EPD2IN9 commands +/// Epd1in54 and EPD2IN9 commands /// /// Should rarely (never?) be needed directly. /// @@ -67,7 +67,7 @@ pub(crate) enum Command { SetRamYAddressCounter = 0x4F, - NOP = 0xFF, + Nop = 0xFF, } impl traits::Command for Command { @@ -88,6 +88,6 @@ mod tests { assert_eq!(Command::SetRamXAddressCounter.address(), 0x4E); - assert_eq!(Command::NOP.address(), 0xFF); + assert_eq!(Command::Nop.address(), 0xFF); } }