render: implement a generic Renderer task that can run any display

This commit is contained in:
2024-11-02 15:22:37 +01:00
parent 873954d596
commit dbfc79046e
5 changed files with 80 additions and 53 deletions

View File

@@ -28,6 +28,8 @@ use crate::render::SharedSurface as SurfaceType;
#[cfg(not(feature="threads"))]
use crate::render::SimpleSurface as SurfaceType;
use crate::render::Renderer;
fn main() {
// It is necessary to call this function once. Otherwise some patches to the runtime
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
@@ -40,13 +42,17 @@ fn main() {
let mut display = DisplayType::new_display::<SurfaceType>();
log::info!("Created new display type {}", core::any::type_name_of_val(&display));
log::info!("Creating runner");
let mut runner = task::Scheduler::new(vec![
Box::new(animations::IdleTask::new(display.new_surface().unwrap())),
Box::new(animations::TestPattern::new(display.new_surface().unwrap())),
Box::new(display),
Box::new(Renderer::new(display)),
]);
log::info!("Runner ready: {:?}", runner);
log::info!("Ready to rock and roll");
loop {
runner.tick();