Henry Herman
/
touchy
b
Diff: touchmachine.h
- Revision:
- 0:4841f4169944
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/touchmachine.h Wed Dec 01 03:29:25 2010 +0000 @@ -0,0 +1,49 @@ +#ifndef TOUCHMACHINE_H +#define TOUCHMACHINE_H + +#include "mbed.h" +#include "touchbutton.h" +#include "handler.h" +#include "com.h" +#define THRESHOLD .45 +#define TIMER_THRESHOLD 50 +//#define DEBUGTM +//#define DEBUGTM1 + + + +class TouchMachine { + public: + TouchMachine(char *c); + void check(); + void run(); + private: + char *pmatchstr; + TouchButton *t0; + TouchButton *t1; + Handler *hand; + bool t0state; + bool t1state; + enum States {ERROR, WAITING, ONE, ZERO, MATCH}; + States touchState; + bool isOne(); + bool isZero(); + bool isWaiting(); + bool isError(); + bool isMatch(); + void setMatch(); + char getNextMatchChar(); + char nextMatchChar(); + void setError(); + void resetTouch(); + char getMatchChar(); + void loadMatchStr(); + void touchError(); + void touchMatch(); + void checkTouchForMatch(); + void waitForRelease(); + void checkMatch(); +}; + + +#endif \ No newline at end of file