DisplayDriver

Struct DisplayDriver 

Source
pub struct DisplayDriver<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> { /* private fields */ }
Expand description

The main driver struct that manages the communication with the display.

You probably want to use one of the display-specific type aliases instead.

Implementations§

Source§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: WriteOnlyDataCommand, BSY: InputPin, RST: OutputPin, DELAY: DelayNs, C: ColorType,

Source

pub fn new(interface: DI, busy: BSY, reset: RST, delay: DELAY) -> Self

Create a new display driver.

Use Self::init to initialize the display.

Source

pub fn init(&mut self) -> Result<()>

Initialize the display

Source

pub fn hw_reset(&mut self)

Perform a hardware reset of the display.

Source

pub fn write_bw_buffer(&mut self, buffer: &[u8]) -> Result<()>

Write to the B/W buffer.

Source

pub fn write_red_buffer(&mut self, buffer: &[u8]) -> Result<()>

Write to the red buffer.

On B/W displays this buffer is used for fast refreshes.

Source

pub fn write_partial_bw_buffer( &mut self, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<()>

Write to the B/W buffer at the given position.

x, and width must be multiples of 8.

Source

pub fn write_partial_red_buffer( &mut self, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<()>

Write to the red buffer at the given position.

x, and width must be multiples of 8.

On B/W displays this buffer is used for fast refreshes.

Source

pub fn clear_bw_buffer(&mut self) -> Result<()>

Make the whole black and white frame on the display driver white.

Source

pub fn clear_red_buffer(&mut self) -> Result<()>

Make the whole red frame on the display driver white.

On B/W displays this buffer is used for fast refreshes.

Source

pub fn full_refresh(&mut self) -> Result<()>

Start a full refresh of the display.

Source

pub fn sleep(&mut self) -> Result<()>

Put the device into deep-sleep mode. You will need to call Self::wake_up before you can draw to the screen again.

Source

pub fn wake_up(&mut self) -> Result<()>

Wake the device up from deep-sleep mode.

Source§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32> DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, Color>
where DI: WriteOnlyDataCommand, BSY: InputPin, RST: OutputPin, DELAY: DelayNs,

Functions available only for B/W displays

Source

pub fn fast_refresh(&mut self) -> Result<()>

Start a fast refresh of the display using the current in-screen buffers.

If the display hasn’t done a Self::full_refresh yet, it will do that first.

Source

pub fn full_update_from_buffer(&mut self, buffer: &[u8]) -> Result<()>

Update the screen with the provided full frame buffer using a full refresh.

Source

pub fn fast_update_from_buffer(&mut self, buffer: &[u8]) -> Result<()>

Update the screen with the provided full frame buffer using a fast refresh.

Source

pub fn fast_partial_update_from_buffer( &mut self, buffer: &[u8], x: u32, y: u32, width: u32, height: u32, ) -> Result<()>

Update the screen with the provided partial frame buffer at the given position using a fast refresh.

x, and width must be multiples of 8.

Source

pub fn full_update<const BUFFER_SIZE: usize>( &mut self, display: &Display<WIDTH, HEIGHT, BUFFER_SIZE, Color>, ) -> Result<()>

Available on crate feature graphics only.

Update the screen with the provided Display using a full refresh.

Source

pub fn fast_update<const BUFFER_SIZE: usize>( &mut self, display: &Display<WIDTH, HEIGHT, BUFFER_SIZE, Color>, ) -> Result<()>

Available on crate feature graphics only.

Update the screen with the provided Display using a fast refresh.

Source

pub fn fast_partial_update<const W: u32, const H: u32, const BUFFER_SIZE: usize>( &mut self, display: &Display<W, H, BUFFER_SIZE, Color>, x: u32, y: u32, ) -> Result<()>

Available on crate feature graphics only.

Update the screen with the provided partial Display at the given position using a fast refresh.

x and the display width W must be multiples of 8.

Source§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32> DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, TriColor>
where DI: WriteOnlyDataCommand, BSY: InputPin, RST: OutputPin, DELAY: DelayNs,

Functions available only for tri-color displays

Source

pub fn full_update_from_buffer( &mut self, bw_buffer: &[u8], red_buffer: &[u8], ) -> Result<()>

Update the screen with the provided full frame buffers using a full refresh.

Source

pub fn full_update<const BUFFER_SIZE: usize>( &mut self, display: &Display<WIDTH, HEIGHT, BUFFER_SIZE, TriColor>, ) -> Result<()>

Available on crate feature graphics only.

Update the screen with the provided Display using a full refresh.

Auto Trait Implementations§

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> Freeze for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: Freeze, BSY: Freeze, RST: Freeze, DELAY: Freeze,

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> RefUnwindSafe for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> Send for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: Send, BSY: Send, RST: Send, DELAY: Send, C: Send,

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> Sync for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: Sync, BSY: Sync, RST: Sync, DELAY: Sync, C: Sync,

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> Unpin for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: Unpin, BSY: Unpin, RST: Unpin, DELAY: Unpin, C: Unpin,

§

impl<DI, BSY, RST, DELAY, const WIDTH: u32, const VISIBLE_WIDTH: u32, const HEIGHT: u32, C> UnwindSafe for DisplayDriver<DI, BSY, RST, DELAY, WIDTH, VISIBLE_WIDTH, HEIGHT, C>
where DI: UnwindSafe, BSY: UnwindSafe, RST: UnwindSafe, DELAY: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.