2 releases
0.1.1 | Oct 5, 2024 |
---|---|
0.1.0 | Aug 19, 2024 |
#430 in Hardware support
115 downloads per month
19KB
461 lines
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();
lib.rs
:
This crate provides a ST7789 driver to connect to TFT displays.
Dependencies
~550KB