Skip to content

Instantly share code, notes, and snippets.

@brxken128
Created November 28, 2022 19:38
Show Gist options
  • Save brxken128/134683b2488f03803dc883c60891eec3 to your computer and use it in GitHub Desktop.
Save brxken128/134683b2488f03803dc883c60891eec3 to your computer and use it in GitHub Desktop.
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