YuuichiAkagawa/Arduino-UHS2MIDI

Would you consider supporting the USB Host Library SAMD too?

Closed this issue · 2 comments

I managed to get this running on an Adafruit Trinket M0 (which uses a SAMD21E18 cpu) using the USB Host Library SAMD from here: https://github.com/gdsports/USB_Host_Library_SAMD

There were a couple of minor changes required, which I've documented on my project blog here: https://diyelectromusic.wordpress.com/2021/03/22/trinket-usb-midi-multi-pot-mozzi-synthesis/

The main one being that the SAMD version of the library uses a USBHost * type rather than USB * type, which needed a change in UHS2-MIDI.H. It also complained about a few other definitions, but I don't know if that was just my Arduino environment (although I've not changed anything to my knowledge). Changing this also means the examples no longer compile.

Would you be interested in include some kind of conditional compilation, perhaps looking for ARDUINO_ARCH_SAMD (if that isn't too generic), to allow for the use of the SAMD version of the USB Host Library? I'm afraid I haven't quite worked out what has changed in the samd version of the USB Host Library compared to the original as I'm not yet familiar enough with the codebase to work it through. It may be that they themselves could merge at some point in the future, but for now there seems to be two parallel architectures in use.

Either way, thanks for this code, I was trying to work out how to do exactly this, when I stumbled across your repository. Great work!

Kevin

Thank you for your report.
The "UHS2" means USB Host Library 2.0. The USB host library SAMD is based on UHS2, so I think it can be used as is now.
We are planning to update USBH_MIDI. In that case, it is more likely that it will not work.

I think it's better to have a separate transport for the USB Host Library SAMD.
https://github.com/YuuichiAkagawa/Arduino-USBHSAMD-MIDI

Yes ok, that's probably a good idea! I'll have a look and give it a go. Many thanks. Kevin.