From 01e6fc9398d3a59544c20d6d8000117d6dcd0246 Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Sat, 5 Oct 2019 16:14:33 -0400 Subject: [PATCH 1/2] Added a protected changed() function --- src/Bounce2.cpp | 2 +- src/Bounce2.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bounce2.cpp b/src/Bounce2.cpp index 049452c..1400123 100644 --- a/src/Bounce2.cpp +++ b/src/Bounce2.cpp @@ -104,7 +104,7 @@ bool Bounce::update() #endif - return getStateFlag(CHANGED_STATE); + return changed(); } diff --git a/src/Bounce2.h b/src/Bounce2.h index da3d429..a48f7e9 100644 --- a/src/Bounce2.h +++ b/src/Bounce2.h @@ -194,6 +194,10 @@ class Bounce inline void unsetStateFlag(const uint8_t flag) {state &= ~flag;} inline void toggleStateFlag(const uint8_t flag) {state ^= flag;} inline bool getStateFlag(const uint8_t flag) {return((state & flag) != 0);} + + protected: + bool Bounce::changed( ) { return getStateFlag(CHANGED_STATE); } + }; #endif -- 2.54.0 From 220a287467764cc11d3f0f58a038af8d459f4403 Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Sun, 6 Oct 2019 13:01:12 -0400 Subject: [PATCH 2/2] Made changed() public instead of protected --- src/Bounce2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bounce2.h b/src/Bounce2.h index a48f7e9..a8ee6d6 100644 --- a/src/Bounce2.h +++ b/src/Bounce2.h @@ -195,7 +195,7 @@ class Bounce inline void toggleStateFlag(const uint8_t flag) {state ^= flag;} inline bool getStateFlag(const uint8_t flag) {return((state & flag) != 0);} - protected: + public: bool Bounce::changed( ) { return getStateFlag(CHANGED_STATE); } }; -- 2.54.0