Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of VCNL4000 by
Diff: VCNL4000.cpp
- Revision:
- 3:8f8caebe76cc
- Parent:
- 2:397b1b9266a9
- Child:
- 4:3c57a6048f2d
diff -r 397b1b9266a9 -r 8f8caebe76cc VCNL4000.cpp --- 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 );