Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    USB XinMo und GPIO Controller

    Controller/GPIO/USB
    usb xinmo und gpio
    2
    10
    2788
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • boergim
      boergim last edited by

      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).
      alt Schaltung Hotkey Tastatur

      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

      1 Reply Last reply Reply Quote 0
      • Substring
        Substring last edited by

        Looks like you'll have to translate to english or french if you want some help 😮

        Former dev - Please reply with @substring so that i am notified when you answer me
        Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

        1 Reply Last reply Reply Quote 0
        • boergim
          boergim last edited by

          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).
          alt text

          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

          Substring 1 Reply Last reply Reply Quote 0
          • Substring
            Substring @boergim last edited by

            @boergim What if a user made a script that could "almost" do what you need, based on gpio ?

            Former dev - Please reply with @substring so that i am notified when you answer me
            Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

            boergim 1 Reply Last reply Reply Quote 0
            • boergim
              boergim @Substring last edited by

              @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 +1

              Hotkey + Start → End Game and Quit To Main Menu
              Hotkey + A → Reset Game
              Hotkey + B → Retroarch Menu
              Hotkey + L1 → Screenshot

              Hotkey + Right → Speedup game
              Hotkey + Left → Rewind (if activated in options)

              Hotkey + R2 → Next shader preset
              Hotkey + L2 → Previous shader preset

              I down't know how to script this.

              1 Reply Last reply Reply Quote 0
              • Substring
                Substring last edited by

                seems to me that combining gpio electronically was not working very well ...

                Former dev - Please reply with @substring so that i am notified when you answer me
                Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                boergim 1 Reply Last reply Reply Quote 0
                • boergim
                  boergim @Substring last edited by

                  @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)

                  Substring 1 Reply Last reply Reply Quote 0
                  • Substring
                    Substring @boergim last edited by

                    @boergim the author of the python script is @supernature2k. This script allows to kick some commands with depending on the GPIO pin.

                    Former dev - Please reply with @substring so that i am notified when you answer me
                    Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                    boergim 1 Reply Last reply Reply Quote 0
                    • boergim
                      boergim @Substring last edited by

                      @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)
                      
                      Substring 1 Reply Last reply Reply Quote 1
                      • Substring
                        Substring @boergim last edited by

                        @boergim good job ! have you checked that the fastforward and fastforward_hold work ?

                        Former dev - Please reply with @substring so that i am notified when you answer me
                        Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Want to support us ?

                        83
                        Online

                        98.7k
                        Users

                        28.1k
                        Topics

                        187.0k
                        Posts

                        Copyright © 2021 recalbox.com