This project is hardware and firmare designed to convert 0-3.3V analog input signals to digital output signals for gamepad controller boards.
It is built with the intention of using Hall Effect keyboard switches with controller boards that typically only accept digital signals for gamepad inputs through 20 pin connectors. Such as
- RP2040 Advanced Breakout Board (GP2040-CE)
- Brook Universal Fighting Board
- Brook UFB-Fusion
- Brook P5 PLUS Fighting Board
- User Configurable GPIO Input
- Custom Actuation Distance
- Advanced Trigger Behavior
- Static Trigger
- Rapid Trigger
- Continuous Rapid Trigger
- Per Button Settings
- Analog output for Left/Right Analog stick axes
- Analog output for L2/R2 Analog Triggers
- Analog output for all gamepad inputs
- Board Hardware - Production Files
- Primary Board
- MUX Auxilary Board
- Web GUI Configurator
- Github Workflow .uf2 Build (CI/CD)
Set up Pico SDK
git clone https://github.com/raspberrypi/pico-sdk.git
RUN cd pico-sdk && git submodule update --init
# Set the PICO_SDK_PATH environment variable to where you just cloned the repo above.
export PICO_SDK_PATH=/path/to/pico-sdk
Install the toolchain needed to build Pico projects.
sudo apt update && apt install -y --no-install-recommends git ca-certificates make cmake gcc g++ gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3 python3-venv nodejs npm clang
Use Microsoft's documentation on running Visual Studio Code in a Docker container using the Dev Containers extension.
The Dockerfile included in the repo will be sufficient for building this project.
Run the following commands in the root of the repo.
mkdir build
cd build
cmake ..
make
Edit the header file config/gpio_output_config.h
Edit the configuration files below in config/CD74HC4067SM96
depending on how many CD74HC4067SM96 you are using and which pins are being used specifically, both of the RP2040 and of the CD74HC4067SM96.
config/CD74HC4067SM96/CD74HC4067SM96_00_config.h
config/CD74HC4067SM96/CD74HC4067SM96_01_config.h
config/CD74HC4067SM96/CD74HC4067SM96_02_config.h
config/CD74HC4067SM96/CD74HC4067SM96_03_config.h
For each of the above configuration files, you will want to modify the following #define
to prior to building the firmware.
- Set
CD74HC4067SM96_##_ENABLED
totrue
to enable that CD74HC4067SM96 module where##
is the number of the CD74HC4067SM96 number (i.e.CD74HC4067SM96_00_config
is CD74HC4067SM96 00) - Set the Analog GPIO pin (GP26-GP29)
- Set a
ButtonAction
for eachCD74HC4067SM96_##_AA_ACTION
where##
is the number of the CD74HC4067SM96 number andAA
is the CD74HC4067SM96 (i.e.CD74HC4067SM96_00_15_ACTION
is the pin 15 of CD74HC4067SM96 00)
ButtonAction | GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
---|---|---|---|---|---|---|
NONE | NONE | NONE | NONE | NONE | NONE | NONE |
BUTTON_PRESS_DPAD_UP | UP | UP | UP | UP | UP | UP |
BUTTON_PRESS_DPAD_DOWN | DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
BUTTON_PRESS_DPAD_LEFT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
BUTTON_PRESS_DPAD_RIGHT | LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
BUTTON_PRESS_LS_UP | ||||||
BUTTON_PRESS_LS_DOWN | ||||||
BUTTON_PRESS_LS_LEFT | ||||||
BUTTON_PRESS_LS_RIGHT | ||||||
BUTTON_PRESS_RS_UP | ||||||
BUTTON_PRESS_RS_DOWN | ||||||
BUTTON_PRESS_RS_LEFT | ||||||
BUTTON_PRESS_RS_RIGHT | ||||||
BUTTON_PRESS_B1 | B1 | A | B | Cross | 2 | K1 |
BUTTON_PRESS_B2 | B2 | B | A | Circle | 3 | K2 |
BUTTON_PRESS_B3 | B3 | X | Y | Square | 1 | P1 |
BUTTON_PRESS_B4 | B4 | Y | X | Triangle | 4 | P2 |
BUTTON_PRESS_L1 | L1 | LB | L | L1 | 5 | P4 |
BUTTON_PRESS_R1 | R1 | RB | R | R1 | 6 | P3 |
BUTTON_PRESS_L2 | L2 | LT | ZL | L2 | 7 | K4 |
BUTTON_PRESS_R2 | R2 | RT | ZR | R2 | 8 | K3 |
BUTTON_PRESS_S1 | S1 | Back | Minus | Select | 9 | Coin |
BUTTON_PRESS_S2 | S2 | Start | Plus | Start | 10 | Start |
BUTTON_PRESS_A1 | A1 | Guide | Home | PS | 13 | NONE |
BUTTON_PRESS_A2 | A2 | NONE | Capture | NONE | 14 | NONE |
BUTTON_PRESS_L3 | L3 | LS | LS | L3 | 11 | LS |
BUTTON_PRESS_R3 | R3 | RS | RS | R3 | 12 | RS |
- [GP2040-CE] - Inspiration for creating the project and making great gamepad firmware