add basic volume control
This commit is contained in:
parent
d3ccc70782
commit
95b55f88a8
2 changed files with 64 additions and 20 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue