User Tools

Site Tools


in202:seance_6:jalon_4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
in202:seance_6:jalon_4 [2021/05/03 10:55]
bmonsuez
in202:seance_6:jalon_4 [2022/11/18 10:47] (current)
Line 54: Line 54:
  
 <code cpp> <code cpp>
-template<​int First, int... _Rest> ​class _ButtonEvents ​+template<​int First, int... _Rest>
 class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​ class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​
 { {
Line 108: Line 108:
  
 <code cpp> <code cpp>
 +template<​int First, int... _Rest>
 class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​ class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​
 { {
Line 145: Line 146:
  
 <code cpp> <code cpp>
 +template<​int First, int... _Rest>
 class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​ class _ButtonEvents <First, _Rest...>​ : private _ButtonEvents <​_Rest...> ​
 { {
Line 308: Line 310:
     static void Released();     static void Released();
     static void Changed();     static void Changed();
-    static int mLastPressed; ​ 
-    static int mLastReleased; ​ 
 public: public:
     static interrupt_type GetPressed(int thePort) { return thePort == mPortNumber ? Pressed : _ButtonEvents<​_Rest...>::​GetPressed(thePort);​ }     static interrupt_type GetPressed(int thePort) { return thePort == mPortNumber ? Pressed : _ButtonEvents<​_Rest...>::​GetPressed(thePort);​ }
Line 363: Line 363:
 template<​int First, int... _Rest> template<​int First, int... _Rest>
 Button* _ButtonEvents<​First,​ _Rest...>::​mButton = NULL; Button* _ButtonEvents<​First,​ _Rest...>::​mButton = NULL;
-template<​int First, int... _Rest> 
-int _ButtonEvents<​First,​ _Rest...>::​mLastReleased = 0; 
-template<​int First, int... _Rest> 
-int _ButtonEvents<​First,​ _Rest...>::​mLastPressed = 0; 
 template<​int First, int... _Rest> template<​int First, int... _Rest>
 void _ButtonEvents<​First,​ _Rest...>::​Pressed() ​ void _ButtonEvents<​First,​ _Rest...>::​Pressed() ​
- +{ if(mButton != NULL) mButton->​OnPressed();​ }
-    int currentTime = millis(); +
-    if(currentTime - mLastPressed > 400) +
-    { +
-        mLastPressed = currentTime;​ +
-        ​if(mButton != NULL) mButton->​OnPressed();​ +
-    } +
-}+
 template <int First, int... _Rest> template <int First, int... _Rest>
 void _ButtonEvents<​First,​ _Rest...>::​Released() ​ void _ButtonEvents<​First,​ _Rest...>::​Released() ​
- +{ if(mButton != NULL) mButton->​OnReleased();​ }
-    int currentTime = millis(); +
-    if(currentTime - mLastReleased > 400) +
-    { +
-        mLastReleased = currentTime;​ +
-        ​if(mButton != NULL) mButton->​OnReleased();​ +
-    } +
-}+
 template <int First, int... _Rest> template <int First, int... _Rest>
-void _ButtonEvents<​First,​ _Rest...>::​Changed() { if(mButton != NULL) mButton->​OnChanged();​ }+void _ButtonEvents<​First,​ _Rest...>::​Changed() ​ 
 +{ if(mButton != NULL) mButton->​OnChanged();​ }
  
 template <int First, int... _Rest> template <int First, int... _Rest>
in202/seance_6/jalon_4.1620039304.txt.gz · Last modified: 2021/05/03 10:55 by bmonsuez