Rust library crate to use ILI9486-driven displays.
The library (originally forked from here) works with version 0.7.1
of the crate embedded-graphics.
The following sketches how to use the crate:
-
First set up a
display interface
for the interface type (e.g. SPI, parallel 8080 type interface etc.). This should implement a genericdisplay_interface
, in particular the traitWriteOnlyDataCommand
. -
Create the driver specifing the chip select (CS) and reset pin.
let mut lcd_driver = ILI9486::new(display_interface, lcd_cs_pin, lcd_reset_pin).unwrap();
- Initialise the driver
lcd_driver.init(&mut delay).unwrap();
- Set the orientation
lcd_driver.set_orientation(ili9486::Orientation::Landscape).unwrap();
- Can now use the
embedded-graphics
functions to, for instance, draw a rectangle.
// Create a rectangle
let rect_style = PrimitiveStyleBuilder::new()
.stroke_color(Rgb565::RED)
.stroke_width(10)
.fill_color(Rgb565::GREEN)
.build();
Rectangle::new(Point::new(30, 20), Size::new(100, 70))
.into_styled(rect_style)
.draw(&mut lcd_driver)
.unwrap();
Instead of just using unwrap
you may want to use sonething else to better handle errors.
Examples are shon in the examples
directory
See the change log.
Currently this seems to work, but was unable to continue testing as the display I was using went bust!