Moved primary lcd and navigation into dedicated files

This commit was merged in pull request #18.
This commit is contained in:
2026-08-02 15:45:04 +02:00
committed by rhetenor
parent 30ba5e3796
commit 1d073df5a1
4 changed files with 128 additions and 68 deletions
+15 -1
View File
@@ -1 +1,15 @@
// Navigation input module
use esp_hal::gpio::{Input, InputConfig, Pull};
use esp_hal::peripherals::GPIO38;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NavCommand {
NextCard,
PrevCard,
Select,
ScanTag,
}
pub fn init_navigation_button(pin: GPIO38<'static>) -> Input<'static> {
let button_config = InputConfig::default().with_pull(Pull::Up);
Input::new(pin, button_config)
}
+35 -1
View File
@@ -1 +1,35 @@
// Navigation state module
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ScreenMode {
CardDetail,
DexGrid,
Settings,
}
#[derive(Debug, Clone, Copy)]
pub struct NavigationState {
pub current_screen: ScreenMode,
pub card_index: usize,
pub use_first_payload: bool,
}
impl Default for NavigationState {
fn default() -> Self {
Self {
current_screen: ScreenMode::CardDetail,
card_index: 0,
use_first_payload: true,
}
}
}
impl NavigationState {
pub fn new() -> Self {
Self::default()
}
pub fn toggle_payload(&mut self) -> bool {
let current = self.use_first_payload;
self.use_first_payload = !self.use_first_payload;
current
}
}