I am in the process of developing a MIDI Module for a modular synthesizer. It has old-school DIN plugs for MIDI and two USB connectors (A and B) for Device and Host.
Receiving MIDI Commands over the UART works, connecting it to the PC as a MIDI device works and being USB host for a MIDI Keyboard works, too.
But the two USB roles only work if only one host OR device is compiled into the code.
Now my question is: How can I switch between the two at runtime? I have a display and and buttons connected and would be fine with selecting host/device via a menu. It does not have to be auto-detecting.
I am using the USBH_MIDI class driver for host and the MIDIUSB library for device.
But they are missing functions like deinit() or detach()/attach() to control which class is handling the USB communication.