Fixed issue with missing buttons in RMP firmware

Signed-off-by: fly <merspieler@alwaysdata.net>
This commit is contained in:
fly 2025-01-28 22:31:54 +01:00
parent 1fda29dcc8
commit a17c66ad12

View file

@ -219,9 +219,9 @@ fn main() -> ! {
values[11] = adc1.read(&mut io_pins.pc3).unwrap();
// Buttons
let mut buttons: u16 = 0;
if io_pins.pb2.is_low() { buttons += 0x1; }
if io_pins.pb13.is_low() { buttons += 0x2; }
let mut buttons: u32 = 0;
if io_pins.pb2.is_low() { buttons += 0x10000000; }
if io_pins.pb13.is_low() { buttons += 0x20000000; }
// Transmission Keyboard matrix
let mut transmission_buttons_read: u16 = 0;
@ -255,8 +255,8 @@ fn main() -> ! {
if io_pins.pb12.is_high() { select_buttons_read += 0x10; }
if io_pins.pb11.is_high() { select_buttons_read += 0x20; }
select_buttons = select_buttons & (0xFFFF - (0x3F << (col_select * 4)));
select_buttons += select_buttons_read << (col_select * 4);
select_buttons = select_buttons & (0xFFFFFFFF - (0x3F << (col_select * 6)));
select_buttons += select_buttons_read << (col_select * 6);
// Pull the next columns high for next time coming through in the main loop ~1ms
if col_select == 0 {
@ -300,8 +300,7 @@ fn main() -> ! {
axis: values,
transmission_buttons,
numpad_buttons,
select_buttons,
// buttons,
select_buttons: select_buttons + buttons,
};
match consumer.device().write_report(&report) {
Err(UsbHidError::WouldBlock) => {}