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:
18:0696efe39d08
Parent:
3:bb32dc22b2f8
--- a/inc/ToF_I2C.h	Wed Jun 23 12:57:26 2021 +0000
+++ b/inc/ToF_I2C.h	Wed Jul 21 17:06:38 2021 +0200
@@ -8,8 +8,6 @@
 
 #include "pinmap.h"
 
-static int mutex =0;
-
 //Class replacing DevI2C class as it was not implementing a 16bit address registers   
 class ToF_DevI2C : public I2C
 {
@@ -34,75 +32,7 @@
      * @note   On some devices if NumByteToWrite is greater
      *         than one, the RegisterAddr must be masked correctly!
      */
-     /*
-    int v53l1x_i2c_write(uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr,
-                  uint16_t NumByteToWrite) {
-        int ret;
-        uint8_t tmp[TEMP_BUF_SIZE];
-
-        if(NumByteToWrite >= TEMP_BUF_SIZE) return -2;
-
-        // First, send device address. Then, send data and STOP condition 
-        tmp[0] = RegisterAddr >> 8;
-        tmp[1] = RegisterAddr & 0x0FF;
-        memcpy(tmp+2, pBuffer, NumByteToWrite);
-        while ( mutex )
-        {
-            wait_ms(1);
-        }
-        mutex = 1;
-
-        ret = write(DeviceAddr, (const char*)tmp, NumByteToWrite+2, false);
-        mutex = 0;
-        if(ret)
-        {
-            wait_ms(1);
-            ret = write(DeviceAddr, (const char*)tmp, NumByteToWrite+2, false);
-            if(ret)
-            {
-                            printf("***************** v53l1x_i2c_write twice times %d %d %d %d\n",DeviceAddr,RegisterAddr,NumByteToWrite,ret);
-            }
- //           printf("v53l1x_i2c_write %d %d %d %d\n",DeviceAddr,RegisterAddr,NumByteToWrite,ret);
-        return -1;
-        }
-        return 0;
-    }
-    */
-
-    /**
-     * @brief  Reads a buffer from the I2C peripheral device.
-     * @param  pBuffer pointer to the byte-array to read data in to
-     * @param  DeviceAddr specifies the peripheral device slave address.
-     * @param  RegisterAddr specifies the internal address register
-     *         where to start reading from (must be correctly masked).
-     * @param  NumByteToRead number of bytes to be read.
-     * @retval 0 if ok,
-     * @retval -1 if an I2C error has occured
-     * @note   On some devices if NumByteToWrite is greater
-     *         than one, the RegisterAddr must be masked correctly!
-     */
-     /*
-    int v53l1x_i2c_read(uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr,
-                 uint16_t NumByteToRead) {
-        int ret;
-
-
-            // Read data, with STOP condition  
-            ret = read(DeviceAddr, (char*)pBuffer, NumByteToRead, false);
-
-       //     printf("class v53l1x_i2c_read read %d %d %d\n",pBuffer[0],pBuffer[1],pBuffer[2]);
-
-
-        if(ret)
-        {
-           printf("********************* class v53l1x_i2c_read %d %d %d %d\n",DeviceAddr,RegisterAddr,NumByteToRead,ret);
-           return -1;
-        }
-        return 0;
-    }
-    */
-    
-        int ToF_i2c_write(uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr,
+    int ToF_i2c_write(uint8_t* pBuffer, uint8_t DeviceAddr, uint16_t RegisterAddr,
                   uint16_t NumByteToWrite) {
         int ret;
         uint8_t tmp[TEMP_BUF_SIZE];
@@ -153,4 +83,4 @@
     static const unsigned int TEMP_BUF_SIZE = 256;
 };
 
-#endif /* __DEV_53L1X_I2C_H */
\ No newline at end of file
+#endif /* __DEV_ToF_I2C_H */