aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/vusb/vusb.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-11-10 09:10:10 +1100
committerGitHub <noreply@github.com>2024-11-09 14:10:10 -0800
commita3cfb1dab7679a774d8aa09f7b609f3302dad73d (patch)
tree315e8c7a35ae390b56f84def0d37b867bfa428c7 /tmk_core/protocol/vusb/vusb.c
parent69093f6de9b551bd84ff0a8eabcccca73026d55e (diff)
Joystick: add support for 8-way hat switch (#24515)
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.c')
-rw-r--r--tmk_core/protocol/vusb/vusb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 2a29fe65d9..fdbfcc17dc 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -621,6 +621,23 @@ const PROGMEM uchar shared_hid_report[] = {
0x81, 0x02, // Input (Data, Variable, Absolute)
# endif
+# ifdef JOYSTICK_HAS_HAT
+ // Hat Switch (4 bits)
+ 0x09, 0x39, // Usage (Hat Switch)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x07, // Logical Maximum (7)
+ 0x35, 0x00, // Physical Minimum (0)
+ 0x46, 0x3B, 0x01, // Physical Maximum (315)
+ 0x65, 0x14, // Unit (Degree, English Rotation)
+ 0x95, 0x01, // Report Count (1)
+ 0x75, 0x04, // Report Size (4)
+ 0x81, 0x42, // Input (Data, Variable, Absolute, Null State)
+ // Padding (4 bits)
+ 0x95, 0x04, // Report Count (4)
+ 0x75, 0x01, // Report Size (1)
+ 0x81, 0x01, // Input (Constant)
+# endif
+
# if JOYSTICK_BUTTON_COUNT > 0
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (Button 1)