Driver for a binary on/off presence device

Dependents:   mbed-IBooth-ETH

Revision:
4:ac5cfd7e90ea
Parent:
3:c255f4943339
Child:
6:b1c665320f0c
--- a/Presence.cpp	Mon Feb 09 10:55:13 2015 +0000
+++ b/Presence.cpp	Mon Feb 09 15:38:02 2015 +0000
@@ -24,7 +24,7 @@
 //        _myint.fall(this, &presence::presence_interrupt_off);
 //    }
     _detection=false;
-    debounce_timer.start();
+//    debounce_timer.start();
     _led1=1;
 
 }
@@ -44,14 +44,11 @@
     debounce_timer.reset(); // Reset counter to 0...
 }
 
-
-bool Presence::isPresent(){
-    bool new_detection = (_true_on_rise && _myint == 1) || (!_true_on_rise && _myint == 0);
-    if(new_detection)debounce_timer.reset();
-    //Poll the pin and update value...
-    if(!_detection || debounce_timer.read_ms() > debounce_ms) {
-        _detection = new_detection;
+bool presence::isPresent(){
+//    if (debounce_timer.read_ms() > debounce_ms) {
+        //Poll the pin and update value...
+        _detection = (_true_on_rise && _myint == 1) || (!_true_on_rise && _myint == 0);
         if(_detection) _led1 = 0; else _led1 = 1;
-    }
+//    }
     return _detection;
 }
\ No newline at end of file