XInput Game Controller for PC Pinball Games
Based on the excellent MSF_FightStick XINPUT project by Zack "Reaper" Littell
The complete project build guide, along with PCB links, wiring schematics, and 3D STL files, is hosted here and backed up on Archive.org.
This code is designed to run on Teensy LC and requires the following libraries:
Please note the instructions for the MSF-XInput library, which requires some Teensyduino files to be overwritten in order to add support for a new USB device type.
I have included compiled code that can be installed on a Teensy LC using the Teensy Loader application. The code will compile for Teensy 3.2 but, besides being more expensive, that board lacks sufficient current output on the LED pins.
- BACK + LEFT FLIPPER: Home analog plunger (if installed)
- BACK + RIGHT FLIPPER: Home/Zero accelerometer
- BACK + JOYSTICK DOWN: Joystick controls D-PAD (default)
- BACK + JOYSTICK UP: Joystick controls left analog stick
- BACK + JOYSTICK LEFT: L1 & R1 flippers (default)
- BACK + JOYSTICK RIGHT: L2 & R2 flippers
Note: If installed, you MUST calibrate the analog plunger range at least once by holding down "A" when plugging in the USB cable. LED-1 should flash rapidly, and then you should pull the plunger all the way out and release it all the way back in. The LED1 should flash again, and normal operation resumes. The setting is saved between power cycles.
- GPIO 21 & 23 connected to L3 & R3 (analog stick buttons). These GPIO pins were previously unused.
- Accelerometer is only zeroed the first time START is pressed, not every time. To zero it again, use the new BACK + RIGHT FLIPPER button combo.
- Plunger base position is now stored between power cycles. You will need to recalibrate the plunger once if upgrading to this firmware by holding A when plugging in the USB cable.
- Auto-detection of four button mode has been improved (avoid false positives).
- Four flipper button support. You can connect a second pair of flipper buttons to GPIO 13 & 14 (Left and Right, respectively) which will map to analog L2/R2 100%. The system will try to autodetect if GPIO 13/14 are connected to double contact or individual switches based on whether GPIO 13/14 are ever pressed without FLIP_L or FLIP_R being pressed (not possible on double contact switches).
- Minor bug fixes.
- Hold Back and press Right on the joystick to map flippers to L2 & R2 analog triggers. This is required by some pinball games.
- Hold Back and press Left on the joystick to map flippers to L1 & R1 buttons (default).
Optionally: You can connect GPIO 13 or 14 to the second stage of double contact switches so FLIP_L & FLIP_R depress the analog triggers by 10% and GPIO 13 & 14 depress them fully. This allows you to control lower and upper flippers independently using a single button (when supported by the game).
(Huge thanks to James Ricalde for his great suggestions and thorough beta testing!)
- Hold Back and press Up on the joystick to map joystick to left analog stick. This is required by Oculus Arcade.
- Hold Back and press Down on the joystick to map joystick to D-pad (default).
- Pressing LB & Back simultaneously sets plunger dead zone. This compensates for PC pinball games that have a huge plunger dead zone that works on Gamepads but is accentuated on real hardware. Just pull the plunger until just before the one in-game starts to move and then hit LB & Back with your other hand. This setting is not saved between power cycles.
- The accelerometer is zeroed out every time Start is pressed.
- Hold left flipper on boot to perform a rumble test.
- Hold right flipper on boot to disable accelerometer.
- Better plunge detection code that scales based on how far back the plunger is pulled.