Using Battery Indicator Button as a Controller Button

Here is all the tutorials, FAQ and support for RaspiBoy Kit
Post Reply
StrangersWrath
Posts: 7
Joined: Sun 31 Dec 2017 08:08

Using Battery Indicator Button as a Controller Button

Post by StrangersWrath » Sun 31 Dec 2017 20:23

I received my Raspiboy yesterday and absolutely love It! I had to reseat the dpad as it wasn't registering properly but it took a minute to fix, everything else was covered in the assembly guide and went pretty smoothly!

I do have a question related to Pierre's post on his kickstart page regarding using the battery indicator button as a controller button on the new 1.2 pcb.
Battery button is no longer a battey indicator button, it is now the GPIO 17 that was not used so far (it's from one of the audio pogo pins pair) So now this button will connect GPIO 17 to ground. So you can use it for different purpose such as : add a controller button if you need one more, make a soft shutdown button (?).
Is there anything I need to configure to get this reading as a controller input? It doesn't work in 'configure input' in emulationstation, so do I need to configure it elsewhere? Maybe the gpio has to be set in boot config, but I'm not too sure what I'm doing there if I'm honest, can anyone assist with that? Ideally I want to make it my 'hotkey enable' button.

Many thanks.

Graylag
Posts: 8
Joined: Tue 12 Dec 2017 12:51

Re: Using Battery Indicator Button as a Controller Button

Post by Graylag » Tue 2 Jan 2018 14:42

It cannot be used as Controller Button - at least not in default state.

This button is connected to GPIO pins, that is as internal hardware signal. However in default setting Retropie recognizes only USB input devices and GPIO does not behave as one. In order to do so, you would have to configure the system to use GPIO signals as input device. However, even if you do so, this will not result in adding one more button to available controller but will instead create second controller. This means unless specific emulator can utilize inputs from two or more input devices at the same time, you cannot use main controll buttons and rear battery indicator button at the same time.

roostaar
Posts: 31
Joined: Tue 2 Jan 2018 00:39

Re: Using Battery Indicator Button as a Controller Button

Post by roostaar » Tue 2 Jan 2018 18:32

There is an app called retrogame which appears to be exactly what we need here.

However, having installed it and mapped GPIO pin 17 to ESC, the button does not register in MAME or the Emulation Station configuration input.

https://learn.adafruit.com/retro-gaming ... s-software

Anyone else want to give this a go? Is this possible to work??

I think best use is to map the button to ESC, and the long press to TAB. Then you can exit and configure MAME4ALL without a keyboard and still have a 6-button controller.

All other emulators are libretro so use the RetroArch hotkeys.

'Select' in my experience is the best key to use as the hotkey, and only become the hotkey when you press a button combo.

roostaar
Posts: 31
Joined: Tue 2 Jan 2018 00:39

Re: Using Battery Indicator Button as a Controller Button

Post by roostaar » Tue 2 Jan 2018 19:29

Posts taking ages to be moderated which is slowing down progress!! I thought first post might be moderated but after that would be instant?
---
I'm not sure which 'Pin 17' Pierre means....

Physical Pin 17 = 3.3v DC power
Physical Pin 11 = GPIO Pin 17

https://pinout.xyz/pinout/pin11_gpio17

If it's the GPIO Pin 17, then using retrogame should work...but it doesn't for me (yet).

User avatar
Admin
Administrateur du site
Posts: 409
Joined: Sat 10 Dec 2016 13:12

Re: Using Battery Indicator Button as a Controller Button

Post by Admin » Thu 4 Jan 2018 09:34

It's GPIO 17 sorry for this was unclear!

And sorry about the need to validate the post, I receive a lot of spam so I had to implement that.
I'm looking for a moderator by the way to help validating the messages if you'r interested in helping me there :)

StrangersWrath
Posts: 7
Joined: Sun 31 Dec 2017 08:08

Re: Using Battery Indicator Button as a Controller Button

Post by StrangersWrath » Thu 4 Jan 2018 10:05

Thanks for the info.

