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

Thread: Get X/Y Axis with custom gamepad and Teensy 3.2

  1. #1

    Get X/Y Axis with custom gamepad and Teensy 3.2

    I am currently using my Teensy 3.2 as a USB game controller driver. I have gotten all the button presses to work but cant figure out how to program the dpad or joystick? Im using a 4 switch type dpad.

    Any help would be much appreciated.

  2. #2
    Junior Member
    Join Date
    Oct 2019
    Posts
    1

    Teensy as gamepad (with proper dpad support) ?

    Hi, I'm new here and am also wondering about gamepads and their dpad.
    So, @toberryhunter, did you figure out how to use your Teensy as a proper gamepad?

    I did some investigations on my own and if I'm not mistaken, this is the current situation:
    - Standard USB HID devices describe themselves via device descriptors. (See usb_desc.c)
    - Teensy(duino) implements a "Joystick" (0x09, 0x05 "USAGE (Joystick)") but in the USB specs this is different from a gamepad (0x09, 0x04 "USAGE Game Pad").
    - A "dpad" is typically associated with a gamepad and not a joystick; the Teensy provides analog axes and buttons, but not a digital directional pad. It may be possible to have the analog X Y axes send only full left, full right, etc., but the OS would probably not autodetect those axes as a dpad. So no plug & play.
    - In order to use the Teensy as a proper USB gamepad, a new type including a gamepad endpoint needs to be implemented in usb_desc.{c,h}. This could be based on code from other projects: bbyam/teensysimplegamepad , AlanChatham/UnoJoy
    - In order for this new type to show up in the Arduino IDE, boards.txt must be edited. (More details here)

    It'd be very helpful if somebody could confirm some or all of the above. :-)
    I've got some experience with Arduino, AVR, ESP8266, PlatformIO, etc. but not so much with USB HID and modifying core code. I may just as well end up hacking the PCB of a cheap SNES-controller clone...

Posting Permissions

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