The following warnings occurred:
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/printthread.php(287) : eval()'d code 2 errorHandler->error_callback
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



Freeplaytech Forum
Configure D-Pad - Printable Version

+- Freeplaytech Forum (https://forum.freeplaytech.com)
+-- Forum: Freeplay Zero / Freeplay CM3 / Game Pie Advance (https://forum.freeplaytech.com/forumdisplay.php?fid=24)
+--- Forum: Freeplay Zero/CM3 (AKA GPA) Software (https://forum.freeplaytech.com/forumdisplay.php?fid=26)
+--- Thread: Configure D-Pad (/showthread.php?tid=5051)

Pages: 1 2 3


Configure D-Pad - billsuncle - 11-06-2019

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???


RE: Configure D-Pad - Porcinus - 11-06-2019

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.


RE: Configure D-Pad - Porcinus - 11-06-2019

It was this one : https://forum.freeplaytech.com/showthread.php?tid=4931&pid=8610#pid8610


RE: Configure D-Pad - billsuncle - 11-06-2019

Hey Porcinus, thanks for your quick reply.

I haven’t actually installed Retropie, just Raspian Buster. Would the process be similar?


RE: Configure D-Pad - Porcinus - 11-07-2019

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/xenial/man1/joy2key.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


RE: Configure D-Pad - Flavor - 11-07-2019

Also, there is a little-known alternate way to do this sort of thing.

Please check out https://github.com/TheFlav/Freeplay-Support/blob/master/gpio-keys-freeplay.txt
and https://github.com/TheFlav/Freeplay-Support/blob/master/gpio-keys-freeplay.dts
and https://github.com/TheFlav/Freeplay-Support/blob/master/gpio-keys-freeplay-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-gpio-button-keyboard-on-a-raspberry-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/master/include/uapi/linux/input-event-codes.h


RE: Configure D-Pad - Porcinus - 11-08-2019

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


RE: Configure D-Pad - Flavor - 11-08-2019

(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.


RE: Configure D-Pad - Porcinus - 11-09-2019

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?


RE: Configure D-Pad - Flavor - 11-09-2019

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.