21 template <
typename Circuit,
typename Pin>
28 BUTTON_PRESSED = Circuit::BUTTON_PRESSED,
29 BUTTON_RELEASED = Circuit::BUTTON_RELEASED
61 pinMode(this->
pin_, Circuit::PIN_MODE);
97 if(rc) this->stateCount_ = 0;
113 if(rc) this->stateCount_ = 0;
128 return this->
currState_ == Circuit::BUTTON_PRESSED;
137 return isPressed() && ((millis() - this->millisStart_) >= this->heldTime_);
146 return !
isPressed() && ((millis() - this->millisStart_) >= this->idleTime_);
157 return this->
currState_ == Circuit::BUTTON_RELEASED && this->prevState_ == Circuit::BUTTON_PRESSED;
171 return this->stateCount_ == 2 && ((millis() - this->millisStart_) >= this->clickTime_);
183 return this->stateCount_ >= 4;
Definition of Pulldown and pull-up ressitor circuits.
Definition of the Pin class and subclasses (DebouncedPin, ClickerPin), providing debounce logic when ...
Resistor circuit base class.
Pin base class reading direct from the pin (without debouncing).
uint8_t pin_
The Arduino pin connected to the button.
void readPin()
Read the pin directly.
uint8_t currState_
The reading of the pin.