You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to false) parameter specifying whether the the PinMode is either InputPullUp or InputPullDown. This is a binary breaking change, but does not break the compilation.
completely remove the the PinMode parameter and add two boolean values:
IsPullUp (false means pull-down)
IsExternalResistor (false means configured through PinMode)
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
The text was updated successfully, but these errors were encountered:
* Added IsExternalResistor in the constructor to support external resistors and continue detecting correctly the gpio transitions in the events
* fixing comment
* Adding two constructors to the button which avoids using PinMode
* ctor refactoring to avoid ambiguity
* Cleaned up the old constructors
* Added IsExternalResistor in the constructor to support external resistors and continue detecting correctly the gpio transitions in the events
* fixing comment
* Adding two constructors to the button which avoids using PinMode
* ctor refactoring to avoid ambiguity
* Cleaned up the old constructors
* fixes as requested by the review
* Removed the old two constructors. The default value of `isPullUp` is now true. This PR introduces a source breaking-change as discussed and approved in the Triage.
* Fixing Arduino Monitor example and compatibiltiy files for ctor breaking changes
* Fixed Arduino.Monitor.cs as for request
* dispose + error handling
* shouldDispose check
* Checking whether the pin support being configured as input and/or pull-up/down.
* refactoring
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 inPinStateChanged
is not detected correctly.See: https://github.com/dotnet/iot/blob/main/src/devices/Button/GpioButton.cs#L78
Steps to reproduce
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:
IsExternalResistor
(defaulting tofalse
) parameter specifying whether the thePinMode
is eitherInputPullUp
orInputPullDown
. This is a binary breaking change, but does not break the compilation.PinMode
parameter and add two boolean values:IsPullUp
(false
means pull-down)IsExternalResistor
(false
means configured throughPinMode
)This requires the user to make changes in her code.
With regards to option 2, instead of the two booleans we may introduce an
enum
with the following fields:The text was updated successfully, but these errors were encountered: