|
|
|
|
@ -9,12 +9,14 @@ use color::Color;
|
|
|
|
|
/// Interface for the physical connection between display and the controlling device
|
|
|
|
|
pub(crate) mod connection_interface; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// All commands need to have this trait which gives the address of the command
|
|
|
|
|
/// which needs to be send via SPI with activated CommandsPin (Data/Command Pin in CommandMode)
|
|
|
|
|
pub(crate) trait Command { |
|
|
|
|
fn address(self) -> u8; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: add LUT trait with set_fast_lut and set_manual_lut and set_normal_lut or sth like that?
|
|
|
|
|
// for partial updates
|
|
|
|
|
trait LUTSupport<ERR> { |
|
|
|
|
@ -23,6 +25,7 @@ trait LUTSupport<ERR> {
|
|
|
|
|
fn set_lut_manual(&mut self, data: &[u8]) -> Result<(), ERR>; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub(crate) trait InternalWiAdditions<SPI, CS, BUSY, DC, RST, Delay, ERR> |
|
|
|
|
where |
|
|
|
|
SPI: Write<u8>, |
|
|
|
|
@ -64,27 +67,7 @@ where
|
|
|
|
|
spi: SPI, cs: CS, busy: BUSY, dc: DC, rst: RST, delay: Delay, |
|
|
|
|
) -> Result<Self, ERR> |
|
|
|
|
where |
|
|
|
|
Self: Sized; |
|
|
|
|
|
|
|
|
|
// TODO: add this abstraction function
|
|
|
|
|
/// Loads a full image on the EPD and displays it
|
|
|
|
|
fn update_and_display_frame(&mut self, buffer: &[u8]) -> Result<(), ERR> { |
|
|
|
|
self.update_frame(buffer)?; |
|
|
|
|
self.display_frame() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Loads a partial image on the EPD and displays it
|
|
|
|
|
fn update_and_display_partial_frame( |
|
|
|
|
&mut self, |
|
|
|
|
buffer: &[u8], |
|
|
|
|
x: u16, |
|
|
|
|
y: u16, |
|
|
|
|
width: u16, |
|
|
|
|
height: u16, |
|
|
|
|
) -> Result<(), ERR> { |
|
|
|
|
self.update_partial_frame(buffer, x, y, width, height)?; |
|
|
|
|
self.display_frame() |
|
|
|
|
}
|
|
|
|
|
Self: Sized;
|
|
|
|
|
|
|
|
|
|
/// Let the device enter deep-sleep mode to save power.
|
|
|
|
|
///
|
|
|
|
|
@ -104,19 +87,17 @@ where
|
|
|
|
|
fn background_color(&self) -> &Color; |
|
|
|
|
|
|
|
|
|
/// Get the width of the display
|
|
|
|
|
fn get_width(&self) -> u16; |
|
|
|
|
fn width(&self) -> u16; |
|
|
|
|
|
|
|
|
|
/// Get the height of the display
|
|
|
|
|
fn get_height(&self) -> u16; |
|
|
|
|
fn height(&self) -> u16; |
|
|
|
|
|
|
|
|
|
/// Abstraction of setting the delay for simpler calls
|
|
|
|
|
///
|
|
|
|
|
/// maximum delay ~65 seconds (u16:max in ms)
|
|
|
|
|
fn delay_ms(&mut self, delay: u16); |
|
|
|
|
|
|
|
|
|
// void DisplayFrame(const unsigned char* frame_buffer);
|
|
|
|
|
/// Transmit a full frame to the SRAM of the DPD
|
|
|
|
|
///
|
|
|
|
|
/// Transmit a full frame to the SRAM of the EPD
|
|
|
|
|
fn update_frame(&mut self, buffer: &[u8]) -> Result<(), ERR>; |
|
|
|
|
|
|
|
|
|
/// Transmits partial data to the SRAM of the EPD
|
|
|
|
|
|