USB XinMo und GPIO Controller
-
Hi zusammen,
ich hab folgendes Problem.
Und zwar will ich eine Hotkey Tastatur bauen, damit man nur einen Button zum beenden von den Spielen drücken muss und keine Tastenkombination.
Dazu haben ich eine Schaltung mit Dioden gebaut damit nicht immer alle Tasten gedrückt werden (so die Theorie).
Problem bei dieser Lösung an dem XinMo Controller ist, dass wenn man wild am zocken ist dennoch die Hotkey Taste gedrückt wird.
Nun zu meinem Fragen.
Werden die GPIO Pins die für den Controller verwendet werden auch auf Masse kurzgeschlossen so wie bei den XinMo Controller?
Kann ich den XinMo und den GPIO Controller gleichzeitig verwenden ohne das Mapping immer umzustellen?
Kann ich zu not mit zwei XinMo arbeiten?
Oder kann ich die Hotkey Funktionen komplett auf einen GPIO Pin legen sodass meine Schaltung überflüssig wird?Gruß und danke schon mal.
BörgiM -
Looks like you'll have to translate to english or french if you want some help
-
hello everybody,
i have the following Problem.I want to build a Hotkey Keyboard, to Exit the game with one button.
Also restart, save, load and anything else.I have made a circuit with Diodes, to prevent that all Buttons are pressed. (So the theory).
The Problem from this circuit is, if you push to many Buttons on the same time, that the hotkey is also pressed.
Now my Question:
Can i use the GPIO Pints from the PI for this?
How do's the GPIO Controller works?
Can i use the CPIO Controller at the same time as the XinMo?Thank you for your answer
BörgiM -
@boergim What if a user made a script that could "almost" do what you need, based on gpio ?
-
@Substring Exit a Game is no problem but what is with Reload, Save, Lade Screenshot and so on. I what to have all Shortcut functions on a Keyboard.
Hotkey + Y → Save State
Hotkey + X → Load State
Hotkey + Up → Select Save Slot -1
Hotkey + Down → Select Save Slot +1Hotkey + Start → End Game and Quit To Main Menu
Hotkey + A → Reset Game
Hotkey + B → Retroarch Menu
Hotkey + L1 → ScreenshotHotkey + Right → Speedup game
Hotkey + Left → Rewind (if activated in options)Hotkey + R2 → Next shader preset
Hotkey + L2 → Previous shader presetI down't know how to script this.
-
seems to me that combining gpio electronically was not working very well ...
-
@Substring i have found something, but it is in German
[http://recalbox-wiki-rtfd.readthedocs.io/en/4.0/DE/Emulator-Interaktionen-mit-GPIO-(DE)/](link url) -
@boergim the author of the python script is @supernature2k. This script allows to kick some commands with depending on the GPIO pin.
-
@Substring thank you.
@all This is my working Script:
import RPi.GPIO as GPIO import time import socket # addressing information of target IPADDR = "127.0.0.1" PORTNUM = 55355 # enter the data content of the UDP packet # initialize a socket, think of it as a cable # SOCK_DGRAM specifies that this is UDP try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except socket.error: print 'Failed to create socket' sys.exit() GPIO.setmode(GPIO.BCM) GPIO.setup(2, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(5, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(6, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(8, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(9, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_UP) def exitEmulator(channel): s.sendto("QUIT", (IPADDR, PORTNUM)) def resetEmulator(channel): s.sendto("RESET", (IPADDR, PORTNUM)) def loadState(channel): s.sendto("LOAD_STATE", (IPADDR, PORTNUM)) def saveState(channel): s.sendto("SAVE_STATE", (IPADDR, PORTNUM)) def stateSlotPlus(channel): s.sendto("STATE_SLOT_PLUS", (IPADDR, PORTNUM)) def stateSlotMinus(channel): s.sendto("STATE_SLOT_MINUS", (IPADDR, PORTNUM)) def pauseEmulator(channel): s.sendto("PAUSE_TOGGLE", (IPADDR, PORTNUM)) def takeScreenshot(channel): s.sendto("SCREENSHOT", (IPADDR, PORTNUM)) def muteEmulator(channel): s.sendto("MUTE", (IPADDR, PORTNUM)) def fastForward(channel): s.sendto("FAST_FORWARD", (IPADDR, PORTNUM)) def fastForwardHold(channel): s.sendto("FAST_FORWARD_HOLD", (IPADDR, PORTNUM)) GPIO.add_event_detect(2, GPIO.FALLING, callback=exitEmulator, bouncetime=500) GPIO.add_event_detect(3, GPIO.FALLING, callback=resetEmulator, bouncetime=500) GPIO.add_event_detect(4, GPIO.FALLING, callback=loadState, bouncetime=500) GPIO.add_event_detect(5, GPIO.FALLING, callback=saveState, bouncetime=500) GPIO.add_event_detect(6, GPIO.FALLING, callback=stateSlotPlus, bouncetime=500) GPIO.add_event_detect(7, GPIO.FALLING, callback=stateSlotMinus, bouncetime=500) GPIO.add_event_detect(8, GPIO.FALLING, callback=takeScreenshot, bouncetime=500) GPIO.add_event_detect(9, GPIO.FALLING, callback=muteEmulator, bouncetime=500) GPIO.add_event_detect(10, GPIO.FALLING, callback=fastForward, bouncetime=500) GPIO.add_event_detect(11, GPIO.FALLING, callback=fastForwardHold, bouncetime=500) while True: time.sleep(10)
-
@boergim good job ! have you checked that the fastforward and fastforward_hold work ?