rustphone/src/apps.rs

18 lines
539 B
Rust

use crate::{display::Display, keypad::KeyEvents, state::ModeState, Context};
pub mod clock;
pub mod dial;
pub trait App {
type AppModeState;
/// Called when the state is entered, before update
fn on_enter(context: &mut Context, mode_state: &mut Self::AppModeState);
/// Return Some if the mode should be changed
fn update(context: &mut Context, mode_state: &mut Self::AppModeState) -> Option<ModeState>;
/// Called when the state is left, after update
fn on_leave(context: &mut Context, mode_state: &mut Self::AppModeState);
}