Embedde graphics demo works!

This commit is contained in:
Sebastian H. Gabrielli 2024-12-21 10:32:57 +01:00
parent 9604e0af66
commit f249ac62be

View File

@ -100,53 +100,58 @@ async fn main(spawner: Spawner) {
display.clear(Rgb565::RED).unwrap(); display.clear(Rgb565::RED).unwrap();
// // Create styles used by the drawing operations. // Create styles used by the drawing operations.
// let thin_stroke = PrimitiveStyle::with_stroke(BinaryColor::On, 1); let thin_stroke = PrimitiveStyle::with_stroke(Rgb565::WHITE, 1);
// let thick_stroke = PrimitiveStyle::with_stroke(BinaryColor::On, 3); let thick_stroke = PrimitiveStyle::with_stroke(Rgb565::WHITE, 3);
// let border_stroke = PrimitiveStyleBuilder::new() let border_stroke = PrimitiveStyleBuilder::new()
// .stroke_color(BinaryColor::On) .stroke_color(Rgb565::WHITE)
// .stroke_width(3) .stroke_width(3)
// .stroke_alignment(StrokeAlignment::Inside) .stroke_alignment(StrokeAlignment::Inside)
// .build(); .build();
// let fill = PrimitiveStyle::with_fill(BinaryColor::On); let fill = PrimitiveStyle::with_fill(Rgb565::WHITE);
// let character_style = MonoTextStyle::new(&FONT_6X10, BinaryColor::On); let character_style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE);
// let yoffset = 10; let yoffset = 10;
// // Draw a 3px wide outline around the display. // Draw a 3px wide outline around the display.
// display display
// .bounding_box() .bounding_box()
// .into_styled(border_stroke) .into_styled(border_stroke)
// .draw(&mut display).unwrap(); .draw(&mut display)
.unwrap();
// // Draw a triangle. // Draw a triangle.
// Triangle::new( Triangle::new(
// Point::new(16, 16 + yoffset), Point::new(16, 16 + yoffset),
// Point::new(16 + 16, 16 + yoffset), Point::new(16 + 16, 16 + yoffset),
// Point::new(16 + 8, yoffset), Point::new(16 + 8, yoffset),
// ) )
// .into_styled(thin_stroke) .into_styled(thin_stroke)
// .draw(&mut display).unwrap(); .draw(&mut display)
.unwrap();
// // Draw a filled square // Draw a filled square
// Rectangle::new(Point::new(52, yoffset), Size::new(16, 16)) Rectangle::new(Point::new(52, yoffset), Size::new(16, 16))
// .into_styled(fill) .into_styled(fill)
// .draw(&mut display).unwrap(); .draw(&mut display)
.unwrap();
// // Draw a circle with a 3px wide stroke. // Draw a circle with a 3px wide stroke.
// Circle::new(Point::new(88, yoffset), 17) Circle::new(Point::new(88, yoffset), 17)
// .into_styled(thick_stroke) .into_styled(thick_stroke)
// .draw(&mut display).unwrap(); .draw(&mut display)
.unwrap();
// // Draw centered text. // Draw centered text.
// let text = "embedded-graphics"; let text = "embedded-graphics";
// Text::with_alignment( Text::with_alignment(
// text, text,
// display.bounding_box().center() + Point::new(0, 15), display.bounding_box().center() + Point::new(0, 15),
// character_style, character_style,
// Alignment::Center, Alignment::Center,
// ) )
// .draw(&mut display).unwrap(); .draw(&mut display)
.unwrap();
let mut led = Output::new(p.P0_03, Level::Low, OutputDrive::Standard); let mut led = Output::new(p.P0_03, Level::Low, OutputDrive::Standard);