Struct Builder

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

Builder for Display instances.

Exposes all possible display options.

§Examples

use lcd_async::{Builder, options::ColorOrder, models::ILI9342CRgb565};

let mut display = Builder::new(ILI9342CRgb565, di)
    .reset_pin(rst)
    .color_order(ColorOrder::Bgr)
    .display_size(320, 240)
    .init(&mut delay).await.unwrap();

Implementations§

Source§

impl<DI, MODEL> Builder<DI, MODEL, NoResetPin>
where DI: Interface, MODEL: Model,

Source

pub fn new(model: MODEL, di: DI) -> Self

Constructs a new builder for given Model.

Source§

impl<DI, MODEL, RST> Builder<DI, MODEL, RST>
where DI: Interface, MODEL: Model, RST: OutputPin,

Source

pub fn invert_colors(self, color_inversion: ColorInversion) -> Self

Sets the invert color flag

Source

pub fn color_order(self, color_order: ColorOrder) -> Self

Sets the ColorOrder

Source

pub fn orientation(self, orientation: Orientation) -> Self

Sets the Orientation

Source

pub fn refresh_order(self, refresh_order: RefreshOrder) -> Self

Sets refresh order

Source

pub fn display_size(self, width: u16, height: u16) -> Self

Sets the display size.

Source

pub fn display_offset(self, x: u16, y: u16) -> Self

Sets the display offset

Source

pub fn reset_pin<RST2: OutputPin>(self, rst: RST2) -> Builder<DI, MODEL, RST2>

Sets the reset pin.

§WARNING

The reset pin needs to be in high state in order for the display to operate. If it wasn’t provided the user needs to ensure this is the case.

Source

pub async fn init( self, delay_source: &mut impl DelayNs, ) -> Result<Display<DI, MODEL, RST>, InitError<DI::Error, RST::Error>>

Consumes the builder to create a new Display with an optional reset OutputPin. Blocks using the provided DelayNs delay_source to perform the display initialization. The display will be awake ready to use, no need to call Display::wake after init.

Returns InitError if the area defined by the display_size and display_offset settings is (partially) outside the framebuffer.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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