Timed switch

Dependencies:   mbed

Revision:
1:a523eaac3b7c
Parent:
0:5d9b6304f982
--- a/timed_switch.h	Sat Feb 11 18:39:32 2012 +0000
+++ b/timed_switch.h	Sun Mar 15 17:19:54 2015 +0000
@@ -2,17 +2,19 @@
 #define TIMED_SWITCH_H
 
 enum {LedOff = 0, LedOn = 1};
-enum {False, True};
+
+const float WAIT_TIME = 0.2;    // to avoid bouncing
+const float WAIT_ON = 0.5;
+const float WAIT_OFF = 0.5;
+const unsigned short time_correction = WAIT_TIME * 1000; // correction in msec.
 
-const float wait_time = 0.2;    // to avoid bouncing
-const float wait_on = 0.5;
-const float wait_off = 0.5;
-const unsigned short time_correction = wait_time * 1000; // correction in msec.
+Timer t;                               // for tracking time
+unsigned int button_hold_duration;     // for tracking how long was the button holded (in msec)
 
-Timer t;                        // for tracking time
-unsigned int button_holded;     // for tracking how long was the button holded
+DigitalIn button(p20);
+DigitalOut myled(LED3);
 
-DigitalIn button (p19);
-DigitalOut myled (LED3);
+void flash_led();
+void debounce();
 
 #endif