Crates.io | st7789-lcd |
lib.rs | st7789-lcd |
version | 0.1.1 |
source | src |
created_at | 2024-08-19 12:22:39.834608 |
updated_at | 2024-10-05 09:34:27.148575 |
description | ST7789 TFT LCD driver with embedded-graphics support |
homepage | |
repository | |
max_upload_size | |
id | 1343813 |
size | 19,444 |
ST7789 driver to connect to TFT displays, with embedded-graphics support
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();