-
Notifications
You must be signed in to change notification settings - Fork 507
Add hardware turbo controls via MCP23017 I2C GPIO expander #1572
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
base: main
Are you sure you want to change the base?
Conversation
…rify goals, hardware requirements, and implementation details for broader compatibility.
Enhanced documentation across multiple files to prepare for upstream PR: - configs/Pico/README.md: Added Hardware Turbo Controls section with pin assignments, required hardware list, switch mapping, and configuration - configs/Pico/BoardConfig.h: Added detailed inline comments explaining MCP23017 requirements, I2C bus sharing, active-low wiring, and all configuration parameters - lib/mcp23017/mcp23017.h: Added doxygen-style documentation for the MCP23017 driver library with hardware specs and API descriptions - src/addons/turbo.cpp: Enhanced code comments for I2C initialization and switch reading logic with detailed explanations - www/server/docs/GP2040-CE.postman_collection.json: Added API documentation for /api/getTurboDiagnostics endpoint All documentation follows GP2040-CE conventions. Build verified successful. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
All hardware and software implementation phases have been successfully completed: - Phase 1: MCP23017 Library ✅ - Phase 2: Hardware Assembly ✅ - Phase 3: Turbo Addon Integration ✅ - Phase 4: Testing & Validation ✅ Added comprehensive project status sections: - Project completion summary - Technical achievements and key files - Testing results (all PASS) - Future enhancement suggestions - Upstream contribution checklist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Currently, this is set up to add functionality that would be optional to the build process, rather than as an addon that could benefit all builds. If we're to add another IO expansion driver, it needs to be available to all devices. A few things that I would request if we were to consider this for merging.
There is also the topic of AI assisted development here. We typically do not approve PRs that have been developed using AI tools as the code cannot be guaranteed functional. Even if my requests can be addressed, this will require further discussion with the team before we can consider merging it in, and we will need to obtain the necessary hardware to be able to vet it further. |
|
Thank you for the detailed feedback. I am happy enough to keep this feature in my own fork. This feature is mainly for people who want to mod their old-school arcade stick with the great GP2040-CE project. These old-school sticks such as SEGA HSS-0136 have hardware turbo on-off switches and turbo speed slider. It will be interesting to be able to retain them. I think GP2040-CE is a wonderful project. So, I try to contribute this PR so that other retro game fans can mod their HSS-0136 without giving up those buttons. Lastly, on AI asisted development, I think the PR should be considered based on the quality of the PR, rather than whether AI tool has been used or not. PR without using AI tools cannot be guaranteed functional as well. But I fully understand the concern from the maintainer, that will create a lot of review burden if someone just use AI tools to produce a lot of low-quality PRs without verifications. That's why I intentionally disclose this feature has been developed using AI tools. I did review the codes and test the feature working properly on my hardware. |
Summary
This PR adds hardware-based turbo controls to GP2040-CE using an MCP23017 I2C GPIO expander. This enables users to add physical toggle switches for per-button turbo control and an optional analog speed dial, without requiring boards with many spare GPIO pins.
Key Features
Hardware Requirements
Implementation Details
New Components:
lib/mcp23017/- Generic MCP23017 driver libraryModified Components:
src/addons/turbo.cpp- Enhanced turbo addon to read I2C switchessrc/addons/display.cpp- Added I2C device scanning diagnosticssrc/webconfig.cpp- New/api/getTurboDiagnosticsendpointwww/src/Addons/Turbo.tsx- Real-time switch state displayConfiguration:
TURBO_I2C_SWITCHES_ENABLEDin BoardConfig.hPicoboard config as reference implementationBoard Compatibility
This feature is designed to work with any RP2040-based board that has:
The reference implementation uses the
Picoboard configuration.Web Configurator Integration
The turbo configuration page now displays real-time diagnostics:
Testing
Documentation
In-repo documentation added:
configs/Pico/README.md- Hardware setup, pin assignments, switch mappingconfigs/Pico/BoardConfig.h- Detailed inline configuration commentslib/mcp23017/mcp23017.h- Doxygen-style API documentationsrc/addons/turbo.cpp- Implementation commentswww/server/docs/GP2040-CE.postman_collection.json- API endpoint documentationExternal documentation needed:
Switch Mapping
MCP23017 Port A pins map to buttons as follows:
Switches are wired active-low (closed = turbo enabled).
Configuration Example
Future Enhancements
Possible improvements for future PRs:
Checklist
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com