add basic volume control

This commit is contained in:
sigil-03 2025-11-05 10:06:41 -07:00
parent d3ccc70782
commit 95b55f88a8
2 changed files with 64 additions and 20 deletions

View file

@ -329,6 +329,25 @@ fn app_main(mut p: hal::Peripherals) -> ! {
app.init();
loop {
// system servicing
//
// edge detector
if !volume_btn_input.active() {
let volume_btn_curr = volume_btn_input.is_high_immediate();
if volume_btn_prev != volume_btn_curr {
volume_btn_input.begin();
volume_btn_prev = volume_btn_curr;
}
}
volume_btn_input.service();
if volume_btn_input.ready() {
#[cfg(feature = "enable_print")]
println!("volume btn value: {}", volume_btn_input.value());
if !volume_btn_input.value() {
app.volume_button();
}
volume_btn_input.reset();
}
// systick tick
if unsafe {
@ -347,17 +366,6 @@ fn app_main(mut p: hal::Peripherals) -> ! {
// interfaces.service();
}
// // edge detector
// if !volume_btn_input.active() {
// let volume_btn_curr = volume_btn_input.is_high_immediate();
// if volume_btn_prev != volume_btn_curr {
// volume_btn_prev = volume_btn_curr;
// unsafe {
// INPUT_FLAGS.volume_btn_flag = true;
// }
// }
// }
// if !light_ctrl_btn_input.active() {
// let light_ctrl_btn_curr = light_ctrl_btn_input.is_high_immediate();
// if light_ctrl_btn_prev != light_ctrl_btn_curr {