tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.19k stars 134 forks source link

Arduino Giga R1 Wifi support #996

Open BenRauzi opened 5 months ago

BenRauzi commented 5 months ago

Are there any plans to support the Arduino Giga R1 Wifi in future with MIDI over USB? Understandably it's STM32 so would be a bit more work, but keen to build something with this board.

Would be happy to collaborate on this if given some pointers if it were needed.

tttapa commented 5 months ago

The code for the Giga should be there, but I don't have the hardware to test it. I've just verified that the correct backend is selected and that the code compiles without warnings or errors, but I have no idea if it will work. If the GIGA USB implementation and API in the ArduinoCore-mbed are similar enough to the ones for the Nano 33 BLE, it may work without too many modifications.

To be honest, the low-level MIDI USB code for the mbed platform is rather experimental, it needs some refactoring and simplifications, along with more rigorous tests, but there have been a lot of other things on my todo list, unfortunately.

If you have a Giga at hand, it would be great if you could give it a try, it should be as simple as using the USBMIDI_Interface.
I usually start with a simple loopback test:

#include <Control_Surface.h>
// Make sure we're not silently falling back to MIDI over Serial
#ifdef CS_USB_MIDI_NOT_SUPPORTED
#error "Actual MIDI USB backend required"
#endif

USBMIDI_Interface midi;
MIDI_Pipe p;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  midi >> p >> midi;
  MIDI_Interface::beginAll();
}

void loop() {
  static bool ledState = false;
  static AH::Timer<millis> timer {500};
  if (timer)
    digitalWrite(LED_BUILTIN, ledState = !ledState);
  MIDI_Interface::updateAll();
}
BenRauzi commented 5 months ago

Sure thing I'll have an experiment and see if I can get anything working