Skip to main content

Interface

Trait Interface 

Source
pub trait Interface {
    type Word: Copy;
    type Error: Debug;

    const KIND: InterfaceKind;

    // Required methods
    fn send_command(
        &mut self,
        command: u8,
        args: &[u8],
    ) -> impl Future<Output = Result<(), Self::Error>>;
    fn send_data_slice(
        &mut self,
        data: &[Self::Word],
    ) -> impl Future<Output = Result<(), Self::Error>>;
}
Expand description

Command and pixel interface

Required Associated Constants§

Required Associated Types§

Source

type Word: Copy

The native width of the interface

In most cases this will be u8, except for larger parallel interfaces such as 16 bit (currently supported) or 9 or 18 bit (currently unsupported)

Source

type Error: Debug

Error type

Required Methods§

Source

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

Send a command with optional parameters

Source

fn send_data_slice( &mut self, data: &[Self::Word], ) -> impl Future<Output = Result<(), Self::Error>>

Send a raw slice of data, typically pre-formatted pixel data. WriteMemoryStart (or equivalent) must be sent before calling this function. The data is assumed to be in the correct format for the display and interface. If Self::Word is u8, data is &u8. If Self::Word is u16, data is &u16.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Interface + ?Sized> Interface for &mut T

Source§

const KIND: InterfaceKind = T::KIND

Source§

type Word = <T as Interface>::Word

Source§

type Error = <T as Interface>::Error

Source§

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

Source§

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

Implementors§

Source§

impl<BUS, DC, WR> Interface for ParallelInterface<BUS, DC, WR>
where BUS: OutputBus, BUS::Word: From<u8> + Eq + BitXor<Output = BUS::Word>, DC: OutputPin, WR: OutputPin,

Source§

const KIND: InterfaceKind = BUS::KIND

Source§

type Word = <BUS as OutputBus>::Word

Source§

type Error = ParallelError<<BUS as OutputBus>::Error, <DC as ErrorType>::Error, <WR as ErrorType>::Error>

Source§

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

Source§

const KIND: InterfaceKind = InterfaceKind::Serial4Line

Source§

type Word = u8

Source§

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