feralai / gp2040 Goto Github PK
View Code? Open in Web Editor NEWGamepad firmware for Raspberry Pi Pico and other RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput
Home Page: https://gp2040.info
License: MIT License
Gamepad firmware for Raspberry Pi Pico and other RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput
Home Page: https://gp2040.info
License: MIT License
Work out a way to integrate on-board configuration of button layouts, LED setup, etc.
I don't know, maybe I'm missing something, but I cannot find in the docs any guide of how to control leds from a pc. You know like all the other led controllers allow you to illuminate only buttons that are used by the currently launched MAME game.
There is a relatively common issue where if the Pico/RP2040 device has been previously flashed with something other than GP2040, the area of flash used for emulated EEPROM could contain invalid values causing the firmware to misbehave (locked to certain input type, buttons might not work, etc.).
Add CRC check to the EEPROM data and perform an EEPROM reset if the CRC does not match when loaded.
A standard sanwa/seimitsu pinout has
gnd
up
down
right
left
while the current default pico config is
up
down
left
right
say you are able to hold down a layer button to temporarily enable the dpad buttons to emulate analog stick(s) output.
or a dip switch to change switch to analog stick(L/R) emulation.
The web configurator is driven by Boards.json, and the activate board is set in .env. The problem is that there's no simple way to have that board set by changing the board configuration files in the main firmware. We could do something at build time to change the .env values, but that seems unnecessary.
Instead, I think we should set that information in the BoardConfig.h file. In the configurator, we should pull that value and use it to determine which board in Boards.json to use.
Then we can reimplement the pin restrictors for the Pico, add a full RP2040 profile for most custom boards that just use every pin, and allow the creation of custom boards for anything that doesn't fit those two.
Currently the web configurator runs via lwIP over RNDIS from the TinyUSB library. RNDIS seems to only work on Windows platforms at the moment. Evaluate other ethernet emulation methods over USB such as CDC-ECM for compatibility with Mac and Linux platforms.
GP2040 supports sending analog values in the USB reports, however there is no specific implementation around the use/handling of those analog inputs.
The RP2040 MCU supports 4 ADC channels, with the Pi Pico only making 3 available. Having 4 channels is enough for 2 full joysticks, and there are a few RP2040 boards out there that make all 4 channels available, such as the Sparkfun RP2040 Thing Plus. The Arduino Nano RP2040 Connect actually supports up to 8 ADC channels, which is enough for a full analog XInput implementation.
Need to add features such as options for enabling, deadzone calibration, and possibly some kind of auto calibration to avoid drift.
Add page to config app for customizing RGB LED settings. This should include:
I have been looking into this recently, however I currently don’t have an RP2040 system to test this on as of now. I didn’t see any information in how (or if) you can control the sticks with analog inputs, as analog outputs. Just a quick question.
Thanks,
brickeduser
Hi, would it be possible to implement a Turbo button to enable/disable this function for the other action buttons?
Many thanks for your work so far.
Add page to config app for remapping buttons. Would be pretty awesome if it showed an image of the controller it's being used on. For Pico it would use some generic fightstick image.
Is there a possibility to configure this with a microcontroller that has a wireless module?
Hello, I'm thinking about getting a Raspberry Pico to test this, but it seems that there are different memory sizes available, from 2MB to 16MB. From what I've seen the uf2 file is a little less than 2MB, so would the 2MB flash memory be enough or should I get the one with 4MB+?
Hi @FeralAI, I don't know if this is useful but here you have the image for the default mapping to Xbox360 controller in Windows just in case you want to use it on the documentation.
You can close this issue.
Thank you for your work.
(Same as https://gp2040.info/#/usage?id=buttons)
This will require #34 to be finished. Allow a button to toggle a secondary layer of button mappings on the fly, similar to G-shift for Logitech mice and Hypershift for Razer mice.
Right now, Switch mode works almost flawlessly on PS3/PS4 games with legacy support, but the home button doesn't seem to do anything. I've verified that my buttons are functioning correctly otherwise, so it's definitely something like a different button mapping. I'll compare what I've got working in CircuitPython and see what the deal is. It may require a third mode, but I'm hoping not.
SOCD mode selection is not working on Pico Fighting Board, look into this.
Test OK under win10, no response under mac
How do I make this support macOS monterey? Do I need to install extra drivers?
Add a version check module in the config app that will link to the current release for that board/controller.
I don't think many sticks have a native button for RS and LS, wouldn't it be better to but it on a button that is always there and never plugged up like one of B1-4? For example I tend to only use 6 buttons, and I've known people in the past to only use 3 (for VF) or 4 (for SNK) and plug up the rest.
Also, this is a cool project, I ordered a pico and am looking forward to trying it in my stick.
Add page to the config app to change runtime settings like D-pad mode, SOCD mode, etc.
There seems to be an issue with the API sometimes returning a mangled JSON response, which then causes the frontend application to error and blank out the page. Need to investigate the cause of the mangled JSON response. This doesn't seem to be an issue with static pages and assets, only JSON responses from API calls.
As the title suggests. Would be nice to backup and restore settings after a firmware update that clears them.
This would allow even more crazy ideas.
Pretty much just a table listing how to support controllers with authentications.
Type | Passthrough | Security chip hijacking | Native | Notes |
---|---|---|---|---|
PS4 | ⭕ | △ | △ | Chip hijacking only works with 3rd party controllers and native requires dumping keys from one's own eligible PS4 controller motherboard. |
PS5 | ❌ | △ | ❌ | May be possible by using a certain overpriced (and reportedly broke after firmware update) UP5 module. Still f**k $**y 🖕 |
Xbox 360 | ⭕ | △ | ❌ | Secrets seem to be symmetrical but not public. Chip hijacking should be possible but no public known successes. |
Xbox One/Series | ⭕ | ❓ | ❌ | Secrets not public. Plus no one cares about it enough except bootleggers. |
Basically the best bet is to implement a passthrough support (wide range of controllers covered and user friendly enough). On RP2040 there's a PIO-based USB PHY that's work in progress. MAX3421E is always available as a second option too.
Use the web server features of TinyUSB to host a SPA (single page application) for controller configuration.
I have problem with web configurator in latest 0.4.3 version. I look first page web configurator but when i click Setting tab then it shows at 1ms and dissapear = empty web page. I only display LED configuration and Display configurator.
On 0.4.2 problem is still exist.
Sorry for my bad English.
Hello,
Could it be possible to become a sponsor for feature development ? In particularly for analog support.
Thanks
Is it possible to provide 2 input devices from a single board? This would be a great option for arcade cabinets.
Rumble support could be a nice addition to a controller made using this project.
Especially since, at least in pi pico, there are some unused pins.
The string descriptors for web config interface are not in the correct format and this might be the cause of web config not functioning on Linux due to repeated re-request of these descriptors before finally giving up and hang.
i have my input mode normally set to xinput with dpad mode to d-pad but it gets randomly switched to left or right analog while i'm using the controller.
The GP2040 encoder is awesome, but i have an improvement in mind. Under dipnut on windows, having 20 buttons + dpad would let ppl run a 2-player MAME cab from a single Pico! I'd personally love to see those 8 blank input pins mapped for that purpose :)
So I'm looking into Taiko no Tatsujin (Drum Master game) after the PC/Xbox announcement, and I'm wondering, is there a way to convert analog piezo inputs to work with the GP2040?
Here are two existing arduino codes.
https://github.com/LuiCat/ArduinoTaikoController
https://github.com/ShikyC/Sanro-Arduino
The problem with the first one is that it doesn't register simultaneous hits, only one at a time.
The problem with the second one is that it uses microphones instead of piezo sensors.
And the ultimate problem with both is that they emulate computer keyboards, not game controllers.
It'd be amazing to be able to build a diy tatacon that works with X-input(PC)/PS3/Switch/PS4(with converter).
I use latest wizio-pico, and, patch the tinyusb_gamepad commit(Updated to support latest TinyUSB version #79), then, the init adc is not work.
I init adc in Gamepad::setup method, like:
adc_init();
adc_gpio_init(26);
adc_gpio_init(27);
adc_gpio_init(28);
and, in Gamepad::read method: update joystick like:
adc_select_input(0);
state.lx = (adc_read() >> 4) << 8;
adc_select_input(1);
state.ly = (adc_read() >> 4) << 8;
it worked before, but, now it not work, I am sure it not my hardware problem, and, not the code problem, it must be some latest lib update break something
Create a page in the config app to allow enabling and configuring LED support. This will require some refactoring since the LED code is conditionally included. Should include everything from the RGB LED section of the dev doc: https://feralai.github.io/GP2040/#/development?id=rgb-leds
I'm shorting pin 27 of my Pi Pico to ground, re plugging the device, opening http://192.168.7.1 but nothing is showing up. What am I missing?
Debouncing is currently configured at the beginning of the main.cpp file with a fixed 5ms delay. At the very least this should be editable via the web configurator.
A more robust implementation would have preset values for certain types of devices. For instance stock Sanwa JLFs may need more than the stock 5ms debounce delay, but the normal buttons may not. Would be nice to say "set debounce to X for directionals/stick and Y for buttons".
Hi there,
I bought a HRAP3 on eBay with the Pi Pico board and GP2040 pre-installed, and it is currently unresponsive on PC, MiSTer and Switch, save for the L3 and R3 buttons, which light up when I test the stick under 'game controllers' on PC. The HRAP shows up as an Xbox 360 controller on PC, a console the firmware doesn't support as far as I'm aware, so I'm wondering if this is an issue with the xinput/dinput/console settings - could you please let me know how to switch between these without opening up the stick, if possible? I've tried uninstalling the device on my PC and seeing if I can get it to register as a generic controller instead, but this didn't help. Is there anything else I can try? (I'm completely unfamiliar with GP2040 itself, but would be up for reinstalling it and doing some tinkering if necessary - please point me in the right direction!)
Thank you very much for your help!
Mike
Add support for parsing USB out reports for player LED status.
Could be a useful feature for Hitbox controllers to use them in a more traditional way with non-fighting games.
Hello, I'm a user who plays Tekken 7 with GP2040. I got an issue, where the lever is mapped to the D-Pad suddenly changed to the left analog stick during the gameplay, and I was able to confirm that both inputs were changed even by accessing the web settings. Upon confirmation, other buttons remain the same, only the binding of the lever has been changed.
The environment used is Windows 10 Pro 21H1, x64 environment, XInput mode is being used, and the game being played is Tekken 7.
The same symptom is happening quite often, and the board I'm using is a Raspberry pi pico board.
Is there any way to use potentiometer for triggers buttons (like LT e RT)?
Need to organize documentation into consumer-friendly and developer sections. The Github Wiki system should be sufficient to handle it.
hi, thanks for pico arcade firmware.
i got an error when building firmware from source code.
Compiling .pio\build\raspberry-pi-pico\lib2ad\httpd\fs.o
Compiling .pio\build\raspberry-pi-pico\lib2ad\httpd\fsdata.o
Compiling .pio\build\raspberry-pi-pico\lib2ad\httpd\httpd.o
Archiving .pio\build\raspberry-pi-pico\libae7\liblwip.a
Compiling .pio\build\raspberry-pi-pico\lib888\rndis\rndis.o
In file included from C:\Users\Administrator.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/common/tusb_common.h:68:0,
from C:\Users\Administrator.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/tusb.h:37,
from lib\rndis\rndis.c:46:
C:\Users\Administrator.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/tusb_option.h:274:6: warning: #warning "CFG_TUD_NET is renamed to CFG_TUD_ECM_RNDIS" [-Wcpp]
#warning "CFG_TUD_NET is renamed to CFG_TUD_ECM_RNDIS"
^~~~~~~
lib\rndis\rndis.c: In function 'linkoutput_fn':
lib\rndis\rndis.c:100:9: error: too few arguments to function 'tud_network_can_xmit'
if (tud_network_can_xmit())
^~~~~~~~~Compiling .pio\build\raspberry-pi-pico\lib888\rndis\rndis_reports.o
compilation terminated due to -Wfatal-errors.
*** [.pio\build\raspberry-pi-pico\lib888\rndis\rndis.o] Error 1
In file included from C:\Users\Administrator\.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/common/tusb_common.h:68:0,
from C:\Users\Administrator\.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/class/cdc/cdc.h:35,
from C:\Users\Administrator\.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/class/net/net_device.h:31,
from lib\rndis\rndis_reports.c:33:
C:\Users\Administrator\.platformio\packages\framework-wizio-pico\SDK\lib\tinyusb\src/tusb_option.h:274:6: warning: #warning "CFG_TUD_NET is renamed to CFG_TUD_ECM_RNDIS" [-Wcpp]
#warning "CFG_TUD_NET is renamed to CFG_TUD_ECM_RNDIS"
^~~~~~~
======================================================== [FAILED] Took 17.76 seconds ========================================================
Environment Status Duration
----------------- -------- ------------
raspberry-pi-pico FAILED 00:00:17.759
=================================================== 1 failed, 0 succeeded in 00:00:17.759 ===================================================The terminal process "C:\Users\Administrator\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'raspberry-pi-pico'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
how to build succesfully from source?
thank you.
Define an interface for libraries to be able to plug into GP2040. Would likely have the following traits (plus more I'm sure):
setup()
and loop()
on the core1 threadBoardConfig.h
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.