Draft
Implement GpioDriver on Pca95x4 for GpioController access#2581
Conversation
Copilot
AI
changed the title
[WIP] Add GpioDriver implementation for Pca95x4
Implement GpioDriver on Pca95x4 for GpioController access
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pca95x4is an 8-bit I2C IO expander that only exposed register-level access, so its pins couldn't be used through the standard GPIO abstraction. This makesPca95x4derive fromGpioDriver, consistent with thePcx857xandTca955xbindings.Users can now drive the expander pins through a
GpioController:Changes
Pca95x4.cs— Derives fromGpioDriver; implements the driver members (PinCount, open/close,Set/GetPinMode,IsPinModeSupported,Read,Write) by mapping onto theConfiguration/InputPort/OutputPortregisters via the existingReadBit/WriteBithelpers. Event-based members throwNotImplementedExceptionwith an explanatory message (mirrorsPcx857x). Disposal is moved into an override ofDispose(bool). The existing register-level public API is unchanged.tests/— New xUnit project covering pin modes, read/write/toggle throughGpioController(backed by an in-memory register mock), and a regression check on the register API.samples/Program.cs— Adds aUseAsGpioControllerexample.README.md— DocumentsGpioControllerusage.Notes
VirtualGpioController/VirtualGpioPinremap pins from an existing controller and don't supply the hardware driver, so they aren't a substitute here; they can wrap this driver if pin remapping is wanted.Configurationbit is an input, a cleared bit is an output.