Guard USB HID descriptor definitions against clang-format

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
f/driver/keyboardiohid
Michael Richters 3 years ago
parent 29da47a155
commit eb94f08c35
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -29,6 +29,7 @@ THE SOFTWARE.
// See Appendix B of USB HID spec // See Appendix B of USB HID spec
static const uint8_t boot_keyboard_hid_descriptor_[] PROGMEM = { static const uint8_t boot_keyboard_hid_descriptor_[] PROGMEM = {
// clang-format off
// Keyboard // Keyboard
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP,
D_USAGE, D_USAGE_KEYBOARD, D_USAGE, D_USAGE_KEYBOARD,
@ -71,6 +72,7 @@ static const uint8_t boot_keyboard_hid_descriptor_[] PROGMEM = {
D_USAGE_MAXIMUM, 0xff, D_USAGE_MAXIMUM, 0xff,
D_INPUT, (D_DATA | D_ARRAY | D_ABSOLUTE), D_INPUT, (D_DATA | D_ARRAY | D_ABSOLUTE),
D_END_COLLECTION D_END_COLLECTION
// clang-format off
}; };
#ifdef ARCH_HAS_CONFIGURABLE_EP_SIZES #ifdef ARCH_HAS_CONFIGURABLE_EP_SIZES

@ -32,6 +32,7 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/MouseButtons.h" #include "kaleidoscope/driver/hid/keyboardio/usb/MouseButtons.h"
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
// clang-format off
#define DESCRIPTOR_ABS_MOUSE_BUTTONS \ #define DESCRIPTOR_ABS_MOUSE_BUTTONS \
/* 8 Buttons */ \ /* 8 Buttons */ \
@ -64,6 +65,8 @@ THE SOFTWARE.
D_REPORT_COUNT, 0x01, /* REPORT_COUNT (1) */ \ D_REPORT_COUNT, 0x01, /* REPORT_COUNT (1) */ \
D_INPUT, (D_DATA|D_VARIABLE|D_RELATIVE), D_INPUT, (D_DATA|D_VARIABLE|D_RELATIVE),
// clang-format on
#pragma pack(push, 1) #pragma pack(push, 1)
typedef union { typedef union {
// Absolute mouse report: 8 buttons, 2 absolute axis, wheel // Absolute mouse report: 8 buttons, 2 absolute axis, wheel

@ -86,6 +86,7 @@ void USB_PackMessages(bool pack);
#include <PluggableUSB.h> #include <PluggableUSB.h>
// clang-format off
#define EPTYPE_DESCRIPTOR_SIZE uint32_t #define EPTYPE_DESCRIPTOR_SIZE uint32_t
#define EP_TYPE_INTERRUPT_IN (UOTGHS_DEVEPTCFG_EPSIZE_512_BYTE | \ #define EP_TYPE_INTERRUPT_IN (UOTGHS_DEVEPTCFG_EPSIZE_512_BYTE | \
UOTGHS_DEVEPTCFG_EPDIR_IN | \ UOTGHS_DEVEPTCFG_EPDIR_IN | \
@ -104,6 +105,7 @@ void USB_PackMessages(bool pack);
#define USB_Recv USBD_Recv #define USB_Recv USBD_Recv
#define USB_Send USBD_Send #define USB_Send USBD_Send
#define USB_Flush USBD_Flush #define USB_Flush USBD_Flush
// clang-format on
#elif defined(ARDUINO_ARCH_SAMD) #elif defined(ARDUINO_ARCH_SAMD)

@ -27,17 +27,19 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t absolute_mouse_hid_descriptor_[] PROGMEM = { static const uint8_t absolute_mouse_hid_descriptor_[] PROGMEM = {
/* Mouse absolute */ // clang-format off
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) 54 */ // Mouse absolute
D_USAGE, D_USAGE_MOUSE, /* USAGE (Mouse) */ D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop) 54
D_COLLECTION, D_APPLICATION, /* COLLECTION (Application) */ D_USAGE, D_USAGE_MOUSE, // USAGE (Mouse)
D_REPORT_ID, HID_REPORTID_MOUSE_ABSOLUTE, /* REPORT_ID */ D_COLLECTION, D_APPLICATION, // COLLECTION (Application)
D_REPORT_ID, HID_REPORTID_MOUSE_ABSOLUTE, // REPORT_ID
DESCRIPTOR_ABS_MOUSE_BUTTONS DESCRIPTOR_ABS_MOUSE_BUTTONS
DESCRIPTOR_ABS_MOUSE_XY DESCRIPTOR_ABS_MOUSE_XY
DESCRIPTOR_ABS_MOUSE_WHEEL DESCRIPTOR_ABS_MOUSE_WHEEL
D_END_COLLECTION /* End */ D_END_COLLECTION // End
// clang-format off
}; };
AbsoluteMouse_::AbsoluteMouse_() { AbsoluteMouse_::AbsoluteMouse_() {

@ -27,20 +27,22 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t consumer_control_hid_descriptor_[] PROGMEM = { static const uint8_t consumer_control_hid_descriptor_[] PROGMEM = {
/* Consumer Control (Sound/Media keys) */ // clang-format off
D_USAGE_PAGE, 0x0C, /* usage page (consumer device) */ // Consumer Control (Sound/Media keys)
D_USAGE, 0x01, /* usage -- consumer control */ D_USAGE_PAGE, 0x0C, // usage page (consumer device)
D_COLLECTION, D_APPLICATION, /* collection (application) */ D_USAGE, 0x01, // usage -- consumer control
D_REPORT_ID, HID_REPORTID_CONSUMERCONTROL, /* report id */ D_COLLECTION, D_APPLICATION, // collection (application)
/* 4 Media Keys */ D_REPORT_ID, HID_REPORTID_CONSUMERCONTROL, // report id
D_LOGICAL_MINIMUM, 0x00, /* logical minimum */ // 4 Media Keys
D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xFF, 0x03, /* logical maximum (3ff) */ D_LOGICAL_MINIMUM, 0x00, // logical minimum
D_USAGE_MINIMUM, 0x00, /* usage minimum (0) */ D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xFF, 0x03, // logical maximum (3ff)
D_MULTIBYTE(D_USAGE_MAXIMUM), 0xFF, 0x03, /* usage maximum (3ff) */ D_USAGE_MINIMUM, 0x00, // usage minimum (0)
D_REPORT_COUNT, 0x04, /* report count (4) */ D_MULTIBYTE(D_USAGE_MAXIMUM), 0xFF, 0x03, // usage maximum (3ff)
D_REPORT_SIZE, 0x10, /* report size (16) */ D_REPORT_COUNT, 0x04, // report count (4)
D_INPUT, 0x00, /* input */ D_REPORT_SIZE, 0x10, // report size (16)
D_END_COLLECTION /* end collection */ D_INPUT, 0x00, // input
D_END_COLLECTION // end collection
// clang-format on
}; };
ConsumerControl_::ConsumerControl_() { ConsumerControl_::ConsumerControl_() {

@ -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_() {

@ -27,6 +27,7 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = { static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = {
// clang-format off
// NKRO Keyboard // NKRO Keyboard
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP,
D_USAGE, D_USAGE_KEYBOARD, D_USAGE, D_USAGE_KEYBOARD,
@ -34,7 +35,7 @@ static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = {
D_REPORT_ID, HID_REPORTID_NKRO_KEYBOARD, D_REPORT_ID, HID_REPORTID_NKRO_KEYBOARD,
D_USAGE_PAGE, D_PAGE_KEYBOARD, D_USAGE_PAGE, D_PAGE_KEYBOARD,
/* Key modifier byte */ // Key modifier byte
D_USAGE_MINIMUM, HID_KEYBOARD_FIRST_MODIFIER, D_USAGE_MINIMUM, HID_KEYBOARD_FIRST_MODIFIER,
D_USAGE_MAXIMUM, HID_KEYBOARD_LAST_MODIFIER, D_USAGE_MAXIMUM, HID_KEYBOARD_LAST_MODIFIER,
D_LOGICAL_MINIMUM, 0x00, D_LOGICAL_MINIMUM, 0x00,
@ -43,7 +44,7 @@ static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = {
D_REPORT_COUNT, 0x08, D_REPORT_COUNT, 0x08,
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE),
/* 5 LEDs for num lock etc, 3 left for advanced, custom usage */ // 5 LEDs for num lock etc, 3 left for advanced, custom usage
D_USAGE_PAGE, D_PAGE_LEDS, D_USAGE_PAGE, D_PAGE_LEDS,
D_USAGE_MINIMUM, 0x01, D_USAGE_MINIMUM, 0x01,
D_USAGE_MAXIMUM, 0x08, D_USAGE_MAXIMUM, 0x08,
@ -51,7 +52,7 @@ static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = {
D_REPORT_SIZE, 0x01, D_REPORT_SIZE, 0x01,
D_OUTPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), D_OUTPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE),
/* NKRO Keyboard */ // NKRO Keyboard
D_USAGE_PAGE, D_PAGE_KEYBOARD, D_USAGE_PAGE, D_PAGE_KEYBOARD,
// Padding 4 bits, to skip NO_EVENT & 3 error states. // Padding 4 bits, to skip NO_EVENT & 3 error states.
@ -73,6 +74,7 @@ static const uint8_t nkro_keyboard_hid_descriptor_[] PROGMEM = {
D_INPUT, (D_CONSTANT), D_INPUT, (D_CONSTANT),
D_END_COLLECTION, D_END_COLLECTION,
// clang-format on
}; };
Keyboard_::Keyboard_() { Keyboard_::Keyboard_() {

@ -27,13 +27,14 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t mouse_hid_descriptor_[] PROGMEM = { static const uint8_t mouse_hid_descriptor_[] PROGMEM = {
/* Mouse relative */ // clang-format off
// Mouse relative
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop) D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
D_USAGE, D_USAGE_MOUSE, // USAGE (Mouse) D_USAGE, D_USAGE_MOUSE, // USAGE (Mouse)
D_COLLECTION, D_APPLICATION, // COLLECTION (Application) D_COLLECTION, D_APPLICATION, // COLLECTION (Application)
D_REPORT_ID, HID_REPORTID_MOUSE, // REPORT_ID (Mouse) D_REPORT_ID, HID_REPORTID_MOUSE, // REPORT_ID (Mouse)
/* 8 Buttons */ // 8 Buttons
D_USAGE_PAGE, D_PAGE_BUTTON, // USAGE_PAGE (Button) D_USAGE_PAGE, D_PAGE_BUTTON, // USAGE_PAGE (Button)
D_USAGE_MINIMUM, 0x01, // USAGE_MINIMUM (Button 1) D_USAGE_MINIMUM, 0x01, // USAGE_MINIMUM (Button 1)
D_USAGE_MAXIMUM, 0x08, // USAGE_MAXIMUM (Button 8) D_USAGE_MAXIMUM, 0x08, // USAGE_MAXIMUM (Button 8)
@ -43,7 +44,7 @@ static const uint8_t mouse_hid_descriptor_[] PROGMEM = {
D_REPORT_SIZE, 0x01, // REPORT_SIZE (1) D_REPORT_SIZE, 0x01, // REPORT_SIZE (1)
D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs) D_INPUT, (D_DATA | D_VARIABLE | D_ABSOLUTE), // INPUT (Data,Var,Abs)
/* X, Y, Wheel */ // X, Y, Wheel
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop) D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
D_USAGE, 0x30, // USAGE (X) D_USAGE, 0x30, // USAGE (X)
D_USAGE, 0x31, // USAGE (Y) D_USAGE, 0x31, // USAGE (Y)
@ -54,7 +55,7 @@ static const uint8_t mouse_hid_descriptor_[] PROGMEM = {
D_REPORT_COUNT, 0x03, // REPORT_COUNT (3) D_REPORT_COUNT, 0x03, // REPORT_COUNT (3)
D_INPUT, (D_DATA | D_VARIABLE | D_RELATIVE), // INPUT (Data,Var,Rel) D_INPUT, (D_DATA | D_VARIABLE | D_RELATIVE), // INPUT (Data,Var,Rel)
/* Horizontal wheel */ // Horizontal wheel
D_USAGE_PAGE, D_PAGE_CONSUMER, // USAGE_PAGE (Consumer) D_USAGE_PAGE, D_PAGE_CONSUMER, // USAGE_PAGE (Consumer)
D_PAGE_ORDINAL, 0x38, 0x02, // PAGE (AC Pan) D_PAGE_ORDINAL, 0x38, 0x02, // PAGE (AC Pan)
D_LOGICAL_MINIMUM, 0x81, // LOGICAL_MINIMUM (-127) D_LOGICAL_MINIMUM, 0x81, // LOGICAL_MINIMUM (-127)
@ -63,8 +64,9 @@ static const uint8_t mouse_hid_descriptor_[] PROGMEM = {
D_REPORT_COUNT, 0x01, // REPORT_COUNT (1) D_REPORT_COUNT, 0x01, // REPORT_COUNT (1)
D_INPUT, (D_DATA | D_VARIABLE | D_RELATIVE), // INPUT (Data,Var,Rel) D_INPUT, (D_DATA | D_VARIABLE | D_RELATIVE), // INPUT (Data,Var,Rel)
/* End */ // End
D_END_COLLECTION // END_COLLECTION D_END_COLLECTION // END_COLLECTION
// clang-format on
}; };
Mouse_::Mouse_() { Mouse_::Mouse_() {

@ -27,21 +27,23 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t system_control_hid_descriptor_[] PROGMEM = { static const uint8_t system_control_hid_descriptor_[] PROGMEM = {
//TODO(anyone) limit to system keys only? // clang-format off
/* System Control (Power Down, Sleep, Wakeup, ...) */ // TODO(anyone) limit to system keys only?
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */ // System Control (Power Down, Sleep, Wakeup, ...)
D_USAGE, 0x80, /* USAGE (System Control) */ D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop)
D_COLLECTION, D_APPLICATION, /* COLLECTION (Application) */ D_USAGE, 0x80, // USAGE (System Control)
D_REPORT_ID, HID_REPORTID_SYSTEMCONTROL, /* REPORT_ID */ D_COLLECTION, D_APPLICATION, // COLLECTION (Application)
/* 1 system key */ D_REPORT_ID, HID_REPORTID_SYSTEMCONTROL, // REPORT_ID
D_LOGICAL_MINIMUM, 0x00, /* LOGICAL_MINIMUM (0) */ // 1 system key
D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xff, 0x00, /* LOGICAL_MAXIMUM (255) */ D_LOGICAL_MINIMUM, 0x00, // LOGICAL_MINIMUM (0)
D_USAGE_MINIMUM, 0x00, /* USAGE_MINIMUM (Undefined) */ D_MULTIBYTE(D_LOGICAL_MAXIMUM), 0xff, 0x00, // LOGICAL_MAXIMUM (255)
D_USAGE_MAXIMUM, 0xff, /* USAGE_MAXIMUM (System Menu Down) */ D_USAGE_MINIMUM, 0x00, // USAGE_MINIMUM (Undefined)
D_REPORT_COUNT, 0x01, /* REPORT_COUNT (1) */ D_USAGE_MAXIMUM, 0xff, // USAGE_MAXIMUM (System Menu Down)
D_REPORT_SIZE, 0x08, /* REPORT_SIZE (8) */ D_REPORT_COUNT, 0x01, // REPORT_COUNT (1)
D_INPUT, (D_DATA | D_ARRAY | D_ABSOLUTE), /* INPUT (Data,Ary,Abs) */ D_REPORT_SIZE, 0x08, // REPORT_SIZE (8)
D_END_COLLECTION /* END_COLLECTION */ D_INPUT, (D_DATA | D_ARRAY | D_ABSOLUTE), // INPUT (Data,Ary,Abs)
D_END_COLLECTION // END_COLLECTION
// clang-format on
}; };
SystemControl_::SystemControl_() { SystemControl_::SystemControl_() {

@ -27,14 +27,16 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/HIDReportObserver.h" #include "kaleidoscope/driver/hid/keyboardio/usb/HIDReportObserver.h"
static const uint8_t _hidSingleReportDescriptorAbsoluteMouse[] PROGMEM = { static const uint8_t _hidSingleReportDescriptorAbsoluteMouse[] PROGMEM = {
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) 54 */ // clang-format off
D_USAGE, D_USAGE_MOUSE, /* USAGE (Mouse) */ D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, // USAGE_PAGE (Generic Desktop) 54
D_COLLECTION, D_APPLICATION, /* COLLECTION (Application) */ D_USAGE, D_USAGE_MOUSE, // USAGE (Mouse)
D_COLLECTION, D_APPLICATION, // COLLECTION (Application)
DESCRIPTOR_ABS_MOUSE_BUTTONS DESCRIPTOR_ABS_MOUSE_BUTTONS
DESCRIPTOR_ABS_MOUSE_XY DESCRIPTOR_ABS_MOUSE_XY
DESCRIPTOR_ABS_MOUSE_WHEEL DESCRIPTOR_ABS_MOUSE_WHEEL
D_END_COLLECTION /* End */ D_END_COLLECTION // End
// clang-format on
}; };
#ifdef ARCH_HAS_CONFIGURABLE_EP_SIZES #ifdef ARCH_HAS_CONFIGURABLE_EP_SIZES

Loading…
Cancel
Save