INSAT Mini Project
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_6180XA1 by
Diff: Components/VL6180X/vl6180x_class.cpp
- Revision:
- 48:e799ad44dab7
- Parent:
- 46:116dadbc80f1
- Child:
- 51:229ea522cff8
--- a/Components/VL6180X/vl6180x_class.cpp Mon May 23 09:59:39 2016 +0000 +++ b/Components/VL6180X/vl6180x_class.cpp Tue Jun 07 14:56:36 2016 +0200 @@ -278,7 +278,7 @@ //static int VL6180x_UpscaleStaticInit(VL6180xDev_t dev); int VL6180X::VL6180x_WaitDeviceBooted(VL6180xDev_t dev){ - uint8_t FreshOutReset; + uint8_t FreshOutReset=0; int status; LOG_FUNCTION_START(""); do{ @@ -2532,7 +2532,7 @@ { int status; - uint8_t buffer; + uint8_t buffer=0; status=VL6180x_I2CRead(dev->I2cAddr, index, &buffer,1); if(!status) { @@ -2546,6 +2546,7 @@ int status; uint8_t buffer[2]; + buffer[0]=buffer[1]=0; status=VL6180x_I2CRead(dev->I2cAddr, index, buffer, 2); if(!status) { @@ -2558,6 +2559,7 @@ { int status; uint8_t buffer[4]; + buffer[0]=buffer[1]=buffer[2]=buffer[3]=0; status=VL6180x_I2CRead(dev->I2cAddr, index, buffer,4); if(!status) { @@ -2569,7 +2571,7 @@ int VL6180X::VL6180x_UpdateByte(VL6180xDev_t dev, uint16_t index, uint8_t AndData, uint8_t OrData) { int status; - uint8_t buffer; + uint8_t buffer=0; status=VL6180x_I2CWrite(dev->I2cAddr, index, (uint8_t *)&buffer,(uint8_t)0); if(!status) @@ -3507,6 +3509,17 @@ } +int VL6180X::IsPresent() +{ + int status; uint8_t id; + + status=ReadID(&id); + if(status) + VL6180x_ErrLog("Failed to read ID device. Device not present!\n\r"); + return status; +} + + int VL6180X::StopRangeMeasurement(OperatingMode operating_mode) { int status;