add settings struct

This commit is contained in:
sigil-03 2025-10-26 13:31:18 -06:00
parent 3eb410c796
commit 73e4b482a6

View file

@ -24,6 +24,42 @@ use hal::println;
use qingke::riscv; use qingke::riscv;
enum Level {
Off,
Low,
Medium,
High,
Maximum,
}
impl Level {
pub fn next(&mut self) {
*self = match self {
Self::Off => Self::Low,
Self::Low => Self::Medium,
Self::Medium => Self::High,
Self::High => Self::Maximum,
Self::Maximum => Self::Off,
};
}
}
struct Settings {
brightness: Level,
volume: Level,
button_sound_index: u8,
}
impl Default for Settings {
fn default() -> Self {
Self {
brightness: Level::Medium,
volume: Level::Medium,
button_sound_index: 0,
}
}
}
struct DebouncedGPIO<'a> { struct DebouncedGPIO<'a> {
input: Input<'a>, input: Input<'a>,
// value of the GPIO // value of the GPIO