add main button press handling
This commit is contained in:
parent
c8c42c0194
commit
d815507bcc
2 changed files with 32 additions and 1 deletions
|
|
@ -381,8 +381,15 @@ impl App {
|
|||
#[cfg(feature = "enable_print")]
|
||||
println!("new brightness: {:?}", self.settings.brightness);
|
||||
}
|
||||
pub fn main_button(&mut self) {
|
||||
pub fn main_button_press(&mut self) {
|
||||
// TODO
|
||||
#[cfg(feature = "enable_print")]
|
||||
println!("main button press");
|
||||
}
|
||||
pub fn main_button_release(&mut self) {
|
||||
// TODO
|
||||
#[cfg(feature = "enable_print")]
|
||||
println!("main button release");
|
||||
}
|
||||
pub fn coin_detect(&self) {
|
||||
#[cfg(feature = "enable_print")]
|
||||
|
|
|
|||
|
|
@ -408,6 +408,30 @@ fn app_main(mut p: hal::Peripherals) -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
// main button handling
|
||||
unsafe {
|
||||
#[allow(static_mut_refs)]
|
||||
if INPUT_FLAGS.main_btn_flag.active() {
|
||||
#[cfg(feature = "enable_print")]
|
||||
println!("button flag active");
|
||||
#[allow(static_mut_refs)]
|
||||
INPUT_FLAGS.main_btn_flag.clear();
|
||||
main_btn_input.begin();
|
||||
}
|
||||
}
|
||||
main_btn_input.service();
|
||||
if main_btn_input.ready() {
|
||||
let value = main_btn_input.value();
|
||||
main_btn_input.reset();
|
||||
// #[cfg(feature = "enable_print")]
|
||||
// println!("main button", value);
|
||||
|
||||
match value {
|
||||
true => app.main_button_release(),
|
||||
false => app.main_button_press(),
|
||||
}
|
||||
}
|
||||
|
||||
// systick tick
|
||||
if unsafe {
|
||||
#[allow(static_mut_refs)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue