PDA

View Full Version : Making A Custom Teensy3 HID Joystick



FuzzyWuzzie
10-26-2013, 03:16 AM
Hello,

A few weeks ago I needed to change the Teensy's default usb joystick behaviour (ie, not have 6 axes + a hat + 32 buttons - only 4 axes + 16 buttons). I didn't really find any guides on how to do this, so I hashed it out myself and wrote a semi-quick guide for anyone else looking to do the same thing to hopefully save them some of the time and frustrations I had. The guide is up on my blog at http://www.hamaluik.com/?p=321. Hopefully someone finds this useful, but if I've left anything out or anything is too confusing, please let me know and I'll try to help you out!

PS, thanks for the EXCELLENT hardware platform to work off of! I already have 6 teensy3's and am considering more for some upcoming projects..

PaulStoffregen
10-26-2013, 07:47 AM
Very nice writeup. I added a link to your instructions at the end of Teensy's joystick page.

FuzzyWuzzie
10-28-2013, 08:53 PM
Awesome, thanks!

Pointy
12-03-2013, 12:21 PM
Hi,

Big thanks for the guide, I have managed to use it to make a new USB Gamepad type and get it to compile (haven't tested the hardware side yet though). Just one quick question for starters...

My device shows the correct name in the Devices & Printers section of Windows 7, but under Game Controllers is shows up as '4 axis 16 button joystick'. Did I miss something somewhere to change this?

Regards,

Les

Pointy
12-03-2013, 11:03 PM
My device shows the correct name in the Devices & Printers section of Windows 7, but under Game Controllers is shows up as '4 axis 16 button joystick'. Did I miss something somewhere to change this?

Showed correctly on another PC, and now shows correctly on this one after deleting some reg keys!

PaulStoffregen
12-04-2013, 09:54 AM
I've never understood why Microsoft doesn't simply use the device's info, which they full read every time the device is plugged in and they have to go through the USB enumeration. They pretty much created "Plug and Play" in the 90s and made every use it.

I guess they love their Windows Registry a lot and would rather depend on stale info, even when they always have the read everything freshly from the device every time it's connected. Crazy.

Pointy
01-28-2014, 09:21 AM
Sorry to drag up and older post but while working on a similar guide (http://www.planetpointy.co.uk/custom-teensy-2-0-joystick/) for the older teensy boards, it occured to me that the older way of doing this may have been better.

When upgrading the Teensy software any changes made to the following files WProgram.h, usb_desc.h, usb_desc.c and usb_inst.cpp for Teesny 3 will be overwritten. Which will effectively wipe out your custom joystick/usb device, especially if you haven't backed it up somewhere else.

For the older boards it will reset core_id.h, usb.c, usb.api.cpp, usb_api.h and usb_private.h in the teensy folder, but assuming you have added a new folder for you custom joystick/device the core files will be left intact. It's just a matter of adding 2 lines back to the above files for the includes.

Maybe the Teensy 3 should be done with includes, so custom USB devices aren't overwritten when doing software updates?

Regards,

Les

vitormhenrique
03-30-2017, 08:37 PM
Very nice writeup. I added a link to your instructions at the end of Teensy's joystick page.

Paul, is this tutorial still applicable for the new releases? after making the changes I don't see any usb interface on my computer.

Technicus
11-20-2017, 09:26 PM
Hello,

I setup a Teensy 2.0 as a joystick following this tutorial: < https://www.pjrc.com/teensy/td_joystick.html >. It works as intended. The Teensy is recognized as a joystick with 8 axis and 32 buttons. That is fine, but exceeds what I need.

I am now trying to modify the joystick to show up with no axis and just 15 buttons. I tried following this tutorial: < http://www.planetpointy.co.uk/custom-teensy-2-0-joystick/ >, but I get stuck at: "We are going to add a new USB type for our new joystick and we will call it Gamepad. First open up the ‘boards.txt‘ file found in a ‘arduino install folder\hardware\teensy‘." I am doing this with an ArchLinux OS. The arduino files are located here: '~/.arduino15' and here: '~/Arduino'.

I have also sought assistance from Freenode.net #arduino IRC channel. The people there suggested that I come here for help with this. Any advice or suggestions would be super awesome.

Thanks.

Edit:
Since posting last I have found the install path it is: '/usr/share/arduino/hardware/teensy/avr/cores/' , but I seem to have the same results as vitormhenrique. Here is another link that has HID information: < http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/ >.