wip: add flash info view
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
use crate::navigation::inputs::ButtonAction;
|
||||
use crate::navigation::navigation::Action;
|
||||
use crate::navigation::navigation::Navigable;
|
||||
use crate::navigation::navigation::NewState;
|
||||
use crate::navigation::outputs::Outputs;
|
||||
use crate::views::view::View;
|
||||
use embedded_graphics::mono_font::MonoTextStyle;
|
||||
use embedded_graphics::mono_font::ascii::FONT_10X20;
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::prelude::DrawTarget;
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
use embedded_graphics::text::Text;
|
||||
|
||||
use embedded_graphics::prelude::Point;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FlashInfoView {}
|
||||
|
||||
impl Navigable for FlashInfoView {
|
||||
fn display(&self, outputs: &mut Outputs) -> impl core::future::Future<Output = ()> + Send {
|
||||
let style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE);
|
||||
Text::new("Flash Initialized: {:?}", Point::new(40, 40), style);
|
||||
|
||||
core::future::ready(())
|
||||
}
|
||||
|
||||
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
|
||||
async move {
|
||||
let Action::Button(input) = input else {
|
||||
// Skip timer inputs
|
||||
return NewState {
|
||||
view: View::FlashInfo(self.clone()),
|
||||
replace_view: true,
|
||||
redraw: false,
|
||||
};
|
||||
};
|
||||
|
||||
let new_menu = match input {
|
||||
_ => View::FlashInfo(self.clone()),
|
||||
};
|
||||
|
||||
NewState {
|
||||
replace_view: matches!(new_menu, View::FlashInfo(_)),
|
||||
view: new_menu,
|
||||
redraw: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user