Clean up and removal of a few fixed todos
parent
bbdecdb6f7
commit
a522375695
|
|
@ -28,7 +28,7 @@ pub trait Display {
|
||||||
|
|
||||||
pub struct DisplayEink42BlackWhite {
|
pub struct DisplayEink42BlackWhite {
|
||||||
buffer: [u8; 400 * 300 / 8],
|
buffer: [u8; 400 * 300 / 8],
|
||||||
rotation: DisplayRotation, //TODO: check embedded_graphics for orientation
|
rotation: DisplayRotation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DisplayEink42BlackWhite {
|
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 {
|
impl Drawing<Color> for DisplayEink42BlackWhite {
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
|
|
@ -126,7 +126,6 @@ fn rotation(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRotation)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TODO: write tests
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
|
|
@ -158,23 +158,16 @@ where
|
||||||
self.init(spi, delay)
|
self.init(spi, delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: is such a long delay really needed inbetween?
|
|
||||||
fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
|
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.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::VCM_DC_SETTING)?; // VCOM to 0V
|
||||||
self.command(spi, Command::PANEL_SETTING)?;
|
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
|
self.command(spi, Command::POWER_SETTING)?; //VG&VS to 0V fast
|
||||||
for _ in 0..4 {
|
for _ in 0..4 {
|
||||||
self.send_data(spi, &[0x00])?;
|
self.send_data(spi, &[0x00])?;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Removal of delay. TEST!
|
|
||||||
//self.delay_ms(100);
|
|
||||||
|
|
||||||
self.command(spi, Command::POWER_OFF)?;
|
self.command(spi, Command::POWER_OFF)?;
|
||||||
self.wait_until_idle();
|
self.wait_until_idle();
|
||||||
self.interface.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5])
|
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])?;
|
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)
|
//VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||||
//self.send_command_u8(0x97)?; //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.interface.cmd_with_data(spi, Command::VCOM_AND_DATA_INTERVAL_SETTING, &[0x97])?;
|
||||||
|
|
||||||
|
//TODO: compare with using a loop instead of the full buffer
|
||||||
self.command(spi, Command::DATA_START_TRANSMISSION_1)?;
|
self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_1, &[color_value; WIDTH as usize / 8 * HEIGHT as usize])?;
|
||||||
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);
|
|
||||||
|
|
||||||
self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)
|
self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ pub(crate) mod type_a;
|
||||||
|
|
||||||
extern crate embedded_graphics;
|
extern crate embedded_graphics;
|
||||||
|
|
||||||
//TODO: test spi mode
|
|
||||||
/// SPI mode -
|
/// SPI mode -
|
||||||
/// For more infos see [Requirements: SPI](index.html#spi)
|
/// For more infos see [Requirements: SPI](index.html#spi)
|
||||||
pub const SPI_MODE: Mode = Mode {
|
pub const SPI_MODE: Mode = Mode {
|
||||||
|
|
|
||||||
|
|
@ -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?
|
// Trait for using various Waveforms from different LUTs
|
||||||
// for partial updates
|
// E.g. for partial updates
|
||||||
trait LUTSupport<ERR> {
|
trait LUTSupport<ERR> {
|
||||||
fn set_lut(&mut self) -> Result<(), ERR>;
|
fn set_lut(&mut self) -> Result<(), ERR>;
|
||||||
fn set_lut_quick(&mut self) -> Result<(), ERR>;
|
fn set_lut_quick(&mut self) -> Result<(), ERR>;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue