Teensy 4.1 Joystick Support

Hello,

I am working on developing a Microsoft Flight Simulator interface for my home cockpit. I purchased a Teensy 4.1 and four (4) CD74HC4067 16 channel mux boards (to increase I/O count). I have done some research online and it looks like Windows has a maximum joystick button limit of 32. Can the Teensy 4.1 be setup to appear to Windows as multiple joystick each with 32 buttons? I would like to have 90+ hardware buttons assignable in the Flight Simulator.

Thanks for your support.

Greg M.
 
After more digging it looks like I need to modify the usb_desc.h file. In the Arduino software I have selected Serial+Keyboard+Mouse+Joystick. Can I copy/paste this in the usb_desc.h file and create a Serial+Joystick+Joystick+Joystick? This would give me 32x3=96 buttons (and 3 joysticks in Windows game controllers menu). Is this possible?
 
There are two standard configurations of the USB Joystick code that is part of Teensyduino...

You might want to look at the thread: https://forum.pjrc.com/threads/23681-Many-axis-joystick

Look at the sources for the file usb_desc.h
And change the define: #define JOYSTICK_SIZE 12 // 12 = normal, 64 = extreme joystick
To 64 and then:
And then the system is defined for:
Code:
#elif JOYSTICK_SIZE == 64
// extreme joystick  (to use this, edit JOYSTICK_SIZE to 64 in usb_desc.h)
//  128 buttons   16
//    6 axes      12
//   17 sliders   34
//    4 pov        2
 
I got the Teensy 4.1 working with 128 buttons. Below are the steps I performed to get it working.

Step 1: Navigate to "C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\"
Step 2: Open the file usb_desc.h and change the following:
Original #define JOYSTICK_SIZE 12
New #define JOYSTICK_SIZE 64
Step 3: In Arduino IDE, change USB type to Serial+Keyboard+Mouse+Joystick
Step 4: Upload program

Note: If you use Windows 10 default game controller calibration screen (built into windows), it only shows 32 buttons available.
You will need to use your game control setup screen or the below game controller test application to see all the available buttons.

http://www.planetpointy.co.uk/joystick-test-application/

Enjoy
 
Greg, I am doing a similar project here on a Teensy 4.0 with a button pad that has 38 buttons in a matrix, 6x6 + a 7th row with 2 buttons. I was wondering if you could post your source code for your joystick. I was trying to utilize the Keypad library but could not get it to function with how my diodes are wired. Thought I do have my matrix functional with different code that does not utilize the Keypad library but it is as a keyboard rather that as a Joystick. My diodes are on the row wires and are 1N4148 diodes.

Sorry to necro this thread.
 
Back
Top