Hello there chaps, I am making a HID dj controller with 128 single bit buttons and 48 analogue dials (pots) at 8 bit resolution.
I am very new to this type of prototyping but I'm learning as I go. Fortunately a lot of the coding for firmware creation has been done here UnoJoy
I am following the example there and expanding, so I edited
dataForController_t.h
UnoJoy.C
usb_gamepad.h
usb_gamepad.c
It is composing the HID report in usb_gamepad.c (is this the descriptor? I'm unsure) that I am having trouble with.
What HID usage type would be best for 128 buttons at 1 bit each and 48 dials (ADC) at 8 bit each?
Here is part of my code from usb_gamepad.c (which I know is wrong but I am stumped)
static const uint8_t PROGMEM device_descriptor[] = {
18, // bLength //I SHOULD CHANGE THIS TO 64?
1, // bDescriptorType
0x10, 0x01, // bcdUSB
0, // bDeviceClass
0, // bDeviceSubClass
0, // bDeviceProtocol
ENDPOINT0_SIZE, // bMaxPacketSize0
LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct
0x00, 0x01, // bcdDevice
1, // iManufacturer
2, // iProduct
0, // iSerialNumber
1 // bNumConfigurations
};
static const uint8_t PROGMEM gamepad_hid_report_desc[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Gamepad)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x45, 0x01, // PHYSICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x80, // REPORT_COUNT (128)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x80, // USAGE_MAXIMUM (Button 128)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x46, 0xff, 0x00, // PHYSICAL_MAXIMUM (255)
0x09, 0x30, // USAGE (X) //HERE IS WHERE I DERPED OUT, COULD I HAVE 48*X AXIS'?
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x35, // USAGE (Rz)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x30, // REPORT_COUNT (48)
0xc0 // END_COLLECTION
};
If required I can add my edited files or provide more information.
Thanks for reading and any guidance, locodog