diff --git a/boards/rp2040/src/main.rs b/boards/rp2040/src/main.rs index 38bae7c6..b5dec41d 100644 --- a/boards/rp2040/src/main.rs +++ b/boards/rp2040/src/main.rs @@ -143,15 +143,19 @@ mod app { info!("Start matrix scanning"); loop { cx.local.keyboard.keyboard_task().await.unwrap(); - cx.shared.usb_device.lock(|d| { - cx.local.keyboard.send_report(d); + cx.shared.usb_device.lock(|usb_device| { + // Send keyboard report + cx.local.keyboard.send_report(usb_device); + + // Process via report + cx.local.keyboard.process_via_report(usb_device); }); // Blink LED let _ = cx.local.led.toggle(); - // Scanning frequency: 1KHZ - Systick::delay(1.millis()).await; + // Scanning frequency: 10KHZ + Systick::delay(100.micros()).await; } } diff --git a/boards/stm32h7/src/main.rs b/boards/stm32h7/src/main.rs index d70d86e5..43af1cde 100644 --- a/boards/stm32h7/src/main.rs +++ b/boards/stm32h7/src/main.rs @@ -151,14 +151,14 @@ mod app { info!("Start matrix scanning"); loop { cx.local.keyboard.keyboard_task().await.unwrap(); - cx.shared.usb_device.lock(|d| { - cx.local.keyboard.send_report(d); - // Read via report - // TODO: move it to another thread? - cx.local.keyboard.read_report(d); + cx.shared.usb_device.lock(|usb_device| { + // Send keyboard report + cx.local.keyboard.send_report(usb_device); + // Process via report + cx.local.keyboard.process_via_report(usb_device); }); - // Scanning frequency: 1KHZ - Systick::delay(1.millis()).await; + // Scanning frequency: 10KHZ + Systick::delay(100.micros()).await; } } diff --git a/rmk/src/keyboard.rs b/rmk/src/keyboard.rs index 3e25cdbd..a57c41e0 100644 --- a/rmk/src/keyboard.rs +++ b/rmk/src/keyboard.rs @@ -191,7 +191,7 @@ impl< } /// Read hid report. - pub fn read_report(&mut self, usb_device: &mut KeyboardUsbDevice<'_, B>) { + pub fn process_via_report(&mut self, usb_device: &mut KeyboardUsbDevice<'_, B>) { if usb_device.read_via_report(&mut self.via_report) > 0 { process_via_packet(&mut self.via_report, &mut self.keymap, &mut self.eeprom);