Teensy 4.1 USB Host Joystick

Witlock123

New member
I am using the joystick example and can figure out how to manipulate the button data but I dont
see the location where the code is for the hid_process_in_data that is being printed out.
I can see the joystick data changing when I move the sticks and now I want to process this data for my application.
What function do I use to access this data.
 
If you look through the sketch you will see two primary functions for getting the data:
Code:
uint32_t buttons = joysticks[joystick_index].getButtons();
and
joysticks[joystick_index].getAxis(i)
where axis data is an array of 64 depending on your controller
 
If you look through the sketch you will see two primary functions for getting the data:
Code:
uint32_t buttons = joysticks[joystick_index].getButtons();
and
joysticks[joystick_index].getAxis(i)
where axis data is an array of 64 depending on your controller

I commented out all the print statements but still print out "hid_process_in_data", so I still don't know where
the printing is coming from? I can get some of the data to print out using joysticks[joystick_index].getAxis(i).
 
I commented out all the print statements but still print out "hid_process_in_data", so I still don't know where
the printing is coming from? I can get some of the data to print out using joysticks[joystick_index].getAxis(i).

That message is coming from the Joystick debug code.

Try editing joystick.cpp in the USBHost_t36 directory.

Look for:

Code:
//#define DEBUG_JOYSTICK
#ifdef  DEBUG_JOYSTICK
#define DBGPrintf USBHDBGSerial.printf
#else
#define DBGPrintf(...)
#endif
Which in my current file is I believe line 30.

I have the define commented out: //#define DEBUG_JOYSTICK
If you are not interested in the debug information, make sure that your copy is as well.
 
Back
Top