@@ -71,7 +71,7 @@ void EZButton::Loop()
7171 unsigned long stateChangeDiff = millis () - _buttonDownMillis[i];
7272 if (stateChangeDiff < DebounceTime)
7373 continue ;
74-
74+
7575 if (buttonStates[i])
7676 {
7777 if (!_buttonLastState[i])
@@ -107,21 +107,26 @@ void EZButton::Loop()
107107 delete[] buttonStates;
108108}
109109
110- void EZButton::Subscribe (int index, void (* event)() , EventTypes type)
110+ void EZButton::Subscribe (int index, Event event, EventTypes type)
111111{
112112 _events[EventIndex (index, type)] = event;
113113
114114 LogEvent (" Subscribe:" , index, type);
115115}
116116
117+ void EZButton::Subscribe (int index, void (*event)(), EventTypes type)
118+ {
119+ Subscribe (index, (Event)event, type);
120+ }
121+
117122void EZButton::CallEvent (int index, EventTypes type)
118123{
119124 int i = EventIndex (index, type);
120125
121- LogEvent (" Call:" ,index, type);
126+ LogEvent (" Call:" , index, type);
122127
123128 if (_events[i] != nullptr )
124- _events[i]();
129+ _events[i](index );
125130}
126131
127132int EZButton::EventIndex (int index, EventTypes type)
0 commit comments