Hello!
I'm working on a custom controller project on the Teensy LC that uses XInput, taking cues from Zachery Littell's implementation here. Adding XInput support requires modifying a number of Teensy 3 core files:
For another user to use this XInput implementation, as it's currently written, they would have to overwrite the relevant Teensy core files with these XInput equivalents. Since the modified files are direct replacements, the user's Teensyduino version must also match exactly or they risk breaking all of the USB modes. Predictably this is very messy and prone to issues. On top of that, maintaining these modified files is a mess because unrelated portions will change with Teensyduino updates.
Here's my question: How would I make it so this can be more easily packaged for distribution?
My assumption is that there would need to be some changes made to the Teensy cores to support custom USB descriptors / classes, though I don't know the ideal way to go about that. Perhaps custom macros in the relevant files that would be toggled on with a custom build recipe? At that point I'd assume I could define it as a custom board in the Arduino IDE and link back to the Teensyduino 3 core, which would avoid users having to copy + overwrite files.
Any thoughts?
I'm working on a custom controller project on the Teensy LC that uses XInput, taking cues from Zachery Littell's implementation here. Adding XInput support requires modifying a number of Teensy 3 core files:
- WProgram.h: to include a custom XInput implementation header (usb_xinput.h).
- usb_desc.c: overriding portions of the device descriptor and defining the config descriptor with an exact size.
- usb_desc.h: adding USB macros for XInput (device class, VID, PID, num endpoints, etc.).
- usb_inst.cpp creating USB XInput class instances.
For another user to use this XInput implementation, as it's currently written, they would have to overwrite the relevant Teensy core files with these XInput equivalents. Since the modified files are direct replacements, the user's Teensyduino version must also match exactly or they risk breaking all of the USB modes. Predictably this is very messy and prone to issues. On top of that, maintaining these modified files is a mess because unrelated portions will change with Teensyduino updates.
Here's my question: How would I make it so this can be more easily packaged for distribution?
My assumption is that there would need to be some changes made to the Teensy cores to support custom USB descriptors / classes, though I don't know the ideal way to go about that. Perhaps custom macros in the relevant files that would be toggled on with a custom build recipe? At that point I'd assume I could define it as a custom board in the Arduino IDE and link back to the Teensyduino 3 core, which would avoid users having to copy + overwrite files.
Any thoughts?