Teensy 4.1, USB MIDI init failing

Status
Not open for further replies.

Miq58

Member
Hi,

I am trying to bring my T4_1 to send out MIDI messages via USB. I have the following statement at the begining of my code:
Code:
MIDI_CREATE_INSTANCE(HardwareSerial, SerialUSB, midiB);
(I picked it from an example I found on the net)

But this is giving me a compiler error (on PlatformIO):
Code:
In file included from C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/MIDI.h:35:0,
                 from src\main.cpp:9:
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:102:61: error: no matching function for call to 'midi::SerialMIDI<HardwareSerial>::SerialMIDI(usb_seremu_class&)'
     MIDI_NAMESPACE::SerialMIDI<Type> serial##Name(SerialPort);\
                                                             ^
src\main.cpp:11:1: note: in expansion of macro 'MIDI_CREATE_INSTANCE'
 MIDI_CREATE_INSTANCE(HardwareSerial, SerialUSB, midiB);
 ^
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:48:2: note: candidate: midi::SerialMIDI<SerialPort, _Settings>::SerialMIDI(SerialPort&) [with SerialPort = HardwareSerial; _Settings = midi::DefaultSerialSettings]
  SerialMIDI(SerialPort& inSerial)
  ^
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:48:2: note:   no known conversion for argument 1 from 'usb_seremu_class' to 'HardwareSerial&'
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:43:7: note: candidate: constexpr midi::SerialMIDI<HardwareSerial>::SerialMIDI(const midi::SerialMIDI<HardwareSerial>&)
 class SerialMIDI
       ^
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:43:7: note:   no known conversion for argument 1 from 'usb_seremu_class' to 'const midi::SerialMIDI<HardwareSerial>&'
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:43:7: note: candidate: constexpr midi::SerialMIDI<HardwareSerial>::SerialMIDI(midi::SerialMIDI<HardwareSerial>&&)
C:\Users\Micha\.platformio\packages\framework-arduinoteensy\libraries\MIDI\src/serialMIDI.h:43:7: note:   no known conversion for argument 1 from 'usb_seremu_class' to 'midi::SerialMIDI<HardwareSerial>&&'
*** [.pio\build\teensy41\src\main.cpp.o] Error 1
It looks to me like the 'SerialUSB' is not matching the 'HardwareSerial' type.

What should I use instead?
 
MIDI_CREATE_INSTANCE is used for hardware MIDI ports, as described here.
If you want your Teensy to send out MIDI messages via USB, see this page.

Hope this helps,
Paul
 
Thanks, Paul.

I know that page, but it relies on the Arduino IDE menu. I am using PlatformIO and would like to learn what to write without the help of that menu. I already added the "UUSB_SERIAL -DUSB-MIDI" flags to platformio.ini.
 
Thanks! I will try that today - I found a resource in the meantime stating the same. There seems to be a predefined usbMIDI device then, that will not need any declaration.
 
Status
Not open for further replies.
Back
Top