[][src]Trait epd_waveshare::prelude::WaveshareDisplay

pub trait WaveshareDisplay<SPI, CS, BUSY, DC, RST> where
    SPI: Write<u8>,
    CS: OutputPin,
    BUSY: InputPin,
    DC: OutputPin,
    RST: OutputPin
{ fn new<DELAY: DelayMs<u8>>(
        spi: &mut SPI,
        cs: CS,
        busy: BUSY,
        dc: DC,
        rst: RST,
        delay: &mut DELAY
    ) -> Result<Self, SPI::Error>
    where
        Self: Sized
;
fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>;
fn wake_up<DELAY: DelayMs<u8>>(
        &mut self,
        spi: &mut SPI,
        delay: &mut DELAY
    ) -> Result<(), SPI::Error>;
fn set_background_color(&mut self, color: Color);
fn background_color(&self) -> &Color;
fn width(&self) -> u32;
fn height(&self) -> u32;
fn update_frame(
        &mut self,
        spi: &mut SPI,
        buffer: &[u8]
    ) -> Result<(), SPI::Error>;
fn update_partial_frame(
        &mut self,
        spi: &mut SPI,
        buffer: &[u8],
        x: u32,
        y: u32,
        width: u32,
        height: u32
    ) -> Result<(), SPI::Error>;
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>;
fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>;
fn set_lut(
        &mut self,
        spi: &mut SPI,
        refresh_rate: Option<RefreshLUT>
    ) -> Result<(), SPI::Error>;
fn is_busy(&self) -> bool; }

All the functions to interact with the EPDs

This trait includes all public functions to use the EPDS

Required methods

fn new<DELAY: DelayMs<u8>>(
    spi: &mut SPI,
    cs: CS,
    busy: BUSY,
    dc: DC,
    rst: RST,
    delay: &mut DELAY
) -> Result<Self, SPI::Error> where
    Self: Sized

Creates a new driver from a SPI peripheral, CS Pin, Busy InputPin, DC

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

fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>

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<u8>>(
    &mut self,
    spi: &mut SPI,
    delay: &mut DELAY
) -> Result<(), SPI::Error>

Wakes the device up from sleep

fn set_background_color(&mut self, color: Color)

Sets the backgroundcolor for various commands like clear_frame()

fn background_color(&self) -> &Color

Get current background color

fn width(&self) -> u32

Get the width of the display

fn height(&self) -> u32

Get the height of the display

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

Transmit a full frame to the SRAM of the EPD

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

Transmits partial data to the SRAM of the EPD

(x,y) is the top left corner

BUFFER needs to be of size: width / 8 * height !

fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>

Displays the frame data from SRAM

This function waits until the device isn`t busy anymore

fn clear_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>

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

The background color can be changed with [set_background_color]

fn set_lut(
    &mut self,
    spi: &mut SPI,
    refresh_rate: Option<RefreshLUT>
) -> Result<(), SPI::Error>

Trait for using various Waveforms from different LUTs E.g. for partial refreshes

A full refresh is needed after a certain amount of quick refreshes!

WARNING: Quick Refresh might lead to ghosting-effects/problems with your display. Especially for the 4.2in Display!

If None is used the old value will be loaded on the LUTs once more

fn is_busy(&self) -> bool

Checks if the display is busy transmitting data

This is normally handled by the more complicated commands themselves, but in the case you send data and commands directly you might need to check if the device is still busy

Loading content...

Implementors

impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST> for EPD2in9<SPI, CS, BUSY, DC, RST> where
    SPI: Write<u8>,
    CS: OutputPin,
    BUSY: InputPin,
    DC: OutputPin,
    RST: OutputPin
[src]

impl<SPI, CS, BUSY, DC, RST> WaveshareDisplay<SPI, CS, BUSY, DC, RST> for EPD4in2<SPI, CS, BUSY, DC, RST> where
    SPI: Write<u8>,
    CS: OutputPin,
    BUSY: InputPin,
    DC: OutputPin,
    RST: OutputPin
[src]

fn new<DELAY: DelayMs<u8>>(
    spi: &mut SPI,
    cs: CS,
    busy: BUSY,
    dc: DC,
    rst: RST,
    delay: &mut DELAY
) -> Result<Self, SPI::Error>
[src]

Creates a new driver from a SPI peripheral, CS Pin, Busy InputPin, DC

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 epd4in2 = EPD4in2::new(spi, cs, busy, dc, rst, delay);

epd4in2.display_and_transfer_frame(buffer, None);

epd4in2.sleep();

impl<SPI, CS, BUSY, DC, RST, E> WaveshareDisplay<SPI, CS, BUSY, DC, RST> for EPD1in54<SPI, CS, BUSY, DC, RST> where
    SPI: Write<u8, Error = E>,
    CS: OutputPin,
    BUSY: InputPin,
    DC: OutputPin,
    RST: OutputPin
[src]

Loading content...