Skip to main content

Interface

Trait Interface 

Source
pub trait Interface {
    type Error;

    const SPI_RAM_WRITE: bool = false;

    // Required methods
    fn write_command(
        &mut self,
        command: u8,
        params: &[u8],
    ) -> Result<(), Self::Error>;
    fn write_pixels(
        &mut self,
        command: u8,
        data: &[u8],
    ) -> Result<(), Self::Error>;
}
Expand description

A transport that carries CO5300 commands and pixel data.

The driver only ever needs two operations, both of which every CO5300 host interface offers in some form:

  • write_command: a command code followed by its parameter bytes;
  • write_pixels: a memory write command, RAMWR (2Ch) or RAMWRC (3Ch), followed by pixel bytes, possibly many kilobytes.

The split mirrors ESP-IDF’s esp_lcd_panel_io_tx_param and esp_lcd_panel_io_tx_color, so a MIPI-DSI or Quad-SPI panel IO handle maps onto it one to one. Each call is one complete transfer; the driver streams large images as one RAMWR followed by RAMWRC calls, which continue where the previous write stopped (datasheet section 7.5.33).

Shipped implementations: SpiInterface (4-wire SPI with a D/C pin) and FramedSpiInterface (single-line SPI with the instruction/address framing of datasheet section 5.2.2). For dual or quad data lines, build an adapter on the qspi framing helper and your HAL’s half-duplex transfer.

Provided Associated Constants§

Source

const SPI_RAM_WRITE: bool = false

Whether init sends SetSPIMode (C4h) with SPI_WRAM set, enabling SPI writes to the frame memory (datasheet section 7.5.57). true for SPI and Quad-SPI transports, false (the default) for MIPI-DSI.

Required Associated Types§

Source

type Error

The transport error type.

Required Methods§

Source

fn write_command( &mut self, command: u8, params: &[u8], ) -> Result<(), Self::Error>

Sends a command code followed by its parameter bytes (none for most commands).

Source

fn write_pixels(&mut self, command: u8, data: &[u8]) -> Result<(), Self::Error>

Sends a memory write command, RAMWR (2Ch) or RAMWRC (3Ch), followed by pixel data.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

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

Source§

impl<SPI> Interface for FramedSpiInterface<SPI>
where SPI: SpiDevice,