add click, short, and long press handling / detection

This commit is contained in:
sigil-03 2025-11-05 14:26:50 -07:00
parent 2d8e2ce6ee
commit 5aa56a244d
2 changed files with 37 additions and 8 deletions

View file

@ -396,6 +396,19 @@ impl App {
// TODO
#[cfg(feature = "enable_print")]
println!("main button release");
match (
self.timers.sp_timer.is_enabled(),
self.timers.lp_timer.is_enabled(),
) {
// click
(true, true) => self.main_button_click(),
// short press
(false, true) => self.main_button_short_press(),
// long press
(false, false) => self.main_button_long_press(),
// anything else is not possible
_ => {}
}
self.timers.sp_timer.reset();
self.timers.lp_timer.reset();
}
@ -406,6 +419,25 @@ impl App {
}
}
// Events
impl App {
fn main_button_click(&self) {
// TODO
#[cfg(feature = "enable_print")]
println!("click");
}
fn main_button_short_press(&self) {
// TODO
#[cfg(feature = "enable_print")]
println!("short press");
}
fn main_button_long_press(&self) {
// TODO
#[cfg(feature = "enable_print")]
println!("long press");
}
}
// TODO LIST
//
// AUDIO: