Crate mipidsi

source ·
Expand description

This crate provides a generic display driver to connect to TFT displays that implement the MIPI Display Command Set.

Uses display_interface to talk to the hardware via transports.

An optional batching of draws is supported via the batch feature (default on)

§List of supported models

  • GC9A01
  • ILI9341
  • ILI9342C
  • ILI9486
  • ST7735
  • ST7789
  • ST7796

§Examples

For the ili9486 display, using the SPI interface with no chip select:

use display_interface_spi::SPIInterface;                 // Provides the builder for DisplayInterface
use mipidsi::{Builder, models::ILI9486Rgb666};           // Provides the builder for Display
use embedded_graphics::{prelude::*, pixelcolor::Rgb666}; // Provides the required color type

/* Define the SPI interface as the variable `spi` */
/* Define the DC digital output pin as the variable `dc` */
/* Define the Reset digital output pin as the variable `rst` */

// Create a DisplayInterface from SPI and DC pin, with no manual CS control
let di = SPIInterface::new(spi, dc);

// Create the ILI9486 display driver from the display interface and optional RST pin
let mut display = Builder::new(ILI9486Rgb666, di)
    .reset_pin(rst)
    .init(&mut delay).unwrap();

// Clear the display to black
display.clear(Rgb666::BLACK).unwrap();

For the ili9341 display, using the Parallel port, with the RGB666 color space and the Bgr color order:

// Provides the builder for DisplayInterface
use display_interface_parallel_gpio::{Generic8BitBus, PGPIO8BitInterface};
// Provides the builder for Display
use mipidsi::{Builder, models::ILI9341Rgb666};
// Provides the required color type
use embedded_graphics::{prelude::*, pixelcolor::Rgb666};

/* Define digital output pins d0 - d7 for the parallel port as `lcd_dX` */
/* Define the D/C digital output pin as `dc` */
/* Define the WR and Reset digital output pins with the initial state set as High as `wr` and
`rst` */

// Create the DisplayInterface from a Generic8BitBus, which is made from the parallel pins
let bus = Generic8BitBus::new((lcd_d0, lcd_d1, lcd_d2,
    lcd_d3, lcd_d4, lcd_d5, lcd_d6, lcd_d7));
let di = PGPIO8BitInterface::new(bus, dc, wr);

// Create the ILI9341 display driver from the display interface with the RGB666 color space
let mut display = Builder::new(ILI9341Rgb666, di)
     .reset_pin(rst)
     .color_order(mipidsi::options::ColorOrder::Bgr)
     .init(&mut delay).unwrap();

// Clear the display to black
display.clear(Rgb666::RED).unwrap();

Use the appropriate display interface crate for your needs:

§Troubleshooting

See document

Modules§

Structs§

Enums§