Using Joystick and RawHID on Teensy 4.1

Status
Not open for further replies.

root670

New member
I'm working on a project for a game controller that gets run-time configuration over the USB serial interface provided by the "Serial + Keyboard + Mouse + Joystick" USB type in Teensyduino (or the "-D USB_SERIAL_HID" build flag in PlatformIO). As the project has developed I'm seeing a need for replacing the serial interface with RawHID for sending configuration packets to the device to overcome the restriction of exclusive access inherit with serial interfaces.

With the Teensy 3 series this is possible using the "Everything" USB type in Teensyduino ("-D USB_EVERYTHING" build flag in PlatformIO). However, for Teensy 4.0/4.1 the "Everything" option is missing in Teensyduino and compiling with the -D USB_EVERYTHING build flag in platformIO results in this compile error:

Code:
In file included from /Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:3:0:
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c: In function 'endpoint0_setup':
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:900:28: error: 'ENDPOINT_TRANSMIT_AND_RECEIVE' undeclared (first use in this function)
   #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
                            ^
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:406:21: note: in expansion of macro 'ENDPOINT2_CONFIG'
   USB1_ENDPTCTRL2 = ENDPOINT2_CONFIG;
                     ^
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:900:28: note: each undeclared identifier is reported only once for each function it appears in
   #define ENDPOINT2_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
                            ^
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:406:21: note: in expansion of macro 'ENDPOINT2_CONFIG'
   USB1_ENDPTCTRL2 = ENDPOINT2_CONFIG;
                     ^
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb_desc.h:902:28: error: 'ENDPOINT_TRANSMIT_ONLY' undeclared (first use in this function)
   #define ENDPOINT4_CONFIG ENDPOINT_TRANSMIT_ONLY
                            ^
/Users/wes/.platformio/packages/framework-arduinoteensy/cores/teensy4/usb.c:412:21: note: in expansion of macro 'ENDPOINT4_CONFIG'
   USB1_ENDPTCTRL4 = ENDPOINT4_CONFIG;
                     ^
*** [.pio/build/teensy41/FrameworkArduino/usb.c.o] Error 1

Is there a technical reason the teensy4 core doesn't support this or has it not been implemented yet? Alternatively, is there another way to enable the Joystick and RawHID interfaces simultaneously with teensy4?

Thank you.
 
Status
Not open for further replies.
Back
Top