Freeplaytech Forum

Full Version: Adding more USBs, a fan, second trigger buttons, and hotkey to the Freeplay CM3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have everything I need to add more USBs and a fan to the CM3 but as long as I was taking it back apart, I'd like to add a second set of trigger buttons and a hotkey button through the unused GPIO pins.  As far as I can tell, I just wire a button between an unused pin and ground. **Please correct me if I'm wrong**  The part I need help with is coding.  I am not software savvy at all. Could someone please provide instructions on modifying the software to add three more buttons? Also, if there are preferred pins to wire to. Thank you so much! I will post pictures of the final build.
I believe that you are on the right track here. As far as the code goes, then, I would suggest that you look at the GPIO controller driver code and just get an idea of how it works.

https://github.com/TheFlav/mk_arcade_joystick_rpi

There you can see the "mk_arcade_joystick_rpi.c" file and that the install.sh script adds this line into a "/etc/modprobe.d/mk_arcade_joystick.conf" file:
options mk_arcade_joystick_rpi map=4 gpio=4,17,6,5,19,26,16,24,23,18,15,14,-20

Maybe take a look at that and see if you can make sense of it.
Interested in adding two additional shoulder (trigger) buttons also.

Nothing fancy, just similar to the X/Y 'without cover' buttons, but at the back. Would like to know how!
Alright Ed, I've got everything put back together.
http://forum.freeplaytech.com/showthread.php?tid=4554
I have wired bottom right to GPIO 40, bottom left to 41, and hotkey to 42.
If I'm reading your last reply correctly, I can go into that mk_arcade_joystick.conf file and find the line you speak of and just add in the three new GPIO pins?
For example:  mk_arcade_joystick_rpi map=4 gpio=4,17,6,5,19,26,16,24,23,18,15,14,-20,40,41,42


After that, will the controller setup detect the new buttons?.

I just want to make sure I have all my ducks in a row before I start trying to code this.  (never done this before)
No. You can’t just add extra buttons at the end like that. If I recall correctly the -20 was the hotkey, so you could just edit that. The other ones, you would have to edit the source code and recompile it to add more buttons.

Maybe at some point I could edit the code so that you could just put more values on that line. I don’t know when I would get to that though.