feat(mouse): Initial mouse keys support.

* Add HID report/descriptor for a new report with mouse buttons,
  and x/y/wheel deltas.
* New mouse key press behavior for press/release of mouse keys.
* Add constants for HID main item values (e.g. data/array/absolute)
* Define and use constants for our HID report IDs.
This commit is contained in:
Alexander Krikun
2021-04-27 18:24:11 +03:00
committed by Pete Johanson
parent 8776911da5
commit d7d9eed317
27 changed files with 618 additions and 1 deletions

View File

@@ -129,6 +129,19 @@ int zmk_usb_hid_send_consumer_report() {
return zmk_usb_hid_send_report((uint8_t *)report, sizeof(*report));
}
#if IS_ENABLED(CONFIG_ZMK_MOUSE)
int zmk_usb_hid_send_mouse_report() {
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
if (hid_protocol == HID_PROTOCOL_BOOT) {
return -ENOTSUP;
}
#endif /* IS_ENABLED(CONFIG_ZMK_USB_BOOT) */
struct zmk_hid_mouse_report *report = zmk_hid_get_mouse_report();
return zmk_usb_hid_send_report((uint8_t *)report, sizeof(*report));
}
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)
static int zmk_usb_hid_init(const struct device *_arg) {
hid_dev = device_get_binding("HID_0");
if (hid_dev == NULL) {