[][src]Trait epd_waveshare_uart::prelude::WaveshareDisplay

pub trait WaveshareDisplay<E, F, G, SERIAL, WAKE, RST> where
    SERIAL: Write<u8, Error = F> + Read<u8, Error = E>,
    WAKE: OutputPin<Error = G>,
    RST: OutputPin<Error = G>, 
{ fn new<DELAY: DelayMs<u16>>(
        serial: &mut SERIAL,
        wake: WAKE,
        rst: RST,
        delay: &mut DELAY
    ) -> Result<Self, Error<E, F, G>>
    where
        Self: Sized
;
fn sleep(&mut self, serial: &mut SERIAL) -> Result<(), Error<E, F, G>>;
fn wake_up<DELAY: DelayMs<u16>>(
        &mut self,
        serial: &mut SERIAL,
        delay: &mut DELAY
    ) -> Result<(), Error<E, F, G>>;
fn set_background_color(&mut self, color: EpdColor);
fn set_foreground_color(&mut self, color: EpdColor);
fn width(&self) -> u32;
fn height(&self) -> u32;
fn update_frame<DELAY: DelayMs<u16>>(
        &mut self,
        serial: &mut SERIAL,
        buffer: &[EpdColor],
        delay: &mut DELAY
    ) -> Result<(), Error<E, F, G>>;
fn display_frame(
        &mut self,
        serial: &mut SERIAL
    ) -> Result<(), Error<E, F, G>>;
fn clear_frame(&mut self, serial: &mut SERIAL) -> Result<(), Error<E, F, G>>; }

All the functions to interact with the EPDs

This trait includes all public functions to use the EPDS

Required methods

fn new<DELAY: DelayMs<u16>>(
    serial: &mut SERIAL,
    wake: WAKE,
    rst: RST,
    delay: &mut DELAY
) -> Result<Self, Error<E, F, G>> where
    Self: Sized

Creates a new driver from a Serial peripheral, Wake Pin, Reset Pin

This already initialises the device. That means init() isn't needed directly afterwards

fn sleep(&mut self, serial: &mut SERIAL) -> Result<(), Error<E, F, G>>

Let the device enter deep-sleep mode to save power.

The deep sleep mode returns to standby with a hardware reset. But you can also use wake_up() to awaken. But as you need to power it up once more anyway you can also just directly use new() for resetting and initialising which already contains the reset

fn wake_up<DELAY: DelayMs<u16>>(
    &mut self,
    serial: &mut SERIAL,
    delay: &mut DELAY
) -> Result<(), Error<E, F, G>>

Wakes the device up from sleep

fn set_background_color(&mut self, color: EpdColor)

Sets the backgroundcolor for various commands like clear_frame()

fn set_foreground_color(&mut self, color: EpdColor)

Sets the foregroundcolor for various commands like clear_frame()

fn width(&self) -> u32

Get the width of the display

fn height(&self) -> u32

Get the height of the display

fn update_frame<DELAY: DelayMs<u16>>(
    &mut self,
    serial: &mut SERIAL,
    buffer: &[EpdColor],
    delay: &mut DELAY
) -> Result<(), Error<E, F, G>>

Transmit a full frame to the SRAM of the EPD

fn display_frame(&mut self, serial: &mut SERIAL) -> Result<(), Error<E, F, G>>

Displays the frame data from SRAM

fn clear_frame(&mut self, serial: &mut SERIAL) -> Result<(), Error<E, F, G>>

Clears the frame buffer on the EPD with the declared background color

The background color can be changed with [set_background_color]

Loading content...

Implementors

impl<E, F, G, SERIAL, WAKE, RST> WaveshareDisplay<E, F, G, SERIAL, WAKE, RST> for EPD4in3<SERIAL, WAKE, RST> where
    SERIAL: Write<u8, Error = F> + Read<u8, Error = E>,
    WAKE: OutputPin<Error = G>,
    RST: OutputPin<Error = G>, 
[src]

fn new<DELAY: DelayMs<u16>>(
    serial: &mut SERIAL,
    wake: WAKE,
    rst: RST,
    delay: &mut DELAY
) -> Result<Self, Error<E, F, G>>
[src]

Creates a new driver from a SERIAL peripheral, WAKE Pin, RST Pin

This already initialises the device. That means init() isn't needed directly afterwards

Example

This example is not tested
//buffer = some image data;

let mut epd4in3 = EPD4in3::new(serial, wake, rst, delay);

epd4in3.display_and_transfer_frame(buffer, None);

epd4in3.sleep();
Loading content...