Re: Universal GPIO keyboard daemon
think someone could who knows c can do it? just learned python so i want to stick with it for a bit... ill look into it for python if no one does it.... how much more cpu would python need than in C if you could estimate.... and do u think it would affect mame speed?
Re: Universal GPIO keyboard daemon
Dear PhillyNJ,PhillyNJ wrote:Thanks - got it to display "5" in the console but Advmame is not liking it.. Trying PiMame. I'll keep you posted
I had same problems were it showed in console but Pimame was not getting it.
I found that if I disconnected my USB keyboard the inputs started to work with Pimame.
I read somewhere that it can not accept two keyboards and that is why uinput did not work.
SOLUTION: Remove your USB keyboard and boot again without.
Re: Universal GPIO keyboard daemon
Thanks, I'll give it a try. As a note I got it working with a different build:
The clone already has a compiled version. So no need to build
I had to tweak the config file, but got it working. I'll try your suggestion too. Whats cool is I can use my keyboard also. Give it a try.
Thanks!
Code: Select all
https://github.com/BirchJD/advancemame-0.106.1-RPi

I had to tweak the config file, but got it working. I'll try your suggestion too. Whats cool is I can use my keyboard also. Give it a try.
Thanks!
Re: Universal GPIO keyboard daemon
Just a followup - after trying get all my buttons working, I was unable to wire up the joystick. So, I tried your suggestion (disconnect the keyboard) and it works. Thx again!
Re: Universal GPIO keyboard daemon
Due to popular demand I've added I2C polling for MCP23008 and MCP23017 I/O expanders.
This is in a new branch here: https://github.com/mmoller2k/pikeyd/tree/iic
Consider it a beta release. Once I get independent confirmation that it works, I'll merge it with the master branch.
The interrupt output pins are configured open-drain, so multiple pins from multiple chips can be wired together. Don't forget to add a pull-up resistor on the interrupt pin and to tie the reset pin to VDD. The expanders can also be run at 5V if you only pull-up to 3V3.
The internal pull-ups are activated, so none are needed on the switches themselves.
Here's the diagram:
This is in a new branch here: https://github.com/mmoller2k/pikeyd/tree/iic
Consider it a beta release. Once I get independent confirmation that it works, I'll merge it with the master branch.
The interrupt output pins are configured open-drain, so multiple pins from multiple chips can be wired together. Don't forget to add a pull-up resistor on the interrupt pin and to tie the reset pin to VDD. The expanders can also be run at 5V if you only pull-up to 3V3.
The internal pull-ups are activated, so none are needed on the switches themselves.
Here's the diagram:
Re: Universal GPIO keyboard daemon
Thank you atvdude01 for all your patience. Together we found and squashed some bugs in my code, and all seems to be working now.
I've merged the I2C I/O expander support into the main branch at https://github.com/mmoller2k/pikeyd
I've merged the I2C I/O expander support into the main branch at https://github.com/mmoller2k/pikeyd
Re: Universal GPIO keyboard daemon
I have successfully configured the GPIO to simulate key presses and have it working when activated manually however whenever I run it via rc.local the Raspberry pi won't let me press ^c. Instead it just shows ^C on the line bellow. Do you know any way around this?
Re: Universal GPIO keyboard daemon
I'm not sure I understand. What are you trying to do with the ^C? Are you trying to have pikeyd generate a ^C, or are you trying to interrupt it using a ^C? Are you running it with the -d switch to run it in the background? The ^C only works for stopping the program if it is running in the foreground.
Re: Universal GPIO keyboard daemon
HAY,
I got a problem
i can see the keys in the console output,
but pimame doesn't.
Have you got an idea?
THanks a lot
Mike
I got a problem
i can see the keys in the console output,
but pimame doesn't.
Have you got an idea?
THanks a lot
Mike
Re: Universal GPIO keyboard daemon
Nice!
I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.
Re: Universal GPIO keyboard daemon
See below the response from Møller:
This works. It is a bit of a pain while you are configuring your Pi and the controls, but it works.Møller wrote: I had same problems were it showed in console but Pimame was not getting it.
I found that if I disconnected my USB keyboard the inputs started to work with Pimame.
I read somewhere that it can not accept two keyboards and that is why uinput did not work.
SOLUTION: Remove your USB keyboard and boot again without.
-
- Posts: 179
- Joined: Wed Jun 06, 2012 1:51 am
- Location: United States
- Contact: Website
Re: Universal GPIO keyboard daemon
I will be looking at this this week. This is awesome stuff.
My blog of various geeky things - http://blog.sheasilverman.com
PiPLAY - http://piplay.org
DeskCade.com - Mini Raspberry Pi Arcade Cabinet
PiPLAY - http://piplay.org
DeskCade.com - Mini Raspberry Pi Arcade Cabinet
-
- Posts: 4
- Joined: Thu Feb 28, 2013 11:23 am
Re: Universal GPIO keyboard daemon
I'm gonna give this a go. I've bulit my cabinett with 10 buttons(1 player, 2 player, credit, exit B1-B6) and a 4/8 way joystick. So i need 14 IO's.
I have a rev. 1 board. can i use any GPIO pins or is there some that wont work?
found this in the joy_RPI.c
"// Raspberry Pi V1 GPIO
//static int GPIO_Pin[] = { 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25 };
// Raspberry Pi V2 GPIO
//static int GPIO_Pin[] = { 2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27 };
//MameBox pins
//static int GPIO_Pin[] = { 4, 17, 18, 22, 23, 24, 10, 25, 11, 8, 7 };"
Does this mean i can only use 11 GPIO as MameBox pins says or is the complete array from V1 available? I need 14.
/Mathias
I have a rev. 1 board. can i use any GPIO pins or is there some that wont work?
found this in the joy_RPI.c
"// Raspberry Pi V1 GPIO
//static int GPIO_Pin[] = { 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25 };
// Raspberry Pi V2 GPIO
//static int GPIO_Pin[] = { 2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27 };
//MameBox pins
//static int GPIO_Pin[] = { 4, 17, 18, 22, 23, 24, 10, 25, 11, 8, 7 };"
Does this mean i can only use 11 GPIO as MameBox pins says or is the complete array from V1 available? I need 14.
/Mathias
Re: Universal GPIO keyboard daemon
You can use 17 pins:
2,3,4,17,27,22,10,9,11,14,15,18,23,24,25,8 & 7.
I would personally not use 14 TX and 15 RX. I like to keep these pins free in case I ever need to add functionality. These pins are for serial communication and can be used and expanded
.
Good luck.
My rig has 10 buttons also, including the 4-way joystick. I am interested in seeing your final PCB when your done.
2,3,4,17,27,22,10,9,11,14,15,18,23,24,25,8 & 7.
I would personally not use 14 TX and 15 RX. I like to keep these pins free in case I ever need to add functionality. These pins are for serial communication and can be used and expanded

