/embedded-text.rs Secret
Created
November 28, 2022 19:38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let di = SPIInterfaceNoCS::new(interface, dc); | |
let mut display = Builder::st7789_pico1(di) | |
.with_display_size(240, 135) | |
.with_orientation(Orientation::Landscape(true)) | |
.init(Delay::get_delay_mut(), Some(rst)) | |
.unwrap(); | |
display.clear(Rgb565::BLACK).unwrap(); | |
let text_style = MonoTextStyleBuilder::new() | |
.font(&FONT_9X15) | |
.text_color(Rgb565::WHITE) | |
.build(); | |
let textbox_style = TextBoxStyleBuilder::new() | |
.alignment(HorizontalAlignment::Center) | |
.vertical_alignment(VerticalAlignment::Middle) | |
.build(); | |
let bounds = Rectangle::new(Point::zero(), Size::new(235, 130)); | |
let text_box = TextBox::with_textbox_style(text, bounds, text_style, textbox_style); | |
text_box.draw(display).unwrap(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment