Methods to determine whether Button is currently pressed #67

Merged
jamesmyatt merged 3 commits from better_button into master 2020-09-03 16:28:59 +03:00
jamesmyatt commented 2020-08-25 16:02:12 +03:00 (Migrated from github.com)

Main update is to add isPressed and getPressedState methods, otherwise there is no direct public way to determine whether the button is currently pressed.

Also updated to re-use state variable from Debouncer class. Also addresses #62

Main update is to add isPressed and getPressedState methods, otherwise there is no direct public way to determine whether the button is currently pressed. Also updated to re-use state variable from Debouncer class. Also addresses #62
thomasfredericks commented 2020-08-25 21:33:46 +03:00 (Migrated from github.com)

As I commented in the source code, the inline functions need to stay private as they are internal to Debouncer and could change in the future. So I agree with the new functions, but not the conversion of the private inline functions to protected ones.

As I commented in the source code, the inline functions need to stay private as they are internal to Debouncer and could change in the future. So I agree with the new functions, but not the conversion of the private inline functions to protected ones.
jamesmyatt commented 2020-08-26 15:45:34 +03:00 (Migrated from github.com)

I think it's OK to make these methods protected rather than private, but not public, but if you prefer I'll revert that change.

I think it's OK to make these methods protected rather than private, but not public, but if you prefer I'll revert that change.
jamesmyatt commented 2020-08-26 15:57:29 +03:00 (Migrated from github.com)

Does this also mean that stateForPressed and pin should also private?

Does this also mean that stateForPressed and pin should also private?
jamesmyatt commented 2020-08-28 16:21:50 +03:00 (Migrated from github.com)

@thomasfredericks , I've updated this as requested.

@thomasfredericks , I've updated this as requested.
Derkades commented 2020-09-02 11:37:39 +03:00 (Migrated from github.com)

This is a good feature, for example to determine the state of switches when the microcontroller boots instead of only after a switch state change.

This is a good feature, for example to determine the state of switches when the microcontroller boots instead of only after a switch state change.
thomasfredericks commented 2020-09-03 16:28:41 +03:00 (Migrated from github.com)

Thanks @jamesmyatt . Merging!

Thanks @jamesmyatt . Merging!
jamesmyatt commented 2020-09-03 18:45:05 +03:00 (Migrated from github.com)

Thanks

Thanks
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Max/thomasfredericks_Bounce2#67