From a52237569571731af3bd96043cbfc6c6432bc4a3 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 19 Oct 2018 09:58:52 +0200 Subject: [PATCH] Clean up and removal of a few fixed todos --- src/drawing.rs | 5 ++--- src/epd4in2/mod.rs | 21 +++------------------ src/lib.rs | 1 - src/traits.rs | 4 ++-- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/drawing.rs b/src/drawing.rs index a2fe671..d4278b1 100644 --- a/src/drawing.rs +++ b/src/drawing.rs @@ -28,7 +28,7 @@ pub trait Display { pub struct DisplayEink42BlackWhite { buffer: [u8; 400 * 300 / 8], - rotation: DisplayRotation, //TODO: check embedded_graphics for orientation + rotation: DisplayRotation, } impl Default for DisplayEink42BlackWhite { @@ -56,7 +56,7 @@ impl Display for DisplayEink42BlackWhite { } } -//TODO: add more tests for the rotation maybe? or test it at least once in real! + impl Drawing for DisplayEink42BlackWhite { fn draw(&mut self, item_pixels: T) where @@ -126,7 +126,6 @@ fn rotation(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRotation) -//TODO: write tests #[cfg(test)] mod tests { use super::*; diff --git a/src/epd4in2/mod.rs b/src/epd4in2/mod.rs index 4d6dd53..2802672 100644 --- a/src/epd4in2/mod.rs +++ b/src/epd4in2/mod.rs @@ -158,23 +158,16 @@ where self.init(spi, delay) } - //TODO: is such a long delay really needed inbetween? fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { self.interface.cmd_with_data(spi, Command::VCOM_AND_DATA_INTERVAL_SETTING, &[0x17])?; //border floating self.command(spi, Command::VCM_DC_SETTING)?; // VCOM to 0V self.command(spi, Command::PANEL_SETTING)?; - //TODO: Removal of delay. TEST! - //self.delay_ms(100); - self.command(spi, Command::POWER_SETTING)?; //VG&VS to 0V fast for _ in 0..4 { self.send_data(spi, &[0x00])?; } - //TODO: Removal of delay. TEST! - //self.delay_ms(100); - self.command(spi, Command::POWER_OFF)?; self.wait_until_idle(); self.interface.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5]) @@ -187,19 +180,11 @@ where self.interface.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?; - //TODO: this was a send_command instead of a send_data. check if it's alright and doing what it should do (setting the default values) - //self.send_command_u8(0x97)?; //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 + //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7 self.interface.cmd_with_data(spi, Command::VCOM_AND_DATA_INTERVAL_SETTING, &[0x97])?; - - self.command(spi, Command::DATA_START_TRANSMISSION_1)?; - self.send_data(spi, &[color_value; WIDTH as usize / 8 * HEIGHT as usize])?; - //for _ in 0..buffer.len() { - // self.send_data(spi, &[color_value])?; - //} - - //TODO: Removal of delay. TEST! - //self.delay_ms(2); + //TODO: compare with using a loop instead of the full buffer + self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_1, &[color_value; WIDTH as usize / 8 * HEIGHT as usize])?; self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer) } diff --git a/src/lib.rs b/src/lib.rs index 23d6745..f2f24df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,6 @@ pub(crate) mod type_a; extern crate embedded_graphics; -//TODO: test spi mode /// SPI mode - /// For more infos see [Requirements: SPI](index.html#spi) pub const SPI_MODE: Mode = Mode { diff --git a/src/traits.rs b/src/traits.rs index 8e95745..b8f55a8 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -17,8 +17,8 @@ pub(crate) trait Command { } -//TODO: add LUT trait with set_fast_lut and set_manual_lut and set_normal_lut or sth like that? -// for partial updates +// Trait for using various Waveforms from different LUTs +// E.g. for partial updates trait LUTSupport { fn set_lut(&mut self) -> Result<(), ERR>; fn set_lut_quick(&mut self) -> Result<(), ERR>;