summaryrefslogtreecommitdiff
path: root/arcin/report_desc.h
diff options
context:
space:
mode:
Diffstat (limited to 'arcin/report_desc.h')
-rw-r--r--arcin/report_desc.h197
1 files changed, 197 insertions, 0 deletions
diff --git a/arcin/report_desc.h b/arcin/report_desc.h
new file mode 100644
index 0000000..b9602b7
--- /dev/null
+++ b/arcin/report_desc.h
@@ -0,0 +1,197 @@
+#ifndef REPORT_DESC_H
+#define REPORT_DESC_H
+
+#include <usb/hid.h>
+
+auto report_desc = gamepad(
+ // Inputs.
+ report_id(1),
+
+ buttons(15),
+ padding_in(1),
+
+ usage_page(UsagePage::Desktop),
+ usage(DesktopUsage::X),
+ logical_minimum(0),
+ logical_maximum(255),
+ report_count(1),
+ report_size(8),
+ input(0x02),
+
+ usage_page(UsagePage::Desktop),
+ usage(DesktopUsage::Y),
+ logical_minimum(0),
+ logical_maximum(255),
+ report_count(1),
+ report_size(8),
+ input(0x02),
+
+ // Outputs.
+ report_id(2),
+
+ usage_page(UsagePage::Ordinal),
+ usage(1),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(2),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(3),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(4),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(5),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(6),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(7),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(8),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(9),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(10),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ usage_page(UsagePage::Ordinal),
+ usage(11),
+ collection(Collection::Logical,
+ usage_page(UsagePage::LED),
+ usage(0x4b),
+ report_size(1),
+ report_count(1),
+ output(0x02)
+ ),
+
+ padding_out(5),
+
+ // Bootloader
+ report_id(0xb0),
+
+ usage_page(0xff55),
+ usage(0xb007),
+ logical_minimum(0),
+ logical_maximum(255),
+ report_size(8),
+ report_count(1),
+
+ feature(0x02), // HID bootloader function
+
+ // Configuration
+ report_id(0xc0),
+
+ usage(0xc000),
+ feature(0x02), // Config segment
+
+ usage(0xc001),
+ feature(0x02), // Config segment size
+
+ feature(0x01), // Padding
+
+ usage(0xc0ff),
+ report_count(60),
+ feature(0x02) // Config data
+);
+
+struct input_report_t {
+ uint8_t report_id;
+ uint16_t buttons;
+ uint8_t axis_x;
+ uint8_t axis_y;
+} __attribute__((packed));
+
+struct output_report_t {
+ uint8_t report_id;
+ uint16_t leds;
+} __attribute__((packed));
+
+struct bootloader_report_t {
+ uint8_t report_id;
+ uint8_t func;
+} __attribute__((packed));
+
+struct config_report_t {
+ uint8_t report_id;
+ uint8_t segment;
+ uint8_t size;
+ uint8_t pad;
+ uint8_t data[60];
+} __attribute__((packed));
+
+#endif