implement simple card storage retreival

This commit is contained in:
2026-08-26 20:03:01 +00:00
parent 38e1617bdd
commit 7b378b89ab
10 changed files with 209 additions and 6 deletions
+6 -2
View File
@@ -16,6 +16,8 @@ use creaturedex::drivers::nfc_pn532::NfcPn532Driver;
use creaturedex::navigation::inputs::Inputs;
use creaturedex::navigation::navigation::{self, CARD_DATA};
use creaturedex::network::wifi::setup_wifi;
use creaturedex::storage::cardstore::CardStore;
use creaturedex::storage::store::Store;
use embassy_executor::Spawner;
use embassy_time::Instant;
use embedded_graphics::pixelcolor::BinaryColor;
@@ -108,7 +110,9 @@ async fn main(spawner: Spawner) {
);
}
setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await;
let store = Store::new(peripherals.FLASH).expect("Could not initialize Flash Store");
let card_store = CardStore::new(store).expect("Could not initialize Card Store");
//setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await;
let mut nfc_driver = NfcPn532Driver::new(AtomicDevice::new(shared_i2c));
if nfc_driver.configure_sam().await.is_ok() {
@@ -150,7 +154,7 @@ async fn nfc_driver_task(
CARD_DATA
.lock()
.await
.replace(Card::try_from(split_data).unwrap());
.replace(Card::try_from(split_data).expect("Invalid card data"));
let elapsed_ms = start.elapsed().as_millis();
log::info!(
"NFC read duration: {} ms, card data length: {}",