Jerry Szczurak / X_NUCLEO_53L0A1

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   Display_53L0A1_IntSatelites Display_53L0A1_InterruptMode

Fork of X_NUCLEO_53L0A1 by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vl53l0x_class.h Source File

vl53l0x_class.h

00001 /*******************************************************************************
00002  Copyright © 2016, STMicroelectronics International N.V.
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without
00006  modification, are permitted provided that the following conditions are met:
00007  * Redistributions of source code must retain the above copyright
00008  notice, this list of conditions and the following disclaimer.
00009  * Redistributions in binary form must reproduce the above copyright
00010  notice, this list of conditions and the following disclaimer in the
00011  documentation and/or other materials provided with the distribution.
00012  * Neither the name of STMicroelectronics nor the
00013  names of its contributors may be used to endorse or promote products
00014  derived from this software without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
00019  NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
00020  IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
00021  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  *****************************************************************************/
00028 
00029 #ifndef __VL53L0X_CLASS_H
00030 #define __VL53L0X_CLASS_H
00031 
00032 
00033 #ifdef _MSC_VER
00034 #   ifdef VL53L0X_API_EXPORTS
00035 #       define VL53L0X_API  __declspec(dllexport)
00036 #   else
00037 #       define VL53L0X_API
00038 #   endif
00039 #else
00040 #   define VL53L0X_API
00041 #endif
00042 
00043 
00044 /* Includes ------------------------------------------------------------------*/
00045 #include "mbed.h"
00046 #include "RangeSensor.h"
00047 #include "DevI2C.h" 
00048 
00049 #include "vl53l0x_def.h"
00050 #include "vl53l0x_platform.h"
00051 #include "stmpe1600_class.h"
00052 
00053 
00054 /**
00055  * The device model ID
00056  */
00057 #define IDENTIFICATION_MODEL_ID                 0x000
00058  
00059 
00060 #define STATUS_OK              0x00
00061 #define STATUS_FAIL            0x01
00062 
00063 
00064 #define VL53L0X_OsDelay(...) HAL_Delay(2)
00065 
00066 #ifdef USE_EMPTY_STRING
00067     #define  VL53L0X_STRING_DEVICE_INFO_NAME                             ""
00068     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS0                         ""
00069     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS1                         ""
00070     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS2                         ""
00071     #define  VL53L0X_STRING_DEVICE_INFO_NAME_ES1                         ""
00072     #define  VL53L0X_STRING_DEVICE_INFO_TYPE                             ""
00073 
00074     /* PAL ERROR strings */
00075     #define  VL53L0X_STRING_ERROR_NONE                                   ""
00076     #define  VL53L0X_STRING_ERROR_CALIBRATION_WARNING                    ""
00077     #define  VL53L0X_STRING_ERROR_MIN_CLIPPED                            ""
00078     #define  VL53L0X_STRING_ERROR_UNDEFINED                              ""
00079     #define  VL53L0X_STRING_ERROR_INVALID_PARAMS                         ""
00080     #define  VL53L0X_STRING_ERROR_NOT_SUPPORTED                          ""
00081     #define  VL53L0X_STRING_ERROR_RANGE_ERROR                            ""
00082     #define  VL53L0X_STRING_ERROR_TIME_OUT                               ""
00083     #define  VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED                     ""
00084     #define  VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL                       ""
00085     #define  VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING                      ""
00086     #define  VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED       ""
00087     #define  VL53L0X_STRING_ERROR_CONTROL_INTERFACE                      ""
00088     #define  VL53L0X_STRING_ERROR_INVALID_COMMAND                        ""
00089     #define  VL53L0X_STRING_ERROR_DIVISION_BY_ZERO                       ""
00090     #define  VL53L0X_STRING_ERROR_REF_SPAD_INIT                          ""
00091     #define  VL53L0X_STRING_ERROR_NOT_IMPLEMENTED                        ""
00092 
00093     #define  VL53L0X_STRING_UNKNOW_ERROR_CODE                            ""
00094 
00095 
00096 
00097     /* Range Status */
00098     #define  VL53L0X_STRING_RANGESTATUS_NONE                             ""
00099     #define  VL53L0X_STRING_RANGESTATUS_RANGEVALID                       ""
00100     #define  VL53L0X_STRING_RANGESTATUS_SIGMA                            ""
00101     #define  VL53L0X_STRING_RANGESTATUS_SIGNAL                           ""
00102     #define  VL53L0X_STRING_RANGESTATUS_MINRANGE                         ""
00103     #define  VL53L0X_STRING_RANGESTATUS_PHASE                            ""
00104     #define  VL53L0X_STRING_RANGESTATUS_HW                               ""
00105 
00106 
00107     /* Range Status */
00108     #define  VL53L0X_STRING_STATE_POWERDOWN                              ""
00109     #define  VL53L0X_STRING_STATE_WAIT_STATICINIT                        ""
00110     #define  VL53L0X_STRING_STATE_STANDBY                                ""
00111     #define  VL53L0X_STRING_STATE_IDLE                                   ""
00112     #define  VL53L0X_STRING_STATE_RUNNING                                ""
00113     #define  VL53L0X_STRING_STATE_UNKNOWN                                ""
00114     #define  VL53L0X_STRING_STATE_ERROR                                  ""
00115 
00116 
00117     /* Device Specific */
00118     #define  VL53L0X_STRING_DEVICEERROR_NONE                             ""
00119     #define  VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE       ""
00120     #define  VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE         ""
00121     #define  VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND                  ""
00122     #define  VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET                     ""
00123     #define  VL53L0X_STRING_DEVICEERROR_SNRCHECK                         ""
00124     #define  VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK                  ""
00125     #define  VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK              ""
00126     #define  VL53L0X_STRING_DEVICEERROR_TCC                              ""
00127     #define  VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY                 ""
00128     #define  VL53L0X_STRING_DEVICEERROR_MINCLIP                          ""
00129     #define  VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE                    ""
00130     #define  VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW                    ""
00131     #define  VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW                     ""
00132     #define  VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD             ""
00133     #define  VL53L0X_STRING_DEVICEERROR_UNKNOWN                          ""
00134 
00135     /* Check Enable */
00136     #define  VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE                ""
00137     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE          ""
00138     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP                  ""
00139     #define  VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD           ""
00140 
00141     /* Sequence Step */
00142     #define  VL53L0X_STRING_SEQUENCESTEP_TCC                             ""
00143     #define  VL53L0X_STRING_SEQUENCESTEP_DSS                             ""
00144     #define  VL53L0X_STRING_SEQUENCESTEP_MSRC                            ""
00145     #define  VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE                       ""
00146     #define  VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE                     ""
00147 #else
00148     #define  VL53L0X_STRING_DEVICE_INFO_NAME          "VL53L0X cut1.0"
00149     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS0      "VL53L0X TS0"
00150     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS1      "VL53L0X TS1"
00151     #define  VL53L0X_STRING_DEVICE_INFO_NAME_TS2      "VL53L0X TS2"
00152     #define  VL53L0X_STRING_DEVICE_INFO_NAME_ES1      "VL53L0X ES1 or later"
00153     #define  VL53L0X_STRING_DEVICE_INFO_TYPE          "VL53L0X"
00154 
00155     /* PAL ERROR strings */
00156     #define  VL53L0X_STRING_ERROR_NONE \
00157             "No Error"
00158     #define  VL53L0X_STRING_ERROR_CALIBRATION_WARNING \
00159             "Calibration Warning Error"
00160     #define  VL53L0X_STRING_ERROR_MIN_CLIPPED \
00161             "Min clipped error"
00162     #define  VL53L0X_STRING_ERROR_UNDEFINED \
00163             "Undefined error"
00164     #define  VL53L0X_STRING_ERROR_INVALID_PARAMS \
00165             "Invalid parameters error"
00166     #define  VL53L0X_STRING_ERROR_NOT_SUPPORTED \
00167             "Not supported error"
00168     #define  VL53L0X_STRING_ERROR_RANGE_ERROR \
00169             "Range error"
00170     #define  VL53L0X_STRING_ERROR_TIME_OUT \
00171             "Time out error"
00172     #define  VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED \
00173             "Mode not supported error"
00174     #define  VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL \
00175             "Buffer too small"
00176     #define  VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING \
00177             "GPIO not existing"
00178     #define  VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \
00179             "GPIO funct not supported"
00180     #define  VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED \
00181             "Interrupt not Cleared"
00182     #define  VL53L0X_STRING_ERROR_CONTROL_INTERFACE \
00183             "Control Interface Error"
00184     #define  VL53L0X_STRING_ERROR_INVALID_COMMAND \
00185             "Invalid Command Error"
00186     #define  VL53L0X_STRING_ERROR_DIVISION_BY_ZERO \
00187             "Division by zero Error"
00188     #define  VL53L0X_STRING_ERROR_REF_SPAD_INIT \
00189             "Reference Spad Init Error"
00190     #define  VL53L0X_STRING_ERROR_NOT_IMPLEMENTED \
00191             "Not implemented error"
00192 
00193     #define  VL53L0X_STRING_UNKNOW_ERROR_CODE \
00194             "Unknown Error Code"
00195 
00196 
00197 
00198     /* Range Status */
00199     #define  VL53L0X_STRING_RANGESTATUS_NONE                 "No Update"
00200     #define  VL53L0X_STRING_RANGESTATUS_RANGEVALID           "Range Valid"
00201     #define  VL53L0X_STRING_RANGESTATUS_SIGMA                "Sigma Fail"
00202     #define  VL53L0X_STRING_RANGESTATUS_SIGNAL               "Signal Fail"
00203     #define  VL53L0X_STRING_RANGESTATUS_MINRANGE             "Min Range Fail"
00204     #define  VL53L0X_STRING_RANGESTATUS_PHASE                "Phase Fail"
00205     #define  VL53L0X_STRING_RANGESTATUS_HW                   "Hardware Fail"
00206 
00207 
00208     /* Range Status */
00209     #define  VL53L0X_STRING_STATE_POWERDOWN               "POWERDOWN State"
00210     #define  VL53L0X_STRING_STATE_WAIT_STATICINIT \
00211             "Wait for staticinit State"
00212     #define  VL53L0X_STRING_STATE_STANDBY                 "STANDBY State"
00213     #define  VL53L0X_STRING_STATE_IDLE                    "IDLE State"
00214     #define  VL53L0X_STRING_STATE_RUNNING                 "RUNNING State"
00215     #define  VL53L0X_STRING_STATE_UNKNOWN                 "UNKNOWN State"
00216     #define  VL53L0X_STRING_STATE_ERROR                   "ERROR State"
00217 
00218 
00219     /* Device Specific */
00220     #define  VL53L0X_STRING_DEVICEERROR_NONE                   "No Update"
00221     #define  VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE \
00222             "VCSEL Continuity Test Failure"
00223     #define  VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE \
00224             "VCSEL Watchdog Test Failure"
00225     #define  VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND \
00226             "No VHV Value found"
00227     #define  VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET \
00228             "MSRC No Target Error"
00229     #define  VL53L0X_STRING_DEVICEERROR_SNRCHECK \
00230             "SNR Check Exit"
00231     #define  VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK \
00232             "Range Phase Check Error"
00233     #define  VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK \
00234             "Sigma Threshold Check Error"
00235     #define  VL53L0X_STRING_DEVICEERROR_TCC \
00236             "TCC Error"
00237     #define  VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY \
00238             "Phase Consistency Error"
00239     #define  VL53L0X_STRING_DEVICEERROR_MINCLIP \
00240             "Min Clip Error"
00241     #define  VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE \
00242             "Range Complete"
00243     #define  VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW \
00244             "Range Algo Underflow Error"
00245     #define  VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW \
00246             "Range Algo Overlow Error"
00247     #define  VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD \
00248             "Range Ignore Threshold Error"
00249     #define  VL53L0X_STRING_DEVICEERROR_UNKNOWN \
00250             "Unknown error code"
00251 
00252     /* Check Enable */
00253     #define  VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
00254             "SIGMA FINAL RANGE"
00255     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
00256             "SIGNAL RATE FINAL RANGE"
00257     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP \
00258             "SIGNAL REF CLIP"
00259     #define  VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
00260             "RANGE IGNORE THRESHOLD"
00261     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_MSRC \
00262             "SIGNAL RATE MSRC"
00263     #define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_PRE_RANGE \
00264             "SIGNAL RATE PRE RANGE"
00265 
00266     /* Sequence Step */
00267     #define  VL53L0X_STRING_SEQUENCESTEP_TCC                   "TCC"
00268     #define  VL53L0X_STRING_SEQUENCESTEP_DSS                   "DSS"
00269     #define  VL53L0X_STRING_SEQUENCESTEP_MSRC                  "MSRC"
00270     #define  VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE             "PRE RANGE"
00271     #define  VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE           "FINAL RANGE"
00272 #endif /* USE_EMPTY_STRING */
00273 
00274 
00275 
00276 
00277 
00278 /* sensor operating modes */ 
00279 typedef enum
00280 {
00281    range_single_shot_polling=1,
00282    range_continuous_polling,
00283    range_continuous_interrupt,
00284    range_continuous_polling_low_threshold,
00285    range_continuous_polling_high_threshold,
00286    range_continuous_polling_out_of_window,
00287    range_continuous_interrupt_low_threshold,
00288    range_continuous_interrupt_high_threshold,
00289    range_continuous_interrupt_out_of_window,
00290 }OperatingMode;
00291 
00292 /** default device address */
00293 #define DEFAULT_DEVICE_ADDRESS      0x52 /* (8-bit) */
00294 
00295 /* Classes -------------------------------------------------------------------*/
00296 /** Class representing a VL53L0 sensor component
00297  */
00298 class VL53L0X : public RangeSensor
00299 {
00300  public:
00301     /** Constructor
00302      * @param[in] &i2c device I2C to be used for communication
00303      * @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
00304      * @param[in] DevAddr device address, 0x29 by default  
00305      */
00306     VL53L0X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : dev_i2c(i2c), gpio0(&pin)
00307     {
00308        MyDevice.I2cDevAddr =DevAddr;      
00309        MyDevice.comms_type =1; // VL53L0X_COMMS_I2C
00310              MyDevice.comms_speed_khz =400;
00311        Device=&MyDevice;
00312        expgpio0=NULL;
00313        if (pin_gpio1 != NC) { gpio1Int = new InterruptIn(pin_gpio1); }
00314         else { gpio1Int = NULL; }
00315     }  
00316     
00317     /** Constructor 2 (STMPE1600DigiOut)
00318      * @param[in] i2c device I2C to be used for communication
00319      * @param[in] &pin Gpio Expander STMPE1600DigiOut pin to be used as component GPIO_0 CE
00320      * @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
00321      * @param[in] device address, 0x29 by default  
00322      */     
00323     VL53L0X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : dev_i2c(i2c), expgpio0(&pin)
00324     {
00325        MyDevice.I2cDevAddr =DevAddr;      
00326        MyDevice.comms_type =1; // VL53L0X_COMMS_I2C
00327              MyDevice.comms_speed_khz =400;
00328        Device=&MyDevice;
00329        gpio0=NULL;      
00330        if (pin_gpio1 != NC) { gpio1Int = new InterruptIn(pin_gpio1); }
00331         else { gpio1Int = NULL; }
00332     }    
00333     
00334    /** Destructor
00335     */
00336     virtual ~VL53L0X(){ 
00337         if (gpio1Int != NULL) delete gpio1Int;
00338     }     
00339     /* warning: VL53L0X class inherits from GenericSensor, RangeSensor and LightSensor, that haven`t a destructor.
00340        The warning should request to introduce a virtual destructor to make sure to delete the object */
00341 
00342     /*** Interface Methods ***/ 
00343     /*** High level API ***/        
00344     /**
00345      * @brief       PowerOn the sensor
00346      * @return      void
00347      */     
00348     /* turns on the sensor */        
00349     void VL53L0X_On(void)
00350     {
00351         if (gpio0) 
00352               *gpio0 = 1;
00353         else if (expgpio0) 
00354             *expgpio0 = 1;
00355         wait_ms(10);
00356     } 
00357 
00358     /**
00359      * @brief       PowerOff the sensor
00360      * @return      void
00361      */     
00362     /* turns off the sensor */
00363     void VL53L0X_Off(void) 
00364     {
00365         if (gpio0) 
00366               *gpio0 = 0;
00367         else if (expgpio0) 
00368             *expgpio0 = 0;
00369         wait_ms(10);
00370     }
00371     
00372     /**
00373      * @brief       Initialize the sensor with default values
00374      * @return      0 on Success
00375      */
00376 
00377     int InitSensor(uint8_t NewAddr);
00378 
00379     int RawInitSensor(void);
00380     int initDevice(VL53L0X_DEV Dev);
00381     int setLongRangePresets(VL53L0X_DEV Dev);
00382     int DoRanging(VL53L0X_Dev_t *pMyDevice);
00383 
00384 
00385 
00386 
00387     /**
00388      * @brief       Start the measure indicated by operating mode
00389      * @param[in]   operating_mode specifies requested measure 
00390      * @param[in]   fptr specifies call back function must be !NULL in case of interrupt measure     
00391      * @return      0 on Success
00392      */                      
00393     int StartMeasurement(OperatingMode operating_mode, void (*fptr)(void));
00394 
00395     /**
00396      * @brief       Get results for the measure indicated by operating mode
00397      * @param[in]   operating_mode specifies requested measure results
00398      * @param[out]  Data pointer to the MeasureData_t structure to read data in to
00399      * @return      0 on Success
00400      */                          
00401     int GetMeasurement(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *Data);       
00402 
00403     /**
00404      * @brief       Stop the currently running measure indicate by operating_mode
00405      * @param[in]   operating_mode specifies requested measure to stop
00406      * @return      0 on Success
00407      */                              
00408     int StopMeasurement(OperatingMode operating_mode);
00409      
00410     /**
00411      * @brief       Interrupt handling func to be called by user after an INT is occourred
00412      * @param[in]   opeating_mode indicating the in progress measure
00413      * @param[out]  Data pointer to the MeasureData_t structure to read data in to
00414      * @return      0 on Success
00415      */                                 
00416     int HandleIRQ(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *Data);    
00417 
00418     /**
00419      * @brief       Enable interrupt measure IRQ
00420      * @return      0 on Success
00421      */                      
00422     void EnableInterruptMeasureDetectionIRQ(void) 
00423     {
00424        if (gpio1Int != NULL) gpio1Int->enable_irq();
00425     }
00426 
00427     /**
00428      * @brief       Disable interrupt measure IRQ
00429      * @return      0 on Success
00430      */                           
00431     void DisableInterruptMeasureDetectionIRQ(void) 
00432     {
00433        if (gpio1Int != NULL) gpio1Int->disable_irq();
00434     }
00435     /*** End High level API ***/              
00436     
00437     /**
00438      * @brief       Attach a function to call when an interrupt is detected, i.e. measurement is ready
00439      * @param[in]   fptr pointer to call back function to be called whenever an interrupt occours
00440      * @return      0 on Success
00441      */                                   
00442     void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void))
00443     {
00444        if (gpio1Int != NULL) gpio1Int->rise(fptr);
00445     }
00446     
00447     /**
00448      * @brief       Check the sensor presence
00449      * @return      1 when device is present
00450      */                     
00451     unsigned Present()
00452     {
00453 //       return Device->Present;
00454        return 1;
00455     }
00456         
00457     /** Wrapper functions */    
00458 /** @defgroup api_init Init functions
00459  *  @brief    API init functions
00460  *  @ingroup api_hl
00461  *  @{  
00462  */
00463 /**
00464  * @brief Wait for device booted after chip enable (hardware standby)
00465  * @par Function Description
00466  * After Chip enable Application you can also simply wait at least 1ms to ensure device is ready
00467  * @warning After device chip enable (gpio0) de-asserted  user must wait gpio1 to get asserted (hardware standby).
00468  * or wait at least 400usec prior to do any low level access or api call .
00469  *
00470  * This function implements polling for standby but you must ensure 400usec from chip enable passed\n
00471  * @warning if device get prepared @a VL53L0X_Prepare() re-using these function can hold indefinitely\n
00472  *
00473  * @param       void
00474  * @return     0 on success
00475  */
00476     int WaitDeviceBooted()
00477     {
00478        return VL53L0X_WaitDeviceBooted(Device);
00479 //          return 1;
00480     }
00481 
00482 
00483 /**
00484  *
00485  * @brief One time device initialization
00486  *
00487  * To be called once and only once after device is brought out of reset (Chip enable) and booted see @a VL6180x_WaitDeviceBooted()
00488  *
00489  * @par Function Description
00490  * When not used after a fresh device "power up" or reset, it may return @a #CALIBRATION_WARNING
00491  * meaning wrong calibration data may have been fetched from device that can result in ranging offset error\n
00492  * If application cannot execute device reset or need to run VL6180x_InitData  multiple time
00493  * then it  must ensure proper offset calibration saving and restore on its own
00494  * by using @a VL6180x_GetOffsetCalibrationData() on first power up and then @a VL6180x_SetOffsetCalibrationData() all all subsequent init
00495  *
00496  * @param void
00497  * @return     0 on success,  @a #CALIBRATION_WARNING if failed
00498  */     
00499     virtual int init(void *init)
00500     {
00501         return VL53L0X_DataInit(Device);
00502     }
00503     
00504 /** deprecated Init funtion from ComponentObject. for backward compatibility
00505 */  
00506     virtual int Init(void * NewAddr)
00507     {
00508         return init(NewAddr);
00509     }
00510 
00511 /**
00512  * @brief Configure GPIO1 function and set polarity.
00513  * @par Function Description
00514  * To be used prior to arm single shot measure or start  continuous mode.
00515  *
00516  * The function uses @a VL6180x_SetupGPIOx() for setting gpio 1.
00517  * @warning  changing polarity can generate a spurious interrupt on pins.
00518  * It sets an interrupt flags condition that must be cleared to avoid polling hangs. \n
00519  * It is safe to run VL6180x_ClearAllInterrupt() just after.
00520  *
00521  * @param IntFunction   The interrupt functionality to use one of :\n
00522  *  @a #GPIOx_SELECT_OFF \n
00523  *  @a #GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT
00524  * @param ActiveHigh  The interrupt line polarity see ::IntrPol_e
00525  *      use @a #INTR_POL_LOW (falling edge) or @a #INTR_POL_HIGH (rising edge)
00526  * @return 0 on success
00527  */     
00528     int SetupGPIO1(uint8_t InitFunction, int ActiveHigh)
00529     {
00530 //       return VL6180x_SetupGPIO1(Device, InitFunction, ActiveHigh);
00531             return 1;
00532     }
00533 
00534 /**
00535   * @brief  Prepare device for operation
00536   * @par Function Description
00537   * Does static initialization and reprogram common default settings \n
00538   * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n
00539   * After prepare user can : \n
00540   * @li Call other API function to set other settings\n
00541   * @li Configure the interrupt pins, etc... \n
00542   * @li Then start ranging or ALS operations in single shot or continuous mode
00543   *
00544   * @param void
00545   * @return      0 on success
00546   */        
00547     int Prepare()
00548     {
00549         VL53L0X_Error Status = VL53L0X_ERROR_NONE;
00550         uint32_t refSpadCount;
00551         uint8_t isApertureSpads;
00552         uint8_t VhvSettings;
00553         uint8_t PhaseCal;
00554 
00555         if(Status == VL53L0X_ERROR_NONE)
00556         {
00557             printf ("Call of VL53L0X_StaticInit\n");
00558             Status = VL53L0X_StaticInit(Device); // Device Initialization
00559         }
00560     
00561         if(Status == VL53L0X_ERROR_NONE)
00562         {
00563             printf ("Call of VL53L0X_PerformRefCalibration\n");
00564            Status = VL53L0X_PerformRefCalibration(Device,
00565                                 &VhvSettings, &PhaseCal); // Device Initialization
00566         }
00567 
00568         if(Status == VL53L0X_ERROR_NONE)
00569         {
00570             printf ("Call of VL53L0X_PerformRefSpadManagement\n");
00571             Status = VL53L0X_PerformRefSpadManagement(Device,
00572                              &refSpadCount, &isApertureSpads); // Device Initialization
00573 //            printf ("refSpadCount = %d, isApertureSpads = %d\n", refSpadCount, isApertureSpads);
00574         }
00575             
00576         return Status;
00577     }
00578 
00579  /**
00580  * @brief Start continuous ranging mode
00581  *
00582  * @details End user should ensure device is in idle state and not already running
00583  * @return      0 on success
00584  */     
00585     int RangeStartContinuousMode()
00586     {
00587         int status;
00588         status = RangeSetSystemMode(VL53L0X_REG_SYSRANGE_MODE_START_STOP|VL53L0X_REG_SYSRANGE_MODE_BACKTOBACK);
00589         return status;
00590     }
00591 
00592 /**
00593  * @brief Start single shot ranging measure
00594  *
00595  * @details End user should ensure device is in idle state and not already running
00596  * @return      0 on success 
00597  */     
00598     int RangeStartSingleShot()
00599     {
00600 //       return VL6180x_RangeStartSingleShot(Device);
00601             return 1;
00602     }
00603 
00604 /**
00605  * @brief Set maximum convergence time
00606  *
00607  * @par Function Description
00608  * Setting a low convergence time can impact maximal detectable distance.
00609  * Refer to VL6180x Datasheet Table 7 : Typical range convergence time.
00610  * A typical value for up to x3 scaling is 50 ms
00611  *
00612  * @param MaxConTime_msec
00613  * @return 0 on success. <0 on error. >0 for calibration warning status
00614  */     
00615     int RangeSetMaxConvergenceTime(uint8_t MaxConTime_msec)
00616     {
00617 //       return VL6180x_RangeSetMaxConvergenceTime(Device, MaxConTime_msec);
00618             return 1;
00619     }
00620 
00621 /**
00622   * @brief Single shot Range measurement in polling mode.
00623   *
00624   * @par Function Description
00625   * Kick off a new single shot range  then wait for ready to retrieve it by polling interrupt status \n
00626   * Ranging must be prepared by a first call to  @a VL6180x_Prepare() and it is safer to clear  very first poll call \n
00627   * This function reference VL6180x_PollDelay(dev) porting macro/call on each polling loop,
00628   * but PollDelay(dev) may never be called if measure in ready on first poll loop \n
00629   * Should not be use in continuous mode operation as it will stop it and cause stop/start misbehaviour \n
00630   * \n This function clears Range Interrupt status , but not error one. For that uses  @a VL6180x_ClearErrorInterrupt() \n
00631   * This range error is not related VL6180x_RangeData_t::errorStatus that refer measure status \n
00632   * 
00633   * @param pRangeData   Will be populated with the result ranging data @a  VL6180x_RangeData_t
00634   * @return 0 on success , @a #RANGE_ERROR if device reports an error case in it status (not cleared) use
00635   *
00636   * \sa ::VL6180x_RangeData_t
00637   */        
00638     int RangePollMeasurement(VL53L0X_RangingMeasurementData_t *pRangeData)
00639     {
00640 //       return VL6180x_RangePollMeasurement(Device, pRangeData);
00641             return 1;
00642     }
00643 
00644 /**
00645  * @brief Check for measure readiness and get it if ready
00646  *
00647  * @par Function Description
00648  * Using this function is an alternative to @a VL6180x_RangePollMeasurement() to avoid polling operation. This is suitable for applications
00649  * where host CPU is triggered on a interrupt (not from VL6180X) to perform ranging operation. In this scenario, we assume that the very first ranging
00650  * operation is triggered by a call to @a VL6180x_RangeStartSingleShot(). Then, host CPU regularly calls @a VL6180x_RangeGetMeasurementIfReady() to
00651  * get a distance measure if ready. In case the distance is not ready, host may get it at the next call.\n
00652  *
00653  * @warning 
00654  * This function does not re-start a new measurement : this is up to the host CPU to do it.\n 
00655  * This function clears Range Interrupt for measure ready , but not error interrupts. For that, uses  @a VL6180x_ClearErrorInterrupt() \n
00656  *
00657  * @param pRangeData  Will be populated with the result ranging data if available
00658  * @return  0 when measure is ready pRange data is updated (untouched when not ready),  >0 for warning and @a #NOT_READY if measurement not yet ready, <0 for error @a #RANGE_ERROR if device report an error,
00659  */     
00660     int RangeGetMeasurementIfReady(VL53L0X_RangingMeasurementData_t *pRangeData)
00661     {
00662 //       return VL6180x_RangeGetMeasurementIfReady(Device, pRangeData);
00663             return 1;
00664     }
00665 
00666 /**
00667  * @brief Retrieve range measurements set  from device
00668  *
00669  * @par Function Description
00670  * The measurement is made of range_mm status and error code @a VL6180x_RangeData_t \n
00671  * Based on configuration selected extra measures are included.
00672  *
00673  * @warning should not be used in continuous if wrap around filter is active \n
00674  * Does not perform any wait nor check for result availability or validity.
00675  *\sa VL6180x_RangeGetResult for "range only" measurement
00676  *
00677  * @param pRangeData  Pointer to the data structure to fill up
00678  * @return            0 on success
00679  */     
00680     int RangeGetMeasurement(VL53L0X_RangingMeasurementData_t *pRangeData)
00681     {
00682 //       return VL6180x_RangeGetMeasurement(Device, pRangeData);
00683             return 1;
00684     }
00685 
00686 /**
00687  * @brief Get ranging result and only that
00688  *
00689  * @par Function Description
00690  * Unlike @a VL6180x_RangeGetMeasurement() this function only retrieves the range in millimeter \n
00691  * It does any required up-scale translation\n
00692  * It can be called after success status polling or in interrupt mode \n
00693  * @warning these function is not doing wrap around filtering \n
00694  * This function doesn't perform any data ready check!
00695  *
00696  * @param pRange_mm  Pointer to range distance
00697  * @return           0 on success
00698  */     
00699     virtual int get_distance(uint32_t *piData)
00700     {
00701         int status=0;
00702         VL53L0X_RangingMeasurementData_t pRangingMeasurementData;
00703 
00704         status=StartMeasurement(range_single_shot_polling, NULL);
00705         if (!status) {
00706             status=GetMeasurement(range_single_shot_polling, &pRangingMeasurementData);
00707         }
00708         if (pRangingMeasurementData.RangeStatus == 0) {
00709         // we have a valid range.
00710             *piData = pRangingMeasurementData.RangeMilliMeter;
00711         }
00712         else {
00713             *piData = 0;
00714             status = VL53L0X_ERROR_RANGE_ERROR;
00715         }
00716         StopMeasurement(range_single_shot_polling);
00717         return status;
00718     }
00719 /* Deprecated funtion from RangeSensor class. For backward compatibility*/  
00720     virtual int GetDistance(uint32_t *piData)
00721     {
00722         return get_distance(piData);
00723     }   
00724 /**
00725  * @brief Configure ranging interrupt reported to application
00726  *
00727  * @param ConfigGpioInt  Select ranging report\n select one (and only one) of:\n
00728  *   @a #CONFIG_GPIO_INTERRUPT_DISABLED \n
00729  *   @a #CONFIG_GPIO_INTERRUPT_LEVEL_LOW \n
00730  *   @a #CONFIG_GPIO_INTERRUPT_LEVEL_HIGH \n
00731  *   @a #CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW \n
00732  *   @a #CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY
00733  * @return   0 on success
00734  */
00735     int RangeConfigInterrupt(uint8_t ConfigGpioInt)
00736     {
00737         int status;
00738          if( ConfigGpioInt<= VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY)
00739          {
00740             status = VL53L0X_UpdateByte(Device, VL53L0X_REG_SYSTEM_INTERRUPT_CONFIG_GPIO, (uint8_t)(~(0x7<<0)), ConfigGpioInt);
00741          }
00742          else
00743          {
00744             status = 1;
00745          }  
00746         //       return VL6180x_RangeConfigInterrupt(Device, ConfigGpioInt);
00747             
00748         return status;
00749     }
00750 
00751 /**
00752  * @brief Return ranging error interrupt status
00753  *
00754  * @par Function Description
00755  * Appropriate Interrupt report must have been selected first by @a VL6180x_RangeConfigInterrupt() or @a  VL6180x_Prepare() \n
00756  *
00757  * Can be used in polling loop to wait for a given ranging event or in interrupt to read the trigger \n
00758  * Events triggers are : \n
00759  * @a #RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD \n
00760  * @a #RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD \n
00761  * @a #RES_INT_STAT_GPIO_OUT_OF_WINDOW \n (RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD|RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD)
00762  * @a #RES_INT_STAT_GPIO_NEW_SAMPLE_READY \n
00763  *
00764  * @sa IntrStatus_t
00765  * @param pIntStatus Pointer to status variable to update
00766  * @return           0 on success
00767  */     
00768     int RangeGetInterruptStatus(uint8_t *pIntStatus)
00769     {
00770 //       return VL6180x_RangeGetInterruptStatus(Device, pIntStatus);
00771             return 1;
00772     }
00773 
00774 /**
00775  * @brief Low level ranging and ALS register static settings (you should call @a VL6180x_Prepare() function instead)
00776  *
00777  * @return 0 on success
00778  */
00779     int StaticInit()
00780     {
00781 //       return VL6180x_StaticInit(Device);
00782             return 1;
00783     }
00784 
00785 /**
00786  * @brief Wait for device to be ready (before a new ranging command can be issued by application)
00787  * @param MaxLoop    Max Number of i2c polling loop see @a #msec_2_i2cloop
00788  * @return           0 on success. <0 when fail \n
00789  *                   @ref VL6180x_ErrCode_t::TIME_OUT for time out \n
00790  *                   @ref VL6180x_ErrCode_t::INVALID_PARAMS if MaxLop<1
00791  */     
00792     int RangeWaitDeviceReady(int MaxLoop )
00793     {
00794 //       return VL6180x_RangeWaitDeviceReady(Device, MaxLoop);
00795             return 1;
00796     }
00797 
00798 /**
00799  * @brief Program Inter measurement period (used only in continuous mode)
00800  *
00801  * @par Function Description
00802  * When trying to set too long time, it returns #INVALID_PARAMS
00803  *
00804  * @param InterMeasTime_msec Requires inter-measurement time in msec
00805  * @return 0 on success
00806  */     
00807     int RangeSetInterMeasPeriod(uint32_t  InterMeasTime_msec)
00808     {
00809 //       return VL6180x_RangeSetInterMeasPeriod(Device, InterMeasTime_msec);
00810             return 1;
00811     }
00812 
00813 /**
00814  * @brief Set device ranging scaling factor
00815  *
00816  * @par Function Description
00817  * The ranging scaling factor is applied on the raw distance measured by the device to increase operating ranging at the price of the precision.
00818  * Changing the scaling factor when device is not in f/w standby state (free running) is not safe.
00819  * It can be source of spurious interrupt, wrongly scaled range etc ...
00820  * @warning __This  function doesns't update high/low threshold and other programmed settings linked to scaling factor__.
00821  *  To ensure proper operation, threshold and scaling changes should be done following this procedure: \n
00822  *  @li Set Group hold  : @a VL6180x_SetGroupParamHold() \n
00823  *  @li Get Threshold @a VL6180x_RangeGetThresholds() \n
00824  *  @li Change scaling : @a VL6180x_UpscaleSetScaling() \n
00825  *  @li Set Threshold : @a VL6180x_RangeSetThresholds() \n
00826  *  @li Unset Group Hold : @a VL6180x_SetGroupParamHold()
00827  *
00828  * @param scaling  Scaling factor to apply (1,2 or 3)
00829  * @return          0 on success when up-scale support is not configured it fail for any
00830  *                  scaling than the one statically configured.
00831  */
00832     int UpscaleSetScaling(uint8_t scaling)
00833     {
00834 //       return VL6180x_UpscaleSetScaling(Device, scaling);
00835             return 1;
00836     }
00837 
00838 /**
00839  * @brief Get current ranging scaling factor
00840  *
00841  * @return    The current scaling factor
00842  */             
00843     int UpscaleGetScaling()
00844     {
00845 //       return VL6180x_UpscaleGetScaling(Device);
00846             return 1;
00847     }
00848 
00849 /**
00850  * @brief Get the maximal distance for actual scaling
00851  * @par Function Description
00852  * Do not use prior to @a VL6180x_Prepare() or at least @a VL6180x_InitData()
00853  *
00854  * Any range value more than the value returned by this function is to be considered as "no target detected"
00855  * or "no target in detectable range" \n
00856  * @warning The maximal distance depends on the scaling
00857  *
00858  * @return    The maximal range limit for actual mode and scaling
00859  */     
00860     uint16_t GetUpperLimit()
00861     {
00862 //       return VL6180x_GetUpperLimit(Device);
00863             return 1;
00864     }
00865 
00866 /**
00867  * @brief Apply low and high ranging thresholds that are considered only in continuous mode
00868  *
00869  * @par Function Description
00870  * This function programs low and high ranging thresholds that are considered in continuous mode : 
00871  * interrupt will be raised only when an object is detected at a distance inside this [low:high] range.  
00872  * The function takes care of applying current scaling factor if any.\n
00873  * To be safe, in continuous operation, thresholds must be changed under "group parameter hold" cover.
00874  * Group hold can be activated/deactivated directly in the function or externally (then set 0)
00875  * using /a VL6180x_SetGroupParamHold() function.
00876  *
00877  * @param low      Low threshold in mm
00878  * @param high     High threshold in mm
00879  * @param SafeHold  Use of group parameters hold to surround threshold programming.
00880  * @return  0 On success
00881  */     
00882     int RangeSetThresholds(uint16_t low, uint16_t high, int SafeHold)
00883     {
00884 //       return VL6180x_RangeSetThresholds(Device, low, high, SafeHold);
00885             return 1;
00886     }
00887 
00888 /**
00889  * @brief  Get scaled high and low threshold from device
00890  *
00891  * @par Function Description
00892  * Due to scaling factor, the returned value may be different from what has been programmed first (precision lost).
00893  * For instance VL6180x_RangeSetThresholds(dev,11,22) with scale 3
00894  * will read back 9 ((11/3)x3) and 21 ((22/3)x3).
00895  *
00896  * @param low  scaled low Threshold ptr  can be NULL if not needed
00897  * @param high scaled High Threshold ptr can be NULL if not needed
00898  * @return 0 on success, return value is undefined if both low and high are NULL
00899  * @warning return value is undefined if both low and high are NULL
00900  */
00901     int RangeGetThresholds(uint16_t *low, uint16_t *high)
00902     {
00903 //       return VL6180x_RangeGetThresholds(Device, low, high);
00904             return 1;
00905     }
00906 
00907 /**
00908  * @brief Set ranging raw thresholds (scaling not considered so not recommended to use it)
00909  *
00910  * @param low  raw low threshold set to raw register
00911  * @param high raw high threshold set to raw  register
00912  * @return 0 on success
00913  */         
00914     int RangeSetRawThresholds(uint8_t low, uint8_t high)
00915     {
00916 //       return VL6180x_RangeSetRawThresholds(Device, low, high);
00917             return 1;
00918     }
00919 
00920 /**
00921  * @brief Set Early Convergence Estimate ratio
00922  * @par Function Description
00923  * For more information on ECE check datasheet
00924  * @warning May return a calibration warning in some use cases
00925  *
00926  * @param FactorM    ECE factor M in M/D
00927  * @param FactorD    ECE factor D in M/D
00928  * @return           0 on success. <0 on error. >0 on warning
00929  */     
00930     int RangeSetEceFactor(uint16_t  FactorM, uint16_t FactorD)
00931     {
00932 //       return VL6180x_RangeSetEceFactor(Device, FactorM, FactorD);
00933             return 1;
00934     }
00935 
00936 /**
00937  * @brief Set Early Convergence Estimate state (See #SYSRANGE_RANGE_CHECK_ENABLES register)
00938  * @param enable    State to be set 0=disabled, otherwise enabled
00939  * @return          0 on success
00940  */     
00941     int RangeSetEceState(int enable)
00942     {
00943 //       return VL6180x_RangeSetEceState(Device, enable);
00944             return 1;
00945     }
00946 
00947 /**
00948  * @brief Set activation state of the wrap around filter
00949  * @param state New activation state (0=off,  otherwise on)
00950  * @return      0 on success
00951  */         
00952     int FilterSetState(int state)
00953     {
00954 //       return VL6180x_FilterSetState(Device, state);
00955             return 1;
00956     }
00957 
00958 /**
00959  * Get activation state of the wrap around filter
00960  * @return     Filter enabled or not, when filter is not supported it always returns 0S
00961  */         
00962     int FilterGetState()
00963     {
00964 //       return VL6180x_FilterGetState(Device);
00965             return 1;
00966     }
00967 
00968 /**
00969  * @brief Set activation state of  DMax computation
00970  * @param state New activation state (0=off,  otherwise on)
00971  * @return      0 on success
00972  */     
00973     int DMaxSetState(int state)
00974     {
00975 //       return VL6180x_DMaxSetState(Device, state);
00976             return 1;
00977     }
00978 
00979 /**
00980  * Get activation state of DMax computation
00981  * @return     Filter enabled or not, when filter is not supported it always returns 0S
00982  */     
00983     int DMaxGetState()
00984     {
00985 //       return VL6180x_DMaxGetState(Device);
00986             return 1;
00987     }
00988 
00989 /**
00990  * @brief Set ranging mode and start/stop measure (use high level functions instead : @a VL6180x_RangeStartSingleShot() or @a VL6180x_RangeStartContinuousMode())
00991  *
00992  * @par Function Description
00993  * When used outside scope of known polling single shot stopped state, \n
00994  * user must ensure the device state is "idle" before to issue a new command.
00995  *
00996  * @param mode  A combination of working mode (#MODE_SINGLESHOT or #MODE_CONTINUOUS) and start/stop condition (#MODE_START_STOP) \n
00997  * @return      0 on success
00998  */     
00999     int RangeSetSystemMode(uint8_t mode)
01000     {       
01001         int status;
01002         /* FIXME we are not checking device is ready via @a VL6180X_RangeWaitDeviceReady
01003          * so if called back to back real fast we are not checking
01004          * if previous mode "set" got absorbed => bit 0 must be 0 so that it work
01005          */
01006         if( mode <= 3){
01007             status=VL53L0X_WrByte(Device, VL53L0X_REG_SYSRANGE_START, mode);
01008             if( status ){
01009                 VL53L0X_ErrLog("SYSRANGE_START wr fail");
01010             }
01011         }
01012         else{
01013             status = 1;
01014         }
01015         return status;      
01016 //       return VL6180x_RangeSetSystemMode(Device, mode);
01017 //          return 1;
01018     }
01019 
01020 /** @}  */ 
01021 
01022 /** @defgroup api_ll_range_calibration Ranging calibration functions
01023  *  @brief    Ranging calibration functions
01024  *  @ingroup api_ll
01025  *  @{  
01026  */
01027 /**
01028  * @brief Get part to part calibration offset
01029  *
01030  * @par Function Description
01031  * Should only be used after a successful call to @a VL6180x_InitData to backup device nvm value
01032  *
01033  * @return part to part calibration offset from device
01034  */     
01035     int8_t GetOffsetCalibrationData()
01036     {
01037 //       return VL6180x_GetOffsetCalibrationData(Device);
01038             return 1;
01039     }
01040 
01041 /**
01042  * Set or over-write part to part calibration offset
01043  * \sa VL6180x_InitData(), VL6180x_GetOffsetCalibrationData()
01044  * @param offset   Offset
01045  */     
01046     void SetOffsetCalibrationData(int8_t offset)
01047     {
01048 //       return VL6180x_SetOffsetCalibrationData(Device, offset);
01049             return;
01050     }
01051 
01052 /**
01053  * @brief Set Cross talk compensation rate
01054  *
01055  * @par Function Description
01056  * It programs register @a #SYSRANGE_CROSSTALK_COMPENSATION_RATE
01057  *
01058  * @param Rate Compensation rate (9.7 fix point) see datasheet for details
01059  * @return     0 on success
01060  */     
01061     int SetXTalkCompensationRate(uint16_t Rate)
01062     {
01063 //       return VL6180x_SetXTalkCompensationRate(Device, Rate);
01064             return 1;
01065     }
01066 /** @}  */
01067 
01068 /**
01069  * @brief Set new device i2c address
01070  *
01071  * After completion the device will answer to the new address programmed.
01072  *
01073  * @sa AN4478: Using multiple VL6180X's in a single design
01074  * @param NewAddr   The new i2c address (7bit)
01075  * @return          0 on success
01076  */     
01077     int SetDeviceAddress(int NewAddr)
01078     {
01079        int status;
01080             
01081        status=VL53L0X_SetDeviceAddress(Device, NewAddr);
01082        if(!status)
01083           Device->I2cDevAddr =NewAddr;
01084        return status;
01085 
01086     }
01087 
01088 /**
01089  * @brief Fully configure gpio 0/1 pin : polarity and functionality
01090  *
01091  * @param pin          gpio pin 0 or 1
01092  * @param IntFunction  Pin functionality : either #GPIOx_SELECT_OFF or #GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT (refer to #SYSTEM_MODE_GPIO1 register definition)
01093  * @param ActiveHigh   Set active high polarity, or active low see @a ::IntrPol_e
01094  * @return             0 on success
01095  */     
01096     int SetupGPIOx(int pin, uint8_t IntFunction, int ActiveHigh)
01097     {
01098 //       return VL6180x_SetupGPIOx(Device, pin, IntFunction, ActiveHigh);
01099             return 1;
01100     }
01101 
01102 /**
01103  * @brief Set interrupt pin polarity for the given GPIO
01104  *
01105  * @param pin          Pin 0 or 1
01106  * @param active_high  select active high or low polarity using @ref IntrPol_e
01107  * @return             0 on success
01108  */     
01109     int SetGPIOxPolarity(int pin, int active_high)
01110     {
01111 //       return VL6180x_SetGPIOxPolarity(Device, pin, active_high);
01112             return 1;
01113     }
01114 
01115 /**
01116  * Select interrupt functionality for the given GPIO
01117  *
01118  * @par Function Description
01119  * Functionality refer to @a SYSTEM_MODE_GPIO0
01120  *
01121  * @param pin            Pin to configure 0 or 1 (gpio0 or gpio1)\nNote that gpio0 is chip enable at power up !
01122  * @param functionality  Pin functionality : either #GPIOx_SELECT_OFF or #GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT (refer to #SYSTEM_MODE_GPIO1 register definition)
01123  * @return              0 on success
01124  */      
01125     int SetGPIOxFunctionality(int pin, uint8_t functionality)
01126     {
01127 //       return VL6180x_SetGPIOxFunctionality(Device, pin, functionality);
01128             return 1;
01129     }
01130 
01131 /**
01132  * #brief Disable and turn to Hi-Z gpio output pin
01133  *
01134  * @param pin  The pin number to disable 0 or 1
01135  * @return     0 on success
01136  */ 
01137     int DisableGPIOxOut(int pin)
01138     {
01139 //       return VL6180x_DisableGPIOxOut(Device, pin);
01140             return 1;
01141     }
01142 
01143 /** @}  */
01144 
01145 /** @defgroup api_ll_intr Interrupts management functions
01146  *  @brief    Interrupts management functions
01147  *  @ingroup api_ll
01148  *  @{  
01149  */
01150 
01151 /**
01152  * @brief     Get all interrupts cause
01153  *
01154  * @param status Ptr to interrupt status. You can use @a IntrStatus_t::val
01155  * @return 0 on success
01156  */     
01157     int GetInterruptStatus(uint8_t *status)
01158     {
01159 //       return VL6180x_GetInterruptStatus(Device, status);
01160             return 1;
01161     }
01162 
01163 /**
01164  * @brief Clear given system interrupt condition
01165  *
01166  * @par Function Description
01167  * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register.
01168  * @param dev       The device 
01169  * @param IntClear  Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR.
01170  * @return  0       On success
01171  */     
01172     int ClearInterrupt(uint8_t IntClear)
01173     {
01174          int status = VL53L0X_WrByte(Device, VL53L0X_REG_SYSTEM_INTERRUPT_CLEAR, IntClear);
01175 //       return VL6180x_ClearInterrupt(Device, IntClear );
01176          return status;
01177     }
01178 
01179 /**
01180  * @brief Clear error interrupt
01181  *
01182  * @param dev    The device
01183  * @return  0    On success
01184  */
01185  #define VL6180x_ClearErrorInterrupt(dev) VL6180x_ClearInterrupt(dev, INTERRUPT_CLEAR_ERROR)
01186 
01187 /**
01188  * @brief Clear All interrupt causes (als+range+error)
01189  *
01190  * @param dev    The device
01191  * @return  0    On success
01192  */
01193 #define VL6180x_ClearAllInterrupt(dev) VL6180x_ClearInterrupt(dev, INTERRUPT_CLEAR_ERROR|INTERRUPT_CLEAR_RANGING|INTERRUPT_CLEAR_ALS)
01194     
01195 
01196  private:       
01197     /* api.h functions */
01198     VL53L0X_Error VL53L0X_DataInit(VL53L0X_DEV Dev);
01199     VL53L0X_Error VL53L0X_GetOffsetCalibrationDataMicroMeter(VL53L0X_DEV Dev, int32_t *pOffsetCalibrationDataMicroMeter);
01200     VL53L0X_Error VL53L0X_SetOffsetCalibrationDataMicroMeter(VL53L0X_DEV Dev,
01201         int32_t OffsetCalibrationDataMicroMeter);
01202     VL53L0X_Error VL53L0X_GetDeviceParameters(VL53L0X_DEV Dev,
01203         VL53L0X_DeviceParameters_t *pDeviceParameters);
01204     VL53L0X_Error VL53L0X_GetDeviceMode(VL53L0X_DEV Dev,
01205         VL53L0X_DeviceModes *pDeviceMode);
01206     VL53L0X_Error VL53L0X_GetInterMeasurementPeriodMilliSeconds(VL53L0X_DEV Dev,
01207         uint32_t *pInterMeasurementPeriodMilliSeconds);
01208     VL53L0X_Error VL53L0X_GetXTalkCompensationRateMegaCps(VL53L0X_DEV Dev,
01209         FixPoint1616_t *pXTalkCompensationRateMegaCps);
01210     VL53L0X_Error VL53L0X_GetLimitCheckValue(VL53L0X_DEV Dev, uint16_t LimitCheckId,
01211         FixPoint1616_t *pLimitCheckValue);
01212     VL53L0X_Error VL53L0X_GetLimitCheckEnable(VL53L0X_DEV Dev, uint16_t LimitCheckId,
01213         uint8_t *pLimitCheckEnable);
01214     VL53L0X_Error VL53L0X_GetWrapAroundCheckEnable(VL53L0X_DEV Dev,
01215         uint8_t *pWrapAroundCheckEnable);
01216     VL53L0X_Error VL53L0X_GetMeasurementTimingBudgetMicroSeconds(VL53L0X_DEV Dev,
01217         uint32_t *pMeasurementTimingBudgetMicroSeconds);
01218     VL53L0X_Error VL53L0X_GetSequenceStepEnables(VL53L0X_DEV Dev,
01219         VL53L0X_SchedulerSequenceSteps_t *pSchedulerSequenceSteps);
01220     VL53L0X_Error sequence_step_enabled(VL53L0X_DEV Dev,
01221         VL53L0X_SequenceStepId SequenceStepId, uint8_t SequenceConfig,
01222         uint8_t *pSequenceStepEnabled);
01223     VL53L0X_Error VL53L0X_GetVcselPulsePeriod(VL53L0X_DEV Dev,
01224         VL53L0X_VcselPeriod VcselPeriodType, uint8_t *pVCSELPulsePeriodPCLK);
01225     VL53L0X_Error VL53L0X_GetDeviceInfo(VL53L0X_DEV Dev,
01226         VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
01227     VL53L0X_Error VL53L0X_StaticInit(VL53L0X_DEV Dev);
01228     VL53L0X_Error VL53L0X_GetMeasurementDataReady(VL53L0X_DEV Dev,
01229         uint8_t *pMeasurementDataReady);
01230     VL53L0X_Error VL53L0X_GetInterruptMaskStatus(VL53L0X_DEV Dev,
01231         uint32_t *pInterruptMaskStatus);
01232     VL53L0X_Error VL53L0X_ClearInterruptMask(VL53L0X_DEV Dev, uint32_t InterruptMask);
01233     VL53L0X_Error VL53L0X_PerformSingleRangingMeasurement(VL53L0X_DEV Dev,
01234         VL53L0X_RangingMeasurementData_t *pRangingMeasurementData);
01235     VL53L0X_Error VL53L0X_SetDeviceMode(VL53L0X_DEV Dev, VL53L0X_DeviceModes DeviceMode);
01236     VL53L0X_Error VL53L0X_PerformSingleMeasurement(VL53L0X_DEV Dev);
01237     VL53L0X_Error VL53L0X_StartMeasurement(VL53L0X_DEV Dev);
01238     VL53L0X_Error VL53L0X_CheckAndLoadInterruptSettings(VL53L0X_DEV Dev,
01239         uint8_t StartNotStopFlag);
01240     VL53L0X_Error VL53L0X_GetInterruptThresholds(VL53L0X_DEV Dev,
01241         VL53L0X_DeviceModes DeviceMode, FixPoint1616_t *pThresholdLow,
01242         FixPoint1616_t *pThresholdHigh);
01243     VL53L0X_Error VL53L0X_GetRangingMeasurementData(VL53L0X_DEV Dev,
01244         VL53L0X_RangingMeasurementData_t *pRangingMeasurementData);
01245     VL53L0X_Error VL53L0X_GetXTalkCompensationEnable(VL53L0X_DEV Dev,
01246         uint8_t *pXTalkCompensationEnable);
01247     VL53L0X_Error VL53L0X_WaitDeviceBooted(VL53L0X_DEV Dev);
01248     VL53L0X_Error VL53L0X_PerformRefCalibration(VL53L0X_DEV Dev, uint8_t *pVhvSettings,
01249         uint8_t *pPhaseCal);
01250     VL53L0X_Error VL53L0X_PerformRefSpadManagement(VL53L0X_DEV Dev,
01251         uint32_t *refSpadCount, uint8_t *isApertureSpads);
01252     VL53L0X_Error VL53L0X_SetDeviceAddress(VL53L0X_DEV Dev, uint8_t DeviceAddress);
01253     VL53L0X_Error VL53L0X_SetGpioConfig(VL53L0X_DEV Dev, uint8_t Pin,
01254         VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality,
01255         VL53L0X_InterruptPolarity Polarity);
01256     VL53L0X_Error VL53L0X_GetFractionEnable(VL53L0X_DEV Dev, uint8_t *pEnabled);
01257     VL53L0X_Error VL53L0X_SetSequenceStepEnable(VL53L0X_DEV Dev,
01258         VL53L0X_SequenceStepId SequenceStepId, uint8_t SequenceStepEnabled);
01259     VL53L0X_Error VL53L0X_SetMeasurementTimingBudgetMicroSeconds(VL53L0X_DEV Dev,
01260         uint32_t MeasurementTimingBudgetMicroSeconds);
01261     VL53L0X_Error VL53L0X_SetLimitCheckEnable(VL53L0X_DEV Dev, uint16_t LimitCheckId,
01262         uint8_t LimitCheckEnable);
01263     VL53L0X_Error VL53L0X_SetLimitCheckValue(VL53L0X_DEV Dev, uint16_t LimitCheckId,
01264         FixPoint1616_t LimitCheckValue);
01265     VL53L0X_Error VL53L0X_StopMeasurement(VL53L0X_DEV Dev);
01266     VL53L0X_Error VL53L0X_GetStopCompletedStatus(VL53L0X_DEV Dev,
01267         uint32_t *pStopStatus);
01268     VL53L0X_Error VL53L0X_SetVcselPulsePeriod(VL53L0X_DEV Dev,
01269         VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriod);
01270 
01271     /* api_core.h functions */
01272     VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV Dev, uint8_t option);
01273     VL53L0X_Error VL53L0X_device_read_strobe(VL53L0X_DEV Dev);
01274     VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev,
01275             uint32_t *pMeasurementTimingBudgetMicroSeconds);
01276     VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV Dev,
01277         VL53L0X_VcselPeriod VcselPeriodType, uint8_t *pVCSELPulsePeriodPCLK);
01278     uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
01279     uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
01280     uint32_t VL53L0X_calc_timeout_us(VL53L0X_DEV Dev,
01281             uint16_t timeout_period_mclks,
01282             uint8_t vcsel_period_pclks);
01283     uint32_t VL53L0X_calc_macro_period_ps(VL53L0X_DEV Dev, uint8_t vcsel_period_pclks);
01284     VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV Dev);
01285     VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV Dev,
01286             uint8_t *pTuningSettingBuffer);
01287     VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV Dev,
01288             uint8_t DeviceRangeStatus,
01289             FixPoint1616_t SignalRate,
01290             uint16_t EffectiveSpadRtnCount,
01291             VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
01292             uint8_t *pPalRangeStatus);
01293     VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV Dev,
01294         VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
01295         FixPoint1616_t *pSigmaEstimate,
01296         uint32_t *pDmax_mm);
01297     VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV Dev,
01298         VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
01299         FixPoint1616_t *ptotal_signal_rate_mcps);
01300     VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV Dev,
01301         VL53L0X_RangingMeasurementData_t *pRangingMeasurementData,
01302         FixPoint1616_t *ptotal_xtalk_rate_mcps);
01303     uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV Dev,
01304             uint32_t timeout_period_us,
01305             uint8_t vcsel_period_pclks);
01306     uint32_t VL53L0X_isqrt(uint32_t num);
01307     VL53L0X_Error VL53L0X_calc_dmax(
01308         VL53L0X_DEV Dev,
01309         FixPoint1616_t totalSignalRate_mcps,
01310         FixPoint1616_t totalCorrSignalRate_mcps,
01311         FixPoint1616_t pwMult,
01312         uint32_t sigmaEstimateP1,
01313         FixPoint1616_t sigmaEstimateP2,
01314         uint32_t peakVcselDuration_us,
01315         uint32_t *pdmax_mm);
01316     VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV Dev,
01317             uint32_t MeasurementTimingBudgetMicroSeconds);
01318     VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV Dev,
01319                     VL53L0X_SequenceStepId SequenceStepId,
01320                     uint32_t *pTimeOutMicroSecs);
01321     VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV Dev,
01322                         VL53L0X_SequenceStepId SequenceStepId,
01323                         uint32_t TimeOutMicroSecs);
01324     uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks);
01325     VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV Dev,
01326         VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriodPCLK);
01327     uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
01328 
01329     /* api_calibration.h functions */
01330     VL53L0X_Error VL53L0X_apply_offset_adjustment(VL53L0X_DEV Dev);
01331     VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV Dev,
01332             int32_t *pOffsetCalibrationDataMicroMeter);
01333     VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV Dev,
01334             int32_t OffsetCalibrationDataMicroMeter);
01335     VL53L0X_Error VL53L0X_perform_ref_spad_management(VL53L0X_DEV Dev,
01336                     uint32_t *refSpadCount,
01337                     uint8_t *isApertureSpads);
01338     VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV Dev,
01339         uint8_t *pVhvSettings, uint8_t *pPhaseCal, uint8_t get_data_enable);
01340     VL53L0X_Error VL53L0X_perform_vhv_calibration(VL53L0X_DEV Dev,
01341         uint8_t *pVhvSettings, const uint8_t get_data_enable,
01342         const uint8_t restore_config);
01343     VL53L0X_Error VL53L0X_perform_single_ref_calibration(VL53L0X_DEV Dev,
01344             uint8_t vhv_init_byte);
01345     VL53L0X_Error VL53L0X_ref_calibration_io(VL53L0X_DEV Dev, uint8_t read_not_write,
01346         uint8_t VhvSettings, uint8_t PhaseCal,
01347         uint8_t *pVhvSettings, uint8_t *pPhaseCal,
01348         const uint8_t vhv_enable, const uint8_t phase_enable);
01349     VL53L0X_Error VL53L0X_perform_phase_calibration(VL53L0X_DEV Dev,
01350         uint8_t *pPhaseCal, const uint8_t get_data_enable,
01351         const uint8_t restore_config);
01352     VL53L0X_Error enable_ref_spads(VL53L0X_DEV Dev,
01353                     uint8_t apertureSpads,
01354                     uint8_t goodSpadArray[],
01355                     uint8_t spadArray[],
01356                     uint32_t size,
01357                     uint32_t start,
01358                     uint32_t offset,
01359                     uint32_t spadCount,
01360                     uint32_t *lastSpad);
01361     void get_next_good_spad(uint8_t goodSpadArray[], uint32_t size,
01362                 uint32_t curr, int32_t *next);
01363     uint8_t is_aperture(uint32_t spadIndex);
01364     VL53L0X_Error enable_spad_bit(uint8_t spadArray[], uint32_t size,
01365         uint32_t spadIndex);
01366     VL53L0X_Error set_ref_spad_map(VL53L0X_DEV Dev, uint8_t *refSpadArray);
01367     VL53L0X_Error get_ref_spad_map(VL53L0X_DEV Dev, uint8_t *refSpadArray);
01368     VL53L0X_Error perform_ref_signal_measurement(VL53L0X_DEV Dev,
01369             uint16_t *refSignalRate);
01370     VL53L0X_Error VL53L0X_set_reference_spads(VL53L0X_DEV Dev,
01371                      uint32_t count, uint8_t isApertureSpads);
01372 
01373     /* api_strings.h functions */
01374     VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV Dev,
01375                     VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
01376     VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV Dev,
01377             uint8_t *Revision,
01378             VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
01379 
01380     /* deprecated Read function from Component class for backward compatibility*/
01381     //   virtual int ReadID();
01382     virtual int ReadID(uint8_t *id);
01383 
01384     /* Read function of the ID device */
01385     //   virtual int read_id();    
01386     virtual int read_id(uint8_t *id);
01387     
01388     VL53L0X_Error WaitMeasurementDataReady(VL53L0X_DEV Dev);
01389     VL53L0X_Error WaitStopCompleted(VL53L0X_DEV Dev);
01390 
01391     /* Write and read functions from I2C */
01392         
01393     VL53L0X_Error VL53L0X_WrByte(VL53L0X_DEV dev, uint8_t index, uint8_t data);
01394     VL53L0X_Error VL53L0X_WrWord(VL53L0X_DEV dev, uint8_t index, uint16_t data);
01395     VL53L0X_Error VL53L0X_WrDWord(VL53L0X_DEV dev, uint8_t index, uint32_t data);
01396     VL53L0X_Error VL53L0X_RdByte(VL53L0X_DEV dev, uint8_t index, uint8_t *data);
01397     VL53L0X_Error VL53L0X_RdWord(VL53L0X_DEV dev, uint8_t index, uint16_t *data);
01398     VL53L0X_Error VL53L0X_RdDWord(VL53L0X_DEV dev, uint8_t index, uint32_t *data);
01399     VL53L0X_Error VL53L0X_UpdateByte(VL53L0X_DEV dev, uint8_t index, uint8_t AndData, uint8_t OrData);
01400         
01401     VL53L0X_Error VL53L0X_WriteMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count);
01402     VL53L0X_Error VL53L0X_ReadMulti(VL53L0X_DEV Dev, uint8_t index, uint8_t *pdata, uint32_t count);
01403         
01404     VL53L0X_Error VL53L0X_I2CWrite(uint8_t dev, uint8_t index, uint8_t *data, uint16_t number_of_bytes);
01405     VL53L0X_Error VL53L0X_I2CRead(uint8_t dev, uint8_t index, uint8_t *data, uint16_t number_of_bytes);
01406         
01407     VL53L0X_Error VL53L0X_PollingDelay(VL53L0X_DEV Dev); /* usually best implemented as a real function */
01408         
01409     int IsPresent()
01410     {
01411        int status;
01412        uint8_t id=0;
01413             
01414        status=ReadID(&id);
01415        if(status)
01416           VL53L0X_ErrLog("Failed to read ID device. Device not present!\n\r");
01417        return status;
01418     }   
01419     int StopRangeMeasurement(OperatingMode operating_mode);
01420     int GetRangeMeas(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *Data); 
01421     int RangeSetLowThreshold(uint16_t threshold);
01422     int RangeSetHighThreshold(uint16_t threshold);
01423     int GetRangeError(VL53L0X_RangingMeasurementData_t *Data, VL53L0X_RangingMeasurementData_t RangeData);
01424     int RangeMeasPollSingleShot();
01425     int RangeMeasPollContinuousMode();  
01426     int RangeMeasIntContinuousMode(void (*fptr)(void));
01427 
01428 
01429     VL53L0X_DeviceInfo_t DeviceInfo;
01430         
01431     /* IO Device */
01432     DevI2C &dev_i2c;
01433     /* Digital out pin */
01434     DigitalOut *gpio0;
01435     /* GPIO expander */
01436     STMPE1600DigiOut *expgpio0;
01437     /* Measure detection IRQ */
01438     InterruptIn *gpio1Int;
01439     /* Device data */
01440     VL53L0X_Dev_t MyDevice;
01441     VL53L0X_DEV Device;  
01442 };
01443 
01444 
01445 #endif /* _VL53L0X_CLASS_H_ */
01446 
01447 
01448 
01449