Henry Herman / Mbed 2 deprecated touchy_fg_bg

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers touchbutton.h Source File

touchbutton.h

00001 
00002 #ifndef TOUCHBUTTON_H
00003 #define TOUCHBUTTON_H
00004 #define NUMSAMP 10
00005 //#define DEBUGTOUCH
00006 #define DEBUGTOUCHLED
00007 class TouchButton {
00008 
00009 public:
00010     TouchButton(PinName ain, PinName din, PinName dout, float threshold, int debounceTime, char *nm);
00011     void setThreshold(float level);
00012     void setDebounceTime(int t);
00013     bool checkState();
00014     float sample();
00015     void charge();
00016 
00017 private:
00018     char name[10];
00019     float currentValue;
00020     float previousValue;
00021     AnalogIn sensor;
00022     DigitalIn charger;
00023     DigitalOut ground;
00024     Timer timer;
00025     Timer debounceTimer;
00026     float analogThreshold;
00027     int timeout_ms;
00028     void storeValue();
00029     float difference();
00030 };
00031 
00032 #endif