Struct Display

Source
pub struct Display<DI, MODEL, RST>
where DI: Interface, MODEL: Model, RST: OutputPin,
{ /* private fields */ }
Expand description

Display driver to connect to TFT displays.

Implementations§

Source§

impl<DI, M, RST> Display<DI, M, RST>
where DI: Interface, M: Model, RST: OutputPin,

Source

pub fn orientation(&self) -> Orientation

Returns currently set options::Orientation

Source

pub async fn set_orientation( &mut self, orientation: Orientation, ) -> Result<(), DI::Error>

Sets display options::Orientation with mirror image parameter

§Examples
use lcd_async::options::{Orientation, Rotation};

display.set_orientation(Orientation::default().rotate(Rotation::Deg180)).await.unwrap();
Source

pub async fn show_raw_data<DW>( &mut self, x: u16, y: u16, width: u16, height: u16, pixel_data: &[DW], ) -> Result<(), DI::Error>
where DI: Interface<Word = DW>, DW: Copy,

Sends a raw pixel data slice to the specified rectangular region of the display.

Source

pub async fn set_vertical_scroll_region( &mut self, top_fixed_area: u16, bottom_fixed_area: u16, ) -> Result<(), DI::Error>

Sets the vertical scroll region.

The top_fixed_area and bottom_fixed_area arguments can be used to define an area on the top and/or bottom of the display which won’t be affected by scrolling.

Note that this method is not affected by the current display orientation and will always scroll vertically relative to the default display orientation.

The combined height of the fixed area must not larger than the height of the framebuffer height in the default orientation.

After the scrolling region is defined the set_vertical_scroll_offset can be used to scroll the display.

Source

pub async fn set_vertical_scroll_offset( &mut self, offset: u16, ) -> Result<(), DI::Error>

Sets the vertical scroll offset.

Setting the vertical scroll offset shifts the vertical scroll region upwards by offset pixels.

Use set_vertical_scroll_region to setup the scroll region, before using this method.

Source

pub fn release(self) -> (DI, M, Option<RST>)

Release resources allocated to this driver back. This returns the display interface, reset pin and and the model deconstructing the driver.

Source

pub async fn set_tearing_effect( &mut self, tearing_effect: TearingEffect, ) -> Result<(), DI::Error>

Configures the tearing effect output.

Source

pub fn is_sleeping(&self) -> bool

Returns true if display is currently set to sleep.

Source

pub async fn sleep<D: DelayNs>( &mut self, delay: &mut D, ) -> Result<(), DI::Error>

Puts the display to sleep, reducing power consumption. Need to call Self::wake before issuing other commands

Source

pub async fn wake<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), DI::Error>

Wakes the display after it’s been set to sleep via Self::sleep

Source

pub unsafe fn dcs(&mut self) -> &mut DI

Returns the DCS interface for sending raw commands.

§Safety

Sending raw commands to the controller can lead to undefined behaviour, because the rest of the code isn’t aware of any state changes that were caused by sending raw commands. The user must ensure that the state of the controller isn’t altered in a way that interferes with the normal operation of this crate.

Auto Trait Implementations§

§

impl<DI, MODEL, RST> Freeze for Display<DI, MODEL, RST>
where DI: Freeze, MODEL: Freeze, RST: Freeze,

§

impl<DI, MODEL, RST> RefUnwindSafe for Display<DI, MODEL, RST>
where DI: RefUnwindSafe, MODEL: RefUnwindSafe, RST: RefUnwindSafe,

§

impl<DI, MODEL, RST> Send for Display<DI, MODEL, RST>
where DI: Send, MODEL: Send, RST: Send,

§

impl<DI, MODEL, RST> Sync for Display<DI, MODEL, RST>
where DI: Sync, MODEL: Sync, RST: Sync,

§

impl<DI, MODEL, RST> Unpin for Display<DI, MODEL, RST>
where DI: Unpin, MODEL: Unpin, RST: Unpin,

§

impl<DI, MODEL, RST> UnwindSafe for Display<DI, MODEL, RST>
where DI: UnwindSafe, MODEL: UnwindSafe, RST: 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.