Skip to content
Snippets Groups Projects
Commit 807e6aa6 authored by zdmx's avatar zdmx :crab:
Browse files

Add start screen / bmp rendering example

parent e74da10c
No related branches found
No related tags found
No related merge requests found
......@@ -699,6 +699,7 @@ dependencies = [
"shared-bus",
"smart-leds",
"static_cell",
"tinybmp",
]
[[package]]
......@@ -1269,6 +1270,15 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "tinybmp"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197cc000e382175ff15abd9c54c694ef80ef20cb07e7f956c71e3ea97fc8dc60"
dependencies = [
"embedded-graphics",
]
[[package]]
name = "toml_datetime"
version = "0.6.3"
......
......@@ -32,3 +32,4 @@ port-expander = "0.4.0"
shared-bus = { version = "0.3.0", features = ["xtensa"] }
smart-leds = "0.3.0"
static_cell = "1.2.0"
tinybmp = "0.5.0"
img/logo.bmp

27.1 KiB

......@@ -5,10 +5,11 @@ use embedded_graphics::{
pixelcolor::Rgb565,
prelude::*,
primitives::{PrimitiveStyle, Rectangle, StyledDrawable},
text::Text,
text::Text, image::Image,
};
use esp_backtrace as _;
use esp_println::println;
use tinybmp::Bmp;
use crate::flow3r::display::Display;
use smart_leds::SmartLedsWrite;
......@@ -87,3 +88,18 @@ async fn move_rectangle<'a>(
display.flush().await.unwrap();
Timer::after(Duration::from_millis(10)).await;
}
pub async fn draw_start_screen(display: &mut Display) {
let bmp_data = include_bytes!("../img/logo.bmp");
let bmp = Bmp::from_slice(bmp_data).unwrap();
display.fill_solid(&display.bounding_box(), Rgb565::WHITE).unwrap();
Image::with_center(&bmp, display.bounding_box().center()).draw(display).unwrap();
Text::with_alignment(
"flow3-rs starting",
Point { x: 120, y: 180 },
MonoTextStyle::new(&FONT_6X10, Rgb565::BLACK),
embedded_graphics::text::Alignment::Center
).draw(display).unwrap();
display.flush().await.unwrap();
display.set_backlight(100).unwrap();
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ mod flow3r;
mod runtime;
mod demo_tasks;
use demo_tasks::draw_start_screen;
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
......@@ -24,7 +25,10 @@ fn runtime() -> ! {
}
#[embassy_executor::task]
async fn main(flow3r: Flow3r) -> ! {
async fn main(mut flow3r: Flow3r) -> ! {
draw_start_screen(&mut flow3r.display).await;
Timer::after(Duration::from_secs(10)).await;
let spawner = Spawner::for_current_executor().await;
spawner.spawn(demo_tasks::leds_fade(flow3r.leds)).ok();
spawner.spawn(demo_tasks::display_demo(flow3r.display)).ok();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment