Skip to content

Commit c8401c3

Browse files
committed
inputs: don't overwrite buttons in every iteration of the loop
1 parent 0b8ed37 commit c8401c3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use rp_pico::{self as bsp, hal::gpio::SioInput};
2121

2222
use bsp::hal::{
2323
self,
24+
Sio,
2425
clocks::init_clocks_and_plls,
2526
pac::{self},
2627
// prelude::*,
2728
watchdog::Watchdog,
28-
Sio,
2929
};
3030
use embedded_hal::digital::InputPin;
3131

@@ -214,11 +214,11 @@ fn main() -> ! {
214214
}
215215
if index < 2 {
216216
// Actual buttons
217-
report.buttons = 1 << index;
217+
report.buttons |= 1 << index;
218218
} else if index < 2 + 4 {
219-
report.buttons = 1 << (index + 2);
219+
report.buttons |= 1 << (index + 2);
220220
} else if index < 2 + 4 + 1 {
221-
report.misc_buttons = 1 << 4;
221+
report.misc_buttons |= 1 << 4;
222222
} else if index < 2 + 4 + 1 + 4 {
223223
// Joysticks
224224
let value = if index & 1 == 1 { i16::MAX } else { i16::MIN };

0 commit comments

Comments
 (0)