Neale Pickett
·
2024-01-04
instrument.hh
1#pragma once
2
3static const uint8_t _hidReportDescriptor[137] PROGMEM = {
4 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
5 0x09, 0x05, // Usage (Game Pad)
6 0xA1, 0x01, // Collection (Application)
7 0x15, 0x00, // Logical Minimum (0)
8 0x25, 0x01, // Logical Maximum (1)
9 0x35, 0x00, // Physical Minimum (0)
10 0x45, 0x01, // Physical Maximum (1)
11 0x75, 0x01, // Report Size (1)
12 0x95, 0x0D, // Report Count (13)
13 0x05, 0x09, // Usage Page (Button)
14 0x19, 0x01, // Usage Minimum (0x01)
15 0x29, 0x0D, // Usage Maximum (0x0D)
16 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
17 0x95, 0x03, // Report Count (3)
18 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
19 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
20 0x25, 0x07, // Logical Maximum (7)
21 0x46, 0x3B, 0x01, // Physical Maximum (315)
22 0x75, 0x04, // Report Size (4)
23 0x95, 0x01, // Report Count (1)
24 0x65, 0x14, // Unit (System: English Rotation, Length: Centimeter)
25 0x09, 0x39, // Usage (Hat switch)
26 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
27 0x65, 0x00, // Unit (None)
28 0x95, 0x01, // Report Count (1)
29 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
30 0x26, 0xFF, 0x00, // Logical Maximum (255)
31 0x46, 0xFF, 0x00, // Physical Maximum (255)
32 0x09, 0x30, // Usage (X)
33 0x09, 0x31, // Usage (Y)
34 0x09, 0x32, // Usage (Z)
35 0x09, 0x35, // Usage (Rz)
36 0x75, 0x08, // Report Size (8)
37 0x95, 0x04, // Report Count (4)
38 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
39 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
40 0x09, 0x20, // Usage (0x20)
41 0x09, 0x21, // Usage (0x21)
42 0x09, 0x22, // Usage (0x22)
43 0x09, 0x23, // Usage (0x23)
44 0x09, 0x24, // Usage (0x24)
45 0x09, 0x25, // Usage (0x25)
46 0x09, 0x26, // Usage (0x26)
47 0x09, 0x27, // Usage (0x27)
48 0x09, 0x28, // Usage (0x28)
49 0x09, 0x29, // Usage (0x29)
50 0x09, 0x2A, // Usage (0x2A)
51 0x09, 0x2B, // Usage (0x2B)
52 0x95, 0x0C, // Report Count (12)
53 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
54 0x0A, 0x21, 0x26, // Usage (0x2621)
55 0x95, 0x08, // Report Count (8)
56 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
57 0x0A, 0x21, 0x26, // Usage (0x2621)
58 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
59 0x26, 0xFF, 0x03, // Logical Maximum (1023)
60 0x46, 0xFF, 0x03, // Physical Maximum (1023)
61 0x09, 0x2C, // Usage (0x2C)
62 0x09, 0x2D, // Usage (0x2D)
63 0x09, 0x2E, // Usage (0x2E)
64 0x09, 0x2F, // Usage (0x2F)
65 0x75, 0x10, // Report Size (16)
66 0x95, 0x04, // Report Count (4)
67 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
68 0xC0, // End Collection
69 // 137 bytes
70};
71
72typedef struct {
73 uint16_t buttons; // 2
74 uint8_t hatAndConstant; // 1
75 uint8_t axis[4]; // 4
76 uint8_t reserved1[4]; // Not sure what this is
77 uint8_t velocity[4]; // Y, R, G, B
78 uint8_t reserved2[4]; // Not sure what this is, either
79 uint64_t finalConstant; // 8
80} InstrumentButtonState;