Cannot compile with USB_EVERYTHING flag on Platform IO

notaglowie

New member
Hello, I'm currently trying to compile a Teensy 4.0 project that uses both the MIDI and Keyboard libraries, but I can't seem to be able to find a flag to enable both of them except the USB_EVERYTHING flag, which just errors when trying to compile the project:
Code:
In file included from /home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:33:
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c: In function 'endpoint0_setup':
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:937:33: error: 'ENDPOINT_TRANSMIT_AND_RECEIVE' undeclared (first use in this function); did you mean 'ENDPOINT_TRANSMIT_UNUSED'?
  937 |   #define ENDPOINT2_CONFIG      ENDPOINT_TRANSMIT_AND_RECEIVE
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:458:35: note: in expansion of macro 'ENDPOINT2_CONFIG'
  458 |                 USB1_ENDPTCTRL2 = ENDPOINT2_CONFIG;
      |                                   ^~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:937:33: note: each undeclared identifier is reported only once for each function it appears in
  937 |   #define ENDPOINT2_CONFIG      ENDPOINT_TRANSMIT_AND_RECEIVE
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:458:35: note: in expansion of macro 'ENDPOINT2_CONFIG'
  458 |                 USB1_ENDPTCTRL2 = ENDPOINT2_CONFIG;
      |                                   ^~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:939:33: error: 'ENDPOINT_TRANSMIT_ONLY' undeclared (first use in this function); did you mean 'ENDPOINT_TRANSMIT_BULK'?
  939 |   #define ENDPOINT4_CONFIG      ENDPOINT_TRANSMIT_ONLY
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:464:35: note: in expansion of macro 'ENDPOINT4_CONFIG'
  464 |                 USB1_ENDPTCTRL4 = ENDPOINT4_CONFIG;
      |                                   ^~~~~~~~~~~~~~~~
*** [.pio/build/teensy40/FrameworkArduino/usb.c.o] Error 1
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:764:13: error: 'CDC_RX_SIZE_480' undeclared here (not in a function); did you mean 'CDC_RX_SIZE'?
  764 |         LSB(CDC_RX_SIZE_480),MSB(CDC_RX_SIZE_480),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:771:13: error: 'CDC_TX_SIZE_480' undeclared here (not in a function); did you mean 'CDC_TX_SIZE'?
  771 |         LSB(CDC_TX_SIZE_480),MSB(CDC_TX_SIZE_480),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:1035:13: error: 'MIDI_RX_SIZE_480' undeclared here (not in a function); did you mean 'MIDI_RX_SIZE'?
 1035 |         LSB(MIDI_RX_SIZE_480),MSB(MIDI_RX_SIZE_480),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:1095:13: error: 'MIDI_TX_SIZE_480' undeclared here (not in a function); did you mean 'MIDI_TX_SIZE'?
 1095 |         LSB(MIDI_TX_SIZE_480),MSB(MIDI_TX_SIZE_480),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:1778:13: error: 'CDC_RX_SIZE_12' undeclared here (not in a function); did you mean 'CDC_RX_SIZE'?
 1778 |         LSB(CDC_RX_SIZE_12),MSB(CDC_RX_SIZE_12),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:1785:13: error: 'CDC_TX_SIZE_12' undeclared here (not in a function); did you mean 'CDC_TX_SIZE'?
 1785 |         LSB(CDC_TX_SIZE_12),MSB(CDC_TX_SIZE_12),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:2049:13: error: 'MIDI_RX_SIZE_12' undeclared here (not in a function); did you mean 'MIDI_RX_SIZE'?
 2049 |         LSB(MIDI_RX_SIZE_12),MSB(MIDI_RX_SIZE_12),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:2109:13: error: 'MIDI_TX_SIZE_12' undeclared here (not in a function); did you mean 'MIDI_TX_SIZE'?
 2109 |         LSB(MIDI_TX_SIZE_12),MSB(MIDI_TX_SIZE_12),// wMaxPacketSize
      |             ^~~~~~~~~~~~~~~
/home/user/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.c:72:18: note: in definition of macro 'LSB'
   72 | #define LSB(n) ((n) & 255)
      |                  ^
*** [.pio/build/teensy40/FrameworkArduino/usb_desc.c.o] Error 1
I could probably fix this myself with a patch to the usb_desc.h file but I don't know enough about TeensyDuino to actually do that, is it maybe a software/hardware limitation that can't let me use both libraries at once? Could it be possible to create a custom flag to have both MIDI and Keyboard (and Serial maybe) without enabling everything else?
 
Last edited:
Back
Top