Browse Source

Clean up and removal of a few fixed todos

embedded-hal-1.0
Chris 7 years ago
parent
commit
a522375695
  1. 5
      src/drawing.rs
  2. 21
      src/epd4in2/mod.rs
  3. 1
      src/lib.rs
  4. 4
      src/traits.rs

5
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<Color> for DisplayEink42BlackWhite {
fn draw<T>(&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::*;

21
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)
}

1
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 {

4
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<ERR> {
fn set_lut(&mut self) -> Result<(), ERR>;
fn set_lut_quick(&mut self) -> Result<(), ERR>;

Loading…
Cancel
Save