Crates.io | edrv-st7735 |
lib.rs | edrv-st7735 |
version | 0.0.1 |
source | src |
created_at | 2024-09-28 16:01:35.823101 |
updated_at | 2024-09-28 16:01:35.823101 |
description | Driver for ST7735, maintained by the embedded-drivers team |
homepage | https://github.com/embedded-drivers/embedded-drivers |
repository | https://github.com/embedded-drivers/embedded-drivers |
max_upload_size | |
id | 1390202 |
size | 16,061 |
Rust driver for ST7735.
The ST7735 is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 396 source line and 162 gate line driving circuits.
This project is maintained by the embedded-drivers team. Our organization's goal is to provide consistent driver access interfaces for embedded Rust and to maintain these drivers collectively to avoid orphaned crates.
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
use embassy_sync::mutex::Mutex;
let spi = hpm_hal::spi::Spi::new_txonly(r.spi1, r.sclk, r.mosi, r.dma_ch0, config);
let spi_bus = Mutex::<NoopRawMutex, _>::new(spi);
let spi_dev = embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice::new(&spi_bus, cs);
let mut display: ST7735<Display160x80Type2, _, _> = ST7735::new(spi_dev, dc);
let mut fb = Framebuffer::<
Rgb565,
_,
BigEndian,
160,
80,
{ embedded_graphics::framebuffer::buffer_size::<Rgb565>(160, 80) },
>::new();
display.init(&mut Delay).await;
Or using blocking SPI:
use embedded_hal_bus::spi::AtomicDevice;
use embedded_hal_bus::util::AtomicCell;
let spi = hal::spi::Spi::new_blocking_txonly(r.spi1, r.sclk, r.mosi, config);
let spi_bus = AtomicCell::new(spi);
let spi_dev = AtomicDevice::new(&spi_bus, cs, Delay).unwrap();
let mut display: ST7735<Display160x80Type2, _, _> = ST7735::new(spi_dev, dc);
Please refer to embedded-drivers