|
|
@ -9,13 +9,13 @@ |
|
|
|
#include <usb/usb_device.h> |
|
|
|
#include <usb/usb_device.h> |
|
|
|
#include <usb/class/usb_hid.h> |
|
|
|
#include <usb/class/usb_hid.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <dt-bindings/zmk/keys.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <zmk/keys.h> |
|
|
|
#include <zmk/keys.h> |
|
|
|
|
|
|
|
|
|
|
|
#define COLLECTION_REPORT 0x03 |
|
|
|
#define COLLECTION_REPORT 0x03 |
|
|
|
|
|
|
|
|
|
|
|
#define ZMK_HID_MAX_KEYCODE GUI |
|
|
|
#define ZMK_HID_KEYPAD_NKRO_SIZE 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define ZMK_HID_CONSUMER_NKRO_SIZE 6 |
|
|
|
|
|
|
|
|
|
|
|
static const u8_t zmk_hid_report_desc[] = { |
|
|
|
static const u8_t zmk_hid_report_desc[] = { |
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
@ -56,42 +56,44 @@ static const u8_t zmk_hid_report_desc[] = { |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_MI_INPUT, |
|
|
|
0x02, |
|
|
|
0x02, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* USAGE_PAGE (Keypad) */ |
|
|
|
|
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
|
|
|
|
USAGE_GEN_DESKTOP_KEYPAD, |
|
|
|
|
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
|
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
|
|
|
|
0x08, |
|
|
|
|
|
|
|
/* REPORT_COUNT (1) */ |
|
|
|
|
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
|
|
|
|
0x01, |
|
|
|
|
|
|
|
/* INPUT (Cnst,Var,Abs) */ |
|
|
|
|
|
|
|
HID_MI_INPUT, |
|
|
|
|
|
|
|
0x03, |
|
|
|
|
|
|
|
|
|
|
|
/* USAGE_PAGE (Keypad) */ |
|
|
|
/* USAGE_PAGE (Keypad) */ |
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
USAGE_GEN_DESKTOP_KEYPAD, |
|
|
|
USAGE_GEN_DESKTOP_KEYPAD, |
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
0x00, |
|
|
|
0x00, |
|
|
|
/* LOGICAL_MAXIMUM (1) */ |
|
|
|
/* LOGICAL_MAXIMUM (0xFF) */ |
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
0x01, |
|
|
|
0xFF, |
|
|
|
/* USAGE_MINIMUM (Reserved) */ |
|
|
|
/* USAGE_MINIMUM (Reserved) */ |
|
|
|
HID_LI_USAGE_MIN(1), |
|
|
|
HID_LI_USAGE_MIN(1), |
|
|
|
0x00, |
|
|
|
0x00, |
|
|
|
/* USAGE_MAXIMUM (Keyboard Application) */ |
|
|
|
/* USAGE_MAXIMUM (Keyboard Application) */ |
|
|
|
HID_LI_USAGE_MAX(1), |
|
|
|
HID_LI_USAGE_MAX(1), |
|
|
|
ZMK_HID_MAX_KEYCODE, |
|
|
|
0xFF, |
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
/* REPORT_SIZE (1) */ |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
0x01, |
|
|
|
0x08, |
|
|
|
/* REPORT_COUNT (6) */ |
|
|
|
/* REPORT_COUNT (ZMK_HID_KEYPAD_NKRO_SIZE) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
ZMK_HID_MAX_KEYCODE + 1, |
|
|
|
ZMK_HID_KEYPAD_NKRO_SIZE, |
|
|
|
/* INPUT (Data,Ary,Abs) */ |
|
|
|
/* INPUT (Data,Ary,Abs) */ |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_MI_INPUT, |
|
|
|
0x02, |
|
|
|
0x00, |
|
|
|
/* USAGE_PAGE (Keypad) */ |
|
|
|
|
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
|
|
|
|
USAGE_GEN_DESKTOP_KEYPAD, |
|
|
|
|
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
|
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
|
|
|
|
0x02, |
|
|
|
|
|
|
|
/* REPORT_COUNT (6) */ |
|
|
|
|
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
|
|
|
|
0x01, |
|
|
|
|
|
|
|
/* INPUT (Cnst,Var,Abs) */ |
|
|
|
|
|
|
|
HID_MI_INPUT, |
|
|
|
|
|
|
|
0x03, |
|
|
|
|
|
|
|
/* END_COLLECTION */ |
|
|
|
/* END_COLLECTION */ |
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
/* USAGE_PAGE (Consumer) */ |
|
|
|
/* USAGE_PAGE (Consumer) */ |
|
|
@ -124,9 +126,9 @@ static const u8_t zmk_hid_report_desc[] = { |
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
0x08, |
|
|
|
0x08, |
|
|
|
/* REPORT_COUNT (8) */ |
|
|
|
/* REPORT_COUNT (ZMK_HID_CONSUMER_NKRO_SIZE) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
0x06, |
|
|
|
ZMK_HID_CONSUMER_NKRO_SIZE, |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_MI_INPUT, |
|
|
|
0x00, |
|
|
|
0x00, |
|
|
|
/* END COLLECTION */ |
|
|
|
/* END COLLECTION */ |
|
|
@ -142,7 +144,8 @@ static const u8_t zmk_hid_report_desc[] = { |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_hid_keypad_report_body { |
|
|
|
struct zmk_hid_keypad_report_body { |
|
|
|
zmk_mod_flags modifiers; |
|
|
|
zmk_mod_flags modifiers; |
|
|
|
u8_t keys[13]; |
|
|
|
u8_t _reserved; |
|
|
|
|
|
|
|
u8_t keys[ZMK_HID_KEYPAD_NKRO_SIZE]; |
|
|
|
} __packed; |
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_hid_keypad_report { |
|
|
|
struct zmk_hid_keypad_report { |
|
|
@ -151,7 +154,7 @@ struct zmk_hid_keypad_report { |
|
|
|
} __packed; |
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_hid_consumer_report_body { |
|
|
|
struct zmk_hid_consumer_report_body { |
|
|
|
u8_t keys[6]; |
|
|
|
u8_t keys[ZMK_HID_CONSUMER_NKRO_SIZE]; |
|
|
|
} __packed; |
|
|
|
} __packed; |
|
|
|
|
|
|
|
|
|
|
|
struct zmk_hid_consumer_report { |
|
|
|
struct zmk_hid_consumer_report { |
|
|
|