main menu first simple implementation of display and state

This commit is contained in:
2026-08-14 20:20:53 +00:00
parent 6b8d076b3c
commit f38181d98a
3 changed files with 60 additions and 10 deletions
+6 -5
View File
@@ -7,8 +7,9 @@
)]
#![deny(clippy::large_stack_frames)]
use alloc::boxed::Box;
use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2};
use creaturedex::display::primary_lcd::init_primary_lcd;
use creaturedex::display::primary_lcd::{PrimaryLcdDisplay, init_primary_lcd};
use creaturedex::display::views::card_view::render_nfc_payload;
use creaturedex::drivers::nfc_pn532::NfcPn532Driver;
use creaturedex::navigation::inputs::Inputs;
@@ -61,7 +62,7 @@ async fn main(spawner: Spawner) {
log::info!("Setup complete, entering main loop");
let mut display = init_primary_lcd(
let display: &mut PrimaryLcdDisplay = Box::leak(Box::new(init_primary_lcd(
peripherals.SPI2,
peripherals.GPIO36,
peripherals.GPIO35,
@@ -69,7 +70,7 @@ async fn main(spawner: Spawner) {
peripherals.GPIO11,
peripherals.GPIO10,
peripherals.GPIO12,
);
)));
setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await;
@@ -91,7 +92,7 @@ async fn main(spawner: Spawner) {
let mut nav_state = NavigationState::new();
let button_config = InputConfig::default().with_pull(Pull::Up);
let mut inputs = Inputs {
let inputs = Inputs {
up: Input::new(peripherals.GPIO38, button_config.clone()),
down: Input::new(peripherals.GPIO0, button_config.clone()),
left: Input::new(peripherals.GPIO1, button_config.clone()),
@@ -100,5 +101,5 @@ async fn main(spawner: Spawner) {
ok: Input::new(peripherals.GPIO4, button_config.clone()),
};
spawner.spawn(navigation::run(inputs).expect("run task failed"));
spawner.spawn(navigation::run(inputs, display).expect("run task failed"));
}