Logic_library
Library for Logic board by RoboticsBrno.
Loading...
Searching...
No Matches
Buttons.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Error.hpp"
4#include "Platform.hpp"
5#include <array>
6#include <bitset>
7#include <driver/gpio.h>
8#include <eventpp/callbacklist.h>
9#include <eventpp/utilities/conditionalremover.h>
10#include <eventpp/utilities/counterremover.h>
11#include <freertos/FreeRTOS.h>
12#include <freertos/queue.h>
13#include <soc/gpio_periph.h>
14
15extern QueueHandle_t eventQueue;
16
17class Buttons {
18 friend class Logic;
19
20public:
21 using CallbackList = eventpp::CallbackList<void(std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns)>;
22
23private:
24 static constexpr const char* const m_tag = "Buttons";
25
26 CallbackList m_callbackListButtons;
27 QueueHandle_t m_eventQueue;
28
29 static void callbacksTask(void* selfVoid);
30
31 Buttons();
32 void init();
33
34 static void IRAM_ATTR isrHandler(void* selfVoid);
35
36public:
37 Buttons(Buttons&) = delete;
39
40 static bool IRAM_ATTR read(gpio_num_t);
41 static bool IRAM_ATTR read(ButtonID);
42 static std::bitset<MaxID> IRAM_ATTR readAll();
43
44 CallbackList& callbackList() { return m_callbackListButtons; }
45
46 static bool IRAM_ATTR precti(gpio_num_t cisloPinu) {
47 return read(cisloPinu);
48 }
49 static bool IRAM_ATTR precti(ButtonID idTlacitka) {
50 return read(idTlacitka);
51 }
52 static std::bitset<MaxID> IRAM_ATTR prectiVsechny() {
53 return readAll();
54 }
55
56 /*
57 buttons.onChange([](std::bitset<MaxID> currentState, std::bitset<MaxID> buttonChange) {
58 if (buttonChange[up] == 1) {
59
60 std::cout << "Button Up has changed and is now ";
61
62 if (currentState[Up] == 1) {
63 std::cout << "pressed." << std::endl;
64 } else {
65 std::cout << "released." << std::endl;
66 }
67 }
68 });
69
70 buttons.onChange([](std::bitset<MaxID> currentState) {
71 std::cout << "Button Up is now ";
72
73 if (currentState[Up] == 1) {
74 std::cout << "pressed." << std::endl;
75 } else {
76 std::cout << "released." << std::endl;
77 }
78 });
79
80 buttons.onChange([]() {
81 std::cout << "A button has changed. No more information available" << std::endl;
82 });
83
84 buttons.onChange([](std::bitset<MaxID> currentState, std::bitset<MaxID> buttonChange) {
85 std::cout << "You will see this only when Button Down changes, and the button is now ";
86
87 if (currentState[Down] == 1) {
88 std::cout << "pressed." << std::endl;
89 } else {
90 std::cout << "released." << std::endl;
91 }
92 }, Down);
93
94 buttons.onChange([](bool isPressed) {
95 std::cout << "You will see this only when Button Down changes" << std::endl;
96
97 if (isPressed == 1) {
98 std::cout << "pressed." << std::endl;
99 } else {
100 std::cout << "released." << std::endl;
101 }
102 }, Down);
103
104
105 buttons.onChange([]() {
106 std::cout << "You will see this only when Button Down changes" << std::endl;
107 }, Down);
108 */
109
110 CallbackList::Handle onChange(CallbackList::Callback function);
111 CallbackList::Handle onChange(std::function<void(std::bitset<MaxID> currentState)> function) {
112 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID>) { function(currentState); });
113 }
114 CallbackList::Handle onChange(std::function<void()> function) {
115 return onChange([=](std::bitset<MaxID>, std::bitset<MaxID>) { function(); });
116 }
117
118 CallbackList::Handle onChange(CallbackList::Callback function, ButtonID watchedButton) {
119 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
120 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns) {
121 if (changedBtns[watchedButton]) {
122 function(currentState, changedBtns);
123 }
124 });
125 }
126 CallbackList::Handle onChange(std::function<void(bool isPressed)> function, ButtonID watchedButton) {
127 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
128 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns) {
129 if (changedBtns[watchedButton]) {
130 function(currentState[watchedButton]);
131 }
132 });
133 }
134 CallbackList::Handle onChange(std::function<void()> function, ButtonID watchedButton) {
135 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
136 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns) {
137 if (changedBtns[watchedButton]) {
138 function();
139 }
140 });
141 }
142 Buttons::CallbackList::Handle onNextChanges(Buttons::CallbackList::Callback function, int count) {
143 return eventpp::counterRemover(m_callbackListButtons).append(function, count);
144 }
145 Buttons::CallbackList::Handle onNextChange(Buttons::CallbackList::Callback function) {
146 return onNextChanges(function, 1);
147 }
148 CallbackList::Handle onNextChanges(std::function<void(bool isPressed)> function, ButtonID watchedButton, int count) {
149 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
150 return onNextChanges([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns) {
151 if (changedBtns[watchedButton]) {
152 function(currentState[watchedButton]);
153 }
154 },
155 count);
156 }
157 CallbackList::Handle onNextChange(std::function<void(bool isPressed)> function, ButtonID watchedButton) {
158 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
159 return onNextChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changedBtns) {
160 if (changedBtns[watchedButton]) {
161 function(currentState[watchedButton]);
162 }
163 });
164 }
165 template<typename Condition>
166 Buttons::CallbackList::Handle onChangeUntil(Buttons::CallbackList::Callback function, Condition condition) {
167 return eventpp::conditionalRemover<Condition>(m_callbackListButtons).append(function, condition);
168 }
169
170 /*
171 buttons.onPress([](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
172 std::cout << "A button has been pressed. ";
173
174 if (changed[Right] == 1) {
175 std::cout << "It was the Right button" << std::endl;
176 } else {
177 std::cout << "It was not the Right button" << std::endl;
178 }
179 });
180
181 buttons.onPress([](std::bitset<MaxID> currentState) {
182 std::cout << "A button has been pressed. ";
183
184 std::cout << "Buttons ";
185
186 for(int i = 0; i < MaxID; i++) {
187 if (currentState[i] == 1) {
188 std::cout << i << ", ";
189 }
190 }
191
192 std::cout << "are now pressed." << std::endl;
193 });
194
195 buttons.onPress([]() {
196 std::cout << "A button has been pressed. No more information available" << std::endl;
197 });
198
199 buttons.onPress([]() {
200 std::cout << "You will see this only when Button Left get pressed down." << std::endl;
201 }, Left);
202 */
203
204 CallbackList::Handle onPress(CallbackList::Callback function) {
205 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
206 if ((changed & currentState).any()) {
207 function(currentState, changed);
208 }
209 });
210 }
211 CallbackList::Handle onPress(std::function<void(std::bitset<MaxID> currentState)> function) {
212 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
213 if ((changed & currentState).any()) {
214 function(currentState);
215 }
216 });
217 }
218 CallbackList::Handle onPress(std::function<void()> function) {
219 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
220 if ((changed & currentState).any()) {
221 function();
222 }
223 });
224 }
225
226 CallbackList::Handle onPress(std::function<void()> function, ButtonID watchedButton) {
227 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
228 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
229 if (currentState[watchedButton] && changed[watchedButton]) {
230 function();
231 }
232 });
233 }
234 CallbackList::Handle onNextPresses(std::function<void()> function, ButtonID watchedButton, int count) {
235 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
236 return onNextChanges([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
237 if (currentState[watchedButton] && changed[watchedButton]) {
238 function();
239 }
240 },
241 count);
242 }
243
244 CallbackList::Handle onNextPress(std::function<void()> function, ButtonID watchedButton) {
245 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
246 return onNextChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
247 if (currentState[watchedButton] && changed[watchedButton]) {
248 function();
249 }
250 });
251 }
252
253 template<typename Condition>
254 Buttons::CallbackList::Handle onPressUntil(std::function<void()> function, Condition condition, ButtonID watchedButton) {
255 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
256 return onChangeUntil<Condition>([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
257 if (currentState[watchedButton] && changed[watchedButton]) {
258 function();
259 }
260 }, condition);
261 }
262 /*
263 buttons.onRelease([](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
264 std::cout << "A button has been released. ";
265
266 if (changed[Right] == 0) {
267 std::cout << "It was the Right button" << std::endl;
268 } else {
269 std::cout << "It was not the Right button" << std::endl;
270 }
271 });
272
273 buttons.onRelease([](std::bitset<MaxID> currentState) {
274 std::cout << "A button has been released. ";
275
276 std::cout << "Buttons ";
277
278 for(int i = 0; i < MaxID; i++) {
279 if (currentState[i] == 0) {
280 std::cout << i << ", ";
281 }
282 }
283
284 std::cout << "are now released." << std::endl;
285 });
286
287 buttons.onRelease([]() {
288 std::cout << "A button has been released. No more information available" << std::endl;
289 });
290
291 buttons.onRelease([]() {
292 std::cout << "You will see this only when Button Left gets released." << std::endl;
293 }, Left);
294 */
295
296 CallbackList::Handle onRelease(CallbackList::Callback function) {
297 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
298 if ((changed & ~currentState).any()) {
299 function(currentState, changed);
300 }
301 });
302 }
303 CallbackList::Handle onRelease(std::function<void(std::bitset<MaxID> currentState)> function) {
304 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
305 if ((changed & ~currentState).any()) {
306 function(currentState);
307 }
308 });
309 }
310 CallbackList::Handle onRelease(std::function<void()> function) {
311 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
312 if ((changed & ~currentState).any()) {
313 function();
314 }
315 });
316 }
317
318 CallbackList::Handle onRelease(std::function<void()> function, ButtonID watchedButton) {
319 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
320 return onChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
321 if (!currentState[watchedButton] && changed[watchedButton]) {
322 function();
323 }
324 });
325 }
326 CallbackList::Handle onNextReleases(std::function<void()> function, ButtonID watchedButton, int count) {
327 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
328 return onNextChanges([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
329 if (!currentState[watchedButton] && changed[watchedButton]) {
330 function();
331 }
332 },
333 count);
334 }
335
336 CallbackList::Handle onNexRelease(std::function<void()> function, ButtonID watchedButton) {
337 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
338 return onNextChange([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
339 if (!currentState[watchedButton] && changed[watchedButton]) {
340 function();
341 }
342 });
343 }
344
345 template<typename Condition>
346 Buttons::CallbackList::Handle onReleaseUntil(std::function<void()> function, Condition condition, ButtonID watchedButton) {
347 checkRange(watchedButton, 0, ButtonID::MaxID - 1, m_tag);
348 return onChangeUntil<Condition>([=](std::bitset<MaxID> currentState, std::bitset<MaxID> changed) {
349 if (!currentState[watchedButton] && changed[watchedButton]) {
350 function();
351 }
352 }, condition);
353 }
354 /*
355 buttons.priZmene([](std::bitset<MaxID> aktualniStav, std::bitset<MaxID> zmenenaTlacitka) {
356 if (zmenenaTlacitka[Up] == 1) {
357
358 std::cout << "Tlačítko Nahoru se změnilo a teď je ";
359
360 if (aktualniStav[Up] == 1) {
361 std::cout << "zmáčknuté." << std::endl;
362 } else {
363 std::cout << "puštěné." << std::endl;
364 }
365 }
366 });
367
368 buttons.priZmene([](std::bitset<MaxID> aktualniStav) {
369 std::cout << "Tlačítko Nahoru je nyní ";
370
371 if (aktualniStav[Up] == 1) {
372 std::cout << "zmáčknuté." << std::endl;
373 } else {
374 std::cout << "puštěné." << std::endl;
375 }
376 });
377
378 buttons.priZmene([]() {
379 std::cout << "Tlačítko bylo změněno. Není k dispozici více informací." << std::endl;
380 });
381
382 buttons.priZmene([](std::bitset<MaxID> aktualniStav, std::bitset<MaxID> zmenenaTlacitka) {
383 std::cout << "Tohle uvidíte pouze pokud se změní tlačítko Dolů, a toto tlačítko je nyní ";
384
385 if (aktualniStav[Down] == 1) {
386 std::cout << "zmáčknuté." << std::endl;
387 } else {
388 std::cout << "puštěné." << std::endl;
389 }
390 }, Down);
391
392 buttons.priZmene([](bool isPressed) {
393 std::cout << "Tohle uvidíte pouze pokud se změní tlačítko Dolů" << std::endl;
394
395 if (isPressed == 1) {
396 std::cout << "zmáčknuté." << std::endl;
397 } else {
398 std::cout << "puštěné." << std::endl;
399 }
400 }, Down);
401
402
403 buttons.onChange([]() {
404 std::cout << "Tohle uvidíte pouze pokud se změní tlačítko Dolů" << std::endl;
405 }, Down);
406 */
407 CallbackList::Handle priZmene(CallbackList::Callback funkce) { return onChange(funkce); }
408 CallbackList::Handle priZmene(std::function<void(std::bitset<MaxID> aktualniStav)> funkce) { return onChange(funkce); }
409 CallbackList::Handle priZmene(std::function<void()> funkce) { return onChange(funkce); }
410
411 CallbackList::Handle priZmene(CallbackList::Callback funkce, ButtonID sledovaneTlacitko) { return onChange(funkce, sledovaneTlacitko); }
412 CallbackList::Handle priZmene(std::function<void(bool jeStisknuto)> funkce, ButtonID sledovaneTlacitko) {
413 return onChange(funkce, sledovaneTlacitko);
414 }
415 CallbackList::Handle priZmene(std::function<void()> funkce, ButtonID sledovaneTlacitko) {
416 return onChange(funkce, sledovaneTlacitko);
417 }
418 /*
419 buttons.priStisku([](std::bitset<MaxID> aktualniStav, std::bitset<MaxID> zmena) {
420 std::cout << "Nějaké tlačítko bylo zmáčknuto. ";
421
422 if (zmena[Right] == 1) {
423 std::cout << "Bylo to tlačítko Vpravo" << std::endl;
424 } else {
425 std::cout << "Nebylo to tlačítko Vpravo" << std::endl;
426 }
427 });
428
429 buttons.priStisku([](std::bitset<MaxID> aktualniStav) {
430 std::cout << "Nějaké tlačítko bylo zmáčknuto. ";
431
432 std::cout << "Tlačítka ";
433
434 for(int i = 0; i < MaxID; i++) {
435 if (aktualniStav[i] == 1) {
436 std::cout << i << ", ";
437 }
438 }
439
440 std::cout << "jsou nyní zmáčknutá." << std::endl;
441 });
442
443 buttons.priStisku([]() {
444 std::cout << "Tlačítko bylo Zmáčknuto. Není k dispozici více informací." << std::endl;
445 });
446
447 buttons.priStisku([]() {
448 std::cout << "Tohle uvidíte pouze pokud zmáčknete tlačítko Vlevo." << std::endl;
449 }, Left);
450 */
451 CallbackList::Handle priStisku(CallbackList::Callback funkce) {
452 return onPress(funkce);
453 }
454 CallbackList::Handle priStisku(std::function<void(std::bitset<MaxID> currentState)> funkce) {
455 return onPress(funkce);
456 }
457 CallbackList::Handle priStisku(std::function<void()> funkce) {
458 return onPress(funkce);
459 }
460
461 CallbackList::Handle priStisku(std::function<void()> funkce, ButtonID sledovaneTlacitko) {
462 return onPress(funkce, sledovaneTlacitko);
463 }
464 /*
465 buttons.priUvolneni([](std::bitset<MaxID> aktualniStav, std::bitset<MaxID> zmena) {
466 std::cout << "Tlačítko bylo puštěno. ";
467
468 if (zmena[Right] == 1) {
469 std::cout << "Bylo to tlačítko Vpravo" << std::endl;
470 } else {
471 std::cout << "Nebylo to tlačítko Vpravo" << std::endl;
472 }
473 });
474
475 buttons.priUvolneni([](std::bitset<MaxID> aktualniStav) {
476 std::cout << "Tlačítko bylo puštěno. ";
477
478 std::cout << "Tlačítka ";
479
480 for(int i = 0; i < MaxID; i++) {
481 if (aktualniStav[i] == 0) {
482 std::cout << i << ", ";
483 }
484 }
485
486 std::cout << "jsou nyní puštěná." << std::endl;
487 });
488
489 buttons.priUvolneni([]() {
490 std::cout << "Tlačítko bylo uvolněno. Není k dispozici více informací." << std::endl;
491 });
492
493 buttons.priUvolneni([]() {
494 std::cout << "Tohle uvidíte pouze pokud pustíte tlačítko Vlevo." << std::endl;
495 }, Left);
496 */
497 CallbackList::Handle priUvolneni(CallbackList::Callback funkce) {
498 return onRelease(funkce);
499 }
500 CallbackList::Handle priUvolneni(std::function<void(std::bitset<MaxID> currentState)> funkce) {
501 return onRelease(funkce);
502 }
503 CallbackList::Handle priUvolneni(std::function<void()> funkce) {
504 return onRelease(funkce);
505 }
506
507 CallbackList::Handle priUvolneni(std::function<void()> funkce, ButtonID sledovaneTlacitko) {
508 return onRelease(funkce, sledovaneTlacitko);
509 }
510
511 void removeCallback(CallbackList::Handle);
512 void smazatCallback(CallbackList::Handle handle) {
513 removeCallback(handle);
514 }
515};
ButtonID
Definition: 1_1.hpp:6
QueueHandle_t eventQueue
void checkRange(int value, int min, int max, const char *tag, unsigned stackTraceDepth=10)
Definition: Error.hpp:45
Definition: Buttons.hpp:17
CallbackList::Handle onChange(std::function< void(std::bitset< MaxID > currentState)> function)
Definition: Buttons.hpp:111
CallbackList::Handle onChange(std::function< void()> function, ButtonID watchedButton)
Definition: Buttons.hpp:134
CallbackList::Handle priStisku(std::function< void(std::bitset< MaxID > currentState)> funkce)
Definition: Buttons.hpp:454
Buttons::CallbackList::Handle onPressUntil(std::function< void()> function, Condition condition, ButtonID watchedButton)
Definition: Buttons.hpp:254
CallbackList::Handle onNextReleases(std::function< void()> function, ButtonID watchedButton, int count)
Definition: Buttons.hpp:326
Buttons(Buttons &)=delete
CallbackList::Handle priZmene(CallbackList::Callback funkce)
Definition: Buttons.hpp:407
CallbackList::Handle onRelease(std::function< void()> function, ButtonID watchedButton)
Definition: Buttons.hpp:318
CallbackList::Handle priUvolneni(CallbackList::Callback funkce)
Definition: Buttons.hpp:497
CallbackList::Handle priZmene(std::function< void(std::bitset< MaxID > aktualniStav)> funkce)
Definition: Buttons.hpp:408
CallbackList::Handle priUvolneni(std::function< void()> funkce, ButtonID sledovaneTlacitko)
Definition: Buttons.hpp:507
CallbackList::Handle onChange(std::function< void()> function)
Definition: Buttons.hpp:114
CallbackList::Handle priStisku(std::function< void()> funkce, ButtonID sledovaneTlacitko)
Definition: Buttons.hpp:461
CallbackList::Handle priUvolneni(std::function< void()> funkce)
Definition: Buttons.hpp:503
CallbackList::Handle onNextChange(std::function< void(bool isPressed)> function, ButtonID watchedButton)
Definition: Buttons.hpp:157
CallbackList::Handle onPress(std::function< void()> function, ButtonID watchedButton)
Definition: Buttons.hpp:226
CallbackList::Handle onNexRelease(std::function< void()> function, ButtonID watchedButton)
Definition: Buttons.hpp:336
CallbackList::Handle priZmene(std::function< void(bool jeStisknuto)> funkce, ButtonID sledovaneTlacitko)
Definition: Buttons.hpp:412
static std::bitset< MaxID > IRAM_ATTR prectiVsechny()
Definition: Buttons.hpp:52
CallbackList::Handle onRelease(CallbackList::Callback function)
Definition: Buttons.hpp:296
void smazatCallback(CallbackList::Handle handle)
Definition: Buttons.hpp:512
CallbackList::Handle onNextChanges(std::function< void(bool isPressed)> function, ButtonID watchedButton, int count)
Definition: Buttons.hpp:148
void removeCallback(CallbackList::Handle)
Definition: Buttons.cpp:85
CallbackList & callbackList()
Definition: Buttons.hpp:44
eventpp::CallbackList< void(std::bitset< MaxID > currentState, std::bitset< MaxID > changedBtns)> CallbackList
Definition: Buttons.hpp:21
static bool IRAM_ATTR precti(ButtonID idTlacitka)
Definition: Buttons.hpp:49
CallbackList::Handle onNextPress(std::function< void()> function, ButtonID watchedButton)
Definition: Buttons.hpp:244
Buttons::CallbackList::Handle onReleaseUntil(std::function< void()> function, Condition condition, ButtonID watchedButton)
Definition: Buttons.hpp:346
CallbackList::Handle onPress(CallbackList::Callback function)
Definition: Buttons.hpp:204
static std::bitset< MaxID > IRAM_ATTR readAll()
Definition: Buttons.cpp:27
CallbackList::Handle priZmene(CallbackList::Callback funkce, ButtonID sledovaneTlacitko)
Definition: Buttons.hpp:411
CallbackList::Handle onChange(std::function< void(bool isPressed)> function, ButtonID watchedButton)
Definition: Buttons.hpp:126
CallbackList::Handle onChange(CallbackList::Callback function, ButtonID watchedButton)
Definition: Buttons.hpp:118
CallbackList::Handle priStisku(CallbackList::Callback funkce)
Definition: Buttons.hpp:451
static bool IRAM_ATTR precti(gpio_num_t cisloPinu)
Definition: Buttons.hpp:46
CallbackList::Handle onRelease(std::function< void(std::bitset< MaxID > currentState)> function)
Definition: Buttons.hpp:303
CallbackList::Handle onPress(std::function< void(std::bitset< MaxID > currentState)> function)
Definition: Buttons.hpp:211
CallbackList::Handle priStisku(std::function< void()> funkce)
Definition: Buttons.hpp:457
CallbackList::Handle onPress(std::function< void()> function)
Definition: Buttons.hpp:218
CallbackList::Handle priUvolneni(std::function< void(std::bitset< MaxID > currentState)> funkce)
Definition: Buttons.hpp:500
CallbackList::Handle onChange(CallbackList::Callback function)
Buttons::CallbackList::Handle onNextChanges(Buttons::CallbackList::Callback function, int count)
Definition: Buttons.hpp:142
CallbackList::Handle priZmene(std::function< void()> funkce)
Definition: Buttons.hpp:409
static bool IRAM_ATTR read(gpio_num_t)
Definition: Buttons.cpp:13
CallbackList::Handle priZmene(std::function< void()> funkce, ButtonID sledovaneTlacitko)
Definition: Buttons.hpp:415
Buttons::CallbackList::Handle onChangeUntil(Buttons::CallbackList::Callback function, Condition condition)
Definition: Buttons.hpp:166
CallbackList::Handle onNextPresses(std::function< void()> function, ButtonID watchedButton, int count)
Definition: Buttons.hpp:234
CallbackList::Handle onRelease(std::function< void()> function)
Definition: Buttons.hpp:310
Buttons & operator=(Buttons &)=delete
Buttons::CallbackList::Handle onNextChange(Buttons::CallbackList::Callback function)
Definition: Buttons.hpp:145
Definition: Logic.hpp:14