I’m also thinking whatever it is might need to disable the joystick switches and wait for a split second then engage the direction/button switches I want.
It should be possible to do this with a custom Arduino keyboard sketch.
- Even an inexpensive Arduino Pro Micro knockoff has more than enough ports for this keyboard encoder project.
Wire the 13 joystick and button switches directly (no diodes) to 13 input ports.
The program loop would do something like this:
- Read joystick switches and (center) fire button.
- Send simultaneous keystrokes for joystick direction and/or fire.
-
Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
- Read directional fire buttons. (8 outer buttons)
- Send simultaneous keystrokes for directional fire.
-
Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
If you're pressing left on the joystick and the (center) fire button, the first read/send will output "left+fire" and the second read/send will output nothing.
If you're pressing left on the joystick and the top center button, the first read/send will output "left" and the second read/send will output "up+fire".
NOTE: This might cause problems if the program requires continuous button-presses or has problems with the timing.
If that happens, you could add an SPDT switch on a 14th port to toggle between 1 read/send "continuous" (logic high) and 2 read/send "isolated" (logic low) modes.
That program loop would do something like this:
- Read mode switch port and set variable.
- If mode switch variable = high do this section, else skip to next section.
-- Read all switches.
-- Send simultaneous keystrokes.
-- Return to beginning of the loop.
- If mode switch variable = low do this section, else return to beginning of the loop.
-- Read joystick switches and (center) fire button.
-- Send simultaneous keystrokes for joystick direction and/or fire.
--
Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
-- Read directional fire buttons. (8 outer buttons)
-- Send simultaneous keystrokes for directional fire.
--
Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
-- Return to beginning of the loop.
Scott
EDIT: You might want to define the "continuous" and "isolated" code as modules to simplify the program loop.