st7789-lcd

Crates.iost7789-lcd
lib.rsst7789-lcd
version0.1.1
sourcesrc
created_at2024-08-19 12:22:39.834608
updated_at2024-10-05 09:34:27.148575
descriptionST7789 TFT LCD driver with embedded-graphics support
homepage
repository
max_upload_size
id1343813
size19,444
(Merisy-Thing)

documentation

README

ST7789 LCD

ST7789 driver to connect to TFT displays, with embedded-graphics support

Usage

let mut nss = Pin::new(PortNum::PA, PinNum::Pin15).into_output(PinModeOutput::OutPP);
nss.set_high().ok();

let dc = Pin::new(PortNum::PB, PinNum::Pin6).into_output(PinModeOutput::OutPP);
let rst = Pin::new(PortNum::PF, PinNum::Pin7).into_output(PinModeOutput::OutPP);
let _sck = Pin::new(PortNum::PB, PinNum::Pin3).into_alternate(PinModeAlternate::AF(0));
let _mosi = Pin::new(PortNum::PB, PinNum::Pin5).into_alternate(PinModeAlternate::AF(0));

let spi_cfg = spi::Config::default();
let _spi_bus = SpiBus::new(SpiBusId::Bus1, &spi_cfg);
let lcd_spi = _spi_bus.to_device(nss);

let mut disp = ST7789::<_, _, _, 280, 240, 20, 0>::new(lcd_spi, dc, rst);

let mut disp_delay = Delay::new();
disp.init(&mut disp_delay, Orientation::Portrait, true, true).ok();
disp.clear(Rgb565::BLACK).ok();

Text::new("Hello world!", POS, ch_style).draw(&mut disp).ok();
Commit count: 0

cargo fmt