The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2

Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.

Revision:
14:f06785b2a964
Parent:
11:be14e3591d65
Child:
16:27131f13570d
--- a/src/VL53L1CB.cpp	Mon Jun 14 07:57:55 2021 +0000
+++ b/src/VL53L1CB.cpp	Sat Jun 19 16:45:54 2021 +0100
@@ -69,10 +69,10 @@
 {
     VL53L1CB_ERROR Status = 0;
 
-    pVersion->major = VL53L1CB_IMPLEMENTATION_VER_MAJOR;
-    pVersion->minor = VL53L1CB_IMPLEMENTATION_VER_MINOR;
-    pVersion->build = VL53L1CB_IMPLEMENTATION_VER_SUB;
-    pVersion->revision = VL53L1CB_IMPLEMENTATION_VER_REVISION;
+    pVersion->major = VL53L1_IMPLEMENTATION_VER_MAJOR;
+    pVersion->minor = VL53L1_IMPLEMENTATION_VER_MINOR;
+    pVersion->build = VL53L1_IMPLEMENTATION_VER_SUB;
+    pVersion->revision = VL53L1_IMPLEMENTATION_VER_REVISION;
     return Status;
 }
 
@@ -85,7 +85,7 @@
   //  Device->i2c_slave_address = new_address;  //~~ was
     if ( Device->i2c_slave_address != new_address)
     {
-        status = VL53L1CB_WrByte(Device, VL53L1CB_I2C_SLAVE__DEVICE_ADDRESS, new_address >> 1);   
+        status = VL53L1_WrByte(Device, VL53L1_I2C_SLAVE__DEVICE_ADDRESS, new_address >> 1);   
         printf("VL53L1_SetI2CAddress %d to %d status = %d\n", Device->i2c_slave_address,new_address,status);
                 Device->i2c_slave_address = new_address; 
 
@@ -115,7 +115,7 @@
     uint8_t Addr = 0x00;
 
     for (Addr = 0x2D; Addr <= 0x87; Addr++){
-        status = VL53L1CB_WrByte(Device, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D]);
+        status = VL53L1_WrByte(Device, Addr, VL51L1X_DEFAULT_CONFIGURATION[Addr - 0x2D]);
         if (status != 0)
         {
             printf("Writing config failed - %d\r\n", status);
@@ -144,8 +144,8 @@
 {
     VL53L1CB_ERROR status = 0;
 
-    status = VL53L1CB_WrByte(Device, SYSTEM__INTERRUPT_CLEAR, 0x01);
-//    printf("VL53L1CB::VL53L1CBX_ClearInterrupt()\n");
+    status = VL53L1_WrByte(Device, SYSTEM__INTERRUPT_CLEAR, 0x01);
+//    printf("VL53L1CB::VL53L1X_ClearInterrupt()\n");
     return status;
 }
 
@@ -158,7 +158,7 @@
     uint8_t Temp;
     VL53L1CB_ERROR status = 0;
 
-    status = VL53L1CB_RdByte(Device, GPIO_HV_MUX__CTRL, &Temp);
+    status = VL53L1_RdByte(Device, GPIO_HV_MUX__CTRL, &Temp);
     Temp = Temp & 0x10;
     *pInterruptPolarity = !(Temp>>4);
     return status;
@@ -170,7 +170,7 @@
 {
     VL53L1CB_ERROR status = 0;
 
-    status = VL53L1CB_WrByte(Device, SYSTEM__MODE_START, 0x40); 
+    status = VL53L1_WrByte(Device, SYSTEM__MODE_START, 0x40); 
     return status;
 }
 
@@ -179,7 +179,7 @@
 {
     VL53L1CB_ERROR status = 0;
 
-    status = VL53L1CB_WrByte(Device, SYSTEM__MODE_START, 0x00);   
+    status = VL53L1_WrByte(Device, SYSTEM__MODE_START, 0x00);   
     return status;
 }
 
@@ -191,7 +191,7 @@
     VL53L1CB_ERROR status = 0;
     uint8_t tmp = 0;
 
-    status = VL53L1CB_RdByte(Device,VL53L1CB_FIRMWARE__SYSTEM_STATUS, &tmp);
+    status = VL53L1_RdByte(Device,VL53L1_FIRMWARE__SYSTEM_STATUS, &tmp);
     *state = tmp;
     return status;
 }
@@ -202,8 +202,8 @@
     VL53L1CB_ERROR status = 0;
     uint16_t tmp;
 
-    status = (VL53L1CB_RdWord(Device,
-            VL53L1CB_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0, &tmp));
+    status = (VL53L1_RdWord(Device,
+            VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0, &tmp));
     *distance = tmp;
     return status;
 }
