RFC: Add a HID report composition helper macros
These macros make it slightly easier and more modular to create a HID report descriptor from scratch. Since they carry the annotation we don't need to comment it and they cannot get stale.
For comparison, before we had this:
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x04, // Report Count (4)
0x75, 0x01, // Report Size (1)
Now we can write this as:
LOGICAL_RANGE_i8(0, 1)
REPORT_COUNT(4)
REPORT_SIZE(1)
Because these macros are for creating new report descriptors, some bits aren't directly exposed. e.g in the example above: there is a logical range as one macro that sets both min and max. There is seldom a good use case for skipping either anyway.
These macros will need to be expanded over time.
Filing as RFC for comments and bikeshedding on style, not yet content, I may expand those as needed.
These are the macros from !87 (merged) factored into a separate header file (and slightly cleaned up/improved).
tbh, reading this I wouldn't mind using the HID notation instead of the screaming capitals, things like ReportId(4)
would be nicer to read than REPORT_ID(4)
.