Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Making A Custom Teensy3 HID Joystick

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    3

    Post Making A Custom Teensy3 HID Joystick

    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..

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    Very nice writeup. I added a link to your instructions at the end of Teensy's joystick page.

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Awesome, thanks!

  4. #4
    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

  5. #5
    Quote Originally Posted by Pointy View Post
    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!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    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.

  7. #7
    Sorry to drag up and older post but while working on a similar guide 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

  8. #8
    Senior Member
    Join Date
    Aug 2014
    Posts
    124
    Quote Originally Posted by PaulStoffregen View Post
    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.

  9. #9
    Junior Member
    Join Date
    Nov 2017
    Posts
    3

    Custom USB Joystick

    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...-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-ab...t-descriptors/ >.
    Last edited by Technicus; 11-21-2017 at 03:39 AM. Reason: Unknown

  10. #10
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    This tutorial is now out of date, but I still have people asking for the information as a starting-off point for their own adventures. Since posting, the address for this tutorial has changed, so if you're looking for it you can now find it at https://blog.hamaluik.ca/posts/makin...-hid-joystick/. Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •