|
|
|
@ -13,11 +13,9 @@
@@ -13,11 +13,9 @@
|
|
|
|
|
#include <dt-bindings/zmk/hid_usage.h> |
|
|
|
|
#include <dt-bindings/zmk/hid_usage_pages.h> |
|
|
|
|
|
|
|
|
|
#define COLLECTION_REPORT 0x03 |
|
|
|
|
|
|
|
|
|
#define ZMK_HID_KEYBOARD_NKRO_SIZE 6 |
|
|
|
|
#define ZMK_HID_KEYBOARD_NKRO_MAX_USAGE HID_USAGE_KEY_KEYPAD_EQUAL |
|
|
|
|
|
|
|
|
|
#define ZMK_HID_CONSUMER_NKRO_SIZE 6 |
|
|
|
|
#define COLLECTION_REPORT 0x03 |
|
|
|
|
|
|
|
|
|
static const uint8_t zmk_hid_report_desc[] = { |
|
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
@ -74,6 +72,30 @@ static const uint8_t zmk_hid_report_desc[] = {
@@ -74,6 +72,30 @@ static const uint8_t zmk_hid_report_desc[] = {
|
|
|
|
|
/* USAGE_PAGE (Keyboard/Keypad) */ |
|
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
|
HID_USAGE_KEY, |
|
|
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_NKRO) |
|
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
|
0x00, |
|
|
|
|
/* LOGICAL_MAXIMUM (1) */ |
|
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
|
0x01, |
|
|
|
|
/* USAGE_MINIMUM (Reserved) */ |
|
|
|
|
HID_LI_USAGE_MIN(1), |
|
|
|
|
0x00, |
|
|
|
|
/* USAGE_MAXIMUM (Keyboard Application) */ |
|
|
|
|
HID_LI_USAGE_MAX(1), |
|
|
|
|
ZMK_HID_KEYBOARD_NKRO_MAX_USAGE, |
|
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
|
0x01, |
|
|
|
|
/* REPORT_COUNT (6) */ |
|
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
|
ZMK_HID_KEYBOARD_NKRO_MAX_USAGE + 1, |
|
|
|
|
/* INPUT (Data,Ary,Abs) */ |
|
|
|
|
HID_MI_INPUT, |
|
|
|
|
0x02, |
|
|
|
|
#elif IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_HKRO) |
|
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
|
0x00, |
|
|
|
@ -89,12 +111,15 @@ static const uint8_t zmk_hid_report_desc[] = {
@@ -89,12 +111,15 @@ static const uint8_t zmk_hid_report_desc[] = {
|
|
|
|
|
/* REPORT_SIZE (1) */ |
|
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
|
0x08, |
|
|
|
|
/* REPORT_COUNT (ZMK_HID_KEYBOARD_NKRO_SIZE) */ |
|
|
|
|
/* REPORT_COUNT (CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE) */ |
|
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
|
ZMK_HID_KEYBOARD_NKRO_SIZE, |
|
|
|
|
CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE, |
|
|
|
|
/* INPUT (Data,Ary,Abs) */ |
|
|
|
|
HID_MI_INPUT, |
|
|
|
|
0x00, |
|
|
|
|
#else |
|
|
|
|
#error "A proper HID report type must be selected" |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* END_COLLECTION */ |
|
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
@ -130,9 +155,9 @@ static const uint8_t zmk_hid_report_desc[] = {
@@ -130,9 +155,9 @@ static const uint8_t zmk_hid_report_desc[] = {
|
|
|
|
|
/* REPORT_SIZE (16) */ |
|
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
|
0x10, |
|
|
|
|
/* REPORT_COUNT (ZMK_HID_CONSUMER_NKRO_SIZE) */ |
|
|
|
|
/* REPORT_COUNT (CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE) */ |
|
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
|
ZMK_HID_CONSUMER_NKRO_SIZE, |
|
|
|
|
CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE, |
|
|
|
|
HID_MI_INPUT, |
|
|
|
|
0x00, |
|
|
|
|
/* END COLLECTION */ |
|
|
|
@ -149,7 +174,11 @@ static const uint8_t zmk_hid_report_desc[] = {
@@ -149,7 +174,11 @@ static const uint8_t zmk_hid_report_desc[] = {
|
|
|
|
|
struct zmk_hid_keyboard_report_body { |
|
|
|
|
zmk_mod_flags_t modifiers; |
|
|
|
|
uint8_t _reserved; |
|
|
|
|
uint8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE]; |
|
|
|
|
#if IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_NKRO) |
|
|
|
|
uint8_t keys[(ZMK_HID_KEYBOARD_NKRO_MAX_USAGE + 1) / 8]; |
|
|
|
|
#elif IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_HKRO) |
|
|
|
|
uint8_t keys[CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE]; |
|
|
|
|
#endif |
|
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
struct zmk_hid_keyboard_report { |
|
|
|
@ -158,7 +187,7 @@ struct zmk_hid_keyboard_report {
@@ -158,7 +187,7 @@ struct zmk_hid_keyboard_report {
|
|
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
struct zmk_hid_consumer_report_body { |
|
|
|
|
uint16_t keys[ZMK_HID_CONSUMER_NKRO_SIZE]; |
|
|
|
|
uint16_t keys[CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE]; |
|
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
struct zmk_hid_consumer_report { |
|
|
|
|