From a3cfb1dab7679a774d8aa09f7b609f3302dad73d Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 10 Nov 2024 09:10:10 +1100 Subject: Joystick: add support for 8-way hat switch (#24515) --- tmk_core/protocol/usb_descriptor.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tmk_core/protocol/usb_descriptor.c') diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index e7d12a07d9..c7fb660b65 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -247,6 +247,23 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), # endif +# ifdef JOYSTICK_HAS_HAT + // Hat Switch (4 bits) + HID_RI_USAGE(8, 0x39), // Hat Switch + HID_RI_LOGICAL_MINIMUM(8, 0x00), + HID_RI_LOGICAL_MAXIMUM(8, 0x07), + HID_RI_PHYSICAL_MINIMUM(8, 0), + HID_RI_PHYSICAL_MAXIMUM(16, 315), + HID_RI_UNIT(8, 0x14), // Degree, English Rotation + HID_RI_REPORT_COUNT(8, 1), + HID_RI_REPORT_SIZE(8, 4), + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NULLSTATE), + // Padding (4 bits) + HID_RI_REPORT_COUNT(8, 0x04), + HID_RI_REPORT_SIZE(8, 0x01), + HID_RI_INPUT(8, HID_IOF_CONSTANT), +# endif + # if JOYSTICK_BUTTON_COUNT > 0 HID_RI_USAGE_PAGE(8, 0x09), // Button HID_RI_USAGE_MINIMUM(8, 0x01), -- cgit v1.2.3