MCPcopy Create free account
hub / github.com/FastLED/FastLED / isPressed

Method isPressed

src/fl/sensors/button.cpp.hpp:40–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40bool ButtonLowLevel::isPressed() {
41 switch (mStrategy) {
42 case ButtonStrategy::kHighLowFloating:
43 return highLowFloating();
44 case ButtonStrategy::kPullUp:
45 // Active-low: Button pulls pin to ground when pressed
46 return !mPin.high();
47 case ButtonStrategy::kPullDown:
48 // Active-high: Button pulls pin to VCC when pressed
49 return mPin.high();
50 default:
51 FASTLED_ASSERT(false, "Unknown ButtonLowLevel strategy");
52 return false;
53 }
54}
55
56Button::Button(int pin, ButtonStrategy strategy)
57 : mButton(pin, strategy), mListener(this), mPressedLastFrame(false), mClickedThisFrame(false) {}

Callers 2

ButtonClass · 0.45
onEndFrameMethod · 0.45

Calls 1

highMethod · 0.45

Tested by

no test coverage detected