Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
vl53l1_def.h
00001 /****************************************************************************** 00002 * Copyright (c) 2017, STMicroelectronics - All Rights Reserved 00003 00004 This file is part of VL53L1 Core and is dual licensed, 00005 either 'STMicroelectronics 00006 Proprietary license' 00007 or 'BSD 3-clause "New" or "Revised" License' , at your option. 00008 00009 ****************************************************************************** 00010 00011 'STMicroelectronics Proprietary license' 00012 00013 ******************************************************************************* 00014 00015 License terms: STMicroelectronics Proprietary in accordance with licensing 00016 terms at www.st.com/sla0081 00017 00018 STMicroelectronics confidential 00019 Reproduction and Communication of this document is strictly prohibited unless 00020 specifically authorized in writing by STMicroelectronics. 00021 00022 00023 ******************************************************************************* 00024 00025 Alternatively, VL53L1 Core may be distributed under the terms of 00026 'BSD 3-clause "New" or "Revised" License', in which case the following 00027 provisions apply instead of the ones mentioned above : 00028 00029 ******************************************************************************* 00030 00031 License terms: BSD 3-clause "New" or "Revised" License. 00032 00033 Redistribution and use in source and binary forms, with or without 00034 modification, are permitted provided that the following conditions are met: 00035 00036 1. Redistributions of source code must retain the above copyright notice, this 00037 list of conditions and the following disclaimer. 00038 00039 2. Redistributions in binary form must reproduce the above copyright notice, 00040 this list of conditions and the following disclaimer in the documentation 00041 and/or other materials provided with the distribution. 00042 00043 3. Neither the name of the copyright holder nor the names of its contributors 00044 may be used to endorse or promote products derived from this software 00045 without specific prior written permission. 00046 00047 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00048 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00049 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00050 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00051 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00052 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00053 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00054 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00055 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00056 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00057 00058 00059 ******************************************************************************* 00060 */ 00061 00062 /** 00063 * @file vl53l1_def.h 00064 * 00065 * @brief Type definitions for VL53L1 API. 00066 * 00067 */ 00068 00069 00070 #ifndef _VL53L1_DEF_H_ 00071 #define _VL53L1_DEF_H_ 00072 00073 #include "vl53l1_ll_def.h" 00074 00075 #ifdef __cplusplus 00076 extern "C" { 00077 #endif 00078 00079 /** @defgroup VL53L1_globaldefine_group VL53L1 Defines 00080 * @brief VL53L1 Defines 00081 * @{ 00082 */ 00083 00084 00085 /** VL53L1 IMPLEMENTATION major version */ 00086 #define VL53L1_IMPLEMENTATION_VER_MAJOR 6 00087 /** VL53L1 IMPLEMENTATION minor version */ 00088 #define VL53L1_IMPLEMENTATION_VER_MINOR 6 00089 /** VL53L1 IMPLEMENTATION sub version */ 00090 #define VL53L1_IMPLEMENTATION_VER_SUB 1 00091 /** VL53L1 IMPLEMENTATION sub version */ 00092 #define VL53L1_IMPLEMENTATION_VER_REVISION 2432 00093 00094 /**************************************** 00095 * PRIVATE define do not edit 00096 ****************************************/ 00097 00098 /** @brief Defines the parameters of the Get Version Functions 00099 */ 00100 typedef struct { 00101 uint32_t revision ; /*!< revision number */ 00102 uint8_t major ; /*!< major number */ 00103 uint8_t minor ; /*!< minor number */ 00104 uint8_t build ; /*!< build number */ 00105 } VL53L1_Version_t; 00106 00107 00108 #define VL53L1_DEVINFO_STRLEN 32 00109 00110 /** @brief Defines the parameters of the Get Device Info Functions 00111 */ 00112 typedef struct { 00113 char Name[VL53L1_DEVINFO_STRLEN]; 00114 /*!< Full Name of the Device e.g. VL53L1 cut1.1 */ 00115 char Type[VL53L1_DEVINFO_STRLEN]; 00116 /*!< Type of the Device e.g VL53L1 */ 00117 char ProductId[VL53L1_DEVINFO_STRLEN]; 00118 /*!< Product Identifier String 00119 * @warning Not yet implemented 00120 */ 00121 uint8_t ProductType; 00122 /*!< Product Type, VL53L1 = 0xCC, VL53L3 = 0xAA 00123 * Stands as module_type in the datasheet 00124 */ 00125 uint8_t ProductRevisionMajor; 00126 /*!< Product revision major */ 00127 uint8_t ProductRevisionMinor; 00128 /*!< Product revision minor */ 00129 } VL53L1_DeviceInfo_t; 00130 00131 00132 00133 /** @defgroup VL53L1_define_PresetModes_group Defines Preset modes 00134 * Defines all possible preset modes for the device 00135 * @{ 00136 */ 00137 typedef uint8_t VL53L1_PresetModes; 00138 00139 #define VL53L1_PRESETMODE_RANGING ((VL53L1_PresetModes) 1) 00140 #define VL53L1_PRESETMODE_MULTIZONES_SCANNING ((VL53L1_PresetModes) 2) 00141 #define VL53L1_PRESETMODE_AUTONOMOUS ((VL53L1_PresetModes) 3) 00142 #define VL53L1_PRESETMODE_LITE_RANGING ((VL53L1_PresetModes) 4) 00143 #define VL53L1_PRESETMODE_OLT ((VL53L1_PresetModes) 7) 00144 #define VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS ((VL53L1_PresetModes) 8) 00145 #define VL53L1_PRESETMODE_PROXY_RANGING_MODE ((VL53L1_PresetModes) 9) 00146 00147 /* ... Modes to be added depending on device */ 00148 /** @} VL53L1_define_PresetModes_group */ 00149 00150 00151 /** @defgroup VL53L1_define_DistanceModes_group Defines Distance modes 00152 * Defines all possible Distance modes for the device 00153 * @{ 00154 */ 00155 typedef uint8_t VL53L1_DistanceModes; 00156 00157 #define VL53L1_DISTANCEMODE_SHORT ((VL53L1_DistanceModes) 1) 00158 #define VL53L1_DISTANCEMODE_MEDIUM ((VL53L1_DistanceModes) 2) 00159 #define VL53L1_DISTANCEMODE_LONG ((VL53L1_DistanceModes) 3) 00160 /** @} VL53L1_define_DistanceModes_group */ 00161 00162 /** @defgroup VL53L1_define_OutputModes_group Defines Output modes 00163 * Defines all possible Output modes for the device 00164 * @{ 00165 */ 00166 typedef uint8_t VL53L1_OutputModes; 00167 00168 #define VL53L1_OUTPUTMODE_NEAREST ((VL53L1_OutputModes) 1) 00169 #define VL53L1_OUTPUTMODE_STRONGEST ((VL53L1_OutputModes) 2) 00170 00171 /** @} VL53L1_define_OutputModes_group */ 00172 00173 /** @defgroup VL53L1_define_XtalkCal_group Defines Xtalk Calibration modes 00174 * Defines all possible Offset Calibration modes for the device 00175 * @{ 00176 */ 00177 typedef uint8_t VL53L1_XtalkCalibrationModes; 00178 00179 #define VL53L1_XTALKCALIBRATIONMODE_NO_TARGET \ 00180 ((VL53L1_OffsetCalibrationModes) 0) 00181 /*!< To perform Xtalk calibration with no target below 80 cm */ 00182 #define VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET \ 00183 ((VL53L1_OffsetCalibrationModes) 1) 00184 /*!< To perform Xtalk calibration with one target */ 00185 #define VL53L1_XTALKCALIBRATIONMODE_FULL_ROI \ 00186 ((VL53L1_OffsetCalibrationModes) 2) 00187 /*!< To perform Xtalk calibration based on histogram with full ROI */ 00188 00189 /** @} VL53L1_define_XtalkCal_group */ 00190 00191 /** @defgroup VL53L1_define_OffsetCal_group Defines Offset Calibration modes 00192 * Defines all possible Offset Calibration modes for the device 00193 * @{ 00194 */ 00195 typedef uint8_t VL53L1_OffsetCalibrationModes; 00196 00197 #define VL53L1_OFFSETCALIBRATIONMODE_STANDARD \ 00198 ((VL53L1_OffsetCalibrationModes) 1) 00199 #define VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY \ 00200 ((VL53L1_OffsetCalibrationModes) 2) 00201 #define VL53L1_OFFSETCALIBRATIONMODE_MULTI_ZONE \ 00202 ((VL53L1_OffsetCalibrationModes) 3) 00203 00204 /** @} VL53L1_define_OffsetCal_group */ 00205 00206 /** @defgroup VL53L1_define_DeviceDmaxModes_group Defines Dmax source modes 00207 * Defines all possible sources for Dmax calibration for the device 00208 * @{ 00209 */ 00210 typedef uint8_t VL53L1_DeviceDmaxModes; 00211 00212 #define VL53L1_DMAXMODE_FMT_CAL_DATA ((VL53L1_DeviceDmaxModes) 1) 00213 #define VL53L1_DMAXMODE_CUSTCAL_DATA ((VL53L1_DeviceDmaxModes) 2) 00214 #define VL53L1_DMAXMODE_PER_ZONE_CAL_DATA ((VL53L1_DeviceDmaxModes) 3) 00215 00216 /** @} VL53L1_define_DeviceDmaxModes_group */ 00217 00218 /** @defgroup VL53L1_define_OffsetCorrectionModesBD_group 00219 * Device Offset Correction Mode 00220 * 00221 * @brief Defines all possible offset correction modes for the device 00222 * @{ 00223 */ 00224 typedef uint8_t VL53L1_OffsetCorrectionModes; 00225 00226 #define VL53L1_OFFSETCORRECTIONMODE_STANDARD ((VL53L1_OffsetCorrectionMode) 1) 00227 #define VL53L1_OFFSETCORRECTIONMODE_PERZONE ((VL53L1_OffsetCorrectionMode) 2) 00228 #define VL53L1_OFFSETCORRECTIONMODE_PERVCSEL ((VL53L1_OffsetCorrectionMode) 3) 00229 00230 /** @} VL53L1_define_OffsetCorrectionModesBD_group */ 00231 00232 /** @defgroup VL53L1_define_RoiStatus_group Defines Roi Status 00233 * Defines the read status mode 00234 * @{ 00235 */ 00236 typedef uint8_t VL53L1_RoiStatus; 00237 00238 #define VL53L1_ROISTATUS_NOT_VALID ((VL53L1_RoiStatus) 0) 00239 #define VL53L1_ROISTATUS_VALID_NOT_LAST ((VL53L1_RoiStatus) 1) 00240 #define VL53L1_ROISTATUS_VALID_LAST ((VL53L1_RoiStatus) 2) 00241 /** @} VL53L1_define_RoiStatus_group */ 00242 00243 00244 /** @defgroup VL53L1_CheckEnable_group Check Enable list 00245 * @brief Check Enable code 00246 * 00247 * Define used to specify the LimitCheckId. 00248 * Use @a VL53L1_GetLimitCheckInfo() to get the string. 00249 * @{ 00250 */ 00251 00252 #define VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE 0 00253 #define VL53L1_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE 1 00254 00255 #define VL53L1_CHECKENABLE_NUMBER_OF_CHECKS 2 00256 00257 /** @} end of VL53L1_CheckEnable_group */ 00258 00259 00260 /** @defgroup VL53L1_ThresholdMode_gropup Detection Functionality 00261 * @brief Defines the different functionalities for the detection feature 00262 * @{ 00263 */ 00264 typedef uint8_t VL53L1_ThresholdMode; 00265 00266 #define VL53L1_THRESHOLD_CROSSED_LOW \ 00267 ((VL53L1_ThresholdMode) 0) 00268 /*!< Trigger interrupt if value < thresh_low */ 00269 #define VL53L1_THRESHOLD_CROSSED_HIGH \ 00270 ((VL53L1_ThresholdMode) 1) 00271 /*!< Trigger interrupt if value > thresh_high */ 00272 #define VL53L1_THRESHOLD_OUT_OF_WINDOW \ 00273 ((VL53L1_ThresholdMode) 2) 00274 /*!< Trigger interrupt if value < thresh_low OR value > thresh_high */ 00275 #define VL53L1_THRESHOLD_IN_WINDOW \ 00276 ((VL53L1_ThresholdMode) 3) 00277 /*!< Trigger interrupt if value > thresh_low AND value < thresh_high */ 00278 00279 /** @} end of VL53L1_ThresholdMode_gropup */ 00280 00281 /** @brief Defines parameters for Distance detection Thresholds configuration 00282 */ 00283 typedef struct { 00284 VL53L1_ThresholdMode CrossMode; 00285 uint16_t High ; /*!< Distance threshold high limit in mm */ 00286 uint16_t Low ; /*!< Distance threshold low limit in mm */ 00287 } VL53L1_DistanceThreshold_t; 00288 00289 /** @brief Defines parameters for Signal rate detection Thresholds configuration 00290 */ 00291 typedef struct { 00292 VL53L1_ThresholdMode CrossMode; 00293 FixPoint1616_t High ; /*!< Signal rate threshold high limit */ 00294 FixPoint1616_t Low ; /*!< Signal rate threshold low limit */ 00295 } VL53L1_RateThreshold_t; 00296 00297 /** @defgroup VL53L1_DetectionMode_group Gpio Functionality 00298 * @brief Defines conditions leading to device's IT on GPIO 00299 * @{ 00300 */ 00301 typedef uint8_t VL53L1_DetectionMode; 00302 00303 #define VL53L1_DETECTION_NORMAL_RUN \ 00304 ((VL53L1_DetectionMode) 0) 00305 /*!< Trigger interrupt on new measurement regardless of threshold 00306 * just like after a VL53L1_SetPresetMode() call 00307 */ 00308 #define VL53L1_DETECTION_DISTANCE_ONLY \ 00309 ((VL53L1_DetectionMode) 1) 00310 /*!< Trigger interrupt if "threshold event" occurs on distance */ 00311 #define VL53L1_DETECTION_RATE_ONLY \ 00312 ((VL53L1_DetectionMode) 2) 00313 /*!< Trigger interrupt if "threshold event" occurs on signal rate */ 00314 #define VL53L1_DETECTION_DISTANCE_AND_RATE \ 00315 ((VL53L1_DetectionMode) 3) 00316 /*!< Trigger interrupt if "threshold event" occurs on distance AND rate 00317 */ 00318 #define VL53L1_DETECTION_DISTANCE_OR_RATE \ 00319 ((VL53L1_DetectionMode) 4) 00320 /*!< Trigger interrupt if "threshold event" occurs on distance OR rate 00321 */ 00322 00323 /** @} end of VL53L1_DetectionMode_group */ 00324 00325 /** @brief Defines parameters for User/object Detection configuration 00326 */ 00327 typedef struct { 00328 VL53L1_DetectionMode DetectionMode ; /*!< See #VL53L1_DetectionMode*/ 00329 uint8_t IntrNoTarget ; /*!< 1 to trigger IT in case of no target found */ 00330 VL53L1_DistanceThreshold_t Distance ; /*!< limits in mm */ 00331 VL53L1_RateThreshold_t Rate ;/*!< limits in FixPoint1616_t */ 00332 } VL53L1_DetectionConfig_t; 00333 00334 00335 /** @brief Defines all parameters for the device 00336 */ 00337 typedef struct { 00338 VL53L1_PresetModes PresetMode; 00339 /*!< Defines the operating mode to be used for the next measure */ 00340 VL53L1_OutputModes OutputMode; 00341 /*!< Defines the Output mode to be used for the next measure */ 00342 VL53L1_DistanceModes DistanceMode; 00343 /*!< Defines the operating mode to be used for the next measure */ 00344 uint32_t MeasurementTimingBudgetMicroSeconds; 00345 /*!< Defines the allowed total time for a single measurement */ 00346 uint8_t LimitChecksEnable[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; 00347 /*!< This Array store all the Limit Check enable for this device. */ 00348 uint8_t LimitChecksStatus[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; 00349 /*!< This Array stores all the Status of the check linked to last 00350 * measurement. 00351 */ 00352 FixPoint1616_t LimitChecksValue[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; 00353 /*!< This Array stores all the Limit Check value for this device */ 00354 FixPoint1616_t LimitChecksCurrent[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; 00355 /*!< This Array stores all the Limit Check current value from latest 00356 * ranging 00357 */ 00358 } VL53L1_DeviceParameters_t; 00359 00360 00361 /** @defgroup VL53L1_define_State_group Defines the current status of the device 00362 * Defines the current status of the device 00363 * @{ 00364 */ 00365 00366 typedef uint8_t VL53L1_State; 00367 00368 #define VL53L1_STATE_POWERDOWN ((VL53L1_State) 0) 00369 /*!< Device is in HW reset */ 00370 #define VL53L1_STATE_WAIT_STATICINIT ((VL53L1_State) 1) 00371 /*!< Device is initialized and wait for static initialization */ 00372 #define VL53L1_STATE_STANDBY ((VL53L1_State) 2) 00373 /*!< Device is in Low power Standby mode */ 00374 #define VL53L1_STATE_IDLE ((VL53L1_State) 3) 00375 /*!< Device has been initialized and ready to do measurements */ 00376 #define VL53L1_STATE_RUNNING ((VL53L1_State) 4) 00377 /*!< Device is performing measurement */ 00378 #define VL53L1_STATE_RESET ((VL53L1_State) 5) 00379 /*!< Soft reset has been run on Device */ 00380 #define VL53L1_STATE_UNKNOWN ((VL53L1_State) 98) 00381 /*!< Device is in unknown state and need to be rebooted */ 00382 #define VL53L1_STATE_ERROR ((VL53L1_State) 99) 00383 /*!< Device is in error state and need to be rebooted */ 00384 00385 /** @} VL53L1_define_State_group */ 00386 00387 /** @defgroup VL53L1_define_Smudge_Mode_group Defines smudge correction modes 00388 * Defines the smudge correction modes 00389 * @{ 00390 */ 00391 00392 typedef uint8_t VL53L1_SmudgeCorrectionModes; 00393 00394 #define VL53L1_SMUDGE_CORRECTION_NONE ((VL53L1_SmudgeCorrectionModes) 0) 00395 /*!< Smudge correction is applied continously accross the rangings */ 00396 #define VL53L1_SMUDGE_CORRECTION_CONTINUOUS ((VL53L1_SmudgeCorrectionModes) 1) 00397 /*!< Smudge correction is applied continously accross the rangings */ 00398 #define VL53L1_SMUDGE_CORRECTION_SINGLE ((VL53L1_SmudgeCorrectionModes) 2) 00399 /*!< Smudge correction is applied only once accross the rangings */ 00400 #define VL53L1_SMUDGE_CORRECTION_DEBUG ((VL53L1_SmudgeCorrectionModes) 3) 00401 /*!< Smudge detection is applied continously but Xtalk values are not 00402 * updated automatically within the driver 00403 */ 00404 00405 /** @} VL53L1_define_Smudge_Correction_Mode_group */ 00406 00407 00408 /** 00409 * @struct VL53L1_RangingMeasurementData_t 00410 * @brief Single Range measurement data. 00411 */ 00412 typedef struct { 00413 uint32_t TimeStamp; 00414 /*!< 32-bit time stamp. 00415 * @warning Not yet implemented 00416 */ 00417 00418 uint8_t StreamCount; 00419 /*!< 8-bit Stream Count. */ 00420 00421 uint8_t RangeQualityLevel; 00422 /*!< indicate a quality level in percentage from 0 to 100 00423 * @warning Not yet implemented 00424 */ 00425 00426 FixPoint1616_t SignalRateRtnMegaCps; 00427 /*!< Return signal rate (MCPS)\n these is a 16.16 fix point 00428 * value, which is effectively a measure of target 00429 * reflectance. 00430 */ 00431 00432 FixPoint1616_t AmbientRateRtnMegaCps; 00433 /*!< Return ambient rate (MCPS)\n these is a 16.16 fix point 00434 * value, which is effectively a measure of the ambien 00435 * t light. 00436 */ 00437 00438 uint16_t EffectiveSpadRtnCount; 00439 /*!< Return the effective SPAD count for the return signal. 00440 * To obtain Real value it should be divided by 256 00441 */ 00442 00443 FixPoint1616_t SigmaMilliMeter; 00444 /*!< Return the Sigma value in millimeter */ 00445 00446 int16_t RangeMilliMeter; 00447 /*!< range distance in millimeter. This should be between 00448 * RangeMinMilliMeter and RangeMaxMilliMeter 00449 */ 00450 00451 uint8_t RangeFractionalPart; 00452 /*!< Fractional part of range distance. Final value is a 00453 * RangeMilliMeter + RangeFractionalPart/256. 00454 * @warning Not yet implemented 00455 */ 00456 00457 uint8_t RangeStatus; 00458 /*!< Range Status for the current measurement. This is device 00459 * dependent. Value = 0 means value is valid. 00460 */ 00461 } VL53L1_RangingMeasurementData_t; 00462 00463 /** 00464 * @struct VL53L1_TargetRangeData_t 00465 * @brief One Range measurement data for each target. 00466 */ 00467 typedef struct { 00468 uint8_t RangeQualityLevel; 00469 /*!< indicate a quality level in percentage from 0 to 100 00470 * @warning Not yet implemented 00471 */ 00472 00473 int16_t RangeMaxMilliMeter; 00474 /*!< Tells what is the maximum detection distance of the object 00475 * in current setup and environment conditions (Filled when 00476 * applicable) 00477 */ 00478 00479 int16_t RangeMinMilliMeter; 00480 /*!< Tells what is the minimum detection distance of the object 00481 * in current setup and environment conditions (Filled when 00482 * applicable) 00483 */ 00484 00485 FixPoint1616_t SignalRateRtnMegaCps; 00486 /*!< Return signal rate (MCPS)\n these is a 16.16 fix point 00487 * value, which is effectively a measure of target 00488 * reflectance. 00489 */ 00490 00491 FixPoint1616_t AmbientRateRtnMegaCps; 00492 /*!< Return ambient rate (MCPS)\n these is a 16.16 fix point 00493 * value, which is effectively a measure of the ambien 00494 * t light. 00495 */ 00496 00497 FixPoint1616_t SigmaMilliMeter; 00498 /*!< Return the Sigma value in millimeter */ 00499 00500 int16_t RangeMilliMeter; 00501 /*!< range distance in millimeter. This should be between 00502 * RangeMinMilliMeter and RangeMaxMilliMeter 00503 */ 00504 00505 uint8_t RangeFractionalPart; 00506 /*!< Fractional part of range distance. Final value is a 00507 * RangeMilliMeter + RangeFractionalPart/256. 00508 * @warning Not yet implemented 00509 */ 00510 00511 uint8_t RangeStatus; 00512 /*!< Range Status for the current measurement. This is device 00513 * dependent. Value = 0 means value is valid. 00514 */ 00515 00516 uint8_t ExtendedRange; 00517 /*!< Extended range flag for the current measurement. 00518 * Value = 1 means timings A&B are combined to increase the 00519 * maximum distance range. 00520 */ 00521 } VL53L1_TargetRangeData_t; 00522 /** 00523 * @struct VL53L1_MultiRangingData_t 00524 * @brief Structure for storing the set of range results for a single ROI 00525 * 00526 */ 00527 typedef struct { 00528 uint32_t TimeStamp; 00529 /*!< 32-bit time stamp. 00530 * @warning Not yet implemented 00531 */ 00532 00533 uint8_t StreamCount; 00534 /*!< 8-bit Stream Count. */ 00535 00536 uint8_t RoiNumber; 00537 /*!< Denotes on which ROI the range data is related to. */ 00538 uint8_t NumberOfObjectsFound; 00539 /*!< Indicate the number of objects found in the current ROI. 00540 * This is used to know how many ranging data should be get. 00541 * NumberOfObjectsFound is in the range 0 to 00542 * VL53L1_MAX_RANGE_RESULTS. 00543 */ 00544 VL53L1_RoiStatus RoiStatus; 00545 /*!< Indicate if the data read is valid or not or if this is 00546 * the last valid data in the ROI. 00547 */ 00548 VL53L1_TargetRangeData_t RangeData[VL53L1_MAX_RANGE_RESULTS]; 00549 /*!< Range data each target distance */ 00550 uint8_t HasXtalkValueChanged; 00551 /*!< set to 1 if a new Xtalk value has been computed whilst 00552 * smudge correction mode enable by with 00553 * VL53L1_SmudgeCorrectionEnable() function is either 00554 * VL53L1_SMUDGE_CORRECTION_CONTINUOUS or 00555 * VL53L1_SMUDGE_CORRECTION_SINGLE. 00556 */ 00557 uint16_t EffectiveSpadRtnCount; 00558 /*!< Return the effective SPAD count for the return signal. 00559 * To obtain Real value it should be divided by 256 00560 */ 00561 int16_t DmaxMilliMeter; 00562 /*!< range Dmax distance in millimeter. 00563 */ 00564 VL53L1_DistanceModes RecommendedDistanceMode; 00565 /*!< suggestion for a better distance mode choice to improve 00566 * range accuracy. 00567 */ 00568 } VL53L1_MultiRangingData_t; 00569 00570 00571 /** @brief Defines User Zone(ROI) parameters 00572 * 00573 */ 00574 typedef struct { 00575 00576 uint8_t TopLeftX; /*!< Top Left x coordinate: 0-15 range */ 00577 uint8_t TopLeftY; /*!< Top Left y coordinate: 0-15 range */ 00578 uint8_t BotRightX; /*!< Bot Right x coordinate: 0-15 range */ 00579 uint8_t BotRightY; /*!< Bot Right y coordinate: 0-15 range */ 00580 00581 } VL53L1_UserRoi_t; 00582 00583 00584 /** @brief Defines ROI configuration parameters 00585 * 00586 * Support up a max of 16 zones, Each Zone has the same size 00587 * 00588 */ 00589 typedef struct { 00590 00591 uint8_t NumberOfRoi; /*!< Number of Rois defined*/ 00592 00593 VL53L1_UserRoi_t UserRois[VL53L1_MAX_USER_ZONES]; 00594 /*!< List of Rois */ 00595 00596 } VL53L1_RoiConfig_t; 00597 00598 /** 00599 * @struct VL53L1_CustomerNvmManaged_t 00600 * 00601 */ 00602 00603 typedef struct { 00604 uint8_t global_config__spad_enables_ref_0; 00605 uint8_t global_config__spad_enables_ref_1; 00606 uint8_t global_config__spad_enables_ref_2; 00607 uint8_t global_config__spad_enables_ref_3; 00608 uint8_t global_config__spad_enables_ref_4; 00609 uint8_t global_config__spad_enables_ref_5; 00610 uint8_t global_config__ref_en_start_select; 00611 uint8_t ref_spad_man__num_requested_ref_spads; 00612 uint8_t ref_spad_man__ref_location; 00613 uint32_t algo__crosstalk_compensation_plane_offset_kcps; 00614 int16_t algo__crosstalk_compensation_x_plane_gradient_kcps; 00615 int16_t algo__crosstalk_compensation_y_plane_gradient_kcps; 00616 uint16_t ref_spad_char__total_rate_target_mcps; 00617 int16_t algo__part_to_part_range_offset_mm; 00618 int16_t mm_config__inner_offset_mm; 00619 int16_t mm_config__outer_offset_mm; 00620 } VL53L1_CustomerNvmManaged_t; 00621 00622 /** 00623 * @struct VL53L1_CalibrationData_t 00624 * @brief Structure for storing the Calibration Data 00625 * 00626 */ 00627 00628 typedef struct { 00629 00630 uint32_t struct_version; 00631 VL53L1_CustomerNvmManaged_t customer; 00632 VL53L1_dmax_calibration_data_t fmt_dmax_cal; 00633 VL53L1_dmax_calibration_data_t cust_dmax_cal; 00634 VL53L1_additional_offset_cal_data_t add_off_cal_data; 00635 VL53L1_optical_centre_t optical_centre; 00636 VL53L1_xtalk_histogram_data_t xtalkhisto; 00637 VL53L1_gain_calibration_data_t gain_cal; 00638 VL53L1_cal_peak_rate_map_t cal_peak_rate_map; 00639 VL53L1_per_vcsel_period_offset_cal_data_t per_vcsel_cal_data; 00640 uint32_t algo__xtalk_cpo_HistoMerge_kcps[VL53L1_BIN_REC_SIZE]; 00641 } VL53L1_CalibrationData_t; 00642 00643 #define VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION 0x20 00644 /** VL53L1 additional Calibration Data struct version final struct version 00645 * is given by adding it to VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION 00646 */ 00647 00648 #define VL53L1_CALIBRATION_DATA_STRUCT_VERSION \ 00649 (VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION + \ 00650 VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION) 00651 /* VL53L1 Calibration Data struct version */ 00652 00653 /** 00654 * @struct VL53L1_AdditionalData_t 00655 * @brief Structure for storing the Additional Data 00656 * 00657 */ 00658 typedef VL53L1_additional_data_t VL53L1_AdditionalData_t; 00659 00660 /** 00661 * @struct VL53L1_ZoneCalibrationData_t 00662 * @brief Structure for storing the Zone Calibration Data 00663 * 00664 */ 00665 typedef VL53L1_zone_calibration_results_t VL53L1_ZoneCalibrationData_t; 00666 00667 /** @defgroup VL53L1_define_SequenceStepId_group Defines the SequenceStep 00668 * Defines the the sequence steps performed during ranging.. 00669 * @{ 00670 */ 00671 typedef uint8_t VL53L1_SequenceStepId; 00672 00673 #define VL53L1_SEQUENCESTEP_VHV ((VL53L1_SequenceStepId) 0) 00674 /*!<VHV. */ 00675 #define VL53L1_SEQUENCESTEP_PHASECAL ((VL53L1_SequenceStepId) 1) 00676 /*!<Phase Calibration. */ 00677 #define VL53L1_SEQUENCESTEP_REFPHASE ((VL53L1_SequenceStepId) 2) 00678 /*!<Reference Phase. */ 00679 #define VL53L1_SEQUENCESTEP_DSS1 ((VL53L1_SequenceStepId) 3) 00680 /*!<DSS1. */ 00681 #define VL53L1_SEQUENCESTEP_DSS2 ((VL53L1_SequenceStepId) 4) 00682 /*!<DSS2. */ 00683 #define VL53L1_SEQUENCESTEP_MM1 ((VL53L1_SequenceStepId) 5) 00684 /*!<Mode Mitigation 1. */ 00685 #define VL53L1_SEQUENCESTEP_MM2 ((VL53L1_SequenceStepId) 6) 00686 /*!<Mode Mitigation 2. */ 00687 #define VL53L1_SEQUENCESTEP_RANGE ((VL53L1_SequenceStepId) 7) 00688 /*!<Final Range step. */ 00689 00690 #define VL53L1_SEQUENCESTEP_NUMBER_OF_ITEMS 8 00691 /*!<Number of Sequence Step Managed by the API. */ 00692 00693 /** @} VL53L1_define_SequenceStepId_group */ 00694 00695 /** @defgroup VL53L1_define_RangeStatus_group Defines the Range Status 00696 * @{ 00697 */ 00698 #define VL53L1_RANGESTATUS_RANGE_VALID 0 00699 /*!<The Range is valid. */ 00700 #define VL53L1_RANGESTATUS_SIGMA_FAIL 1 00701 /*!<Sigma Fail. */ 00702 #define VL53L1_RANGESTATUS_SIGNAL_FAIL 2 00703 /*!<Signal fail. */ 00704 #define VL53L1_RANGESTATUS_RANGE_VALID_MIN_RANGE_CLIPPED 3 00705 /*!<Target is below minimum detection threshold. */ 00706 #define VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL 4 00707 /*!<Phase out of valid limits - different to a wrap exit. */ 00708 #define VL53L1_RANGESTATUS_HARDWARE_FAIL 5 00709 /*!<Hardware fail. */ 00710 #define VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL 6 00711 /*!<The Range is valid but the wraparound check has not been done. */ 00712 #define VL53L1_RANGESTATUS_WRAP_TARGET_FAIL 7 00713 /*!<Wrapped target - no matching phase in other VCSEL period timing. */ 00714 #define VL53L1_RANGESTATUS_PROCESSING_FAIL 8 00715 /*!<Internal algo underflow or overflow in lite ranging. */ 00716 #define VL53L1_RANGESTATUS_XTALK_SIGNAL_FAIL 9 00717 /*!<Specific to lite ranging. */ 00718 #define VL53L1_RANGESTATUS_SYNCRONISATION_INT 10 00719 /*!<1st interrupt when starting ranging in back to back mode. Ignore data. */ 00720 #define VL53L1_RANGESTATUS_RANGE_VALID_MERGED_PULSE 11 00721 /*!<All Range ok but object is result of multiple pulses merging together. 00722 * Used by RQL for merged pulse detection 00723 */ 00724 #define VL53L1_RANGESTATUS_TARGET_PRESENT_LACK_OF_SIGNAL 12 00725 /*!<Used by RQL as different to phase fail. */ 00726 #define VL53L1_RANGESTATUS_MIN_RANGE_FAIL 13 00727 /*!<User ROI input is not valid e.g. beyond SPAD Array.*/ 00728 #define VL53L1_RANGESTATUS_RANGE_INVALID 14 00729 /*!<lld returned valid range but negative value ! */ 00730 #define VL53L1_RANGESTATUS_NONE 255 00731 /*!<No Update. */ 00732 00733 /** @} VL53L1_define_RangeStatus_group */ 00734 00735 00736 /** @brief Contains the Internal data of the Bare Driver 00737 */ 00738 00739 typedef struct { 00740 VL53L1_LLDriverData_t LLData; 00741 /*!< Low Level Driver data structure */ 00742 00743 VL53L1_LLDriverResults_t llresults; 00744 /*!< Low Level Driver data structure */ 00745 00746 VL53L1_State PalState; /* Store the pal state */ 00747 VL53L1_DeviceParameters_t CurrentParameters; 00748 /*!< Current Device Parameter */ 00749 00750 } VL53L1_DevData_t; 00751 00752 00753 /* MACRO Definitions */ 00754 /** @defgroup VL53L1_define_GeneralMacro_group General Macro Defines 00755 * General Macro Defines 00756 * @{ 00757 */ 00758 00759 /* Defines */ 00760 #define VL53L1_SETPARAMETERFIELD(Dev, field, value) \ 00761 (VL53L1DevDataSet(Dev, CurrentParameters.field, value)) 00762 00763 #define VL53L1_GETPARAMETERFIELD(Dev, field, variable) \ 00764 (variable = VL53L1DevDataGet(Dev, CurrentParameters).field) 00765 00766 00767 #define VL53L1_SETARRAYPARAMETERFIELD(Dev, field, index, value) \ 00768 (VL53L1DevDataSet(Dev, CurrentParameters.field[index], value)) 00769 00770 #define VL53L1_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \ 00771 (variable = VL53L1DevDataGet(Dev, CurrentParameters).field[index]) 00772 00773 00774 #define VL53L1_SETDEVICESPECIFICPARAMETER(Dev, field, value) \ 00775 (VL53L1DevDataSet(Dev, DeviceSpecificParameters.field, value)) 00776 00777 #define VL53L1_GETDEVICESPECIFICPARAMETER(Dev, field) \ 00778 (VL53L1DevDataGet(Dev, DeviceSpecificParameters).field) 00779 00780 00781 #define VL53L1_FIXPOINT1616TOFIXPOINT44(Value) \ 00782 (uint16_t)((Value>>12)&0xFFFF) 00783 #define VL53L1_FIXPOINT44TOFIXPOINT1616(Value) \ 00784 (FixPoint1616_t)((uint32_t)Value<<12) 00785 00786 #define VL53L1_FIXPOINT1616TOFIXPOINT72(Value) \ 00787 (uint16_t)((Value>>14)&0xFFFF) 00788 #define VL53L1_FIXPOINT72TOFIXPOINT1616(Value) \ 00789 (FixPoint1616_t)((uint32_t)Value<<14) 00790 00791 #define VL53L1_FIXPOINT1616TOFIXPOINT97(Value) \ 00792 (uint16_t)((Value>>9)&0xFFFF) 00793 #define VL53L1_FIXPOINT97TOFIXPOINT1616(Value) \ 00794 (FixPoint1616_t)((uint32_t)Value<<9) 00795 00796 #define VL53L1_FIXPOINT1616TOFIXPOINT88(Value) \ 00797 (uint16_t)((Value>>8)&0xFFFF) 00798 #define VL53L1_FIXPOINT88TOFIXPOINT1616(Value) \ 00799 (FixPoint1616_t)((uint32_t)Value<<8) 00800 00801 #define VL53L1_FIXPOINT1616TOFIXPOINT412(Value) \ 00802 (uint16_t)((Value>>4)&0xFFFF) 00803 #define VL53L1_FIXPOINT412TOFIXPOINT1616(Value) \ 00804 (FixPoint1616_t)((uint32_t)Value<<4) 00805 00806 #define VL53L1_FIXPOINT1616TOFIXPOINT313(Value) \ 00807 (uint16_t)((Value>>3)&0xFFFF) 00808 #define VL53L1_FIXPOINT313TOFIXPOINT1616(Value) \ 00809 (FixPoint1616_t)((uint32_t)Value<<3) 00810 00811 #define VL53L1_FIXPOINT1616TOFIXPOINT08(Value) \ 00812 (uint8_t)((Value>>8)&0x00FF) 00813 #define VL53L1_FIXPOINT08TOFIXPOINT1616(Value) \ 00814 (FixPoint1616_t)((uint32_t)Value<<8) 00815 00816 #define VL53L1_FIXPOINT1616TOFIXPOINT53(Value) \ 00817 (uint8_t)((Value>>13)&0x00FF) 00818 #define VL53L1_FIXPOINT53TOFIXPOINT1616(Value) \ 00819 (FixPoint1616_t)((uint32_t)Value<<13) 00820 00821 #define VL53L1_FIXPOINT1616TOFIXPOINT102(Value) \ 00822 (uint16_t)((Value>>14)&0x0FFF) 00823 #define VL53L1_FIXPOINT102TOFIXPOINT1616(Value) \ 00824 (FixPoint1616_t)((uint32_t)Value<<14) 00825 00826 #define VL53L1_FIXPOINT1616TOFIXPOINT142(Value) \ 00827 (uint16_t)((Value>>14)&0xFFFF) 00828 #define VL53L1_FIXPOINT142TOFIXPOINT1616(Value) \ 00829 (FixPoint1616_t)((uint32_t)Value<<14) 00830 00831 #define VL53L1_FIXPOINT1616TOFIXPOINT160(Value) \ 00832 (uint16_t)((Value>>16)&0xFFFF) 00833 #define VL53L1_FIXPOINT160TOFIXPOINT1616(Value) \ 00834 (FixPoint1616_t)((uint32_t)Value<<16) 00835 00836 #define VL53L1_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \ 00837 (uint16_t)lsb) 00838 00839 #ifndef SUPPRESS_UNUSED_WARNING 00840 #define SUPPRESS_UNUSED_WARNING(x) ((void) (x)) 00841 #endif 00842 00843 /** @} VL53L1_define_GeneralMacro_group */ 00844 00845 /** @} VL53L1_globaldefine_group */ 00846 00847 00848 00849 #ifdef __cplusplus 00850 } 00851 #endif 00852 00853 00854 #endif /* _VL53L1_DEF_H_ */ 00855
Generated on Tue Jul 12 2022 20:07:14 by
 1.7.2