Skip to main content

QuickRefresh

Trait QuickRefresh 

Source
pub trait QuickRefresh<SPI, BUSY, DC, RST, DELAY>
where SPI: SpiDevice, BUSY: InputPin, DC: OutputPin, RST: OutputPin, DELAY: DelayNs,
{ // Required methods fn update_old_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>; fn update_new_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>; fn display_new_frame( &mut self, spi: &mut SPI, _delay: &mut DELAY, ) -> Result<(), SPI::Error>; fn update_and_display_new_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>; fn update_partial_old_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>; fn update_partial_new_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>; fn clear_partial_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>; }
Expand description

Allows quick refresh support for displays that support it; lets you send both old and new frame data to support this.

When using the quick refresh look-up table, the display must receive separate display buffer data marked as old, and new. This is used to determine which pixels need to change, and how they will change. This isn’t required when using full refreshes.

(todo: Example ommitted due to CI failures.) Example:

let (x, y, frame_width, frame_height) = (20, 40, 80,80);

let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 80 / 8 * 80];
let mut display = VarDisplay::new(frame_width, frame_height, &mut buffer,false).unwrap();

epd.update_partial_old_frame(&mut spi, &mut delay, display.buffer(), x, y, frame_width, frame_height)
  .ok();

display.clear(Color::White).ok();

epd.update_partial_new_frame(&mut spi, &mut delay, display.buffer(), x, y, frame_width, frame_height)
  .ok();

Required Methods§

Source

fn update_old_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>

Updates the old frame.

Source

fn update_new_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>

Updates the new frame.

Source

fn display_new_frame( &mut self, spi: &mut SPI, _delay: &mut DELAY, ) -> Result<(), SPI::Error>

Displays the new frame

Source

fn update_and_display_new_frame( &mut self, spi: &mut SPI, buffer: &[u8], delay: &mut DELAY, ) -> Result<(), SPI::Error>

Updates and displays the new frame.

Source

fn update_partial_old_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>

Updates the old frame for a portion of the display.

Source

fn update_partial_new_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>

Updates the new frame for a portion of the display.

Source

fn clear_partial_frame( &mut self, spi: &mut SPI, delay: &mut DELAY, x: u32, y: u32, width: u32, height: u32, ) -> Result<(), SPI::Error>

Clears the partial frame buffer on the EPD with the declared background color The background color can be changed with WaveshareDisplay::set_background_color

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<SPI, BUSY, DC, RST, DELAY> QuickRefresh<SPI, BUSY, DC, RST, DELAY> for Epd2in9<SPI, BUSY, DC, RST, DELAY>
where SPI: SpiDevice, BUSY: InputPin, DC: OutputPin, RST: OutputPin, DELAY: DelayNs,

Source§

impl<SPI, BUSY, DC, RST, DELAY> QuickRefresh<SPI, BUSY, DC, RST, DELAY> for Epd4in2<SPI, BUSY, DC, RST, DELAY>
where SPI: SpiDevice, BUSY: InputPin, DC: OutputPin, RST: OutputPin, DELAY: DelayNs,