ChrisDeadman / usb-to-ps2-gameport-hat

Convert USB devices to PS/2 & Gameport devices with the power of Arduino 🙂
MIT License
15 stars 1 forks source link
arduino converter gamepad gameport gameport-joystick joystick keyboard ps2 ps2-keyboard ps2-mouse usb

Usb => PS/2 & Gameport HAT v1.4

Author: ChrisDeadman

Convert USB devices to PS/2 & Gameport devices with the power of Arduino 🙂

3D render

Supported input devices

* Descriptor parsing is a work in progress and may not work for all devices.
** Currently, only the Xbox 360 Wireless Receiver is supported.

Outputs

* All types are supported, including IntelliMouse (5 Buttons + Scroll wheel).
** Scancode Set 2

Supported Arduino Boards

* Other ATSAMD21G18 boards should also work well, provided they have the same pinout.

Usage

LEDs

Input Mappings

USB -> Gameport

This is how USB Joysticks / Gamepads are mapped to the Gameport:

Joystick 1 Joystick 2 Gameport
X-Axis 1 / D-Pad - X-Axis 1
Y-Axis 1 / D-Pad - Y-Axis 1
X-Axis 2 X-Axis 1 / D-Pad X-Axis 2
Y-Axis 2 Y-Axis 2 / D-Pad Y-Axis 2
Button 1 / A / R2 - Button 1
Button 2 / B / L2 - Button 2
Button 3 / X / Select Button 1 / A / R2 Button 3
Button 4 / Y / Start Button 2 / B / L2 Button 4

Emulation Mode Mappings

Consult the table below to understand the mapping between various device inputs when an emulation mode is enabled:

Keyboard Mouse Joystick Gameport
Left / Right Arrow X-Axis X-Axis 1 / D-Pad X-Axis 1
Up / Down Arrow Y-Axis Y-Axis 1 / D-Pad Y-Axis 1
A / D - X-Axis 2 X-Axis 2
W / S Scroll wheel Y-Axis 2 Y-Axis 2
L-Ctrl / R-Ctrl Button 1 Button 1 / A Button 1
Space / R-Shift Button 2 Button 2 / B Button 2
L-Alt / CapsLock Button 3 Button 3 / X Button 3
L-Shift Button 4 Button 4 / Y Button 4
Period Button 5 Button 5 / R1 -
Comma - Button 6 / L1 -
Up Arrow - Button 7 / R2 -
Down Arrow - Button 8 / L2 -
Escape - Button 9 / SELECT -
Tab - Button 10 / START -

Here are a few examples:

Setup Mode

Enter this mode to enable special features. Note that those settings are reset to default when the device is reset.

Feedback

Settings

Setting LED1 Blinks Values / LED2 Blinks Default
Emulation Mode 1 OFF OFF
1 Joystick -> Keyboard
2 Joystick -> Mouse
3 Keyboard -> Joystick
4 Keyboard -> Mouse
5 Mouse -> Joystick
Swap joy axis 3 and 4 2 ON / OFF OFF
Mouse Emu Speed 3 1 <= n <= 255 2

Key bindings

Keyboard Joystick / Gamepad Function
CTRL+SHIFT+WIN Button 5 / R1 + Button 6 / L1 Hold for ~1s to enter/exit setup mode
Return Button 1 / A Edit setting / exit edit mode
Right Arrow X-Axis 1 / D-PAD Right Next setting / increase value (edit mode)
Left Arrow X-Axis 1 / D-PAD Left Prev. setting / decrease value (edit mode)
ESC Button 9 / SELECT Apply Default Settings and exit setup mode
F1 - Set Emulation Mode #1 and exit setup mode
F2 - Set Emulation Mode #2 and exit setup mode
F3 - Set Emulation Mode #3 and exit setup mode
F4 - Set Emulation Mode #4 and exit setup mode
F5 - Set Emulation Mode #5 and exit setup mode
F6 - Toggle Swap joy axis 3 and 4 and exit setup mode
F7 - Decrease Mouse Emu Speed and exit setup mode
F8 - Increase Mouse Emu Speed and exit setup mode

Flashing the firmware

Automatically

Manually

Ensure you change --port to match your system's actual port. The example provided is for Linux systems.

Developer Notes

Schematic

Schematic

Layout

Layout

Upside

Upside

Backside

Backside

Release notes

Usb => PS/2 & Gameport HAT v1.4

Usb => PS/2 & Gameport HAT v1.3

Usb => PS/2 & Gameport HAT v1.2

Usb => PS/2 & Gameport HAT v1.1

Usb => PS/2 & Gameport HAT v1.0