Skip to content

Commit 33a6829

Browse files
committed
added reset function
1 parent 20186f0 commit 33a6829

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/EZButton.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class EZButton
2424

2525
~EZButton();
2626

27+
void Reset();
2728
void CheckButtons();
2829
void Subscribe(String buttonName, void (*event)(), EventTypes type);
2930

src/EZButton.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ EZButton::~EZButton()
4343
delete[] _onHoldReleaseEvents;
4444
}
4545

46+
void EZButton::Reset(){
47+
for (int i = 0; i < _numButtons; i++)
48+
{
49+
_buttonDownMillis[i] = 0;
50+
_buttonLastState[i] = false;
51+
_lastHoldInterval[i] = 0;
52+
}
53+
}
54+
4655
void EZButton::CheckButtons()
4756
{
4857
bool *buttonStates = _readButtons(_buttons, _numButtons);

0 commit comments

Comments
 (0)