GP2040: A Configurable Game Pad Firmware [Hackaday]

View Article on Hackaday

[feralAI] and fellow GitHub contributors present for your viewing pleasure GP2040: an open source game pad firmware for RP2040-based hardware. The dual-core RP2040 is a good platform to use for gaming inputs, as there is plenty of CPU grunt to get sub-1 ms USB polling time, regardless of any other tasks the controller may be performing. Currently the firmware supports PC, Android, RPi, Nintendo Switch, PS3, PS4 (legacy mode), and the sweet MiSTer FPGA-based retro-gaming platform.

The firmware supports the older DirectInput API and the newer shiny (but rather restrictive) XInput API (no, it’s not the old X11 input extension with the same name) — as well as the usual controller features like SOCD cleaning, D-pad mapping, and RGB support for additional distractions. There is even support for those tiny OLED displays (SSD1306 and friends), although we can’t think of a use case for that at the moment. Configuration is particularly interesting, however, as it is based upon an embedded web application. This is where the pin mappings to your actual hardware are defined, as well as all that RGB bling, if you so desire.

But how does the humble RP2040 (be it in Pico guise or compatible) provide a web page, you ask? The quick answer comes thanks to Microsoft and their Remote Network Driver Interface Specification (RNDIS) support. RNDIS implements a network device over USB, and luckily, other OSs have caught up and implemented it also. The GP2040 firmware leverages TinyUSB to implement the RNDIS protocol, lwIP to implement a lightweight network stack (whilst only occupying a rather paltry 40k of flash), and finally react-bootstrap to code the actual web logic. (Aren’t modern open source libraries awesome?) If you feel the need to use the source (whether you are named Luke or not) the project can be found on the GP2040 GitHub.

If you’re into gaming on game pads, but quite like the responsiveness of the trusty mouse, look no farther than this neat hybrid controller. But if this modern stuff with 45 buttons and levers all over the place is just too much, and you’ve a hankering for the controllers of old, this might be more your style.

Thanks to [DJBiohazard] for the tip!