Good luck.
My rig has 10 buttons also, including the 4-way joystick. I am interested in seeing your final PCB when your done.
-
- Posts: 4
- Joined: Thu Feb 28, 2013 11:23 am
Re: Universal GPIO keyboard daemon
Rev. 1 don't have pins 2, 3, 27 but i have 0, 1, 21.PhillyNJ wrote:You can use 17 pins:
2,3,4,17,27,22,10,9,11,14,15,18,23,24,25,8 & 7.
I would personally not use 14 TX and 15 RX. I like to keep these pins free in case I ever need to add functionality. These pins are for serial communication and can be used and expanded.
Good luck.
My rig has 10 buttons also, including the 4-way joystick. I am interested in seeing your final PCB when your done.
So i should go with:
4,17,22,10,9,11,14,15,18,23,24,25,8 & 7???
-
- Posts: 15
- Joined: Mon Feb 04, 2013 1:41 pm
Re: Universal GPIO keyboard daemon
Wow, um, I had a similar problem I solved in a completely different way.
http://www.powerfulboard.com/
This chip is easy to configure. Making it a USB HID keyboard was simple using this app note:
http://www.cypress.com/?rID=40103
The limitation on this solution is you can only read 6 real keys at once. Modifiers, such as ctrl/shift/alt are all encoded into the first byte so you technically could do more that 6. The limitation is due to how USB HID works for keyboards, not the chip.
http://www.powerfulboard.com/
This chip is easy to configure. Making it a USB HID keyboard was simple using this app note:
http://www.cypress.com/?rID=40103
The limitation on this solution is you can only read 6 real keys at once. Modifiers, such as ctrl/shift/alt are all encoded into the first byte so you technically could do more that 6. The limitation is due to how USB HID works for keyboards, not the chip.
Re: Universal GPIO keyboard daemon
Awesome stuff. I choose to build mine from scratch. I started in January and building the control was a blast. I learned about wiring, resistors, switches, GPIO and Python. I could of bought an iPac but that was too easy.GuardianBob wrote:Wow, um, I had a similar problem I solved in a completely different way.
http://www.powerfulboard.com/