Funnily enough, I came across the adafruit stuff when I was Googling a possible solution. I might have a stab at it the weekend. I think you're absolutely right that any other method would see it as another controller, so it wouldn't create the desired result anyway. Having it map as a keystroke might just be the closest thing we'll get (ideally I wanted it as the Hotkey enable button as I'm not using MAME4ALL).

If I get time over the weekend I may have a play around with adafruit and see if I can get anything working.

roostaar
Posts: 31
Joined: Tue 2 Jan 2018 00:39

Re: Using Battery Indicator Button as a Controller Button

Post by roostaar » Thu 4 Jan 2018 15:10

Admin wrote:It's GPIO 17 sorry for this was unclear!

And sorry about the need to validate the post, I receive a lot of spam so I had to implement that.
I'm looking for a moderator by the way to help validating the messages if you'r interested in helping me there :)
Cheers Pierre, no worries about being unclear. 8-)

Sorry for being confused still, but are GPIO and BCM numbers the same?

Retrogame wants to know the BCM number to apply a keypress to.

According to my GPIO readout (see attached image), BCM 17 = wPi 0 = GPIO.0 = Mode 'IN' = Voltage 1 = Physical Pin 11

I have tried asking retrogame to address '17', '11' and '0' but neither seem to work.

Retrogame does require that the buttons are 'passive'. Is the Raspiboy battery button a 'passive' button?

Retrogame doesn’t work with my optical buttons!
Unfortunately, yes. retrogame only works with “passive” switches between a GPIO pin and ground (logic low=pressed). It won’t work with switches that have the opposite logic level (high=pressed).

This is probably a query for the adafruit forum, but it would be good to know what state the GPIO button is in first.

Hope you can help Pierre.

PS Would be happy to help moderate if you wish.
Attachments
Raspiboy GPIO.png
Raspiboy GPIO.png (58.29 KiB) Viewed 2240 times

Shay
Posts: 22
Joined: Tue 17 Oct 2017 17:50

Re: Using Battery Indicator Button as a Controller Button

Post by Shay » Thu 4 Jan 2018 16:46

I was wondering what that button is for. So it has no default use on the current build of 8BCraft device? Does it allow checking battery status?

roostaar
Posts: 31
Joined: Tue 2 Jan 2018 00:39

Re: Using Battery Indicator Button as a Controller Button

Post by roostaar » Thu 4 Jan 2018 18:08

Graylag wrote:It cannot be used as Controller Button - at least not in default state.

This button is connected to GPIO pins, that is as internal hardware signal. However in default setting Retropie recognizes only USB input devices and GPIO does not behave as one. In order to do so, you would have to configure the system to use GPIO signals as input device. However, even if you do so, this will not result in adding one more button to available controller but will instead create second controller. This means unless specific emulator can utilize inputs from two or more input devices at the same time, you cannot use main controll buttons and rear battery indicator button at the same time.
Ok! I get it now. :oops: I have configured retrogame to map GPIO 17 to keypress ESC and I can see when I launch a retroarch game, the GPIO 'controller' flashes up as 'not configured'. So this is indeed working as expected. EmulationStation also sees two gamepads if I go to 'configure input'. I cannot configure the GPIO button here as it is mapped to ESC.

I guess it will be impossible to set this button up as a keystroke for the built in USB gamepad? Pierre alluded to this being possible?

Anyone have any other suggestions of how to make use of this button?

As there is no useable retroarch emulator for mame on the zero, I was hoping to use the battery button to 'escape' and quit mame4all.

As a workaround, I mapped 'L' to ESC and 'R' to TAB for config.

This limits me to just 4 buttons in mame4all, but thats good enough for all but Street Fighter and the like.

StrangersWrath
Posts: 7
Joined: Sun 31 Dec 2017 08:08

Re: Using Battery Indicator Button as a Controller Button

Post by StrangersWrath » Thu 4 Jan 2018 18:15

Good work, although the results are disappointing it's certainly a step in the right direction!

On a side note, I use lr-mame2000 on my 4.3 build with pretty good results, and as it uses the ra core, the standard hotkeys apply.

Post Reply