-
The
display_interfacedependency has been removed in favor of our own trait and implementations. This gives significantly better performance (#149)- Replace
display_interface_spi::SPIInterfacewithmipidsi::interface::SpiInterface. Note that it requires a small/medium sized&mut [u8]buffer. 512 bytes works well, your milage may vary.
// before use display_interface_spi::SPIInterface; let di = SPIInterface::new(spi_device, dc); // after use mipidsi::interface::SpiInterface; let mut buffer = [0_u8; 512]; let di = SpiInterface::new(spi_device, dc, &mut buffer);
- Replace
display_interface_parallel_gpio::PGPIO{8,16}BitInterfacewithmipidsi::interface::ParallelInterfaceand useGeneric{8,16}BitBusfrommipidsi::interface
// before use display_interface_parallel_gpio::Generic8BitBus; use display_interface_parallel_gpio::PGPIO8BitInterface; let bus = Generic8BitBus::new(pins); let di = PGPIO8BitInterface::new(bus, dc, wr); // after use mipidsi::interface::Generic8BitBus; use mipidsi::interface::ParallelInterface; let bus = Generic8BitBus::new(pins); let di = ParallelInterface::new(bus, dc, wr);
-
If you have a custom impl of the
display_interface_parallel_gpio::OutputBustrait, replace it withmipidsi::interface::OutputBus. This trait is identical except that it uses an associated error type instead of being hardcoded todisplay_interface::DisplayError -
If you are using
stm32f4xx-hal's fsmc, you can copy and paste this adapter:
pub struct FsmcAdapter<S, WORD>(pub Lcd<S, WORD>); impl<S, WORD> Interface for FsmcAdapter<S, WORD> where S: SubBank, WORD: Word + Copy + From<u8>, { type Word = WORD; type Error = Infallible; fn send_command(&mut self, command: u8, args: &[u8]) -> Result<(), Self::Error> { self.0.write_command(command.into()); for &arg in args { self.0.write_data(arg.into()); } Ok(()) } fn send_pixels<const N: usize>( &mut self, pixels: impl IntoIterator<Item = [Self::Word; N]>, ) -> Result<(), Self::Error> { for pixel in pixels { for word in pixel { self.0.write_data(word); } } Ok(()) } fn send_repeated_pixel<const N: usize>( &mut self, pixel: [Self::Word; N], count: u32, ) -> Result<(), Self::Error> { self.send_pixels((0..count).map(|_| pixel)) } }
- Replace
-
The dependencies for the
embedded-halanddisplay-interfacecrates have been updated to makemipidsicompatible with the 1.0 release ofembedded-hal. -
The model specific constructors (like
Builder::ili9341_rgb565) have been removed. Use the genericBuilder::newconstructor instead:// 0.7 use mipidsi::Builder; let display = Builder::ili9341_rgb565(di) .init(&mut delay, None)?; // 0.8 use mipidsi::{Builder, models::ILI9341Rgb565}; let display = Builder::new(ILI9341Rgb565, di) .init(&mut delay)?;
-
The reset pin parameter from
Builder::inithas been removed. Use theBuilder::reset_pinsetter instead:// 0.7 use mipidsi::Builder; let display = Builder::new(ili9341_rgb565, di) .init(&mut delay, Some(rst))?; // 0.8 use mipidsi::{Builder, models::ILI9341Rgb565}; let display = Builder::new(ILI9341Rgb565, di) .reset_pin(rst) .init(&mut delay)?;
-
The
Builder::with_*methods were renamed to versions without thewith_prefix to bring the library in compliance with Rust API guidelines (see this issue for more info):// 0.7 use mipidsi::Builder; let display = Builder::new(ili9341_rgb565, di) .with_invert_colors(ColorInversion::Normal) .with_orientation(Orienation::default()) .init(&mut delay, Some(rst))?; // 0.8 use mipidsi::{Builder, models::ILI9341Rgb565}; let display = Builder::new(ILI9341Rgb565, di) .invert_colors(ColorInversion::Normal) .orientation(Orienation::default()) .reset_pin(rst) .init(&mut delay)?;
-
The default values for the
invert_colorsandcolor_ordersettings were inconsistent between different models inmipidsi0.7. In 0.8 all models use the same default values with no color inversion and RGB subpixel order. Take a look at the troubleshooting guide if your display shows incorrect colors after the update.
-
The
default_optionsfunction has been removed from theModeltrait to make the default options consistent between the models. The maximum framebuffer size is now defined by the addedFRAMEBUFFER_SIZEconstant. -
The type of the
DELAYparameter in theinitmethod has been changed to theembedded-hal1.0 typeDelayNs.
No breaking changes.
- no change, addition of
Builder::with_invert_colors(bool)allows more combinations of display variants.
Model::init now expects the options: &ModelOptions instead of just madcl: u8 argument. This allows the use of the invert_colors field during init.
- use
Builderto construct theDisplayand set any options directly on construction
let display = Display::st7789(di, rst, DisplayOptions::default());
display.init(&mut delay);let display = Builder::st7789(di) // known model or with_model(model)
.with_display_size(240, 240) // set any options on the builder before init
.init(&mut delay, Some(rst)); // optional reset pinModel::new was reverted and is no longer necessary. Models now don't own the ModelOptions which has been moved off to the Display directly. Model::init has changed to include madctl parameter which is now provided by the Display and should be used as-is unless overrides are required.
Model::default_options was added to facilitate "generic variant" construction.
Helper constructors have been moved from Display to Builder with similar implementations as before.
DisplayOptions and ModelOptions values are now a function of the Builder and do not necessitate a constructor helper anymore. e.g. Display::st7789_240x240(...) becomes Builder::st7789(...).with_display_size(240, 240) controlled by the user.
Any variants can still set all of the options for a variant via a builder shortcut, such as Builder::st7789_pico1.
Displayhelper constructors now takeDisplayOptionsargument instead ofinit
let display = Display::st7789(di, rst);
display.init(&mut delay, DisplayOptions::default());let display = Display::st7789(di, rst, DisplayOptions::default());
display.init(&mut delay);Model now requires that the Model::new constructor takes ModelOptions which is an artefact of DisplayOptions in combination with display sizing and windowing settings. This is used by the "helper constructors" to provide pre-made Model variants to users.
Most display Models require just one constructor but some like the ST7789 have a lot of variants that have different display, frameber sizes or even windowing clipping offsets. These can now be provided easily by creating a helper constructor that provides the dimensions information to create ModelOptions.
For users that need to use a variant of a Model that does not yet have a constructor helper, this can be done manually provided you know what your display dimensions and offsets are.