Skip to content

Commit

Permalink
Merge #297
Browse files Browse the repository at this point in the history
297: Add support for some LCD controllers using the FMC/FSMC r=therealprof a=samcrow

# Introduction

This pull request adds code that uses the Flexible Memory Controller or Flexible Static Memory Controller to interface with some types of LCD controllers.

We have [another FMC pull request](#194) for non-LCD applications that has been inactive for a while. I'm hoping that this pull request will be easier to review because it does not try to implement everything that the hardware supports.

# Features

* Controls up to 4 independent LCDs
* Compatible with LCD controllers that use the Intel 8080 protocol with a 16-bit bidirectional data bus
* Includes an example that works on the STM32F412G-DISCO board
* Provides a low-level interface that can be used to write drivers for specific LCD controllers

# Limitations

* No support for bus widths other than 16 bits
* I have only tested this code with Sitronix ST7789-series LCD controllers. Are there other LCD controllers that use an Intel 8080-like interface that this code cannot support?
* The code uses some trait trickery to ensure that the client code can only access the display(s) that correspond to the chip select pin(s) in use. However, this may make the API too difficult for people to understand.

# Future work

* Support an 8-bit data bus (in addition to the currently supported 16-bit bus)
* Potentially support an 18-bit data bus, on microcontroller models that have more than 16 data pins

Co-authored-by: Sam Crow <scrow@eng.ucsd.edu>
  • Loading branch information
bors[bot] and samcrow committed Apr 18, 2021
2 parents fc9c650 + 134723a commit d57eb5f
Show file tree
Hide file tree
Showing 11 changed files with 1,876 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: check
args: --features=${{ matrix.mcu }},rt,usb_fs,sdio,can,i2s --examples
args: --features=${{ matrix.mcu }},rt,usb_fs,sdio,can,i2s,fsmc_lcd --examples
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added internal pullup configuaration for the AlternateOD pin type
- Added USART support for sending and receiving 9-bit words [#299]
- Added support for I2S communication using SPI peripherals, and two examples [#265]
- Added support for some LCD controllers using the Flexible Static Memory
Controller / Flexible Memory Controller [#297]

[#265]: https://github.com/stm32-rs/stm32f4xx-hal/pull/265
[#297]: https://github.com/stm32-rs/stm32f4xx-hal/pull/297

### Changed

Expand Down
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repository = "https://github.com/stm32-rs/stm32f4xx-hal"
version = "0.9.0"

[package.metadata.docs.rs]
features = ["stm32f429", "rt", "usb_fs", "can", "i2s"]
features = ["stm32f429", "rt", "usb_fs", "can", "i2s", "fsmc_lcd"]
targets = ["thumbv7em-none-eabihf"]

[dependencies]
Expand All @@ -40,6 +40,7 @@ bare-metal = { version = "1" }
cast = { default-features = false, version = "0.2.2" }
void = { default-features = false, version = "1.0.2" }
embedded-hal = { features = ["unproven"], version = "0.2.3" }
display-interface = { version = "0.4.0", optional = true }

[dependencies.stm32_i2s_v12x]
version = "0.2.0"
Expand Down Expand Up @@ -89,6 +90,8 @@ sdio = ["sdio-host"]

i2s = ["stm32_i2s_v12x"]

fsmc_lcd = ["display-interface"]

[profile.dev]
debug = true
lto = true
Expand Down Expand Up @@ -161,3 +164,7 @@ required-features = ["rt", "stm32f401"]
[[example]]
name = "serial-9bit"
required-features = ["rt", "stm32f411"]

[[example]]
name = "st7789-lcd"
required-features = ["rt", "stm32f412", "fsmc_lcd"]
Loading

0 comments on commit d57eb5f

Please sign in to comment.