recalboxOS is build with themk_arcade_joystick_gpiodriver that can manage a controller directly connected on rpi GPIO.
So if you plan to make aBartop,Arcade cab, or aportable panel, you don't even need an usb controller.
The driver can manage up to2 controllerscomposed of a4 direction joystickand9 buttons.
If you are on a RPI1 B revision see directly themk_arcade_joystick pinout
Let's consider a 7 buttons cab panel with this button order :
↑ Ⓨ Ⓧ Ⓛ
← → Ⓑ Ⓐ Ⓡ Ⓗ
↓
With Ⓡ= Right trigger = TR, Ⓛ= Left trigger = TLand Ⓗ= HK = Hotkey
On RPI B+, RPI2 and RPi3 you must connect your buttons as specified by this pinout :
You can connect you buttondirectly to the groundas the driver enablegpio internal pullups.
Inrecalbox.conf, enable the gpio driver by setting controllers.gpio.enabled to 1 :controllers.gpio.enabled=1and you're done ! The GPIO are configured out of the box in the frontend and systems.
###Related:###
Enable Gpio button to close emulator with only one button press