ddiakopoulos / hiduino

:musical_keyboard: Native USB-MIDI on the Arduino
http://www.dimitridiakopoulos.com/hiduino
643 stars 110 forks source link

USB Serial and HIDUINO at the same time #32

Closed sanotronics closed 8 years ago

sanotronics commented 9 years ago

Hello!

Would it be possible?

I would love to, for example, have switch, that the Atmega looks at, at startup, and runs one or the other.

What do you think?

ddiakopoulos commented 9 years ago

Difficult!

I did some preliminary work on this 2+ years ago in toggling between USB serial and HIDUINO by checking the state of the reset pin on a 16u2 chip when it powered on (there are only 6 pins directly corrected to the 16u2 for programming... using reset pin is definitely a hack). I seem to remember that this worked?

The biggest problem was fitting both HIDUINO and the USB serial stack on the 16u2. It is definitely not possible on any configurations with an 8u2 since there's just not enough memory for both programs. I also remember something about USB endpoints being an issue.

There's definitely some hacking to be done here, but unfortunately I don't have time to tackle it myself.

sanotronics commented 8 years ago

Thanks dimitri!

So it worked? you could fit both of them in the 16u2 and switch with the reset pin at power on?

I could take a look at some point and try to make it work if you can give me whatever you have so far :)

ddiakopoulos commented 8 years ago

I just found out that the author of MocoLufa (https://github.com/kuwatay/mocolufa/blob/master/dualMoco.c) has an implementation of this.