JDI_MIP on ThunderBoardSense2(Silicon-Labs)

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StateSW.h Source File

StateSW.h

00001 /* mbed StateSW Library without using PWM pins
00002 
00003 
00004  */
00005 #include "mbed.h"
00006 
00007 class StateSW {
00008 
00009 public:
00010     StateSW (PinName SWPin);
00011     
00012     void Enable(int StateNum, int NoiseCancel, int OpenTime);
00013     int  State(void);
00014     bool IfAtTime(void);
00015     void IfCntState(bool IfCntState);
00016     void IfCntClose(bool IfCntClose);
00017     void IfCntOpen(bool IfCntOpen);
00018     //    void Reset(void);
00019     //    bool IfOnetime(void);
00020     
00021 protected:
00022     int  _STATENUM;
00023     int  _REPEAT;
00024     int  _OPNCNT;
00025     int  _State;
00026     
00027     void _fall(void);
00028     void _rise(void);
00029     void _SeekPress(void);
00030   
00031     DigitalIn  _SW;
00032     bool _preSW;
00033     int  _PressCount;
00034 
00035     int  _IfCntOpen;
00036     int  _IfCntClose;
00037     bool _IfCntState;
00038     bool _IfAtTime;
00039 
00040     Timer _Timer_SW;
00041     Ticker _StateCounter;
00042 
00043 };