Skip to content

KaidRommel/esp-rust-spi-lcd-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32-S3 SPI LCD Demo

A demonstration project for the ESP32-S3 microcontroller, showcasing a bouncing text animation on an ATK-MD0240 SPI LCD. This project is built with Rust using the esp-hal and features custom-written drivers for the display and an XL9555 I/O expander.

This project is a great starting point for anyone looking to drive an SPI display and use I2C peripherals with an ESP32-S3 in Rust.

README.md

Features

  • Bouncing "ESP32 <3 Rust" text animation using embedded-graphics.
  • The background color cycles through a palette each time the text bounces off the side walls.
  • Drives an ATK-MD0240 SPI LCD.
  • Utilizes an XL9555 I2C I/O expander for display control signals (Reset and Power/Backlight).
  • Built entirely in Rust on top of the esp-rs ecosystem (esp-hal, esp-backtrace, etc.).
  • Showcases custom, no_std compatible drivers for both the atk_md0240 display and the xl9555 I/O expander.

Hardware Requirements

  • An ESP32-S3 development board.
  • An ATK-MD0240 2.4" TFT LCD Module.
  • An XL9555 I/O Expander.

Connections

The following table details the hardware connections used in this project.

ESP32-S3 Pin Connection Notes
I2C (for XL9555)
GPIO41 XL9555 SDA I2C Data
GPIO42 XL9555 SCL I2C Clock
SPI (for LCD)
GPIO11 LCD MOSI (or SDA) SPI Master Out, Slave In
GPIO12 LCD SCLK (or SCL) SPI Clock
GPIO13 LCD MISO (or SDO) SPI Master In, Slave Out (Optional)
GPIO21 LCD CS SPI Chip Select
Direct LCD Control
GPIO40 LCD WR/DC Data / Command Select
XL9555 Controlled
XL9555 P12 LCD RST Reset Pin
XL9555 P13 LCD PWR Backlight Power Control
3V3 VCC Power for all components
GND GND Common Ground

How to Build and Run

This project is built using the Rust programming language and the esp-rs toolchain.

Prerequisites

  1. Install the Rust esp toolchain. Follow the instructions at https://esp-rs.github.io/book/installation/index.html.
  2. Install espflash for easy flashing and monitoring:
    cargo install espflash

Building and Flashing

  1. Clone this repository:

    https://github.com/KaidRommel/esp-rust-spi-lcd-demo.git
    cd esp-rust-spi-lcd-demo
  2. Build and Run the project:

    cargo run

You should see the bouncing text animation on your LCD screen!

Custom Drivers

A key part of this project is the use of two custom-written drivers, which are also available as standalone crates for your own projects:

  • atk_md0240-rs: A no_std driver for the ATK-MD0240 SPI LCD, providing a simple interface compatible with embedded-graphics.
  • xl9555-rs: A no_std driver for the XL9555 I2C I/O expander, allowing easy control of its 16 I/O pins.

About

A Rust demo for the ESP32-S3, showcasing a bouncing text animation on an SPI LCD using `esp-hal` and `embedded-graphics`.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages