Struct SpiInterface

Source
pub struct SpiInterface<SPI, DC> { /* private fields */ }
Expand description

Async SPI interface for MIPI DCS displays.

This struct implements the Interface trait for SPI-based displays, using an async SpiDevice and a data/command (DC) output pin. Unlike the original mipidsi version, this async variant does not use an internal buffer; all pixel data is sent directly from the provided slice.

Use SpiInterface::new to construct, and SpiInterface::release to deconstruct and recover the SPI and DC resources.

Implementations§

Source§

impl<SPI, DC> SpiInterface<SPI, DC>
where SPI: SpiDevice, DC: OutputPin,

Source

pub fn new(spi: SPI, dc: DC) -> Self

Create a new async SPI interface from an SPI device and DC pin.

Source

pub fn release(self) -> (SPI, DC)

Release the DC pin and SPI peripheral back, deconstructing the interface.

Trait Implementations§

Source§

impl<SPI, DC> Interface for SpiInterface<SPI, DC>
where SPI: SpiDevice, DC: OutputPin,

Source§

async fn send_command( &mut self, command: u8, args: &[u8], ) -> Result<(), Self::Error>

Send a command and its arguments to the display controller.

The DC pin is set low for the command byte, then high for the argument bytes.

Source§

async fn send_data_slice( &mut self, data: &[Self::Word], ) -> Result<(), Self::Error>

Send a slice of pixel or data bytes to the display controller.

The data is sent as-is over SPI, with the DC pin assumed to be high.

Source§

const KIND: InterfaceKind = InterfaceKind::Serial4Line

Kind
Source§

type Word = u8

The native width of the interface Read more
Source§

type Error = SpiError<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>

Error type

Auto Trait Implementations§

§

impl<SPI, DC> Freeze for SpiInterface<SPI, DC>
where SPI: Freeze, DC: Freeze,

§

impl<SPI, DC> RefUnwindSafe for SpiInterface<SPI, DC>
where SPI: RefUnwindSafe, DC: RefUnwindSafe,

§

impl<SPI, DC> Send for SpiInterface<SPI, DC>
where SPI: Send, DC: Send,

§

impl<SPI, DC> Sync for SpiInterface<SPI, DC>
where SPI: Sync, DC: Sync,

§

impl<SPI, DC> Unpin for SpiInterface<SPI, DC>
where SPI: Unpin, DC: Unpin,

§

impl<SPI, DC> UnwindSafe for SpiInterface<SPI, DC>
where SPI: UnwindSafe, DC: 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> InterfaceExt for T
where T: Interface,

Source§

fn write_command( &mut self, command: impl DcsCommand, ) -> impl Future<Output = Result<(), Self::Error>>

Sends a DCS command to the display interface.
Source§

fn write_raw( &mut self, instruction: u8, param_bytes: &[u8], ) -> impl Future<Output = Result<(), Self::Error>>

Sends a raw command with the given instruction to the display interface. Read more
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.