pass outputs and state to nfc task so that they can show errors on their own

This commit is contained in:
2026-08-30 09:18:53 +00:00
parent 3d36885e11
commit 3c657045ca
5 changed files with 79 additions and 43 deletions
+7 -4
View File
@@ -20,6 +20,7 @@ use creaturedex::drivers::tertiary_lcd::{
use creaturedex::navigation::navigation::Mutex;
use creaturedex::navigation::inputs::Inputs;
use creaturedex::navigation::navigation::{self};
use creaturedex::navigation::state::NavigationState;
use creaturedex::navigation::outputs::Outputs;
use creaturedex::peripherals::Peripherals;
use creaturedex::peripherals::storage::cardstore::CardStore;
@@ -163,7 +164,7 @@ async fn main(spawner: Spawner) {
display_shit(&mut secondaries[2], "baz 1");
display_shit_prim(&mut primary, "Hello World");
let outputs = {
let outputs = Box::leak(Box::new(Mutex::new({
let [sec_1, sec_2, sec_3] = secondaries;
Outputs {
primary_display: primary,
@@ -173,12 +174,14 @@ async fn main(spawner: Spawner) {
tertiary_display: lcd,
_led_a: (),
}
};
})));
let navigation_state = Box::leak(Box::new(Mutex::new(NavigationState::new())));
log::info!("Setup complete, entering main loop");
spawner.spawn(navigation::run(inputs, outputs, peripherals).expect("run task failed"));
spawner.spawn(navigation::run(inputs, outputs, peripherals, navigation_state).expect("run task failed"));
spawner.spawn(
background_tasks::nfc_scanner(nfc_driver, peripherals).expect("nfc scanner task failed"),
background_tasks::nfc_scanner(nfc_driver, outputs, peripherals, navigation_state).expect("nfc scanner task failed"),
);
core::future::pending::<()>().await
}