refactor(hid): Replace Zephyr usages with ZMK usages in HID reports

Replace `USAGE_GEN_DESKTOP` with `HID_USAGE_GD`.

Replace `USAGE_GEN_DESKTOP_KEYBOARD` with `HID_USAGE_GD_KEYBOARD`.

Replace `USAGE_GEN_DESKTOP_KEYPAD` with `HID_USAGE_KEY`.

Replace `0x0C` with `HID_USAGE_CONSUMER`.

Closes #217.
This commit is contained in:
innovaker 2020-11-03 16:55:34 +00:00 committed by Pete Johanson
parent e925319e4c
commit 711658206f

View file

@ -10,6 +10,8 @@
#include <usb/class/usb_hid.h> #include <usb/class/usb_hid.h>
#include <zmk/keys.h> #include <zmk/keys.h>
#include <dt-bindings/zmk/hid_usage.h>
#include <dt-bindings/zmk/hid_usage_pages.h>
#define COLLECTION_REPORT 0x03 #define COLLECTION_REPORT 0x03
@ -20,19 +22,19 @@
static const u8_t zmk_hid_report_desc[] = { static const u8_t zmk_hid_report_desc[] = {
/* USAGE_PAGE (Generic Desktop) */ /* USAGE_PAGE (Generic Desktop) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
USAGE_GEN_DESKTOP, HID_USAGE_GD,
/* USAGE (Keyboard) */ /* USAGE (Keyboard) */
HID_LI_USAGE, HID_LI_USAGE,
USAGE_GEN_DESKTOP_KEYBOARD, HID_USAGE_GD_KEYBOARD,
/* COLLECTION (Application) */ /* COLLECTION (Application) */
HID_MI_COLLECTION, HID_MI_COLLECTION,
COLLECTION_APPLICATION, COLLECTION_APPLICATION,
/* REPORT ID (1) */ /* REPORT ID (1) */
HID_GI_REPORT_ID, HID_GI_REPORT_ID,
0x01, 0x01,
/* USAGE_PAGE (Keypad) */ /* USAGE_PAGE (Keyboard/Keypad) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
USAGE_GEN_DESKTOP_KEYPAD, HID_USAGE_KEY,
/* USAGE_MINIMUM (Keyboard LeftControl) */ /* USAGE_MINIMUM (Keyboard LeftControl) */
HID_LI_USAGE_MIN(1), HID_LI_USAGE_MIN(1),
0xE0, 0xE0,
@ -56,9 +58,9 @@ static const u8_t zmk_hid_report_desc[] = {
HID_MI_INPUT, HID_MI_INPUT,
0x02, 0x02,
/* USAGE_PAGE (Keypad) */ /* USAGE_PAGE (Keyboard/Keypad) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
USAGE_GEN_DESKTOP_KEYPAD, HID_USAGE_KEY,
/* REPORT_SIZE (8) */ /* REPORT_SIZE (8) */
HID_GI_REPORT_SIZE, HID_GI_REPORT_SIZE,
0x08, 0x08,
@ -69,9 +71,9 @@ static const u8_t zmk_hid_report_desc[] = {
HID_MI_INPUT, HID_MI_INPUT,
0x03, 0x03,
/* USAGE_PAGE (Keypad) */ /* USAGE_PAGE (Keyboard/Keypad) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
USAGE_GEN_DESKTOP_KEYPAD, HID_USAGE_KEY,
/* LOGICAL_MINIMUM (0) */ /* LOGICAL_MINIMUM (0) */
HID_GI_LOGICAL_MIN(1), HID_GI_LOGICAL_MIN(1),
0x00, 0x00,
@ -98,7 +100,7 @@ static const u8_t zmk_hid_report_desc[] = {
HID_MI_COLLECTION_END, HID_MI_COLLECTION_END,
/* USAGE_PAGE (Consumer) */ /* USAGE_PAGE (Consumer) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
0x0C, HID_USAGE_CONSUMER,
/* USAGE (Consumer Control) */ /* USAGE (Consumer Control) */
HID_LI_USAGE, HID_LI_USAGE,
0x01, 0x01,
@ -110,7 +112,7 @@ static const u8_t zmk_hid_report_desc[] = {
0x02, 0x02,
/* USAGE_PAGE (Consumer) */ /* USAGE_PAGE (Consumer) */
HID_GI_USAGE_PAGE, HID_GI_USAGE_PAGE,
0x0C, HID_USAGE_CONSUMER,
/* LOGICAL_MINIMUM (0) */ /* LOGICAL_MINIMUM (0) */
HID_GI_LOGICAL_MIN(1), HID_GI_LOGICAL_MIN(1),
0x00, 0x00,