Many axis joystick

Is it possible with the current teensyduino 1.56 and arduino IDE to get the teensy 2.0++ with 64 or 128 joystick buttons working somehow? I have encountered the files for teensy 3 and teensy 4, but not for the 2.
 
I have ordered myself a Teensy 3.2 to get around this.
The 128 buttons are working fine by editing the header file. However the axis do not seem to respond, even when not assigned to analogreads but just sending values. As soon as a button is sent as a joystick "command", all axis get reset to 0 and the hat switches have angle 0. No axis change can be manipulated.
 
So this is something that I have been working on for a while and actually have had working for a while..

THIS HID Header Stack that I figured out some months ago should give you all you need to get an extended Joystick Working properly WITH backwards compatibility to Legacy Windows HID Devices..

Even though this is an extended joystick I have been able to get full referencing in the standard Windows HID Tester..

NOTE: this is for the Teensy 3 and LC for sure.. not sure if the setup is the same for other Teensy's but the header stack should work anywhere.

These Headers will offer up a Joystick with the capability of:

128 - Buttons
6 - Primary Axes (16bit)
4 - Hats
17 - Sliders (16bit)

You can adjust these but in order to see the HID backwards compatibility you will not want to change the
// Collection (Axes) - Default Axis Collection or the
// Collection (Axes) - Default Slider Collection sections.

This goes into the usb_dec.c file replacing the JOYSTICK_SIZE == 64 section, you must set the rest of the system to use this set of descriptors.

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
//    4 pov        2
//   17 sliders   34
static uint8_t joystick_report_desc[] = {
        0x05, 0x01,                 // Usage Page (Generic Desktop)
        0x09, 0x04,              	// Usage (Joystick)
        0xA1, 0x01,                 // Collection (Application)
        0xA1, 0x00,                     // Collection (Buttons)
        0x15, 0x00,                    		// Logical Minimum (0)
        0x25, 0x01,                    		// Logical Maximum (1)
        0x75, 0x01,                    		// Report Size (1)
        0x95, 0x80,                    		// Report Count (128)
        0x05, 0x09,                    		// Usage Page (Button)
        0x19, 0x01,                    		// Usage Minimum (Button #1)
        0x29, 0x80,                     	// Usage Maximum (Button #128)
        0x81, 0x02,                     	// Input (variable,absolute)
        0xC0,                           // End Collection
        0x05, 0x01,                     // Usage Page (Generic Desktop)
        0x09, 0x01,                     // Usage (Pointer)
        0xA1, 0x00,                     // Collection (Axes) - Default Axis Collection 
        0x15, 0x00,                     	// Logical Minimum (0)
        0x27, 0xFF, 0xFF, 0x00, 0x00,       // Logical Maximum (65535)
        0x75, 0x10,                     	// Report Size (16)
        0x95, 0x06,                     	// Report Count (6)
        0x09, 0x30,                     	// Usage (X)		DX X
        0x09, 0x31,                     	// Usage (Y)		DX Y
        0x09, 0x32,                     	// Usage (Z)		DXSlider #1
        0x09, 0x33,                     	// Usage (Rx)		DX Rx
        0x09, 0x34,                     	// Usage (Ry)       DX Ry 
        0x09, 0x35,                     	// Usage (Rz)		DX Rz
        0x81, 0x42,                     	// Input (variable,absolute,null_state)
        0xC0,                           // End Collection
        0x05, 0x01,                     // Usage Page (Generic Desktop)
        0x09, 0x01,                     // Usage (Pointer)
        0xA1, 0x00,                     // Collection (Axes) - Default Slider Collection 
        0x15, 0x00,                     	// Logical Minimum (0)
        0x27, 0xFF, 0xFF, 0x00, 0x00,       // Logical Maximum (65535)
        0x75, 0x10,                     	// Report Size (16)
        0x95, 0x02,                     	// Report Count (2)
        0x09, 0x36,                     	// Usage (Slider)	DX Z
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #2
        0x81, 0x42,                     	// Input (variable,absolute,null_state)
        0xC0,                           // End Collection
        0x05, 0x01,                     // Usage Page (Generic Desktop)
        0x09, 0x01,                     // Usage (Pointer)
        0xA1, 0x00,                     // Collection (Axes)
        0x15, 0x00,                     	// Logical Minimum (0)
        0x27, 0xFF, 0xFF, 0x00, 0x00,       // Logical Maximum (65535)
        0x75, 0x10,                     	// Report Size (16)
        0x95, 0x0F,                     	// Report Count (15)
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #17
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #16
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #15
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #14
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #13
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #12
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #11
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #10
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #9
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #8
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #7
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #6
        0x09, 0x36,                     	// Usage (Slider)	DXSlider #5
        0x09, 0x36,                     	// Usage (Slider) 	DXSlider #4
        0x09, 0x36,                     	// Usage (Slider) 	DXSlider #3     
        0x81, 0x42,                     	// Input (variable,absolute,null_state)
        0xC0,                           // End Collection
        0x05, 0x01,                     // Usage Page (Generic Desktop)
        0xA1, 0x00,                     // Collection (Hats)
        0x15, 0x00,                     	// Logical Minimum (0)
        0x25, 0x07,                     	// Logical Maximum (7)
        0x35, 0x00,                     	// Physical Minimum (0)
        0x46, 0x3B, 0x01,               	// Physical Maximum (315)
        0x75, 0x04,                     	// Report Size (4)
        0x95, 0x04,                     	// Report Count (3)
        0x65, 0x14,                     	// Unit (Eng Rot: Degree)
        0x09, 0x39,                     	// Usage (Hat switch)
        0x09, 0x39,                     	// Usage (Hat switch)
        0x09, 0x39,                     	// Usage (Hat switch)
        0x09, 0x39,                     	// Usage (Hat switch)
        0x81, 0x02,                     	// Input (variable,absolute,null_state)
        0xC0,                           // End Collection
        0xC0                     	// End Collection
};
#endif // JOYSTICK_SIZE

