Hello gents, thank you for all your answers again.
I am not measuring the resistance between two GPIO pins when the system has power.
I did measure the voltage on them though (just to make sure, and the read was 3.2V pretty much as expected).
Then I only used an ohmmeter on the
unplugged joystick to make sure the pins were not shorted
before connecting it to P1 using jumper wires.
So, back on topic, this is how I connect to the joystick:

which is pretty much the same as Adafruit's guide.
This is the "driver":
https://github.com/adafruit/Adafruit-Re ... etrogame.c
...and the only part I had to change is the actual mapping:
Code: Select all
struct {
int pin;
int key;
} io[] = {
{ 25, KEY_LEFT },
{ 10, KEY_RIGHT },
{ 7, KEY_UP },
{ 8, KEY_DOWN },
{ 11, KEY_LEFTCTRL },
{ 9, KEY_LEFTALT }
};
Note that internal pullups are enabled around line 250.
It also does this to configure the pins via sysfs:
Code: Select all
if(pinConfig(io[i].pin, "direction", "in") ||
pinConfig(io[i].pin, "edge" , "both"))
err("Pin config failed");
Seems ok to me, and if I connect only one switch to, let's say GPIO 7, that works and I get a KEY_UP when the circuit is closed.
The issue is: if another switch is connected, let's say to GPIO 8 and common ground (P1-25), and I close it... instead of getting just KEY_DOWN I also get KEY_UP as if the other switch was closed too.
If I connect all the switches and close just one, I gett ALL the KEY_* events at the same time, as if I had pressed all buttons.