Skip to content

Commit

Permalink
release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
almindor committed Sep 30, 2022
1 parent efee5d6 commit 30c15e9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <almindor@gmail.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -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"]
Expand Down
29 changes: 29 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
```
Expand Down

0 comments on commit 30c15e9

Please sign in to comment.