From 30c15e99de31d2f52b859c6065e9aa23f3a1369f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Katona?= Date: Fri, 30 Sep 2022 11:25:10 -0700 Subject: [PATCH] release v0.4.0 --- CHANGELOG.md | 2 ++ Cargo.toml | 6 +++--- MIGRATION.md | 29 +++++++++++++++++++++++++++++ README.md | 14 ++++++++++---- 4 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 MIGRATION.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a334a5..e16329e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.4.0] - 2022-09-30 + ### Added - support for model variants via `DisplayOptions` diff --git a/Cargo.toml b/Cargo.toml index 1f8dd1a..ba55c77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mipidsi" description = "MIPI Display Serial Interface generic driver" -version = "0.3.0" +version = "0.4.0" authors = ["Ales Katona "] edition = "2018" license = "MIT" @@ -14,12 +14,12 @@ rust-version = "1.59" [dependencies] display-interface = "0.4.1" embedded-graphics-core = "0.3.3" -embedded-hal = "0.2.6" +embedded-hal = "0.2.7" nb = "1.0.0" [dependencies.heapless] optional = true -version = "0.7.5" +version = "0.7.16" [features] default = ["batch"] diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 0000000..2918f3c --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,29 @@ +# Migration guide for MIPIDSI driver + +## v0.3 -> v0.4 + +### Users + +* `Display` helper constructors now take `DisplayOptions` argument instead of `init` + +#### v0.3 + +```rust +let display = Display::st7789(di, rst); +display.init(&mut delay, DisplayOptions::default()); +``` + +#### v0.4 + +```rust +let display = Display::st7789(di, rst, DisplayOptions::default()); +display.init(&mut delay); +``` + +### Model writers and specific variants + +`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 `Model`s 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. diff --git a/README.md b/README.md index 5d19540..77292b9 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,27 @@ An optional batching of draws is supported via the `batch` feature (default on) ## Architecture -The `Display` driver itself contains most of the functionality. Each specific display model implements the `Model` trait for every color format it supports. +The `Display` driver itself contains most of the functionality. Each specific display model implements the `Model` trait for every color format it supports. Each model can also have different variants which are handled via the `ModelOptions` struct. [embedded-graphics-core](https://crates.io/crates/embedded-graphics-core) is used to provide the drawing API. ## Models -Each supported display model can be used either through the `Display::with_model` call or through a shortcut function such as `Display::st7789` if provided (only available to in-tree models, external crate models must use the `with_model` constructor). +Each supported display model can be used either through the `Display::with_model` call or through a shortcut function such as `Display::st7789` if provided. External crates can be used to provide additional models, and can even expand the display constructor pool via trait extension. + +Variants that require different screen sizes and window addressing offsets are now supported via the `ModelOptions` logic (see docs). + +## Migration + +See [MIGRATION.md](MIGRATION.md) document. ### Example ```rust // create a DisplayInterface from SPI and DC pin, with no manual CS control let di = SPIInterfaceNoCS::new(spi, dc); // create the ILI9486 display driver in rgb666 color mode from the display interface and RST pin -let mut display = Display::ili9486_rgb666(di, rst); -display.init(&mut delay::Ets, DisplayOptions::default())?; +let mut display = Display::ili9486_rgb666(di, rst, DisplayOptions::default()) +display.init(&mut delay)?; // delay provider from your MCU // clear the display to black display.clear(Rgb666::BLACK)?; ```