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

Add event handling methods #2140

Merged
merged 7 commits into from Oct 19, 2023
Merged

Conversation

pgrawehr
Copy link
Contributor

@pgrawehr pgrawehr commented Oct 1, 2023

Fixes #2134

I had the EnableInterruptOnChange written long ago already, but apparently forgot to write a PR for it. Now that's done, together with the support for event handling using the "normal" GpioDriver methods.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Oct 1, 2023
Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good all up.

src/devices/Mcp23xxx/Mcp23x1x.cs Outdated Show resolved Hide resolved
src/devices/Mcp23xxx/Mcp23x1x.cs Outdated Show resolved Hide resolved
Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

… setup

If an interrupt happens while the pin is still being configured,
undefined behavior could occur.
Allows us to trigger on pins where we lost the interrupt,
at least in most cases (obviously, very short pulses on
multiple inputs will still lose some)
@@ -315,37 +326,55 @@ protected PinValue InternalReadInterrupt(Port port)
/// </returns>
public PinValue ReadInterrupt() => InternalReadInterrupt(Port.PortA);

private byte SetBit(byte data, int bitNumber) => (byte)(data | (1 << bitNumber));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can be static

@krwq krwq merged commit 8e745c6 into dotnet:main Oct 19, 2023
9 checks passed
@pgrawehr pgrawehr added this to the v3.1.0 milestone Nov 9, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mcp23017 missing Events/RegisterCallbackForPinValueChangedEvent
3 participants