initialize a Button object
| 7 | |
| 8 | // initialize a Button object |
| 9 | void Button::begin() |
| 10 | { |
| 11 | pinMode(m_pin, m_puEnable ? INPUT_PULLUP : INPUT); |
| 12 | m_state = static_cast<bool>(digitalRead(m_pin)) ^ m_invert; |
| 13 | m_time = millis(); |
| 14 | m_lastState = m_state; |
| 15 | m_changed = false; |
| 16 | m_lastChange = m_time; |
| 17 | } |
| 18 | |
| 19 | // returns the state of the button, true if pressed, false if released. |
| 20 | // does debouncing, captures and maintains times, previous state, etc. |
nothing calls this directly
no outgoing calls
no test coverage detected