Add INPUT_PULLUP support on firmdata platform#728
Add INPUT_PULLUP support on firmdata platform#728disaster37 wants to merge 1 commit intohybridgroup:devfrom
Conversation
Add the availability to use INPUT_PULLUP on some GPIO driver: - button - direct_pin - makey_button - pir_motion_driver
|
Hi, there are some reason to not merge this PR ? |
|
@disaster37 thank you for your PR. IMO this is a nice new feature, so I will try to make some suggestions to get some progress.
Maybe I have not understand the code quite correctly, but would it be better to add an option for each input instead of introducing a new implementation for DigitalRead(), e.g. by an interface with "SetPullUp(pin string, state bool)" and "IsInputPullup()"? In general this should be possible, because the "f.Board.Pins()[p].Mode" is used in both "DigitalRead()" and "DigitalReadInputPullup()". Instead of "go fmt" in unrelated packages and adjust/cleanup of "go.mod/go.sum" you can add an issue (maybe there is one for "go fmt") or try to solve such general format errors by a separate PR. Although I have no firmata adaptor tested yet, thanks again for this new feature! IMO this could be also useful for other boards. |
|
I will now revert the PR back to Draft as reference |
|
accidentally closed - now reopen |
Add the availability to use INPUT_PULLUP on some GPIO driver:
INPUT_PULLUP on arduino is use to avoid to add some resistor when yous should to read the state of button.
When INPUT_PULLUP is enable, the signal is inverted, so the platform invert signal to be transparent for user.
Sample to use it with button driver: