Crate super_simple_st7789driver

Source
Expand description

§super_simple_st7789driver

A simple async Rust driver for the ST7789 TFT display, based on embedded-hal traits.

§Features

  • Async SPI communication
  • Basic display initialization
  • Set row/column address
  • Write memory and data

§Example

use st7789driver::{St7789, Timer_};
use embedded_hal::digital::OutputPin;
use embedded_hal_async::spi::SpiBus;

struct MyTimer;
impl Timer_ for MyTimer {
    fn delay_ms(&self, ms: u64) -> impl core::future::Future<Output = ()> {
        async move {
            // Implement your async delay here
        }
    }
}

// Assume you have implementations for spi, cs, and dc
let mut lcd = St7789::new(spi, cs, dc, MyTimer);

// Initialization and basic operations
lcd.init().await.unwrap();
lcd.set_row(0, 319).await.unwrap();
lcd.set_col(0, 239).await.unwrap();
lcd.write_memory().await.unwrap();// send write data command
lcd.write_data(&[0x00]).await.unwrap();// send real data

Modules§

commands
ST7789 command definitions

Structs§

St7789
ST7789 display driver

Traits§

Timer_
Timer trait for async delay