buffington
Member
I've just recently dove into the deep end of USB HID devices and, as you might guess, am now a bit lost.
Here's what I'm trying to achieve: the Teensyduino joystick library allows you to send values of 0-1023 for any of the axis or slider usages. That's already a pretty generous spread when it comes to joysticks, but I'm looking to get a bit more.
Here's what I've done so far: I've duped the teensy directory found within the Arduino hardware directory (this is for a Teensy 2.0++), renamed it to something meaningful to me (vrc), and edited that folder's boards.txt file to include my "new" Teensy based device.
I've edited the manufacturer and product strings in vrc/cores/teensy/usb_serial_hid/usb_private.h like so:
The product name change is mostly so that when I select my board in the Arduino app it's obviously that I'm using the correct code and the product id change is to force my machine to see it as something new, and therefore obviously new. I only needed to do that once.
Now I'm puzzling a bit over the resolution thing.
In vrc/cores/teensy/usb_serial_hid/usb.c I can see where the HID report is put together.
Am I correct in thinking that if I wanted to adjust the minimum to -1023, and the maximum to 1023, I'd want those lines to look like so?
Is it safe to assume that adjusting the logical minimum then changes the report size? And why a report size of 10 in the first place? With a report count of 4, wouldn't the report size be 8 instead?
Assuming I worked out the report size, by adjusting the minimum does my joystick_report_data array need to increase in size as well? And of course, I'd need to adjust the hard limit defined in vrc/cores/teensy/usb_serial_hid/usb_api.h to allow for the larger range.
What am I missing?
Here's what I'm trying to achieve: the Teensyduino joystick library allows you to send values of 0-1023 for any of the axis or slider usages. That's already a pretty generous spread when it comes to joysticks, but I'm looking to get a bit more.
Here's what I've done so far: I've duped the teensy directory found within the Arduino hardware directory (this is for a Teensy 2.0++), renamed it to something meaningful to me (vrc), and edited that folder's boards.txt file to include my "new" Teensy based device.
I've edited the manufacturer and product strings in vrc/cores/teensy/usb_serial_hid/usb_private.h like so:
Code:
#define STR_MANUFACTURER L"Round4"
#define STR_PRODUCT L"VRCPro"
#define STR_SERIAL L"Serial"
/* */
#define PRODUCT_ID 0x0490
The product name change is mostly so that when I select my board in the Arduino app it's obviously that I'm using the correct code and the product id change is to force my machine to see it as something new, and therefore obviously new. I only needed to do that once.
Now I'm puzzling a bit over the resolution thing.
In vrc/cores/teensy/usb_serial_hid/usb.c I can see where the HID report is put together.
Am I correct in thinking that if I wanted to adjust the minimum to -1023, and the maximum to 1023, I'd want those lines to look like so?
Code:
0x15, 0x01, 0xFC, // Logical Minimum (-1023)
0x26, 0xFF, 0x03, // Logical Maximum (1023)
Is it safe to assume that adjusting the logical minimum then changes the report size? And why a report size of 10 in the first place? With a report count of 4, wouldn't the report size be 8 instead?
Assuming I worked out the report size, by adjusting the minimum does my joystick_report_data array need to increase in size as well? And of course, I'd need to adjust the hard limit defined in vrc/cores/teensy/usb_serial_hid/usb_api.h to allow for the larger range.
What am I missing?