implement settings menu
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
use crate::navigation::menu_item;
|
||||
use crate::navigation::state::Menu;
|
||||
use crate::{display::primary_lcd::PrimaryLcdDisplay, navigation::inputs::Inputs};
|
||||
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
use embedded_graphics_core::draw_target::DrawTarget;
|
||||
pub const MAX_SELECTED: i8 = 2;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SettingsMenu {
|
||||
pub selected: i32,
|
||||
}
|
||||
|
||||
impl super::navigation::Navigable for SettingsMenu {
|
||||
fn display(
|
||||
&self,
|
||||
display: &mut PrimaryLcdDisplay<'static>,
|
||||
) -> impl core::future::Future<Output = ()> + Send {
|
||||
display.clear(Rgb565::BLACK).unwrap();
|
||||
menu_item::show(display, "System Inforation", 0, self.selected);
|
||||
menu_item::show(display, "Wifi Information", 1, self.selected);
|
||||
|
||||
core::future::ready(())
|
||||
}
|
||||
|
||||
fn handle_input(
|
||||
&self,
|
||||
input: super::navigation::Action,
|
||||
) -> impl core::future::Future<Output = super::state::Menu> + Send {
|
||||
async move { Menu::Settings(SettingsMenu { selected: 0 }) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user