simple button debounce
This commit is contained in:
@@ -3,6 +3,9 @@ use crate::{display::primary_lcd::PrimaryLcdDisplay, navigation::inputs::Inputs}
|
||||
|
||||
use embassy_futures::select::Either6;
|
||||
use embassy_futures::select::select6;
|
||||
use embassy_time::{Duration, Timer};
|
||||
|
||||
const DEBOUNCE_DURATION_MILLIS: u64 = 100;
|
||||
|
||||
#[embassy_executor::task]
|
||||
pub async fn run(mut inputs: Inputs, display: &'static mut PrimaryLcdDisplay<'static>) {
|
||||
@@ -51,6 +54,8 @@ pub async fn run(mut inputs: Inputs, display: &'static mut PrimaryLcdDisplay<'st
|
||||
|
||||
state.selected = value;
|
||||
|
||||
state.display(display).await
|
||||
state.display(display).await;
|
||||
|
||||
Timer::after(Duration::from_millis(DEBOUNCE_DURATION_MILLIS)).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user