refactor(hid): Use proper defines for HID values.

* Add report ID defines and use them consistently.
* Add defines for main item value flags to avoid magic constants.
This commit is contained in:
Peter Johanson
2023-11-08 22:05:53 +00:00
committed by Pete Johanson
parent 34c8b3f1e3
commit c2d220fbdf
3 changed files with 43 additions and 17 deletions

View File

@@ -12,9 +12,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <dt-bindings/zmk/modifiers.h>
static struct zmk_hid_keyboard_report keyboard_report = {
.report_id = 1, .body = {.modifiers = 0, ._reserved = 0, .keys = {0}}};
.report_id = ZMK_HID_REPORT_ID_KEYBOARD, .body = {.modifiers = 0, ._reserved = 0, .keys = {0}}};
static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body = {.keys = {0}}};
static struct zmk_hid_consumer_report consumer_report = {.report_id = ZMK_HID_REPORT_ID_CONSUMER,
.body = {.keys = {0}}};
// Keep track of how often a modifier was pressed.
// Only release the modifier if the count is 0.

View File

@@ -47,12 +47,12 @@ enum {
};
static struct hids_report input = {
.id = 0x01,
.id = ZMK_HID_REPORT_ID_KEYBOARD,
.type = HIDS_INPUT,
};
static struct hids_report consumer_input = {
.id = 0x02,
.id = ZMK_HID_REPORT_ID_CONSUMER,
.type = HIDS_INPUT,
};