Henry Herman
/
touchy_fg_bg
None
touchmachine.h@0:6ae7b9747a06, 2010-12-01 (annotated)
- Committer:
- henryeherman
- Date:
- Wed Dec 01 03:28:28 2010 +0000
- Revision:
- 0:6ae7b9747a06
A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryeherman | 0:6ae7b9747a06 | 1 | #ifndef TOUCHMACHINE_H |
henryeherman | 0:6ae7b9747a06 | 2 | #define TOUCHMACHINE_H |
henryeherman | 0:6ae7b9747a06 | 3 | |
henryeherman | 0:6ae7b9747a06 | 4 | #include "mbed.h" |
henryeherman | 0:6ae7b9747a06 | 5 | #include "touchbutton.h" |
henryeherman | 0:6ae7b9747a06 | 6 | #include "handler.h" |
henryeherman | 0:6ae7b9747a06 | 7 | #include "com.h" |
henryeherman | 0:6ae7b9747a06 | 8 | #define THRESHOLD .45 |
henryeherman | 0:6ae7b9747a06 | 9 | #define TIMER_THRESHOLD 50 |
henryeherman | 0:6ae7b9747a06 | 10 | //#define DEBUGTM |
henryeherman | 0:6ae7b9747a06 | 11 | //#define DEBUGTM1 |
henryeherman | 0:6ae7b9747a06 | 12 | |
henryeherman | 0:6ae7b9747a06 | 13 | |
henryeherman | 0:6ae7b9747a06 | 14 | |
henryeherman | 0:6ae7b9747a06 | 15 | class TouchMachine { |
henryeherman | 0:6ae7b9747a06 | 16 | public: |
henryeherman | 0:6ae7b9747a06 | 17 | TouchMachine(char *c); |
henryeherman | 0:6ae7b9747a06 | 18 | void check(); |
henryeherman | 0:6ae7b9747a06 | 19 | void run(); |
henryeherman | 0:6ae7b9747a06 | 20 | private: |
henryeherman | 0:6ae7b9747a06 | 21 | char *pmatchstr; |
henryeherman | 0:6ae7b9747a06 | 22 | TouchButton *t0; |
henryeherman | 0:6ae7b9747a06 | 23 | TouchButton *t1; |
henryeherman | 0:6ae7b9747a06 | 24 | Handler *hand; |
henryeherman | 0:6ae7b9747a06 | 25 | bool t0state; |
henryeherman | 0:6ae7b9747a06 | 26 | bool t1state; |
henryeherman | 0:6ae7b9747a06 | 27 | enum States {ERROR, WAITING, ONE, ZERO, MATCH}; |
henryeherman | 0:6ae7b9747a06 | 28 | States touchState; |
henryeherman | 0:6ae7b9747a06 | 29 | bool isOne(); |
henryeherman | 0:6ae7b9747a06 | 30 | bool isZero(); |
henryeherman | 0:6ae7b9747a06 | 31 | bool isWaiting(); |
henryeherman | 0:6ae7b9747a06 | 32 | bool isError(); |
henryeherman | 0:6ae7b9747a06 | 33 | bool isMatch(); |
henryeherman | 0:6ae7b9747a06 | 34 | void setMatch(); |
henryeherman | 0:6ae7b9747a06 | 35 | char getNextMatchChar(); |
henryeherman | 0:6ae7b9747a06 | 36 | char nextMatchChar(); |
henryeherman | 0:6ae7b9747a06 | 37 | void setError(); |
henryeherman | 0:6ae7b9747a06 | 38 | void resetTouch(); |
henryeherman | 0:6ae7b9747a06 | 39 | char getMatchChar(); |
henryeherman | 0:6ae7b9747a06 | 40 | void loadMatchStr(); |
henryeherman | 0:6ae7b9747a06 | 41 | void touchError(); |
henryeherman | 0:6ae7b9747a06 | 42 | void touchMatch(); |
henryeherman | 0:6ae7b9747a06 | 43 | void checkTouchForMatch(); |
henryeherman | 0:6ae7b9747a06 | 44 | void waitForRelease(); |
henryeherman | 0:6ae7b9747a06 | 45 | void checkMatch(); |
henryeherman | 0:6ae7b9747a06 | 46 | }; |
henryeherman | 0:6ae7b9747a06 | 47 | |
henryeherman | 0:6ae7b9747a06 | 48 | |
henryeherman | 0:6ae7b9747a06 | 49 | #endif |