The RaspBoy (Part 7) – Goodbye Teensy!

Thanks to one of the kind readers on my Blog (Many thanks Hugo!) I started to research a way to use the GameBoy Buttons without the Teensy and – was successfull! There is a great tutorial from Adafruit available

Goodbye Teensy, hello GPIO Pins of the Raspberry Pi!

First of all I had to check if the PCB of the Buttons is still working – after torturing it with my soldering iron it was in a VERY bad shape:

YES, i know, it looks very very bad, but it is still working!

So I soldered the wires to the GPIO Pins and started to modify the tool which is needed to tell the RasPi what to do with the pins.

The tutorial is for a 6 Button setup (4 directional and 2 fire-buttons) so I used 4 more GPIO pins (caution: some of them are preallocated and cant be used). Connected to the RasPi with SSH I downloaded and unpacked this Zip-File and modified the retrogame.c

Even if you have little of no experience in programming this is really easy:

First of all open the file with nano (You´ll find it in the unpacked Adafruit-Retrogame Folder) with

nano retrogame.c

You´ll find the Key-assignment at about line 110 using the format ( {GPIO PIN , KEYCODE} ). Just copy one of the lines and paste it 4 times into the file and assign the GPIO Pins and Keycode the way you need it.

Here are some lines of my retrogame.c:

ioStandard[] = {
// (using HDMI or composite instead), as with our original
// retro gaming guide.
// Input Output (from /usr/include/linux/input.h)

{ 10, KEY_LEFT },        // Left
{ 9, KEY_RIGHT },       // Right
{ 25, KEY_UP },           // Up
{ 9, KEY_DOWN },      // Down
{ 11, KEY_A },             // A
{ 23, KEY_S },             // B
{ 7, KEY_Q },              // X
{ 24, KEY_W },           // Y
{ 18, KEY_TAB },       // Select
{ 17, KEY_ENTER }, // Start

// For credit/start/etc., use USB keyboard or add more buttons.
{ -1, -1 } }; // END OF LIST, DO NOT CHANGE

// This pin/key table is used when the PiTFT isn’t found


ow you have to compile the file with

make retrogame

And edit the rc.local with

sudo nano /etc/rc.local

 pasting the following line BEFORE „Exit 0“ (Adapt the path if necessary)

/home/pi/Adafruit-Retrogame/retrogame &

and save.

Now create with

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

the .rules file and paste

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

in your editor – then save.

Now to a restart with

sudo restart 


Now I have to get rid of the battery-problem….


Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s