FastLED 3.9.15
Loading...
Searching...
No Matches

◆ isPressed()

bool fl::ButtonLowLevel::isPressed ( )

Definition at line 43 of file button.cpp.

43 {
44 // FastLED doesn't have reliable support for pullups/pulldowns.
45 // So we instead use a strategy where the pin is set to high, then
46 // checked if it's high, then set to low, and then checked if it's low
47 // if this is the case, then the pin is floating and thefore the button is
48 // not being pressed. return (mStrategy == kHighLowFloating) ?
49 // highLowFloating() :
50 // (mStrategy == kPullUp) ? mPin.high() : // not implemented yet
51 // (mStrategy == kPullDown) ? !mPin.high() : // not implemented yet
52 // false; // unknown strategy, return false
53 switch (mStrategy) {
55 return highLowFloating();
56 case kPullUp:
57 return mPin.high(); // not implemented yet
58 default:
59 FASTLED_ASSERT(false, "Unknown ButtonLowLevel strategy");
60 return false; // unknown strategy, return false
61 }
62}
bool highLowFloating()
Definition button.cpp:22
ButtonStrategy mStrategy
Definition button.h:44
fl::DigitalPin mPin
Definition button.h:43
@ kHighLowFloating
Definition button.h:21
@ kPullUp
Definition button.h:22

References highLowFloating(), fl::kHighLowFloating, fl::kPullUp, mPin, and mStrategy.

+ Here is the call graph for this function: