The Teensy can be configured as a number of different types of USB device. I am particularly interested in running it as USB Audio, to use with the Audio Library. I had a lot of trouble getting this working, and I wanted to share this solution with other users, and ask for the docs updated.
As described in the Teensy platform docs, you need to define the appropriate option for the USB endpoint type you wish the teensy to appear as. This is equivalent to choosing one of the menu options in the Arduino IDE (as is mentioned in many of the tutorials). The option -DUSB_AUDIO
is needed for audio applications, and is not currently included in this list.
However, all of these options clash with the preconfigured option -DUSB_SERIAL
, which is included in the Makefile. As can be seen in usb_desc.h
, the different options are defined with #elif
, therefore only one can be defined at a time, and the serial option needs to be undefined.
So in the case of USB audio, the solution is to add the following line to platformio.ini
build_flags = -DUSB_AUDIO -UUSB_SERIAL