7 PushbuttonStateMachine::PushbuttonStateMachine()
24 bool PushbuttonStateMachine::getSingleDebouncedRisingEdge(
bool value)
26 uint16_t timeMillis = millis();
34 prevTimeMillis = timeMillis;
46 else if ((uint16_t)(timeMillis - prevTimeMillis) >= 15)
58 prevTimeMillis = timeMillis;
69 else if ((uint16_t)(timeMillis - prevTimeMillis) >= 15)
112 return pressState.getSingleDebouncedRisingEdge(
isPressed());
117 return releaseState.getSingleDebouncedRisingEdge(!
isPressed());
125 _defaultState = defaultState;
128 void Pushbutton::init2()
132 pinMode(_pin, INPUT_PULLUP);
136 pinMode(_pin, INPUT);
139 delayMicroseconds(5);
145 return digitalRead(_pin) != _defaultState;