Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New addon to support controller input from usb host #1102

Closed
wants to merge 4 commits into from

Conversation

smahdink
Copy link

@smahdink smahdink commented Aug 5, 2024

A new addon is added to the gp2040-ce named ControllerHostAddon, that enables getting input from USB controllers through the added USB host port in PICO and USB Host addon.

Currently supported controllers are:

  1. Google Stadia controller
  2. Sony Dualshock 4 controller

@mikepparks
Copy link
Contributor

Just a few notes and nitpicks.

  • Would prefer to not have unnamed bitfields, if possible. The reasons why they're used are understood, but means extra work later for someone trying to understand the code.
  • For the sake of not colliding with design patterns of the same name, would prefer to not use Controller in the name of the class or related addon assets. GamepadHost might be a better alternative, even if it doesn't cover a full scope of game controllers down the line.

@smahdink
Copy link
Author

smahdink commented Aug 6, 2024

Thank you for the notes, can you elaborate about your first point a little more?
About the name I actually like the name you suggested and if everyone agrees I would change the name.

@mikepparks
Copy link
Contributor

Lines 16-19 in headers/addons/controller_host_listener.h for example. I know why those bitfields are unnamed, but for the sake of having code that can be read & understood, we'd prefer if they were named.

@mikepparks
Copy link
Contributor

It appears that this is causing main Gamepad inputs to not function when enabled. Your process() function does not check for changes in your own gamepad state, which continuously overwrites the Gamepad's values with your own. This prevents core functionality from occurring, including being able to use shortcuts on boot to load into bootsel or webconfig. I would say to only update Gamepad state when:

  • A supported device is connected to USB Host
  • The input state from that device has changed since its previous iteration
  • If the device is disconnected, no changes are made to Gamepad.

This will need to be addressed before we can determine if it's functional enough to merge.

@arntsonl
Copy link
Contributor

We're going to push this into the next version of the release. We want functionality like this, but this does open a big can of worms. I think moving our keyboard/mouse/gamepad host into a single host controller with host drivers similar to how we do drivers now is going to be the magic.

mikepparks added a commit to madgooselabs/GP2040-CE that referenced this pull request Nov 24, 2024
Previous PR OpenStickCommunity#1102 by @smahdink
* Updates naming to GamepadUSB instead of Controller to avoid collision with controller objects.
* Adds secondary PID for DS4 usage
* Fixes issue where GPIO-based inputs are overridden, preventing main GPIO controls from functioning
@arntsonl
Copy link
Contributor

Reimplemented in PR#1221!

@arntsonl arntsonl closed this Nov 24, 2024
arntsonl pushed a commit that referenced this pull request Nov 25, 2024
Previous PR #1102 by @smahdink
* Updates naming to GamepadUSB instead of Controller to avoid collision with controller objects.
* Adds secondary PID for DS4 usage
* Fixes issue where GPIO-based inputs are overridden, preventing main GPIO controls from functioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants