@@ -18,7 +18,7 @@ typedef void (*switchCallback_t)(void*);
1818class Switch
1919{
2020public:
21- Switch (byte _pin, byte PinMode=INPUT_PULLUP, bool polarity=LOW, int debouncePeriod=50 , int longPressPeriod=300 , int doubleClickPeriod=250 , int deglitchPeriod=10 );
21+ Switch (byte _pin, byte PinMode=INPUT_PULLUP, bool polarity=LOW, unsigned long debouncePeriod=50 , unsigned long longPressPeriod=300 , unsigned long doubleClickPeriod=250 , unsigned long deglitchPeriod=10 );
2222 bool poll (); // Returns 1 if switched
2323 bool switched (); // will be refreshed by poll()
2424 bool on ();
@@ -36,7 +36,7 @@ class Switch
3636 void setSingleClickCallback (switchCallback_t cb, void * param = nullptr );
3737 void setBeepAllCallback (switchCallback_t cb, void * param = nullptr );
3838
39- int deglitchPeriod, debouncePeriod, longPressPeriod, doubleClickPeriod;
39+ unsigned long deglitchPeriod, debouncePeriod, longPressPeriod, doubleClickPeriod;
4040
4141 protected:
4242 bool process (); // not inline, used in child class
@@ -58,14 +58,13 @@ class Switch
5858 switchCallback_t _longPressCallback = nullptr ;
5959 switchCallback_t _doubleClickCallback = nullptr ;
6060 switchCallback_t _singleClickCallback = nullptr ;
61- static switchCallback_t _beepAllCallback = nullptr ; // static function pointer, can be used by all objects
62- // static void(*_beepAllCallback)(void*) = nullptr; // static function pointer without typedef
61+ static switchCallback_t _beepAllCallback; // static function pointer, can be used by all objects
6362
6463 void * _pushedCallbackParam = nullptr ;
6564 void * _releasedCallbackParam = nullptr ;
6665 void * _longPressCallbackParam = nullptr ;
6766 void * _doubleClickCallbackParam = nullptr ;
6867 void * _singleClickCallbackParam = nullptr ;
69- static void * _beepAllCallbackParam = nullptr ; // can be used by all objects
68+ static void * _beepAllCallbackParam; // can be used by all objects
7069};
7170#endif
0 commit comments