GP2X Gp2x Joystick Actual Facts


Squidge

Certified Guru
Joined
Nov 16, 2003
Messages
8,493
Location
UK
Website
Visit site
(poor) ASCII drawing of rear of joystick.

Code:
12    o   o 1
11   o      o 2
10  o          o 3
 9 o         o 4
 8  o       o 5
 7    o   o 6

12 connections in total mapped out as follows:

1 - Ground
2 - Up Right
3 - Right
4 - Ground
5 - Down Right
6 - Down
7 - Ground
8 - Down Left
9 - Left
10 - Ground
11 - Up Left
12 - Up

So there you have it. 8 directions and 4 grounds, which means an 8-way joystick. Each switch is completely seperate and if you hold the joystick between up and up right, you only get either up or up-right (depending on where about you hold it), you don't get both.

Can we now drop the "It's 12 way, 16 way, 24 way, 32 way" joystick talk?
 
How would this 8 switch setup work? What if you push the stick and register up and the up right diagonal switch at the same time? Would it register up or diagonal? Since you are pressing both how would it know what you wanted? It seems like this arrangement would cause alot of undesired operations. If I wanted to press up and hit both up and diagonal by accident and it gave me diagonal that would be a problem. This would happen much easier than a normal stick or pad. This would make playing some MAME games like MsPacman or MrDO! a problem as you would get many undesired reads. This is probably why a hardware 8-way was never done until now.
 
DaveC,

He said plainly that it CAN NOT read up and up left etc. at the same time.

The hardware won't give such a signal
 
I'm willing to trust Squidgey on this one. :)
And I don't imagine it will be a problem. The difference between right and up-right, for instance, is generally pretty strong (for lack of a better word), but the difference between up-up-right and up-right is trivial at most. Nobody could really intentionally go right in the middle (at least not while playing a serious game).

What DaveC says does trouble me a *little* though. What about games that only support 4-way movement? How do you choose between two directions if it's exactly in the middle? Do you base it on what's been pressed previously?

EDIT: Lol contradiction. Sort of. I've clarified a bit.
 
Squidge posted on Oct 26 2005 at 06:30 PM said:
Each switch is completely seperate and if you hold the joystick between up and up right, you only get either up or up-right (depending on where about you hold it), you don't get both.
I get both on mine. The stick was too senstive in duke so I had to tweak sdl to only return single values. I've also just tried out a quick test app in case duke was fooling my brain in some way, and it shows that /dev/gpio certainly does return 16 different values (not including the stick being pressed in).
 
Last edited by a moderator:
woogal posted on Oct 26 2005 at 07:28 PM said:
Squidge posted on Oct 26 2005 at 06:30 PM said:
Each switch is completely seperate and if you hold the joystick between up and up right, you only get either up or up-right (depending on where about you hold it), you don't get both.
I get both on mine. The stick was too senstive in duke so I had to tweak sdl to only return single values. I've also just tried out a quick test app in case duke was fooling my brain in some way, and it shows that /dev/gpio certainly does return 16 different values (not including the stick being pressed in).

OMG! You've got Duke Nukem running!!! B)
 
Last edited by a moderator:
No, it doesn't click.

I measured the contacts with a multimeter, and it doesn't seem to allow two directions to be selected at the same time. Also, reading the GPIO port, it seems that only 1 bit is ever set.

For porting stujff, you can emulate the older GP32 joystick quite easily with a swtich/case...

switch (joystick_direction)
{
case up: result = up;
case upright: result = up + right;
case right: result = right;
etc...
}

So calm down DaveC... :)

Hmmm, if Woogal gets both, maybe I need to attack another devboard to make sure... Problem is, the above is from my first devboard, and the second has a faulty joystick in which some directions don't work at all.

Still, at least we have the pinout now :)
 
Squidge: thanks for the information :)

Just a little correction with regard to the joystick button: it's on pin 7. The picture is looking down at the CPU side of the board from what would be front of the GP2X:
Code:
       U  COM
     UL      UR
               R
  COM          COM
    L
     DL     DR
       JS D

where

COM = Common
U   = Up
D   = Down
L   = Left
R   = Right
UL  = Up Left
UR  = Up Right
DL  = Down Left
DR  = Down Right
JS  = Joystick Button

From woogal's experience, coders should not assume that there will never be more than one switch closed at once!
 
Squidge posted on Oct 26 2005 at 06:32 PM said:
swtich/case...

switch (joystick_direction)
{
case up: result = up;
case upright: result = up + right;
case right: result = right;
etc...
}

So calm down DaveC... :)



I am calm :) I was just wondering as it is weird. Refer below:

SWITCH.JPG


I can see from this a few different cases when emulating an 8-way stick.

The one on the left is a "normal" stick/pad.

In this case:
sw1 is up.
sw1+ sw2 is up-right diag.
sw2 is right.
and on...

Notice the probability to hit a direction is all the same.

On the GP2X it is a bit different there could be different ways it could be done at the lower level.

case 1:

sw1 is up
sw1+sw2 is up
sw2 is up-right diagonal
sw2+sw3 is right.
sw3 is right
and so on...

Probability is higher that you will hit a straight up, down, left, right, as more combinations exist for that.

case 2:

sw1 is up
sw1+sw2 is up-right diagonal
sw2 is up-right diagonal
sw2+sw3 is up-right diagonal.
sw3 is right
and so on...

Probability is higher that you will hit a diagonal as more combinations exist for that.

Of course there maybe a mechanical stop somewhere that only allow for one switch at a time to be activated. I don't have a dev board so I would not know that.
 
Last edited by a moderator:
Robster posted on Oct 26 2005 at 09:35 PM said:
Squidge: thanks for the information :)

Just a little correction with regard to the joystick button: it's on pin 7.

Thanks, I was kinda wondering how that was connected after posting my findings :)

We need to start documenting these findings, so I'm going to throw them on the Wiki.
 
Last edited by a moderator:
Wow.... I didn't realize this was such a can of worms when I first came to this board.

So, accepting those findings but just to clarify.... What is the advantage of having 8 discrete microswitches (as opposed to having 4 and inferring the diagonals) if only one can be activated at a time? It seems like an unnecessary expense to me unless there's some factor I'm missing.

Also, to those with devboards who are not seeing more than one switch active at a time, (I guess that means Squidge) how does the console handle the transition between two directions? Is it a smooth, instant change from one to the other? Is there a deadzone? I had always been under the impression that the "overlap" area between switches was not only to allow programs to infer the extra diagonal but to prevent the existence of a deadzone where no switches were detecting anything at all. And I'm concerned that we'll see GP2Xes develop a tendency to not register at all with certain directions, ala the GP32.

EDIT: Misspelled a few words.
 
The GP32 does register all 8 directions...until you use it for a year, that is.
Also, if you pull up sharply on the GP32 stick, all directions register at the same time.

I think this new design makes for more robustness and sensitivity, and if that works, it will be a big improvement.
 
Back
Top