Skip to content

Commit a276e7f

Browse files
committed
minor changesin comments reverted
1 parent c6d00f0 commit a276e7f

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

src/OneButton.cpp

+29-25
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,44 @@ OneButton::OneButton(const int pin, const boolean activeLow, const bool pullupAc
6262
void OneButton::setDebounceTicks(const unsigned int ms)
6363
{
6464
_debounce_ms = ms;
65-
}
65+
} // setDebounceTicks
6666

6767

6868
// explicitly set the number of millisec that have to pass by before a click is detected.
6969
void OneButton::setClickTicks(const unsigned int ms)
7070
{
7171
_click_ms = ms;
72-
}
72+
} // setClickTicks
7373

7474

7575
// explicitly set the number of millisec that have to pass by before a long button press is detected.
7676
void OneButton::setPressTicks(const unsigned int ms)
7777
{
7878
_press_ms = ms;
79-
}
79+
} // setPressTicks
8080

8181

8282
// save function for click event
8383
void OneButton::attachClick(callbackFunction newFunction)
8484
{
8585
_clickFunc = newFunction;
86-
}
86+
} // attachClick
8787

8888

8989
// save function for parameterized click event
9090
void OneButton::attachClick(parameterizedCallbackFunction newFunction, void *parameter)
9191
{
9292
_paramClickFunc = newFunction;
9393
_clickFuncParam = parameter;
94-
}
94+
} // attachClick
9595

9696

9797
// save function for doubleClick event
9898
void OneButton::attachDoubleClick(callbackFunction newFunction)
9999
{
100100
_doubleClickFunc = newFunction;
101101
_maxClicks = max(_maxClicks, 2);
102-
}
102+
} // attachDoubleClick
103103

104104

105105
// save function for parameterized doubleClick event
@@ -108,15 +108,15 @@ void OneButton::attachDoubleClick(parameterizedCallbackFunction newFunction, voi
108108
_paramDoubleClickFunc = newFunction;
109109
_doubleClickFuncParam = parameter;
110110
_maxClicks = max(_maxClicks, 2);
111-
}
111+
} // attachDoubleClick
112112

113113

114114
// save function for multiClick event
115115
void OneButton::attachMultiClick(callbackFunction newFunction)
116116
{
117117
_multiClickFunc = newFunction;
118118
_maxClicks = max(_maxClicks, 100);
119-
}
119+
} // attachMultiClick
120120

121121

122122
// save function for parameterized MultiClick event
@@ -125,52 +125,52 @@ void OneButton::attachMultiClick(parameterizedCallbackFunction newFunction, void
125125
_paramMultiClickFunc = newFunction;
126126
_multiClickFuncParam = parameter;
127127
_maxClicks = max(_maxClicks, 100);
128-
}
128+
} // attachMultiClick
129129

130130

131131
// save function for longPressStart event
132132
void OneButton::attachLongPressStart(callbackFunction newFunction)
133133
{
134134
_longPressStartFunc = newFunction;
135-
}
135+
} // attachLongPressStart
136136

137137

138138
// save function for parameterized longPressStart event
139139
void OneButton::attachLongPressStart(parameterizedCallbackFunction newFunction, void *parameter)
140140
{
141141
_paramLongPressStartFunc = newFunction;
142142
_longPressStartFuncParam = parameter;
143-
}
143+
} // attachLongPressStart
144144

145145

146146
// save function for longPressStop event
147147
void OneButton::attachLongPressStop(callbackFunction newFunction)
148148
{
149149
_longPressStopFunc = newFunction;
150-
}
150+
} // attachLongPressStop
151151

152152

153153
// save function for parameterized longPressStop event
154154
void OneButton::attachLongPressStop(parameterizedCallbackFunction newFunction, void *parameter)
155155
{
156156
_paramLongPressStopFunc = newFunction;
157157
_longPressStopFuncParam = parameter;
158-
}
158+
} // attachLongPressStop
159159

160160

161161
// save function for during longPress event
162162
void OneButton::attachDuringLongPress(callbackFunction newFunction)
163163
{
164164
_duringLongPressFunc = newFunction;
165-
}
165+
} // attachDuringLongPress
166166

167167

168168
// save function for parameterized during longPress event
169169
void OneButton::attachDuringLongPress(parameterizedCallbackFunction newFunction, void *parameter)
170170
{
171171
_paramDuringLongPressFunc = newFunction;
172172
_duringLongPressFuncParam = parameter;
173-
}
173+
} // attachDuringLongPress
174174

175175

176176
void OneButton::reset(void)
@@ -189,8 +189,9 @@ int OneButton::getNumberClicks(void)
189189

190190

191191
/**
192-
* @brief Check input of the configured pin, debounce input pin level and then advance the finite state
193-
* machine (FSM).
192+
* @brief Check input of the configured pin,
193+
* debounce input pin level and then
194+
* advance the finite state machine (FSM).
194195
*/
195196
void OneButton::tick(void)
196197
{
@@ -206,7 +207,7 @@ void OneButton::tick(void)
206207
_lastDebounceTime = now;
207208
}
208209
}
209-
}
210+
} // tick()
210211

211212

212213
/**
@@ -215,7 +216,7 @@ void OneButton::tick(void)
215216
void OneButton::_newState(stateMachine_t nextState)
216217
{
217218
_state = nextState;
218-
}
219+
} // _newState()
219220

220221

221222
/**
@@ -233,7 +234,7 @@ void OneButton::tick(bool activeLevel)
233234
_newState(OneButton::OCS_DOWN);
234235
_startTime = now; // remember starting time
235236
_nClicks = 0;
236-
}
237+
} // if
237238
break;
238239

239240
case OneButton::OCS_DOWN:
@@ -247,7 +248,7 @@ void OneButton::tick(bool activeLevel)
247248
if (_longPressStartFunc) _longPressStartFunc();
248249
if (_paramLongPressStartFunc) _paramLongPressStartFunc(_longPressStartFuncParam);
249250
_newState(OneButton::OCS_PRESS);
250-
}
251+
} // if
251252
break;
252253

253254
case OneButton::OCS_UP:
@@ -283,10 +284,10 @@ void OneButton::tick(bool activeLevel)
283284
// this was a multi click sequence.
284285
if (_multiClickFunc) _multiClickFunc();
285286
if (_paramMultiClickFunc) _paramMultiClickFunc(_multiClickFuncParam);
286-
}
287+
} // if
287288

288289
reset();
289-
}
290+
} // if
290291
break;
291292

292293
case OneButton::OCS_PRESS:
@@ -300,7 +301,7 @@ void OneButton::tick(bool activeLevel)
300301
// still the button is pressed
301302
if (_duringLongPressFunc) _duringLongPressFunc();
302303
if (_paramDuringLongPressFunc) _paramDuringLongPressFunc(_duringLongPressFuncParam);
303-
}
304+
} // if
304305
break;
305306

306307
case OneButton::OCS_PRESSEND:
@@ -315,6 +316,9 @@ void OneButton::tick(bool activeLevel)
315316
// unknown state detected -> reset state machine
316317
_newState(OneButton::OCS_INIT);
317318
break;
318-
}
319+
} // if
319320

320321
} // OneButton.tick()
322+
323+
324+
// end.

src/OneButton.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class OneButton
202202
OCS_DOWN = 1, // button is down
203203
OCS_UP = 2, // button is up
204204
OCS_COUNT = 3,
205-
OCS_PRESS = 6, // button is holded down
205+
OCS_PRESS = 6, // button is hold down
206206
OCS_PRESSEND = 7,
207207
};
208208

0 commit comments

Comments
 (0)