Fix row 9 issue
Signed-off-by: fly <merspieler@alwaysdata.net>
This commit is contained in:
parent
4ad1ae2799
commit
cddcaef9cf
1 changed files with 16 additions and 3 deletions
|
@ -105,7 +105,7 @@ fn main() -> ! {
|
|||
.freeze(&mut flash.acr);
|
||||
|
||||
let mut afio = p.AFIO.constrain();
|
||||
let (pa15, pb3, pb4) = afio.mapr.disable_jtag(gpioa.pa15, gpiob.pb3, gpiob.pb4); // To allow us to use pa15 and pb4
|
||||
let (pa15, _pb3, pb4) = afio.mapr.disable_jtag(gpioa.pa15, gpiob.pb3, gpiob.pb4); // To allow us to use pa15 and pb4
|
||||
|
||||
// ====================== USB setup =================
|
||||
assert!(clocks.usbclk_valid());
|
||||
|
@ -226,11 +226,24 @@ fn main() -> ! {
|
|||
if io_pins.pb13.is_high() { buttons_read += 0x20; }
|
||||
if io_pins.pb14.is_high() { buttons_read += 0x40; }
|
||||
if io_pins.pc9.is_high() { buttons_read += 0x80; }
|
||||
// if io_pins.pa8.is_high() { buttons_read += 0x100; }
|
||||
|
||||
buttons1 = buttons1 & (0xFFFFFFFFFFFFFFFF - (0xFF << (col_select * 8)));
|
||||
buttons1 += buttons_read << (col_select * 8);
|
||||
|
||||
// Treat row 9 special so it fits into the 64 bit block
|
||||
if col_select == 1 {
|
||||
if io_pins.pa8.is_high() { buttons2 = (buttons2 & 0xFFFFEFFF) + 0x1000; }
|
||||
else { buttons2 = buttons2 & 0xFFFFEFFF; }
|
||||
}
|
||||
if col_select == 2 {
|
||||
if io_pins.pa8.is_high() { buttons2 = (buttons2 & 0xFFFFDFFF) + 0x2000; }
|
||||
else { buttons2 = buttons2 & 0xFFFFDFFF; }
|
||||
}
|
||||
if col_select == 3 {
|
||||
if io_pins.pa8.is_high() { buttons2 = (buttons2 & 0xFFFFBFFF) + 0x4000; }
|
||||
else { buttons2 = buttons2 & 0xFFFFBFFF; }
|
||||
}
|
||||
|
||||
let report = CustomInputReport {
|
||||
report_id: 1,
|
||||
buttons1,
|
||||
|
@ -244,7 +257,7 @@ fn main() -> ! {
|
|||
io_pins.pb6.set_high();
|
||||
io_pins.pb7.set_low();
|
||||
}
|
||||
else if lsk_col_select == 1 {
|
||||
else {
|
||||
io_pins.pc15.set_low();
|
||||
io_pins.pa5.set_high();
|
||||
io_pins.pb6.set_low();
|
||||
|
|
Loading…
Reference in a new issue