I hope this helps those trying to make a Workable Extended Joystick as it took a lot of Research and trial and error to figure these out.
 
Hello all, I am currently working on a button box using a Teensy 4.1 and the extreme joystick "setting". I have got all of the buttons functioning but my four sliders (https://uk.farnell.com/bourns/ptv09a-4020u-b104/pot-rotary-100kohm-9mm-20/dp/2469526) are not being read correctly.
I am using the Joystick test program that was posted in this thread a few years ago to test the button box and using DCS World (Flight Sim that can handle all the inputs) as back up testing.
The issue is when not using the extreme joystick "setting" the first 32 buttons work fine and so do all four pots, but when I use the extreme "setting" all of my buttons work (38 in total) but the effect my pots have in joystick test are negligible and are not picked up by DCS. In my code I added a serial print for the
analogue values being read from the pots and they are working fine (reading between 0 and 1023 as expected).
My belief is that the Teensy is reading the pots in 10bit but for some reason windows (and there for both my testing programs) are reading the number in 16bit.
Any help on this matter would be greatly appreciated with either changing what windows sees or what the Teensy sees.
 
Hello all, I am currently working on a button box using a Teensy 4.1 and the extreme joystick "setting". I have got all of the buttons functioning but my four sliders (https://uk.farnell.com/bourns/ptv09a-4020u-b104/pot-rotary-100kohm-9mm-20/dp/2469526) are not being read correctly.
I am using the Joystick test program that was posted in this thread a few years ago to test the button box and using DCS World (Flight Sim that can handle all the inputs) as back up testing.
The issue is when not using the extreme joystick "setting" the first 32 buttons work fine and so do all four pots, but when I use the extreme "setting" all of my buttons work (38 in total) but the effect my pots have in joystick test are negligible and are not picked up by DCS. In my code I added a serial print for the
analogue values being read from the pots and they are working fine (reading between 0 and 1023 as expected).
My belief is that the Teensy is reading the pots in 10bit but for some reason windows (and there for both my testing programs) are reading the number in 16bit.
Any help on this matter would be greatly appreciated with either changing what windows sees or what the Teensy sees.

When using the extreme Joystick Windows reads the HID Headers in a certain manner I have found.. It Reads and allocates from the Bottom of the list to the top so most likely the test program being used does not cover all of the sliders offered so they are not being shown OR the program you are trying to use does not have enough mapped sliders and your programming is sending to some of those unmapped sliders..

If you look at my USB Header code from the post above.. you will see that I have actually commented which slider # corresponds to each location so within the joystick.h if you have all these sliders set up in order to actually use the sliders in windows enumerated order slider #3 information needs to be sent to Slider #17 from joystick.h.. (4 to 16, 5 to 15 etc...).

it took me a while to figure this one out myself. The weird thing is that YES the buttons enumerate in correct order..

BTW, the headers above are Windows Backward compatible.. which is not the case with the standard Teensy Header stack.
 
Thank you for the response, I have now modified my usb_dec.c file, as backwards compatibility is always a good thing, but alas my issue still persists. I am getting minute movement on the X and Y axis and no movement being picked up on Z and Xrotate.
I have currently got it working via brute force. I have mapped all of the pot outputs to 0-65535 instead of 0-1023 and it works now.
 
Thank you for the response, I have now modified my usb_dec.c file, as backwards compatibility is always a good thing, but alas my issue still persists. I am getting minute movement on the X and Y axis and no movement being picked up on Z and Xrotate.
I have currently got it working via brute force. I have mapped all of the pot outputs to 0-65535 instead of 0-1023 and it works now.

Actually that would be what you have to do.. With the USB Headers that I developed above it has (17) 16bit sliders.. SO if you were only sending 10bit data raw there would be only minor movement on the sliders.. You need to use the map() function to remap the 1024 output to a 65535 output to use them without having to modify the header file.. You can modify the header file to tell windows that the sliders are 1024 (10bit) but that is definitely more involved.. The good side of doing that would be that you would not have to be doing the mapping calculations..
 
Actually that would be what you have to do.. With the USB Headers that I developed above it has (17) 16bit sliders.. SO if you were only sending 10bit data raw there would be only minor movement on the sliders.. You need to use the map() function to remap the 1024 output to a 65535 output to use them without having to modify the header file.. You can modify the header file to tell windows that the sliders are 1024 (10bit) but that is definitely more involved.. The good side of doing that would be that you would not have to be doing the mapping calculations..

The usb_joystick.h code included with the current Teensy package does include the mods for the "extreme" joystick version. Folks need to pay attention to the fact that if JOYSTICK_SIZE is set to 12, all of the analog methods are going to clamp the passed value to 10 bits. When JOYSTICK_SIZE is 64, it's going to clamp them to 16 bits.

Brion: Have you submitted your changes of the joystick_report_desc[] array to Paul so your version can be included with the next release of the library package? I'm sure he'd be interested if your version is "more correct" than the one that's currently shipping.

tnx.

g.
 
I honestly cannot remember lol. I think I may have mailed them to Paul directly in the past as it has been a year an a half about since I got them all working.. I ended up integrating them into the normal Extended location but personally if they were integrated into the Teensy release due to the size this thing allows (128 buttons, 6 Axis, 17 Sliders, and 4 hats) it seems like it should be under a third definition beyond the 12 and 64 refs to make things easier..

everything has been working for me with them.. Though some software of course still doesn't actually have recognition beyond the standard 32/8/1 inputs.
 
Thank you.. I will check it out.. that descriptor can actually be changed up quite a bit. It currently uses the Maximum Allocation for the decryption but On could if they wanted increase the button count and either lower the slider OR Resolution or count or add more sliders with lower resolutions.. I believe 4 Hat Switches is the Maximum that Windows will enumerate though so I don't believe you can go above the 4 on that..

The sections that have to remain as they are (But resolution can change) for the backwards compatibility to older and the standard interface for windows is the Main 6 axis and then the section with the 2 additional sliders.. I believe I tested it reducing the resolution in those sections though to open up more buttons and it did work properly.

It is pretty flexible really.. the hardest part was getting the Usage Page enumeration correct so that each section of the standard Windows enumeration was picked up correctly which allows the extreme extended joystick the ability to first be viewed as a standard 32/6/2 joystick making it compatible with anything using a standard controller including the Windows Basic Game properties.
 
hello everyone, i tried joystick set to 64 (extreme) and i use pointy joysticktest.exe to test but in raw mode it not response only in directx input mode, im try to using 10sliders, please advise thankyou so much
 
Last edited:
1727235430073.png

i dont understand why my slider is not mapping it correctly
 
Back
Top