try different crates

This commit is contained in:
2026-08-05 20:02:15 +02:00
parent 020ca5cd4b
commit e477462783
6 changed files with 401 additions and 28 deletions
+12 -27
View File
@@ -10,7 +10,6 @@
use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2};
use creaturedex::display::shared_bus::init_dual_displays;
use creaturedex::display::views::card_view::render_nfc_payload;
use creaturedex::drivers::nfc_pn532::NfcPn532Driver;
use creaturedex::navigation::input::init_navigation_button;
@@ -18,17 +17,17 @@ use creaturedex::navigation::state::NavigationState;
use creaturedex::network::wifi::setup_wifi;
use embassy_executor::Spawner;
use embassy_time::Timer;
use embedded_graphics::{
mono_font::{ascii::FONT_6X10, MonoTextStyle},
prelude::*,
text::Text,
};
use embedded_graphics::draw_target::DrawTarget;
use embedded_graphics::pixelcolor::{BinaryColor, Rgb565};
use embedded_graphics::prelude::RgbColor;
use esp_hal::time::Duration;
use embedded_graphics::{
mono_font::{MonoTextStyle, ascii::FONT_6X10},
prelude::*,
text::Text,
};
use esp_hal::clock::CpuClock;
use esp_hal::delay::Delay;
use esp_hal::time::Duration;
use esp_hal::timer::timg::TimerGroup;
use log::error;
@@ -81,7 +80,7 @@ async fn main(spawner: Spawner) {
peripherals.GPIO35, // mosi
peripherals.GPIO37, // miso
peripherals.GPIO11, // primary cs
peripherals.GPIO5, // oled cs
peripherals.GPIO13, // oled cs
peripherals.GPIO10, // shared reset
peripherals.GPIO12, // shared dc
&mut delay,
@@ -97,11 +96,14 @@ async fn main(spawner: Spawner) {
Text::new("Hello OLED", Point::new(10, 20), text_style)
.draw(&mut oled)
.unwrap();
oled.flush().unwrap();
let text_style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE);
display.clear_screen(0).unwrap();
Text::new("Hello OLED", Point::new(10, 20), text_style).draw(&mut display).unwrap();
let mut nfc_driver = NfcPn532Driver::new(peripherals.I2C0, peripherals.GPIO17, peripherals.GPIO18);
let mut nfc_driver =
NfcPn532Driver::new(peripherals.I2C0, peripherals.GPIO17, peripherals.GPIO18);
let timeout = Duration::from_millis(1000);
if nfc_driver.configure_sam(timeout).is_ok() {
log::info!("NFC SAM configuration successful");
@@ -109,24 +111,7 @@ async fn main(spawner: Spawner) {
log::error!("NFC SAM configuration failed");
}
log::info!("Setup complete, entering main loop");
loop {
if let Ok(card_data) = nfc_driver.read_card_data() {
log::info!("NFC Card Read: {:?}", card_data);
}
if button1.is_low() {
log::info!("Button pressed!");
display.clear(Rgb565::BLACK).unwrap();
let payload = if nav_state.toggle_payload() {
&MOCK_PAYLOAD
} else {
&MOCK_PAYLOAD2
};
render_nfc_payload(&mut display, payload);
}
Timer::after_millis(10).await;
}
}