Lucas Borges
/
MenuLCD_Copy
this locks like shit
Fork of MenuLCD_copy by
menbed/include/menbedButtonHandler.h@1:f105b690aeb7, 2017-05-19 (annotated)
- Committer:
- LucasMatBorges
- Date:
- Fri May 19 18:48:04 2017 +0000
- Revision:
- 1:f105b690aeb7
- Parent:
- 0:92357d1220f3
R?row mein
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ViniR | 0:92357d1220f3 | 1 | #ifndef _MENBEDBUTTONHANDLER_H_ |
ViniR | 0:92357d1220f3 | 2 | #define _MENBEDBUTTONHANDLER_H_ |
ViniR | 0:92357d1220f3 | 3 | |
ViniR | 0:92357d1220f3 | 4 | #include "mbed.h" |
ViniR | 0:92357d1220f3 | 5 | #include "menbedNavigator.h" |
ViniR | 0:92357d1220f3 | 6 | #include "menbedButtonHandlerTimespec.h" |
ViniR | 0:92357d1220f3 | 7 | |
ViniR | 0:92357d1220f3 | 8 | class MenbedButtonHandler { |
ViniR | 0:92357d1220f3 | 9 | public: |
ViniR | 0:92357d1220f3 | 10 | MenbedButtonHandler(PinName selectPin, PinName downPin, PinName upPin, PinName cancelPin, |
ViniR | 0:92357d1220f3 | 11 | MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); |
ViniR | 0:92357d1220f3 | 12 | MenbedButtonHandler(PinName selectPin, PinName downPin, PinName upPin, |
ViniR | 0:92357d1220f3 | 13 | MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); |
ViniR | 0:92357d1220f3 | 14 | MenbedButtonHandler(PinName selectPin, PinName downPin, |
ViniR | 0:92357d1220f3 | 15 | MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); |
ViniR | 0:92357d1220f3 | 16 | |
ViniR | 0:92357d1220f3 | 17 | protected: |
ViniR | 0:92357d1220f3 | 18 | DigitalIn *select, *down, *up, *cancel; |
ViniR | 0:92357d1220f3 | 19 | MenbedButtonHandlerTimespec *timespec; |
ViniR | 0:92357d1220f3 | 20 | MenbedNavigator *navigator; |
ViniR | 0:92357d1220f3 | 21 | |
ViniR | 0:92357d1220f3 | 22 | Ticker ticker; |
ViniR | 0:92357d1220f3 | 23 | uint32_t tickerPeriod_us; |
ViniR | 0:92357d1220f3 | 24 | uint32_t currentTime_us; |
ViniR | 0:92357d1220f3 | 25 | |
ViniR | 0:92357d1220f3 | 26 | int numButtons; |
ViniR | 0:92357d1220f3 | 27 | |
ViniR | 0:92357d1220f3 | 28 | uint32_t buttonPushedTime_us[4]; // Absolute time button first depressed |
ViniR | 0:92357d1220f3 | 29 | bool buttonDebounced[4]; // Keep track of which buttons are debounced |
ViniR | 0:92357d1220f3 | 30 | uint32_t buttonLastTypematicTime_us[4]; // Abs. time of last virtual push |
ViniR | 0:92357d1220f3 | 31 | bool buttonAlreadyDepressed[4]; // Keep track of state b/t calls to tick() |
ViniR | 0:92357d1220f3 | 32 | |
ViniR | 0:92357d1220f3 | 33 | void init (void); |
ViniR | 0:92357d1220f3 | 34 | void tick (void); |
ViniR | 0:92357d1220f3 | 35 | bool isButtonDepressed (MenbedButtonEvent::ButtonName); |
ViniR | 0:92357d1220f3 | 36 | }; |
ViniR | 0:92357d1220f3 | 37 | |
ViniR | 0:92357d1220f3 | 38 | #endif /* _MENBEDBUTTONHANDLER_H_ */ |