@@ -230,7 +230,7 @@
 }
 
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_WrByte(VL53L1_DEV Dev, uint16_t index, uint8_t data)
+VL53L1CB_ERROR VL53L1CB::VL53L1_WrByte(VL53L1_DEV Dev, uint16_t index, uint8_t data)
 {
    int  status;
 
@@ -238,7 +238,8 @@
    return status;
 }
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_WrWord(VL53L1_DEV Dev, uint16_t index, uint16_t data)
+
+VL53L1CB_ERROR VL53L1CB::VL53L1_WrWord(VL53L1_DEV Dev, uint16_t index, uint16_t data)
 {
    int  status;
    uint8_t buffer[2];
@@ -249,7 +250,7 @@
    return status;
 }
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_WrDWord(VL53L1_DEV Dev, uint16_t index, uint32_t data)
+VL53L1CB_ERROR VL53L1CB::VL53L1_WrDWord(VL53L1_DEV Dev, uint16_t index, uint32_t data)
 {
    int  status;
    uint8_t buffer[4];
@@ -263,7 +264,7 @@
 }
 
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_RdByte(VL53L1_DEV Dev, uint16_t index, uint8_t *data)
+VL53L1CB_ERROR VL53L1CB::VL53L1_RdByte(VL53L1_DEV Dev, uint16_t index, uint8_t *data)
 {
    int  status;
 
@@ -275,7 +276,7 @@
    return 0;
 }
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_RdWord(VL53L1_DEV Dev, uint16_t index, uint16_t *data)
+VL53L1CB_ERROR VL53L1CB::VL53L1_RdWord(VL53L1_DEV Dev, uint16_t index, uint16_t *data)
 {
    int  status;
    uint8_t buffer[2] = {0,0};
@@ -290,7 +291,7 @@
 
 }
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_RdDWord(VL53L1_DEV Dev, uint16_t index, uint32_t *data)
+VL53L1CB_ERROR VL53L1CB::VL53L1_RdDWord(VL53L1_DEV Dev, uint16_t index, uint32_t *data)
 {
    int status;
    uint8_t buffer[4] = {0,0,0,0};
@@ -304,7 +305,7 @@
 
 }
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_UpdateByte(VL53L1_DEV Dev, uint16_t index, uint8_t AndData, uint8_t OrData)
+VL53L1CB_ERROR VL53L1CB::VL53L1_UpdateByte(VL53L1_DEV Dev, uint16_t index, uint8_t AndData, uint8_t OrData)
 {
    int  status;
    uint8_t buffer = 0;
@@ -406,7 +407,7 @@
 
 
 /***************************************************************************/
-//VL53L1CB_ERROR VL53L1CB::VL53L1CB_WaitValueMaskEx(
+//VL53L1CB_ERROR VL53L1CB::VL53L1_WaitValueMaskEx(
 
 VL53L1CB_ERROR VL53L1CB::VL53L1CB_WaitDeviceBooted(VL53L1_DEV Dev)
 {
@@ -488,7 +489,7 @@
 
  //   LOG_FUNCTION_START("");
 
-    Status = VL53L1_WrByte(Dev, VL53L1CB_I2C_SLAVE__DEVICE_ADDRESS,
+    Status = VL53L1_WrByte(Dev, VL53L1_I2C_SLAVE__DEVICE_ADDRESS,
             DeviceAddress / 2);
 
 //    LOG_FUNCTION_END(Status);
@@ -673,6 +674,9 @@
     return VL53L1_GetROI(Device,pRoiConfig);
 }
 
+
+
+
 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetNumberOfSequenceSteps(uint8_t *pNumberOfSequenceSteps)
 {
     VL53L1CB_ERROR Status = VL53L1_ERROR_NONE;
@@ -720,7 +724,7 @@
 }
 
 
-VL53L1CB_ERROR VL53L1CB::VL53L1CB_ClearInterruptAndStartMeasurement()
+VL53L1CB_ERROR VL53L1CB::VL53L1CB_learInterruptAndStartMeasurement()
 {
 
     return VL53L1_ClearInterruptAndStartMeasurement(Device);
@@ -888,6 +892,11 @@
     return VL53L1_GetOpticalCenter(Device,pOpticalCenterX,pOpticalCenterY);
 }
 
+
+
+
+
+
 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetThresholdConfig(VL53L1_DetectionConfig_t *pConfig)
 {
     return VL53L1_SetThresholdConfig(Device,pConfig);
@@ -899,6 +908,9 @@
     return VL53L1_GetThresholdConfig(Device,pConfig);
 }
 
+
+
+
 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformOffsetPerVcselCalibration(int32_t CalDistanceMilliMeter)
 {
     return VL53L1_PerformOffsetPerVcselCalibration(Device,CalDistanceMilliMeter);