INSAT Mini Project

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_6180XA1 by ST

Revision:
46:116dadbc80f1
Parent:
45:70e4abd970a9
Child:
48:e799ad44dab7
--- a/Components/VL6180X/vl6180x_class.cpp	Tue Mar 15 16:26:36 2016 +0000
+++ b/Components/VL6180X/vl6180x_class.cpp	Thu May 19 14:11:25 2016 +0000
@@ -2685,61 +2685,9 @@
 }
 
 
-int VL6180X::ReadID()
-{
-   int status;
-   uint8_t rl_id=0;
-    
-   status=VL6180x_RdByte(Device, IDENTIFICATION_MODEL_ID, &rl_id);
-   if((status==0)&&(rl_id==0xB4))
-     return status;
-   else
-     return INVALID_PARAMS;
-}
- 
- 
-int VL6180X::InitSensor(uint8_t NewAddr)
+int VL6180X::ReadID(uint8_t *id)
 {
-   int status;
- 
-   VL6180x_Off();
-   VL6180x_On();
-   status=VL6180x_WaitDeviceBooted(Device);
-   if(status)
-      VL6180x_ErrLog("WaitDeviceBooted fail\n\r");
-   status=IsPresent();
-   if(!status)
-   {
-      Device->Present=1;
-      status=Init();
-      if(status)
-      {
-         printf("Failed to init VL6180X sensor!\n\r");
-         return status;
-      }
-      status=Prepare();
-      if(status)
-      {
-         printf("Failed to prepare VL6180X!\n\r");
-         return status;
-      }
-      if(NewAddr!=DEFAULT_DEVICE_ADDRESS)
-      {
-         status=SetI2CAddress(NewAddr);
-         if(status)
-         {
-            printf("Failed to change I2C address!\n\r");
-            return status;
-         }
-      }
-      else
-      {
-         printf("Invalid new address!\n\r");
-         return INVALID_PARAMS;
-      }
-      Device->Ready=1;
-   }
-   return status; 
+   return VL6180x_RdByte(Device, IDENTIFICATION_MODEL_ID, id);
 }