feat(usb): Add boot protocol support

* USB boot protocol support
* Use a single definition of a boot report, used for regular reports in
  non-6KRO, and for rollover in all branches.
* Handle gaps in the zmk report when producing a boot report in HKRO mode. For
  .example, if it was 8KRO, it would be possible to have the state 0 0 0 0 0 0 0
  17 (by pressing 8 keys, and letting go of the first 7). Copying the first 6
  bytes would not show up the single pressed key.
* Disable usb status change and callback on SOF events:
  SOF events were introduced by the boot protocol changes, and required internally
  by Zephyr's idle support, but are unused within ZMK itself. Ignore them in the
  usb status callback.

---------

Co-authored-by: Andrew Childs <lorne@cons.org.nz>
This commit is contained in:
Chris Andreae
2023-11-14 03:04:04 +09:00
committed by GitHub
parent b80c0be0ce
commit 91aa3378f3
7 changed files with 229 additions and 15 deletions

View File

@@ -6,4 +6,8 @@
#pragma once
int zmk_usb_hid_send_report(const uint8_t *report, size_t len);
#include <stdint.h>
int zmk_usb_hid_send_keyboard_report();
int zmk_usb_hid_send_consumer_report();
void zmk_usb_hid_set_protocol(uint8_t protocol);