|
|
@ -27,51 +27,53 @@ THE SOFTWARE.
|
|
|
|
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
|
|
|
|
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
|
|
|
|
|
|
|
|
|
|
|
|
static const uint8_t gamepad_hid_descriptor_[] PROGMEM = {
|
|
|
|
static const uint8_t gamepad_hid_descriptor_[] PROGMEM = {
|
|
|
|
/* Gamepad with 32 buttons and 6 axis*/
|
|
|
|
// clang-format off
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */
|
|
|
|
// Gamepad with 32 buttons and 6 axis
|
|
|
|
D_USAGE, D_USAGE_JOYSTICK, /* USAGE (Joystick) */
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
|
|
|
|
D_COLLECTION, D_APPLICATION, /* COLLECTION (Application) */
|
|
|
|
D_USAGE, D_USAGE_JOYSTICK, // USAGE (Joystick)
|
|
|
|
D_REPORT_ID, HID_REPORTID_GAMEPAD, /* REPORT_ID */
|
|
|
|
D_COLLECTION, D_APPLICATION, // COLLECTION (Application)
|
|
|
|
/* 32 Buttons */
|
|
|
|
D_REPORT_ID, HID_REPORTID_GAMEPAD, // REPORT_ID
|
|
|
|
D_USAGE_PAGE, D_PAGE_BUTTON, /* USAGE_PAGE (Button) */
|
|
|
|
// 32 Buttons
|
|
|
|
D_USAGE_MINIMUM, 0x01, /* USAGE_MINIMUM (Button 1) */
|
|
|
|
D_USAGE_PAGE, D_PAGE_BUTTON, // USAGE_PAGE (Button)
|
|
|
|
D_USAGE_MAXIMUM, 0x20, /* USAGE_MAXIMUM (Button 32) */
|
|
|
|
D_USAGE_MINIMUM, 0x01, // USAGE_MINIMUM (Button 1)
|
|
|
|
D_LOGICAL_MINIMUM, 0x00, /* LOGICAL_MINIMUM (0) */
|
|
|
|
D_USAGE_MAXIMUM, 0x20, // USAGE_MAXIMUM (Button 32)
|
|
|
|
D_LOGICAL_MAXIMUM, 0x01, /* LOGICAL_MAXIMUM (1) */
|
|
|
|
D_LOGICAL_MINIMUM, 0x00, // LOGICAL_MINIMUM (0)
|
|
|
|
D_REPORT_SIZE, 0x01, /* REPORT_SIZE (1) */
|
|
|
|
D_LOGICAL_MAXIMUM, 0x01, // LOGICAL_MAXIMUM (1)
|
|
|
|
D_REPORT_COUNT, 0x20, /* REPORT_COUNT (32) */
|
|
|
|
D_REPORT_SIZE, 0x01, // REPORT_SIZE (1)
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), /* INPUT (Data,Var,Abs) */
|
|
|
|
D_REPORT_COUNT, 0x20, // REPORT_COUNT (32)
|
|
|
|
/* 4 16bit Axis */
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs)
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */
|
|
|
|
// 4 16bit Axis
|
|
|
|
D_COLLECTION, D_PHYSICAL, /* COLLECTION (Physical) */
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
|
|
|
|
D_USAGE, 0x30, /* USAGE (X) */
|
|
|
|
D_COLLECTION, D_PHYSICAL, // COLLECTION (Physical)
|
|
|
|
D_USAGE, 0x31, /* USAGE (Y) */
|
|
|
|
D_USAGE, 0x30, // USAGE (X)
|
|
|
|
D_USAGE, 0x33, /* USAGE (Rx) */
|
|
|
|
D_USAGE, 0x31, // USAGE (Y)
|
|
|
|
D_USAGE, 0x34, /* USAGE (Ry) */
|
|
|
|
D_USAGE, 0x33, // USAGE (Rx)
|
|
|
|
D_MULTIBYTE(D_LOGICAL_MINIMUM), 0x00, 0x80, /* LOGICAL_MINIMUM (-32768) */
|
|
|
|
D_USAGE, 0x34, // USAGE (Ry)
|
|
|
|
D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xFF, 0x7F, /* LOGICAL_MAXIMUM (32767) */
|
|
|
|
D_MULTIBYTE(D_LOGICAL_MINIMUM), 0x00, 0x80, // LOGICAL_MINIMUM (-32768)
|
|
|
|
D_REPORT_SIZE, 0x10, /* REPORT_SIZE (16) */
|
|
|
|
D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xFF, 0x7F, // LOGICAL_MAXIMUM (32767)
|
|
|
|
D_REPORT_COUNT, 0x04, /* REPORT_COUNT (4) */
|
|
|
|
D_REPORT_SIZE, 0x10, // REPORT_SIZE (16)
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), /* INPUT (Data,Var,Abs) */
|
|
|
|
D_REPORT_COUNT, 0x04, // REPORT_COUNT (4)
|
|
|
|
/* 2 8bit Axis */
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs)
|
|
|
|
D_USAGE, 0x32, /* USAGE (Z) */
|
|
|
|
// 2 8bit Axis
|
|
|
|
D_USAGE, 0x35, /* USAGE (Rz) */
|
|
|
|
D_USAGE, 0x32, // USAGE (Z)
|
|
|
|
D_LOGICAL_MINIMUM, 0x80, /* LOGICAL_MINIMUM (-128) */
|
|
|
|
D_USAGE, 0x35, // USAGE (Rz)
|
|
|
|
D_LOGICAL_MAXIMUM, 0x7F, /* LOGICAL_MAXIMUM (127) */
|
|
|
|
D_LOGICAL_MINIMUM, 0x80, // LOGICAL_MINIMUM (-128)
|
|
|
|
D_REPORT_SIZE, 0x08, /* REPORT_SIZE (8) */
|
|
|
|
D_LOGICAL_MAXIMUM, 0x7F, // LOGICAL_MAXIMUM (127)
|
|
|
|
D_REPORT_COUNT, 0x02, /* REPORT_COUNT (2) */
|
|
|
|
D_REPORT_SIZE, 0x08, // REPORT_SIZE (8)
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), /* INPUT (Data,Var,Abs) */
|
|
|
|
D_REPORT_COUNT, 0x02, // REPORT_COUNT (2)
|
|
|
|
D_END_COLLECTION, /* END_COLLECTION */
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs)
|
|
|
|
/* 2 Hat Switches */
|
|
|
|
D_END_COLLECTION, // END_COLLECTION
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */
|
|
|
|
// 2 Hat Switches
|
|
|
|
D_USAGE, 0x39, /* USAGE (Hat switch) */
|
|
|
|
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
|
|
|
|
D_USAGE, 0x39, /* USAGE (Hat switch) */
|
|
|
|
D_USAGE, 0x39, // USAGE (Hat switch)
|
|
|
|
D_LOGICAL_MINIMUM, 0x01, /* LOGICAL_MINIMUM (1) */
|
|
|
|
D_USAGE, 0x39, // USAGE (Hat switch)
|
|
|
|
D_LOGICAL_MAXIMUM, 0x08, /* LOGICAL_MAXIMUM (8) */
|
|
|
|
D_LOGICAL_MINIMUM, 0x01, // LOGICAL_MINIMUM (1)
|
|
|
|
D_REPORT_COUNT, 0x02, /* REPORT_COUNT (2) */
|
|
|
|
D_LOGICAL_MAXIMUM, 0x08, // LOGICAL_MAXIMUM (8)
|
|
|
|
D_REPORT_SIZE, 0x04, /* REPORT_SIZE (4) */
|
|
|
|
D_REPORT_COUNT, 0x02, // REPORT_COUNT (2)
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), /* INPUT (Data,Var,Abs) */
|
|
|
|
D_REPORT_SIZE, 0x04, // REPORT_SIZE (4)
|
|
|
|
D_END_COLLECTION /* END_COLLECTION */
|
|
|
|
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs)
|
|
|
|
|
|
|
|
D_END_COLLECTION // END_COLLECTION
|
|
|
|
|
|
|
|
// clang-format on
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Gamepad_::Gamepad_() {
|
|
|
|
Gamepad_::Gamepad_() {
|
|
|
|