Configure D-Pad
#1
Hey all,
I’m a huge fan of the GBA’s form factor, so have put together a Freeplay Zero to use mainly as a portable
music and movie player, and for some experiments in programming  Smile

I’ve managed to install raspian, git clone and install the following repositories:
https://github.com/TheFlav/Freeplay-Support
https://github.com/TheFlav/mk_arcade_joystick_rpi
https://github.com/TheFlav/rpi-fbcp

So now I have a working raspian desktop environment on my Freeplay Zero, where (with the help of an OTG adaptor and a mouse and keyboard) I can play music and movies, enter commands into the console etc.

However, I’m not sure where to start when it comes to configuring the physical buttons on the FPZ so they create keyboard/mouse keystrokes when pressed - eg select button = Enter, Up/Down/Left/Right move the cursor, A button = left click, B button = right click and so on.

Can anyone give me any pointers on how to go about setting this up for my FPZ???
Reply
#2
Hello,
If I understand it right, you want to bind the control to key event?
If so, this is done via a Python script on Retropie install.
If you have a working Retropie image on hand, connect thru SSH then 'sudo htop' and on the device start a item from Retropie menu, you should see something like "joy2key.py" on htop.

I am not home right now but I did post something on the forum to add a "Media" menu on Emulationstation that use omxplayer to play mp3/mp4 with dpad and AB as control.
Reply
#3
It was this one : https://forum.freeplaytech.com/showthrea...10#pid8610
Reply
#4
Hey Porcinus, thanks for your quick reply.

I haven’t actually installed Retropie, just Raspian Buster. Would the process be similar?
Reply
#5
That's a good question :S
I have no real way to try this on my side (I want to avoid any possible conflict with my Retropie setup) but this could maybe help : http://manpages.ubuntu.com/manpages/xeni...key.1.html
I think it is installed via apt-get.

To take omxplayer example, the command line is maybe : joy2key -axis kcub1 kcuf1 -buttons 0x6B 0x6A 0x70 0x71
Not 100% sure :S
Reply
#6
Also, there is a little-known alternate way to do this sort of thing.

Please check out https://github.com/TheFlav/Freeplay-Supp...eeplay.txt
and https://github.com/TheFlav/Freeplay-Supp...eeplay.dts
and https://github.com/TheFlav/Freeplay-Supp...ay-min.dts

I haven't touched that stuff for quite a while, but, if I recall correctly, it would kill the audio when used. I'm guessing this could be fixed, but I didn't put more time into it.

Essentially, this is a very simple way to turn all the buttons into a virtual keyboard without needing additional drivers/software.

I just did a quick Google search and came up with some additional info here: http://blog.gegg.us/2017/01/setting-up-a...pberry-pi/
I didn't use that when I worked on my version, if I recall. Maybe there's more to learn.

Also notice, in my DTS files, there are lines like this.
linux,code = <105>; //KEY_LEFT
The codes like 105 can be changed to whatever key you want.
See: https://github.com/torvalds/linux/blob/m...nt-codes.h
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#7
Maybe a possibility why gpio-keys-freeplay.dts kill the audio.
brcm,pins = <6 5 4 17 16 24 19 26 15 18 14 23>; // gpio number

On CM3 or Zero motherboard, is PWM audio using BCM18/BCM13 or BCM12/BCM13?
https://pinout.xyz/pinout/pin12_gpio18
Reply
#8
(11-08-2019, 03:03 AM)Porcinus Wrote: Maybe a possibility why gpio-keys-freeplay.dts kill the audio.
brcm,pins =  <6 5 4 17 16 24 19 26 15 18 14 23>; // gpio number

On CM3 or Zero motherboard, is PWM audio using BCM18/BCM13 or BCM12/BCM13?
https://pinout.xyz/pinout/pin12_gpio18

We use 12/13 for audio.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#9
Flavor : Ho, I never really take a look on how overlays work but that could be something interresting to learn.

Billsuncle : Are you looking for a momentary or a permanent way to do it?
Reply
#10
The overlays (and anything you can do in config.txt) is very interesting, because people can easily do them on a Windows/Mac machine without access to the main EXT4 Operating System partition.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)