-
Notifications
You must be signed in to change notification settings - Fork 609
Closed
Labels
Priority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasebugSomething isn't workingSomething isn't working
Description
If an external pull up resistor is wired to the pin button and the user creates the button with PinMode.Input (without internal resistors), the transition in PinStateChanged is not detected correctly.
See: https://github.com/dotnet/iot/blob/main/src/devices/Button/GpioButton.cs#L78
Steps to reproduce
- Use an external pull-up resistor
- Configure the button with
PinMode.Input
The gpio button always need either a pull-up or pull-down. It then can be internal (provided by the board) and configured by PinMode or external.
In order to fix this problem, we may use one of the following strategies:
- add a boolean
IsExternalResistor(defaulting tofalse) parameter specifying whether the thePinModeis eitherInputPullUporInputPullDown. This is a binary breaking change, but does not break the compilation. - completely remove the the
PinModeparameter and add two boolean values:
IsPullUp(falsemeans pull-down)IsExternalResistor(falsemeans configured throughPinMode)
This requires the user to make changes in her code.
- Add a new constructor overload (eventuallty deprecating the previous ones). This does not break any code (not even binary) but still exhibit the bug when using the old constructors.
With regards to option 2, instead of the two booleans we may introduce an enum with the following fields:
- PullUpInternal
- PullUpExternal
- PullDownInternal
- PullDownExternal
Metadata
Metadata
Assignees
Labels
Priority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasebugSomething isn't workingSomething isn't working