Expand description
This crate provides a generic display driver to connect to TFT displays that implement the MIPI Display Command Set.
Uses implementations of the interface::Interface trait to talk to the hardware via different transports. Builtin support for these transports is available:
- SPI (
interface::SpiInterface
) - 8080 style parallel via GPIO (
interface::ParallelInterface
)
An optional batching of draws is supported via the batch
feature (default on)
§List of supported models
- GC9107
- GC9A01
- ILI9341
- ILI9342C
- ILI9486
- ST7735
- ST7789
- ST7796
§Examples
For the ili9486 display, using the SPI interface with no chip select:
use mipidsi::interface::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 buffer
let mut buffer = [0_u8; 512];
// Create a DisplayInterface from SPI and DC pin, with no manual CS control
let di = SpiInterface::new(spi, dc, &mut buffer);
// 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 mipidsi::interface::{Generic8BitBus, ParallelInterface};
// 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 = ParallelInterface::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();
§Troubleshooting
See document
Modules§
- dcs
- MIPI DCS commands.
- interface
- Interface traits and implementations
- models
- Display models.
- options
- ModelOptions and other helper types.
Structs§
- Builder
- Builder for Display instances.
- Display
- Display driver to connect to TFT displays.
- Test
Image - Test image.
Enums§
- NoReset
Pin - Marker type for no reset pin.