My Mame arcade is almost done. My only issue is when its finished I'll have to buy another Pi

Re: Universal GPIO keyboard daemon
I would do some more research. I am not 100% sure.RealElwood wrote: So i should go with:
4,17,22,10,9,11,14,15,18,23,24,25,8 & 7???
Re: Universal GPIO keyboard daemon
OK,
Disconnecting the keyboard will make the GPIOs work.
But i wanted to keep the keyboard connected for other things.
I read something about the multiple keyboard in mame.ini
can anybody help me about that.
Thanks
Mike
Disconnecting the keyboard will make the GPIOs work.
But i wanted to keep the keyboard connected for other things.
I read something about the multiple keyboard in mame.ini
can anybody help me about that.
Thanks
Mike

Re: Universal GPIO keyboard daemon
I read this http://forum.arcadecontrols.com/index.p ... c=116469.0. Give it a try and report back. I would like to know if that solves the issue.mykey1968 wrote:OK,
Disconnecting the keyboard will make the GPIOs work.
But i wanted to keep the keyboard connected for other things.
I read something about the multiple keyboard in mame.ini
can anybody help me about that.
Thanks
Mike
Re: Universal GPIO keyboard daemon
This is funny I already tried to figure out how this works
(the link you posted)
, but i can't (i didn't find the keymap)

(the link you posted)
, but i can't (i didn't find the keymap)

Re: Universal GPIO keyboard daemon
I havent tried this, so I am not sure it works. Try
From the command line
Ref: http://easyemu.mameworld.info/Mame%20Guide.pdf
Code: Select all
<gamename> -multikeyboard
Ref: http://easyemu.mameworld.info/Mame%20Guide.pdf
Re: Universal GPIO keyboard daemon
Hay I tried it out.
only if i disconnect the usb kb the buttons are recognized.
Can anybody help me.
Thanks
Mike
but it does not workI havent tried this, so I am not sure it works. Try
Code: Select all
<gamename> -multikeyboard
only if i disconnect the usb kb the buttons are recognized.
Can anybody help me.
Thanks
Mike
-
- Posts: 4
- Joined: Thu Feb 28, 2013 11:23 am
Re: Universal GPIO keyboard daemon
Kind of hoping to find the answer here, I'll give it a try when i can find the time and comeback with the results.PhillyNJ wrote:I would do some more research. I am not 100% sure.RealElwood wrote: So i should go with:
4,17,22,10,9,11,14,15,18,23,24,25,8 & 7???
Re: Universal GPIO keyboard daemon
Just thought I'd let people know, you don't need to disconnect your keyboard to get AdvMAME working, all you need to is change the device_keyboard attribute towards the top of the advmame.rc (or advmenu.rc) from auto to raw, works perfectly for me.