![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
None
touchbutton.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 | |
henryeherman | 0:6ae7b9747a06 | 2 | #ifndef TOUCHBUTTON_H |
henryeherman | 0:6ae7b9747a06 | 3 | #define TOUCHBUTTON_H |
henryeherman | 0:6ae7b9747a06 | 4 | #define NUMSAMP 10 |
henryeherman | 0:6ae7b9747a06 | 5 | //#define DEBUGTOUCH |
henryeherman | 0:6ae7b9747a06 | 6 | #define DEBUGTOUCHLED |
henryeherman | 0:6ae7b9747a06 | 7 | class TouchButton { |
henryeherman | 0:6ae7b9747a06 | 8 | |
henryeherman | 0:6ae7b9747a06 | 9 | public: |
henryeherman | 0:6ae7b9747a06 | 10 | TouchButton(PinName ain, PinName din, PinName dout, float threshold, int debounceTime, char *nm); |
henryeherman | 0:6ae7b9747a06 | 11 | void setThreshold(float level); |
henryeherman | 0:6ae7b9747a06 | 12 | void setDebounceTime(int t); |
henryeherman | 0:6ae7b9747a06 | 13 | bool checkState(); |
henryeherman | 0:6ae7b9747a06 | 14 | float sample(); |
henryeherman | 0:6ae7b9747a06 | 15 | void charge(); |
henryeherman | 0:6ae7b9747a06 | 16 | |
henryeherman | 0:6ae7b9747a06 | 17 | private: |
henryeherman | 0:6ae7b9747a06 | 18 | char name[10]; |
henryeherman | 0:6ae7b9747a06 | 19 | float currentValue; |
henryeherman | 0:6ae7b9747a06 | 20 | float previousValue; |
henryeherman | 0:6ae7b9747a06 | 21 | AnalogIn sensor; |
henryeherman | 0:6ae7b9747a06 | 22 | DigitalIn charger; |
henryeherman | 0:6ae7b9747a06 | 23 | DigitalOut ground; |
henryeherman | 0:6ae7b9747a06 | 24 | Timer timer; |
henryeherman | 0:6ae7b9747a06 | 25 | Timer debounceTimer; |
henryeherman | 0:6ae7b9747a06 | 26 | float analogThreshold; |
henryeherman | 0:6ae7b9747a06 | 27 | int timeout_ms; |
henryeherman | 0:6ae7b9747a06 | 28 | void storeValue(); |
henryeherman | 0:6ae7b9747a06 | 29 | float difference(); |
henryeherman | 0:6ae7b9747a06 | 30 | }; |
henryeherman | 0:6ae7b9747a06 | 31 | |
henryeherman | 0:6ae7b9747a06 | 32 | #endif |