platform: rewrite the platform-specific display creation traits into a new Board trait that also supports tasks

This commit is contained in:
2024-11-30 16:06:17 +01:00
parent 57e660cbb6
commit 3af9ad408e
5 changed files with 276 additions and 80 deletions

View File

@@ -4,9 +4,19 @@ pub mod embedded_graphics_lib;
#[cfg(feature="smart-leds")]
pub mod smart_leds_lib;
use crate::render::{Surface, Output};
pub mod esp32;
pub trait DisplayInit {
use esp_idf_svc::hal::prelude::Peripherals;
use crate::render::{Output, Surfaces};
use crate::task::Task;
pub trait Board {
type Output: Output;
fn new_display<S: Surface>() -> Self::Output;
}
type Surfaces: Surfaces;
fn new(peripherals: Peripherals) -> Self;
fn output(&mut self) -> Self::Output;
fn surfaces(&mut self) -> Self::Surfaces;
fn system_tasks(&mut self) -> Vec<Box<dyn Task>>;
}