gameboy nano guide - thingiverse · 3 introduction this project is essentially a scaled down...
TRANSCRIPT
1
GameboyNanowithD-PadRaspberryPiZero
LastUpdated6/10/2016
2
TableofContentsTableofContents.....................................................................................................................2
Introduction..............................................................................................................................3
SDCardImage-RetroPi........................................................................................................4Software......................................................................................................................................5Controls................................................................................................................................................5ScreenDrivers(FBCP).....................................................................................................................7
ComponentDiagram...............................................................................................................9
GPIOWiring............................................................................................................................10
3DPrintFiles.........................................................................................................................11Roms.........................................................................................................................................12
AppendixA:retrogame.ccode.........................................................................................13
3
IntroductionThisprojectisessentiallyascaleddownversionofAdafruit’sPigrrl2.FormanyaspectsofthisprojectIusedtheirguideasasupport.IwanttothankAdafruitfortheirgreatguidehttps://learn.adafruit.com/pigrrl-2/overviewAswellasRasmushauschildforallhissupportandgreatideasleadingtothiswonderfulproject:http://www.thingiverse.com/thing:1334253Thisguideshouldactasagreatjumpingoffpoint.FormoreinformationonRetroPiandEmulationStationvisit:https://retropie.org.uk/
4
SDCardImage-RetroPiTosaveyourselfsometroubleinstallingEmulationStationandconfigureinputsIwouldrecommendflashingtheRaspberryPiZeroimageofRetroPitoyoucard,foundonthelinkbelow.https://retropie.org.uk/download/RetroPihasmanytutorialsandhelptoguideintheinstallationprocess.Startwiththisasyoubasebeforeyouproceeded.
5
Software
ControlsToaddcontrolstoGameboyNanowewilluseAdafruitsRetroGame.Toinstallfollowingthefollowingsteps.
cd
git clone https://github.com/adafruit/Adafruit-Retrogame
cd Adafruit-Retrogame
sudo nano retrogame.c
Edit the file retrogame.c, looking for the table called ioStandard (not the ioTFT table — that’s for other projects). Each line in brackets represents one pin on the GPIO header and a corresponding key code.
Figure1:https://learn.adafruit.com/assets/23707
SeeAPENDEXAformyretrogame.ccode.Thefulllistofavailablekeycodescanbefoundin/usr/include/linux/input.hAfteryouhaveeditedthefiletoyourlikingmakethefileandmoveitusingthefollowingcommands. make retrogame mv retrogame /usr/local/bin/
6
Makesureyoubootupthefilebyaddingthefollowinglineto/etc/rc.local(AlreadydoneifyoucopiedcodefromScreenDriversSection /usr/local/bin/retrogame & Addthecontrolstoretrogame
sudo nano /etc/udev/rules.d/10-retrogame.rules
SUBSYSTEM=="input", ATTRS{name}=="retrogame", ENV{ID_INPUT_KEYBOARD}="1"
ReboottheSystem sudo reboot FormorehelpseeAdafruitsguide:(Source:https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/adding-controls)
7
ScreenDrivers(FBCP)TogetoutAdafruit1.5”SPIscreentodisplayproperlyweneedtoinstallFBCP.Todosofollowthebelowsteps.
sudo apt-get install cmake git
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp
(Source:https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/pitft-setup)Thenedityourrc.localfileusing
sudo nano /etc/rc.local
Lastly,addthefollowinglinestothefilebeforethe“exit0”linetogetyourscreentofunctionproperly
modprobe fbtft_device custom name=fb_ssd1351 buswidth=8 gpios=reset:24,dc:25 speed=10000000 width=128 height=128 bgr=1 init=-1,0xFD,0x12,-1,0xFD,0xB1,-1,0xAE,-1,0xB3,0xF1,-1,0xCA,127,-1,0xA0,0x74,-1,0x15,0x00,0x7F,-1,0x75,0x00,0x7F,-1,0xA1,128,-1,0xA2,0x0,-1,0xB5,0x00,-1,0xAB,0x01,-1,0xB1,0x32,-1,0xBE,0x05,-1,0xA6,-1,0xC1,0xC8,0x80,0xC8,-1,0xC7,0x0F,-1,0xB4,0xA0,0xB5,0x55,-1,0xB6,0x01,-1,0xAF,-3
sleep 5s
fbcp &
/usr/local/bin/retrogame &
8
Rebootthemachineandyoushouldseeyourscreencomeonafterabout30seconds.(Source:https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=122992)
9
ComponentDiagram
Figure2:ComponentDiagram(Componentsnottoscale)
10
GPIOWiring
Figure3:GPIOWiring
Takenoteofthesquare3.3VheadertouseasareferencewhenorientingyourRaspberryPiZero.
11
3DPrintFilesTheoriginal3Dprintingfilescanbefoundhere.http://www.thingiverse.com/thing:1334253Modified3Dprintingfiles(withD-Pad)canbefoundhttp://www.thingiverse.com/thing:1619604IwanttothankRasmushauschild(theoriginalcreator)forallhishelpandsupportaswellastheoriginalfilesheprovided.WithoutthishelpIwouldnothavebeenabletocompletethisprocess.
12
RomsBelowisalinkfromRetroPi’sGethubonhowtoinstallroms.DuetolegalreasonsIcannottellyouwheretogetroms,butifyousearchitonGoogleyoucanfindafewsources.(http://lmgtfy.com/?q=roms)RomTutorial:https://github.com/retropie/retropie-setup/wiki/Transferring-RomsDuetoitssmallsizeIfoundthatNES,GBA,Mame,andsomeSNESgamesworkthebest.However,becauseyoucanplaythisonabigscreenyoumaybeabouttoloadafewN64orotherromsandplaywithanexternalcontroller.Awiredx-box360controlworkswell.HereisalistofcompatibleN64romsthatworkonthePi2whichhassimilarhardwaretothePiZero.https://docs.google.com/spreadsheets/d/1Sn3Ks3Xv8cIx3-LGCozVFF7wGLagpVG0csWybnwFHXk/edit#gid=1198946179
13
AppendixA:retrogame.ccodePleaseseebelowioStandard[]codefromretrogame.cfile.Makesuretobuildandmovethefileonceyourchangesaresaved. ioStandard[] = { // This pin/key table is used when the PiTFT isn't found // (using HDMI or composite instead), as with our original // retro gaming guide. // Input Output (from /usr/include/linux/input.h) { 27, KEY_ENTER }, // Joystick (4 pins) { 17, KEY_RIGHTSHIFT }, { 13, KEY_UP }, { 19, KEY_DOWN }, { 26, KEY_LEFT }, // A/Fire/jump/primary { 6, KEY_RIGHT }, // B/Bomb/secondary { 12, KEY_A }, { 16, KEY_S }, { 21, KEY_Z }, { 20, KEY_X }, // For credit/start/etc., use USB keyboard or add more buttons. { -1, -1 } }; // END OF LIST, DO NOT CHANGE