Page 3 of 10

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Thu Jul 07, 2016 3:51 am
by m0rphman
Hi so I've done everything as outlined in this tutorial, but for some reason I can't get my button presses to work. I've checked current with DMM and It seems I'm properly grounded. I'm using a slightly different pin setup for testing at this point, I am using physical pin 39 for the ground and 40 to test with the left button. EmulationStation however only recognizes the button if I touch the wire to the contact, and not if the contact is soldered and then the button is pressed. Any ideas why this would be?

Just a little more information, I'm using the kitsch-bent expanded common ground pcb and 40-pin gpio cable so I don't have to solder to the gpio pins. Any help would be much appreciated!!
Maybe the the resistance between the GPIO and GND pin is too high because the connection on your button board so too weakly closed by your button press? In my setup for example, I drilled the holes for the X and Y buttons slightly off center, so if I press one of those buttons only a small part of the contact pad is bridged. I connected an LED to check the connection and I found that the LED is dimmer when I use the X or Y button compared to any other button which are more well centered.
Do you have this problem with all buttons or just the left button?

Also I have a general question about using the GPIO pins for input. Is it still possible to connect an external controller via USB or do I have to change the input configuration in emulationstation everytime I want to use either the GB buttons or the external controller?

Thanks
m0rphman

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Mon Jul 11, 2016 11:03 am
by winnetouch
I'm trying this on a raspberry pi zero to use with retropie. But it seems the 10-retrogame.rules is never generated no mater how many times I make the retrogame files. Is anyone else gaving issues with that? After I type the make retrogame command I get this returned:

Code: Select all

gcc  -Wall -O3 -fomit-frame-pointer -funroll-loops -s retrogame.c -o retrogame
strip retrogame

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Mon Jul 11, 2016 1:32 pm
by m0rphman
I'm trying this on a raspberry pi zero to use with retropie. But it seems the 10-retrogame.rules is never generated no mater how many times I make the retrogame files. Is anyone else gaving issues with that? After I type the make retrogame command I get this returned:
When you use the

Code: Select all

make retrogame

command that does not automatically create the 10-retrogame.rules file. In order to do that you have to run the code prerunnerseth posted:
To add the rule, run the following command to create and edit the file /etc/udev/rules.d/10-retrogame.rules in the nano text editor:

Code: Select all

sudo nano /etc/udev/rules.d/10-retrogame.rules

Now copy in the following line exactly as shown (this should all be on a single line in the rules file, i.e. don't put in any linebreaks):

Code: Select all

SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"

Save the file by pressing Ctrl-O and pressing enter, then exit nano by pressing Ctrl-X. Restart your Raspberry Pi to make sure the new configuration is loaded.
Now we’re in good shape to test it!
Good Luck :)

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Sun Jul 24, 2016 5:26 pm
by Racerboy
I keep getting this error when I input the "sudo ./retrogame" command:

Code: Select all

./retrogame: Pin config failed. Try 'sudo ./retrogame'.
Anyone know why? Pretty sure I did all the steps correctly.

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Mon Jul 25, 2016 4:20 pm
by Racerboy
Oh, my pin 23 is being taken up by my TFT display (temporary...), and it won't allow it to configure (not sure why?)

Is there a workaround for this?

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Thu Jul 28, 2016 5:29 am
by prerunnerseth
Racerboy wrote:Oh, my pin 23 is being taken up by my TFT display (temporary...), and it won't allow it to configure (not sure why?)

Is there a workaround for this?
If your TFT is using the pin then it cant be configured for something else. You can change the code in the retrogame.c file to configure it to use another available pin.

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Thu Jul 28, 2016 9:15 am
by Racerboy
prerunnerseth wrote:
Racerboy wrote:Oh, my pin 23 is being taken up by my TFT display (temporary...), and it won't allow it to configure (not sure why?)

Is there a workaround for this?
If your TFT is using the pin then it cant be configured for something else. You can change the code in the retrogame.c file to configure it to use another available pin.
I'm just confused because these are the pins that my TFT display takes up (boxed in red):

Image

Unless I'm missing something, none of which are used in the retrogame.c file.

Does the "input" column in the pin/key table mean the pin # or the BCM #?

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Thu Jul 28, 2016 9:27 am
by prerunnerseth
Racerboy wrote:
prerunnerseth wrote:
Racerboy wrote:Oh, my pin 23 is being taken up by my TFT display (temporary...), and it won't allow it to configure (not sure why?)

Is there a workaround for this?
If your TFT is using the pin then it cant be configured for something else. You can change the code in the retrogame.c file to configure it to use another available pin.
I'm just confused because these are the pins that my TFT display takes up (boxed in red):

Image

Unless I'm missing something, none of which are used in the retrogame.c file.

Does the "input" column in the pin/key table mean the pin # or the BCM #?
BCM #

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Fri Jul 29, 2016 12:42 pm
by Racerboy
Edit: See below

Re: How to - Use the GPIO for Buttons instead of a Teensy

Posted: Sat Jul 30, 2016 8:24 pm
by Racerboy
Image

@prerunnerseth So it can't configure pin 23, which is BCM 11 (SCLK), which is being used by my display. But I'm not sure why that matters because in the retrogame.c code, BCM 11 isn't even referenced, and that pin shouldn't even be used by retrogame.