virtua pinnnn / VCNL4000

Fork of VCNL4000 by Benigno Gobbo

Revision:
3:8f8caebe76cc
Parent:
2:397b1b9266a9
Child:
4:3c57a6048f2d
--- a/VCNL4000.cpp	Wed Jun 22 18:07:10 2016 +0000
+++ b/VCNL4000.cpp	Thu Jul 28 02:57:17 2016 +0000
@@ -13,9 +13,12 @@
 const int VCNL4000::ProximitySigFreq        = 0x9;
 const int VCNL4000::ProxymityModulationTime = 0xa;
 
+int proxExistCount = 0;
+const int maxProxExistCount = 100;
+
 // ---------------------------------------------------
 VCNL4000::VCNL4000( PinName sda, PinName scl ) : _i2c( sda, scl ) {
-      
+   
     int prodId = getProductId();
     int prodRev = getProductRevision();
       
@@ -25,6 +28,7 @@
     else {
        _status = 1;
     }  
+
 }
    
 // ---------------------------------------------------   
@@ -59,6 +63,7 @@
     while( !proximityDataReady() ) { 
       wait(0.01);//was 0.1
     }
+    proxExistCount = 0;
     _data = registerRead( VCNL4000regAddr + ProximityMsb ) << 8;
     int status = _status;
     _data +=  registerRead( VCNL4000regAddr + ProximityLsb );