Lucas Borges
/
MenuLCD_Copy
this locks like shit
Fork of MenuLCD_copy by
Diff: menbed/include/menbedButtonHandler.h
- Revision:
- 0:92357d1220f3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/menbed/include/menbedButtonHandler.h Fri May 19 13:07:52 2017 +0000 @@ -0,0 +1,38 @@ +#ifndef _MENBEDBUTTONHANDLER_H_ +#define _MENBEDBUTTONHANDLER_H_ + +#include "mbed.h" +#include "menbedNavigator.h" +#include "menbedButtonHandlerTimespec.h" + +class MenbedButtonHandler { +public: + MenbedButtonHandler(PinName selectPin, PinName downPin, PinName upPin, PinName cancelPin, + MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); + MenbedButtonHandler(PinName selectPin, PinName downPin, PinName upPin, + MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); + MenbedButtonHandler(PinName selectPin, PinName downPin, + MenbedButtonHandlerTimespec *timespec, MenbedNavigator *navigator); + +protected: + DigitalIn *select, *down, *up, *cancel; + MenbedButtonHandlerTimespec *timespec; + MenbedNavigator *navigator; + + Ticker ticker; + uint32_t tickerPeriod_us; + uint32_t currentTime_us; + + int numButtons; + + uint32_t buttonPushedTime_us[4]; // Absolute time button first depressed + bool buttonDebounced[4]; // Keep track of which buttons are debounced + uint32_t buttonLastTypematicTime_us[4]; // Abs. time of last virtual push + bool buttonAlreadyDepressed[4]; // Keep track of state b/t calls to tick() + + void init (void); + void tick (void); + bool isButtonDepressed (MenbedButtonEvent::ButtonName); +}; + +#endif /* _MENBEDBUTTONHANDLER_H_ */ \ No newline at end of file