1 /******************************************************************************* 2 Copyright � 2016, STMicroelectronics International N.V. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions are met: 7 * Redistributions of source code must retain the above copyright 8 notice, this list of conditions and the following disclaimer. 9 * Redistributions in binary form must reproduce the above copyright 10 notice, this list of conditions and the following disclaimer in the 11 documentation and/or other materials provided with the distribution. 12 * Neither the name of STMicroelectronics nor the 13 names of its contributors may be used to endorse or promote products 14 derived from this software without specific prior written permission. 15 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 *****************************************************************************/ 28 29 #ifndef _VL53L0X_API_H_ 30 #define _VL53L0X_API_H_ 31 32 #include "vl53l0x_api_strings.h" 33 #include "vl53l0x_def.h" 34 #include "../vl53l0x_platform.h" 35 36 #ifdef __cplusplus 37 extern "C" 38 { 39 #endif 40 41 #ifdef _MSC_VER 42 #ifdef VL53L0X_API_EXPORTS 43 #define VL53L0X_API __declspec(dllexport) 44 #else 45 #define VL53L0X_API 46 #endif 47 #else 48 #define VL53L0X_API 49 #endif 50 51 /** @defgroup VL53L0X_cut11_group VL53L0X cut1.1 Function Definition 52 * @brief VL53L0X cut1.1 Function Definition 53 * @{ 54 */ 55 56 /** @defgroup VL53L0X_general_group VL53L0X General Functions 57 * @brief General functions and definitions 58 * @{ 59 */ 60 61 /** 62 * @brief Return the VL53L0X PAL Implementation Version 63 * 64 * @note This function doesn't access to the device 65 * 66 * @param pVersion Pointer to current PAL Implementation 67 * Version 68 * @return VL53L0X_ERROR_NONE Success 69 * @return "Other error code" See ::VL53L0X_Error 70 */ 71 VL53L0X_API VL53L0X_Error VL53L0X_GetVersion(VL53L0X_Version_t *pVersion); 72 73 /** 74 * @brief Return the PAL Specification Version used for the current 75 * implementation. 76 * 77 * @note This function doesn't access to the device 78 * 79 * @param pPalSpecVersion Pointer to current PAL Specification 80 * Version 81 * @return VL53L0X_ERROR_NONE Success 82 * @return "Other error code" See ::VL53L0X_Error 83 */ 84 VL53L0X_API VL53L0X_Error 85 VL53L0X_GetPalSpecVersion(VL53L0X_Version_t *pPalSpecVersion); 86 87 /** 88 * @brief Reads the Product Revision for a for given Device 89 * This function can be used to distinguish cut1.0 from cut1.1. 90 * 91 * @note This function Access to the device 92 * 93 * @param Dev Device Handle 94 * @param pProductRevisionMajor Pointer to Product Revision Major 95 * for a given Device 96 * @param pProductRevisionMinor Pointer to Product Revision Minor 97 * for a given Device 98 * @return VL53L0X_ERROR_NONE Success 99 * @return "Other error code" See ::VL53L0X_Error 100 */ 101 VL53L0X_API VL53L0X_Error 102 VL53L0X_GetProductRevision(VL53L0X_DEV Dev, uint8_t *pProductRevisionMajor, 103 uint8_t *pProductRevisionMinor); 104 105 /** 106 * @brief Reads the Device information for given Device 107 * 108 * @note This function Access to the device 109 * 110 * @param Dev Device Handle 111 * @param pVL53L0X_DeviceInfo Pointer to current device info for a given 112 * Device 113 * @return VL53L0X_ERROR_NONE Success 114 * @return "Other error code" See ::VL53L0X_Error 115 */ 116 VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceInfo( 117 VL53L0X_DEV Dev, VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo); 118 119 /** 120 * @brief Read current status of the error register for the selected device 121 * 122 * @note This function Access to the device 123 * 124 * @param Dev Device Handle 125 * @param pDeviceErrorStatus Pointer to current error code of the 126 * device 127 * @return VL53L0X_ERROR_NONE Success 128 * @return "Other error code" See ::VL53L0X_Error 129 */ 130 VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceErrorStatus( 131 VL53L0X_DEV Dev, VL53L0X_DeviceError *pDeviceErrorStatus); 132 133 /** 134 * @brief Human readable Range Status string for a given RangeStatus 135 * 136 * @note This function doesn't access to the device 137 * 138 * @param RangeStatus The RangeStatus code as stored on 139 * @a VL53L0X_RangingMeasurementData_t 140 * @param pRangeStatusString The returned RangeStatus string. 141 * @return VL53L0X_ERROR_NONE Success 142 * @return "Other error code" See ::VL53L0X_Error 143 */ 144 VL53L0X_API VL53L0X_Error 145 VL53L0X_GetRangeStatusString(uint8_t RangeStatus, char *pRangeStatusString); 146 147 /** 148 * @brief Human readable error string for a given Error Code 149 * 150 * @note This function doesn't access to the device 151 * 152 * @param ErrorCode The error code as stored on 153 * ::VL53L0X_DeviceError 154 * @param pDeviceErrorString The error string corresponding to the 155 * ErrorCode 156 * @return VL53L0X_ERROR_NONE Success 157 * @return "Other error code" See ::VL53L0X_Error 158 */ 159 VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceErrorString( 160 VL53L0X_DeviceError ErrorCode, char *pDeviceErrorString); 161 162 /** 163 * @brief Human readable error string for current PAL error status 164 * 165 * @note This function doesn't access to the device 166 * 167 * @param PalErrorCode The error code as stored on @a VL53L0X_Error 168 * @param pPalErrorString The error string corresponding to the 169 * PalErrorCode 170 * @return VL53L0X_ERROR_NONE Success 171 * @return "Other error code" See ::VL53L0X_Error 172 */ 173 VL53L0X_API VL53L0X_Error VL53L0X_GetPalErrorString( 174 VL53L0X_Error PalErrorCode, char *pPalErrorString); 175 176 /** 177 * @brief Human readable PAL State string 178 * 179 * @note This function doesn't access to the device 180 * 181 * @param PalStateCode The State code as stored on @a 182 * VL53L0X_State 183 * @param pPalStateString The State string corresponding to the 184 * PalStateCode 185 * @return VL53L0X_ERROR_NONE Success 186 * @return "Other error code" See ::VL53L0X_Error 187 */ 188 VL53L0X_API VL53L0X_Error VL53L0X_GetPalStateString( 189 VL53L0X_State PalStateCode, char *pPalStateString); 190 191 /** 192 * @brief Reads the internal state of the PAL for a given Device 193 * 194 * @note This function doesn't access to the device 195 * 196 * @param Dev Device Handle 197 * @param pPalState Pointer to current state of the PAL for a 198 * given Device 199 * @return VL53L0X_ERROR_NONE Success 200 * @return "Other error code" See ::VL53L0X_Error 201 */ 202 VL53L0X_API VL53L0X_Error VL53L0X_GetPalState(VL53L0X_DEV Dev, 203 VL53L0X_State *pPalState); 204 205 /** 206 * @brief Set the power mode for a given Device 207 * The power mode can be Standby or Idle. Different level of both Standby 208 * and Idle can exists. This function should not be used when device is in 209 * Ranging state. 210 * 211 * @note This function Access to the device 212 * 213 * @param Dev Device Handle 214 * @param PowerMode The value of the power mode to set. 215 * see ::VL53L0X_PowerModes 216 * Valid values are: 217 * VL53L0X_POWERMODE_STANDBY_LEVEL1, 218 * VL53L0X_POWERMODE_IDLE_LEVEL1 219 * @return VL53L0X_ERROR_NONE Success 220 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 221 * PowerMode is not in the supported list 222 * @return "Other error code" See ::VL53L0X_Error 223 */ 224 VL53L0X_API VL53L0X_Error 225 VL53L0X_SetPowerMode(VL53L0X_DEV Dev, VL53L0X_PowerModes PowerMode); 226 227 /** 228 * @brief Get the power mode for a given Device 229 * 230 * @note This function Access to the device 231 * 232 * @param Dev Device Handle 233 * @param pPowerMode Pointer to the current value of the power 234 * mode. see ::VL53L0X_PowerModes 235 * Valid values are: 236 * VL53L0X_POWERMODE_STANDBY_LEVEL1, 237 * VL53L0X_POWERMODE_IDLE_LEVEL1 238 * @return VL53L0X_ERROR_NONE Success 239 * @return "Other error code" See ::VL53L0X_Error 240 */ 241 VL53L0X_API VL53L0X_Error 242 VL53L0X_GetPowerMode(VL53L0X_DEV Dev, VL53L0X_PowerModes *pPowerMode); 243 244 /** 245 * Set or over-hide part to part calibration offset 246 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter() 247 * 248 * @note This function Access to the device 249 * 250 * @param Dev Device Handle 251 * @param OffsetCalibrationDataMicroMeter Offset (microns) 252 * @return VL53L0X_ERROR_NONE Success 253 * @return "Other error code" See ::VL53L0X_Error 254 */ 255 VL53L0X_API VL53L0X_Error VL53L0X_SetOffsetCalibrationDataMicroMeter( 256 VL53L0X_DEV Dev, int32_t OffsetCalibrationDataMicroMeter); 257 258 /** 259 * @brief Get part to part calibration offset 260 * 261 * @par Function Description 262 * Should only be used after a successful call to @a VL53L0X_DataInit to 263 * backup device NVM value 264 * 265 * @note This function Access to the device 266 * 267 * @param Dev Device Handle 268 * @param pOffsetCalibrationDataMicroMeter Return part to part 269 * calibration offset from device (microns) 270 * @return VL53L0X_ERROR_NONE Success 271 * @return "Other error code" See ::VL53L0X_Error 272 */ 273 VL53L0X_API VL53L0X_Error VL53L0X_GetOffsetCalibrationDataMicroMeter( 274 VL53L0X_DEV Dev, int32_t *pOffsetCalibrationDataMicroMeter); 275 276 /** 277 * Set the linearity corrective gain 278 * 279 * @note This function Access to the device 280 * 281 * @param Dev Device Handle 282 * @param LinearityCorrectiveGain Linearity corrective 283 * gain in x1000 284 * if value is 1000 then no modification is applied. 285 * @return VL53L0X_ERROR_NONE Success 286 * @return "Other error code" See ::VL53L0X_Error 287 */ 288 VL53L0X_API VL53L0X_Error VL53L0X_SetLinearityCorrectiveGain( 289 VL53L0X_DEV Dev, int16_t LinearityCorrectiveGain); 290 291 /** 292 * @brief Get the linearity corrective gain 293 * 294 * @par Function Description 295 * Should only be used after a successful call to @a VL53L0X_DataInit to 296 * backup device NVM value 297 * 298 * @note This function Access to the device 299 * 300 * @param Dev Device Handle 301 * @param pLinearityCorrectiveGain Pointer to the linearity 302 * corrective gain in x1000 303 * if value is 1000 then no modification is applied. 304 * @return VL53L0X_ERROR_NONE Success 305 * @return "Other error code" See ::VL53L0X_Error 306 */ 307 VL53L0X_API VL53L0X_Error VL53L0X_GetLinearityCorrectiveGain( 308 VL53L0X_DEV Dev, uint16_t *pLinearityCorrectiveGain); 309 310 /** 311 * Set Group parameter Hold state 312 * 313 * @par Function Description 314 * Set or remove device internal group parameter hold 315 * 316 * @note This function is not Implemented 317 * 318 * @param Dev Device Handle 319 * @param GroupParamHold Group parameter Hold state to be set (on/off) 320 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 321 */ 322 VL53L0X_API VL53L0X_Error VL53L0X_SetGroupParamHold(VL53L0X_DEV Dev, 323 uint8_t GroupParamHold); 324 325 /** 326 * @brief Get the maximal distance for actual setup 327 * @par Function Description 328 * Device must be initialized through @a VL53L0X_SetParameters() prior 329 * calling this function. 330 * 331 * Any range value more than the value returned is to be considered as 332 * "no target detected" or 333 * "no target in detectable range"\n 334 * @warning The maximal distance depends on the setup 335 * 336 * @note This function is not Implemented 337 * 338 * @param Dev Device Handle 339 * @param pUpperLimitMilliMeter The maximal range limit for actual setup 340 * (in millimeter) 341 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 342 */ 343 VL53L0X_API VL53L0X_Error VL53L0X_GetUpperLimitMilliMeter( 344 VL53L0X_DEV Dev, uint16_t *pUpperLimitMilliMeter); 345 346 347 /** 348 * @brief Get the Total Signal Rate 349 * @par Function Description 350 * This function will return the Total Signal Rate after a good ranging is 351 * done. 352 * 353 * @note This function access to Device 354 * 355 * @param Dev Device Handle 356 * @param pTotalSignalRate Total Signal Rate value in Mega count per 357 * second 358 * @return VL53L0X_ERROR_NONE Success 359 * @return "Other error code" See ::VL53L0X_Error 360 */ 361 VL53L0X_Error VL53L0X_GetTotalSignalRate(VL53L0X_DEV Dev, 362 FixPoint1616_t *pTotalSignalRate); 363 364 /** @} VL53L0X_general_group */ 365 366 /** @defgroup VL53L0X_init_group VL53L0X Init Functions 367 * @brief VL53L0X Init Functions 368 * @{ 369 */ 370 371 /** 372 * @brief Set new device address 373 * 374 * After completion the device will answer to the new address programmed. 375 * This function should be called when several devices are used in parallel 376 * before start programming the sensor. 377 * When a single device us used, there is no need to call this function. 378 * 379 * @note This function Access to the device 380 * 381 * @param Dev Device Handle 382 * @param DeviceAddress The new Device address 383 * @return VL53L0X_ERROR_NONE Success 384 * @return "Other error code" See ::VL53L0X_Error 385 */ 386 VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceAddress(VL53L0X_DEV Dev, 387 uint8_t DeviceAddress); 388 389 /** 390 * 391 * @brief One time device initialization 392 * 393 * To be called once and only once after device is brought out of reset 394 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted() 395 * 396 * @par Function Description 397 * When not used after a fresh device "power up" or reset, it may return 398 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data 399 * may have been fetched from device that can result in ranging offset 400 * error\n If application cannot execute device reset or need to run 401 * VL53L0X_DataInit multiple time then it must ensure proper offset 402 * calibration saving and restore on its own by using @a 403 * VL53L0X_GetOffsetCalibrationData() on first power up and then @a 404 * VL53L0X_SetOffsetCalibrationData() in all subsequent init This function 405 * will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to 406 * VL53L0X_STATE_WAIT_STATICINIT. 407 * 408 * @note This function Access to the device 409 * 410 * @param Dev Device Handle 411 * @return VL53L0X_ERROR_NONE Success 412 * @return "Other error code" See ::VL53L0X_Error 413 */ 414 VL53L0X_API VL53L0X_Error VL53L0X_DataInit(VL53L0X_DEV Dev); 415 416 /** 417 * @brief Set the tuning settings pointer 418 * 419 * This function is used to specify the Tuning settings buffer to be used 420 * for a given device. The buffer contains all the necessary data to permit 421 * the API to write tuning settings. 422 * This function permit to force the usage of either external or internal 423 * tuning settings. 424 * 425 * @note This function Access to the device 426 * 427 * @param Dev Device Handle 428 * @param pTuningSettingBuffer Pointer to tuning settings 429 * buffer. 430 * @param UseInternalTuningSettings Use internal tuning settings 431 * value. 432 * @return VL53L0X_ERROR_NONE Success 433 * @return "Other error code" See ::VL53L0X_Error 434 */ 435 VL53L0X_API VL53L0X_Error VL53L0X_SetTuningSettingBuffer( 436 VL53L0X_DEV Dev, uint8_t *pTuningSettingBuffer, 437 uint8_t UseInternalTuningSettings); 438 439 /** 440 * @brief Get the tuning settings pointer and the internal external switch 441 * value. 442 * 443 * This function is used to get the Tuning settings buffer pointer and the 444 * value. 445 * of the switch to select either external or internal tuning settings. 446 * 447 * @note This function Access to the device 448 * 449 * @param Dev Device Handle 450 * @param ppTuningSettingBuffer Pointer to tuning settings buffer. 451 * @param pUseInternalTuningSettings Pointer to store Use internal tuning 452 * settings value. 453 * @return VL53L0X_ERROR_NONE Success 454 * @return "Other error code" See ::VL53L0X_Error 455 */ 456 VL53L0X_API VL53L0X_Error VL53L0X_GetTuningSettingBuffer( 457 VL53L0X_DEV Dev, uint8_t **ppTuningSettingBuffer, 458 uint8_t *pUseInternalTuningSettings); 459 460 /** 461 * @brief Do basic device init (and eventually patch loading) 462 * This function will change the VL53L0X_State from 463 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE. 464 * In this stage all default setting will be applied. 465 * 466 * @note This function Access to the device 467 * 468 * @param Dev Device Handle 469 * @return VL53L0X_ERROR_NONE Success 470 * @return "Other error code" See ::VL53L0X_Error 471 */ 472 VL53L0X_API VL53L0X_Error VL53L0X_StaticInit(VL53L0X_DEV Dev); 473 474 /** 475 * @brief Wait for device booted after chip enable (hardware standby) 476 * This function can be run only when VL53L0X_State is 477 * VL53L0X_STATE_POWERDOWN. 478 * 479 * @note This function is not Implemented 480 * 481 * @param Dev Device Handle 482 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 483 * 484 */ 485 VL53L0X_API VL53L0X_Error VL53L0X_WaitDeviceBooted(VL53L0X_DEV Dev); 486 487 /** 488 * @brief Do an hard reset or soft reset (depending on implementation) of 489 * the device \nAfter call of this function, device must be in same state as 490 * right after a power-up sequence.This function will change the 491 * VL53L0X_State to VL53L0X_STATE_POWERDOWN. 492 * 493 * @note This function Access to the device 494 * 495 * @param Dev Device Handle 496 * @return VL53L0X_ERROR_NONE Success 497 * @return "Other error code" See ::VL53L0X_Error 498 */ 499 VL53L0X_API VL53L0X_Error VL53L0X_ResetDevice(VL53L0X_DEV Dev); 500 501 /** @} VL53L0X_init_group */ 502 503 /** @defgroup VL53L0X_parameters_group VL53L0X Parameters Functions 504 * @brief Functions used to prepare and setup the device 505 * @{ 506 */ 507 508 /** 509 * @brief Prepare device for operation 510 * @par Function Description 511 * Update device with provided parameters 512 * @li Then start ranging operation. 513 * 514 * @note This function Access to the device 515 * 516 * @param Dev Device Handle 517 * @param pDeviceParameters Pointer to store current device 518 * parameters. 519 * @return VL53L0X_ERROR_NONE Success 520 * @return "Other error code" See ::VL53L0X_Error 521 */ 522 VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceParameters( 523 VL53L0X_DEV Dev, const VL53L0X_DeviceParameters_t *pDeviceParameters); 524 525 /** 526 * @brief Retrieve current device parameters 527 * @par Function Description 528 * Get actual parameters of the device 529 * @li Then start ranging operation. 530 * 531 * @note This function Access to the device 532 * 533 * @param Dev Device Handle 534 * @param pDeviceParameters Pointer to store current device 535 * parameters. 536 * @return VL53L0X_ERROR_NONE Success 537 * @return "Other error code" See ::VL53L0X_Error 538 */ 539 VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceParameters( 540 VL53L0X_DEV Dev, VL53L0X_DeviceParameters_t *pDeviceParameters); 541 542 /** 543 * @brief Set a new device mode 544 * @par Function Description 545 * Set device to a new mode (ranging, histogram ...) 546 * 547 * @note This function doesn't Access to the device 548 * 549 * @param Dev Device Handle 550 * @param DeviceMode New device mode to apply 551 * Valid values are: 552 * VL53L0X_DEVICEMODE_SINGLE_RANGING 553 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING 554 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 555 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 556 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 557 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 558 * VL53L0X_HISTOGRAMMODE_BOTH 559 * 560 * 561 * @return VL53L0X_ERROR_NONE Success 562 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 563 * DeviceMode is not in the supported list 564 */ 565 VL53L0X_API VL53L0X_Error 566 VL53L0X_SetDeviceMode(VL53L0X_DEV Dev, VL53L0X_DeviceModes DeviceMode); 567 568 /** 569 * @brief Get current new device mode 570 * @par Function Description 571 * Get actual mode of the device(ranging, histogram ...) 572 * 573 * @note This function doesn't Access to the device 574 * 575 * @param Dev Device Handle 576 * @param pDeviceMode Pointer to current apply mode value 577 * Valid values are: 578 * VL53L0X_DEVICEMODE_SINGLE_RANGING 579 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING 580 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 581 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 582 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 583 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 584 * VL53L0X_HISTOGRAMMODE_BOTH 585 * 586 * @return VL53L0X_ERROR_NONE Success 587 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 588 * DeviceMode is not in the supported list 589 */ 590 VL53L0X_API VL53L0X_Error 591 VL53L0X_GetDeviceMode(VL53L0X_DEV Dev, VL53L0X_DeviceModes *pDeviceMode); 592 593 /** 594 * @brief Sets the resolution of range measurements. 595 * @par Function Description 596 * Set resolution of range measurements to either 0.25mm if 597 * fraction enabled or 1mm if not enabled. 598 * 599 * @note This function Accesses the device 600 * 601 * @param Dev Device Handle 602 * @param Enable Enable high resolution 603 * 604 * @return VL53L0X_ERROR_NONE Success 605 * @return "Other error code" See ::VL53L0X_Error 606 */ 607 VL53L0X_API VL53L0X_Error VL53L0X_SetRangeFractionEnable(VL53L0X_DEV Dev, 608 uint8_t Enable); 609 610 /** 611 * @brief Gets the fraction enable parameter indicating the resolution of 612 * range measurements. 613 * 614 * @par Function Description 615 * Gets the fraction enable state, which translates to the resolution of 616 * range measurements as follows :Enabled:=0.25mm resolution, 617 * Not Enabled:=1mm resolution. 618 * 619 * @note This function Accesses the device 620 * 621 * @param Dev Device Handle 622 * @param pEnable Output Parameter reporting the fraction enable 623 * state. 624 * 625 * @return VL53L0X_ERROR_NONE Success 626 * @return "Other error code" See ::VL53L0X_Error 627 */ 628 VL53L0X_API VL53L0X_Error VL53L0X_GetFractionEnable(VL53L0X_DEV Dev, 629 uint8_t * pEnable); 630 631 /** 632 * @brief Set a new Histogram mode 633 * @par Function Description 634 * Set device to a new Histogram mode 635 * 636 * @note This function doesn't Access to the device 637 * 638 * @param Dev Device Handle 639 * @param HistogramMode New device mode to apply 640 * Valid values are: 641 * VL53L0X_HISTOGRAMMODE_DISABLED 642 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 643 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 644 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 645 * VL53L0X_HISTOGRAMMODE_BOTH 646 * 647 * @return VL53L0X_ERROR_NONE Success 648 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 649 * HistogramMode is not in the supported list 650 * @return "Other error code" See ::VL53L0X_Error 651 */ 652 VL53L0X_API VL53L0X_Error VL53L0X_SetHistogramMode( 653 VL53L0X_DEV Dev, VL53L0X_HistogramModes HistogramMode); 654 655 /** 656 * @brief Get current new device mode 657 * @par Function Description 658 * Get current Histogram mode of a Device 659 * 660 * @note This function doesn't Access to the device 661 * 662 * @param Dev Device Handle 663 * @param pHistogramMode Pointer to current Histogram Mode value 664 * Valid values are: 665 * VL53L0X_HISTOGRAMMODE_DISABLED 666 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 667 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 668 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 669 * VL53L0X_HISTOGRAMMODE_BOTH 670 * @return VL53L0X_ERROR_NONE Success 671 * @return "Other error code" See ::VL53L0X_Error 672 */ 673 VL53L0X_API VL53L0X_Error VL53L0X_GetHistogramMode( 674 VL53L0X_DEV Dev, VL53L0X_HistogramModes *pHistogramMode); 675 676 /** 677 * @brief Set Ranging Timing Budget in microseconds 678 * 679 * @par Function Description 680 * Defines the maximum time allowed by the user to the device to run a 681 * full ranging sequence for the current mode (ranging, histogram, ASL ...) 682 * 683 * @note This function Access to the device 684 * 685 * @param Dev Device Handle 686 * @param MeasurementTimingBudgetMicroSeconds Max measurement time in 687 * microseconds. 688 * Valid values are: 689 * >= 17000 microsecs when wraparound 690 enabled 691 * >= 12000 microsecs when wraparound 692 disabled 693 * @return VL53L0X_ERROR_NONE Success 694 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if 695 MeasurementTimingBudgetMicroSeconds out of range 696 * @return "Other error code" See ::VL53L0X_Error 697 */ 698 VL53L0X_API VL53L0X_Error VL53L0X_SetMeasurementTimingBudgetMicroSeconds( 699 VL53L0X_DEV Dev, uint32_t MeasurementTimingBudgetMicroSeconds); 700 701 /** 702 * @brief Get Ranging Timing Budget in microseconds 703 * 704 * @par Function Description 705 * Returns the programmed the maximum time allowed by the user to the 706 * device to run a full ranging sequence for the current mode 707 * (ranging, histogram, ASL ...) 708 * 709 * @note This function Access to the device 710 * 711 * @param Dev Device Handle 712 * @param pMeasurementTimingBudgetMicroSeconds Max measurement time in 713 * microseconds. 714 * Valid values are: 715 * >= 17000 microsecs when wraparound 716 * enabled 717 * >= 12000 microsecs when wraparound 718 * disabled 719 * @return VL53L0X_ERROR_NONE Success 720 * @return "Other error code" See ::VL53L0X_Error 721 */ 722 VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementTimingBudgetMicroSeconds( 723 VL53L0X_DEV Dev, uint32_t *pMeasurementTimingBudgetMicroSeconds); 724 725 /** 726 * @brief Gets the VCSEL pulse period. 727 * 728 * @par Function Description 729 * This function retrieves the VCSEL pulse period for the given period type. 730 * 731 * @note This function Accesses the device 732 * 733 * @param Dev Device Handle 734 * @param VcselPeriodType VCSEL period identifier 735 * (pre-range|final). 736 * @param pVCSELPulsePeriod Pointer to VCSEL period value. 737 * @return VL53L0X_ERROR_NONE Success 738 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter 739 * not supported. 740 * @return "Other error code" See ::VL53L0X_Error 741 */ 742 VL53L0X_API VL53L0X_Error VL53L0X_GetVcselPulsePeriod( 743 VL53L0X_DEV Dev, VL53L0X_VcselPeriod VcselPeriodType, 744 uint8_t *pVCSELPulsePeriod); 745 746 /** 747 * @brief Sets the VCSEL pulse period. 748 * 749 * @par Function Description 750 * This function retrieves the VCSEL pulse period for the given period type. 751 * 752 * @note This function Accesses the device 753 * 754 * @param Dev Device Handle 755 * @param VcselPeriodType VCSEL period identifier (pre-range|final). 756 * @param VCSELPulsePeriod VCSEL period value 757 * @return VL53L0X_ERROR_NONE Success 758 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter 759 * not supported. 760 * @return "Other error code" See ::VL53L0X_Error 761 */ 762 VL53L0X_API VL53L0X_Error VL53L0X_SetVcselPulsePeriod( 763 VL53L0X_DEV Dev, VL53L0X_VcselPeriod VcselPeriodType, 764 uint8_t VCSELPulsePeriod); 765 766 /** 767 * @brief Sets the (on/off) state of a requested sequence step. 768 * 769 * @par Function Description 770 * This function enables/disables a requested sequence step. 771 * 772 * @note This function Accesses the device 773 * 774 * @param Dev Device Handle 775 * @param SequenceStepId Sequence step identifier. 776 * @param SequenceStepEnabled Demanded state {0=Off,1=On} 777 * is enabled. 778 * @return VL53L0X_ERROR_NONE Success 779 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not 780 * supported. 781 * @return "Other error code" See ::VL53L0X_Error 782 */ 783 VL53L0X_API VL53L0X_Error VL53L0X_SetSequenceStepEnable( 784 VL53L0X_DEV Dev, VL53L0X_SequenceStepId SequenceStepId, 785 uint8_t SequenceStepEnabled); 786 787 /** 788 * @brief Gets the (on/off) state of a requested sequence step. 789 * 790 * @par Function Description 791 * This function retrieves the state of a requested sequence step, i.e. 792 * on/off. 793 * 794 * @note This function Accesses the device 795 * 796 * @param Dev Device Handle 797 * @param SequenceStepId Sequence step identifier. 798 * @param pSequenceStepEnabled Out parameter reporting if the sequence 799 * step is enabled {0=Off,1=On}. 800 * @return VL53L0X_ERROR_NONE Success 801 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not 802 * supported. 803 * @return "Other error code" See ::VL53L0X_Error 804 */ 805 VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepEnable( 806 VL53L0X_DEV Dev, VL53L0X_SequenceStepId SequenceStepId, 807 uint8_t *pSequenceStepEnabled); 808 809 /** 810 * @brief Gets the (on/off) state of all sequence steps. 811 * 812 * @par Function Description 813 * This function retrieves the state of all sequence step in the scheduler. 814 * 815 * @note This function Accesses the device 816 * 817 * @param Dev Device Handle 818 * @param pSchedulerSequenceSteps Pointer to struct containing 819 * result. 820 * @return VL53L0X_ERROR_NONE Success 821 * @return "Other error code" See ::VL53L0X_Error 822 */ 823 VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepEnables( 824 VL53L0X_DEV Dev, 825 VL53L0X_SchedulerSequenceSteps_t *pSchedulerSequenceSteps); 826 827 /** 828 * @brief Sets the timeout of a requested sequence step. 829 * 830 * @par Function Description 831 * This function sets the timeout of a requested sequence step. 832 * 833 * @note This function Accesses the device 834 * 835 * @param Dev Device Handle 836 * @param SequenceStepId Sequence step identifier. 837 * @param TimeOutMilliSecs Demanded timeout 838 * @return VL53L0X_ERROR_NONE Success 839 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not 840 * supported. 841 * @return "Other error code" See ::VL53L0X_Error 842 */ 843 VL53L0X_API VL53L0X_Error VL53L0X_SetSequenceStepTimeout( 844 VL53L0X_DEV Dev, VL53L0X_SequenceStepId SequenceStepId, 845 FixPoint1616_t TimeOutMilliSecs); 846 847 /** 848 * @brief Gets the timeout of a requested sequence step. 849 * 850 * @par Function Description 851 * This function retrieves the timeout of a requested sequence step. 852 * 853 * @note This function Accesses the device 854 * 855 * @param Dev Device Handle 856 * @param SequenceStepId Sequence step identifier. 857 * @param pTimeOutMilliSecs Timeout value. 858 * @return VL53L0X_ERROR_NONE Success 859 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not 860 * supported. 861 * @return "Other error code" See ::VL53L0X_Error 862 */ 863 VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepTimeout( 864 VL53L0X_DEV Dev, VL53L0X_SequenceStepId SequenceStepId, 865 FixPoint1616_t *pTimeOutMilliSecs); 866 867 /** 868 * @brief Gets number of sequence steps managed by the API. 869 * 870 * @par Function Description 871 * This function retrieves the number of sequence steps currently managed 872 * by the API 873 * 874 * @note This function Accesses the device 875 * 876 * @param Dev Device Handle 877 * @param pNumberOfSequenceSteps Out parameter reporting the number 878 * of sequence steps. 879 * @return VL53L0X_ERROR_NONE Success 880 * @return "Other error code" See ::VL53L0X_Error 881 */ 882 VL53L0X_API VL53L0X_Error VL53L0X_GetNumberOfSequenceSteps( 883 VL53L0X_DEV Dev, uint8_t *pNumberOfSequenceSteps); 884 885 /** 886 * @brief Gets the name of a given sequence step. 887 * 888 * @par Function Description 889 * This function retrieves the name of sequence steps corresponding to 890 * SequenceStepId. 891 * 892 * @note This function doesn't Accesses the device 893 * 894 * @param SequenceStepId Sequence step identifier. 895 * @param pSequenceStepsString Pointer to Info string 896 * 897 * @return VL53L0X_ERROR_NONE Success 898 * @return "Other error code" See ::VL53L0X_Error 899 */ 900 VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepsInfo( 901 VL53L0X_SequenceStepId SequenceStepId, char *pSequenceStepsString); 902 903 /** 904 * Program continuous mode Inter-Measurement period in milliseconds 905 * 906 * @par Function Description 907 * When trying to set too short time return INVALID_PARAMS minimal value 908 * 909 * @note This function Access to the device 910 * 911 * @param Dev Device Handle 912 * @param InterMeasurementPeriodMilliSeconds Inter-Measurement Period in 913 * ms. 914 * @return VL53L0X_ERROR_NONE Success 915 * @return "Other error code" See ::VL53L0X_Error 916 */ 917 VL53L0X_API VL53L0X_Error VL53L0X_SetInterMeasurementPeriodMilliSeconds( 918 VL53L0X_DEV Dev, uint32_t InterMeasurementPeriodMilliSeconds); 919 920 /** 921 * Get continuous mode Inter-Measurement period in milliseconds 922 * 923 * @par Function Description 924 * When trying to set too short time return INVALID_PARAMS minimal value 925 * 926 * @note This function Access to the device 927 * 928 * @param Dev Device Handle 929 * @param pInterMeasurementPeriodMilliSeconds Pointer to programmed 930 * Inter-Measurement Period in milliseconds. 931 * @return VL53L0X_ERROR_NONE Success 932 * @return "Other error code" See ::VL53L0X_Error 933 */ 934 VL53L0X_API VL53L0X_Error VL53L0X_GetInterMeasurementPeriodMilliSeconds( 935 VL53L0X_DEV Dev, uint32_t *pInterMeasurementPeriodMilliSeconds); 936 937 /** 938 * @brief Enable/Disable Cross talk compensation feature 939 * 940 * @note This function is not Implemented. 941 * Enable/Disable Cross Talk by set to zero the Cross Talk value 942 * by using @a VL53L0X_SetXTalkCompensationRateMegaCps(). 943 * 944 * @param Dev Device Handle 945 * @param XTalkCompensationEnable Cross talk compensation 946 * to be set 0=disabled else = enabled 947 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 948 */ 949 VL53L0X_API VL53L0X_Error VL53L0X_SetXTalkCompensationEnable( 950 VL53L0X_DEV Dev, uint8_t XTalkCompensationEnable); 951 952 /** 953 * @brief Get Cross talk compensation rate 954 * 955 * @note This function is not Implemented. 956 * Enable/Disable Cross Talk by set to zero the Cross Talk value by 957 * using @a VL53L0X_SetXTalkCompensationRateMegaCps(). 958 * 959 * @param Dev Device Handle 960 * @param pXTalkCompensationEnable Pointer to the Cross talk 961 * compensation state 0=disabled or 1 = enabled 962 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 963 */ 964 VL53L0X_API VL53L0X_Error VL53L0X_GetXTalkCompensationEnable( 965 VL53L0X_DEV Dev, uint8_t *pXTalkCompensationEnable); 966 967 /** 968 * @brief Set Cross talk compensation rate 969 * 970 * @par Function Description 971 * Set Cross talk compensation rate. 972 * 973 * @note This function Access to the device 974 * 975 * @param Dev Device Handle 976 * @param XTalkCompensationRateMegaCps Compensation rate in 977 * Mega counts per second (16.16 fix point) see datasheet for details 978 * @return VL53L0X_ERROR_NONE Success 979 * @return "Other error code" See ::VL53L0X_Error 980 */ 981 VL53L0X_API VL53L0X_Error VL53L0X_SetXTalkCompensationRateMegaCps( 982 VL53L0X_DEV Dev, FixPoint1616_t XTalkCompensationRateMegaCps); 983 984 /** 985 * @brief Get Cross talk compensation rate 986 * 987 * @par Function Description 988 * Get Cross talk compensation rate. 989 * 990 * @note This function Access to the device 991 * 992 * @param Dev Device Handle 993 * @param pXTalkCompensationRateMegaCps Pointer to Compensation rate 994 in Mega counts per second (16.16 fix point) see datasheet for details 995 * @return VL53L0X_ERROR_NONE Success 996 * @return "Other error code" See ::VL53L0X_Error 997 */ 998 VL53L0X_API VL53L0X_Error VL53L0X_GetXTalkCompensationRateMegaCps( 999 VL53L0X_DEV Dev, FixPoint1616_t *pXTalkCompensationRateMegaCps); 1000 1001 /** 1002 * @brief Set Reference Calibration Parameters 1003 * 1004 * @par Function Description 1005 * Set Reference Calibration Parameters. 1006 * 1007 * @note This function Access to the device 1008 * 1009 * @param Dev Device Handle 1010 * @param VhvSettings Parameter for VHV 1011 * @param PhaseCal Parameter for PhaseCal 1012 * @return VL53L0X_ERROR_NONE Success 1013 * @return "Other error code" See ::VL53L0X_Error 1014 */ 1015 VL53L0X_API VL53L0X_Error VL53L0X_SetRefCalibration(VL53L0X_DEV Dev, 1016 uint8_t VhvSettings, 1017 uint8_t PhaseCal); 1018 1019 /** 1020 * @brief Get Reference Calibration Parameters 1021 * 1022 * @par Function Description 1023 * Get Reference Calibration Parameters. 1024 * 1025 * @note This function Access to the device 1026 * 1027 * @param Dev Device Handle 1028 * @param pVhvSettings Pointer to VHV parameter 1029 * @param pPhaseCal Pointer to PhaseCal Parameter 1030 * @return VL53L0X_ERROR_NONE Success 1031 * @return "Other error code" See ::VL53L0X_Error 1032 */ 1033 VL53L0X_API VL53L0X_Error VL53L0X_GetRefCalibration(VL53L0X_DEV Dev, 1034 uint8_t *pVhvSettings, 1035 uint8_t *pPhaseCal); 1036 1037 /** 1038 * @brief Get the number of the check limit managed by a given Device 1039 * 1040 * @par Function Description 1041 * This function give the number of the check limit managed by the Device 1042 * 1043 * @note This function doesn't Access to the device 1044 * 1045 * @param pNumberOfLimitCheck Pointer to the number of check 1046 * limit. 1047 * @return VL53L0X_ERROR_NONE Success 1048 * @return "Other error code" See ::VL53L0X_Error 1049 */ 1050 VL53L0X_API VL53L0X_Error 1051 VL53L0X_GetNumberOfLimitCheck(uint16_t *pNumberOfLimitCheck); 1052 1053 /** 1054 * @brief Return a description string for a given limit check number 1055 * 1056 * @par Function Description 1057 * This function returns a description string for a given limit check 1058 number. 1059 * The limit check is identified with the LimitCheckId. 1060 * 1061 * @note This function doesn't Access to the device 1062 * 1063 * @param Dev Device Handle 1064 * @param LimitCheckId Limit Check ID 1065 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1066 * @param pLimitCheckString Pointer to the 1067 description string of the given check limit. 1068 * @return VL53L0X_ERROR_NONE Success 1069 * @return VL53L0X_ERROR_INVALID_PARAMS This error is 1070 returned when LimitCheckId value is out of range. 1071 * @return "Other error code" See ::VL53L0X_Error 1072 */ 1073 VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckInfo( 1074 VL53L0X_DEV Dev, uint16_t LimitCheckId, char *pLimitCheckString); 1075 1076 /** 1077 * @brief Return a the Status of the specified check limit 1078 * 1079 * @par Function Description 1080 * This function returns the Status of the specified check limit. 1081 * The value indicate if the check is fail or not. 1082 * The limit check is identified with the LimitCheckId. 1083 * 1084 * @note This function doesn't Access to the device 1085 * 1086 * @param Dev Device Handle 1087 * @param LimitCheckId Limit Check ID 1088 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1089 * @param pLimitCheckStatus Pointer to the 1090 Limit Check Status of the given check limit. 1091 * LimitCheckStatus : 1092 * 0 the check is not fail 1093 * 1 the check if fail or not enabled 1094 * 1095 * @return VL53L0X_ERROR_NONE Success 1096 * @return VL53L0X_ERROR_INVALID_PARAMS This error is 1097 returned when LimitCheckId value is out of range. 1098 * @return "Other error code" See ::VL53L0X_Error 1099 */ 1100 VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckStatus( 1101 VL53L0X_DEV Dev, uint16_t LimitCheckId, uint8_t *pLimitCheckStatus); 1102 1103 /** 1104 * @brief Enable/Disable a specific limit check 1105 * 1106 * @par Function Description 1107 * This function Enable/Disable a specific limit check. 1108 * The limit check is identified with the LimitCheckId. 1109 * 1110 * @note This function doesn't Access to the device 1111 * 1112 * @param Dev Device Handle 1113 * @param LimitCheckId Limit Check ID 1114 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1115 * @param LimitCheckEnable if 1 the check limit 1116 * corresponding to LimitCheckId is Enabled 1117 * if 0 the check limit 1118 * corresponding to LimitCheckId is disabled 1119 * @return VL53L0X_ERROR_NONE Success 1120 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 1121 * when LimitCheckId value is out of range. 1122 * @return "Other error code" See ::VL53L0X_Error 1123 */ 1124 VL53L0X_API VL53L0X_Error VL53L0X_SetLimitCheckEnable( 1125 VL53L0X_DEV Dev, uint16_t LimitCheckId, uint8_t LimitCheckEnable); 1126 1127 /** 1128 * @brief Get specific limit check enable state 1129 * 1130 * @par Function Description 1131 * This function get the enable state of a specific limit check. 1132 * The limit check is identified with the LimitCheckId. 1133 * 1134 * @note This function Access to the device 1135 * 1136 * @param Dev Device Handle 1137 * @param LimitCheckId Limit Check ID 1138 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1139 * @param pLimitCheckEnable Pointer to the check limit enable 1140 * value. 1141 * if 1 the check limit 1142 * corresponding to LimitCheckId is Enabled 1143 * if 0 the check limit 1144 * corresponding to LimitCheckId is disabled 1145 * @return VL53L0X_ERROR_NONE Success 1146 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 1147 * when LimitCheckId value is out of range. 1148 * @return "Other error code" See ::VL53L0X_Error 1149 */ 1150 VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckEnable( 1151 VL53L0X_DEV Dev, uint16_t LimitCheckId, uint8_t *pLimitCheckEnable); 1152 1153 /** 1154 * @brief Set a specific limit check value 1155 * 1156 * @par Function Description 1157 * This function set a specific limit check value. 1158 * The limit check is identified with the LimitCheckId. 1159 * 1160 * @note This function Access to the device 1161 * 1162 * @param Dev Device Handle 1163 * @param LimitCheckId Limit Check ID 1164 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1165 * @param LimitCheckValue Limit check Value for a given 1166 * LimitCheckId 1167 * @return VL53L0X_ERROR_NONE Success 1168 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when 1169 * either LimitCheckId or LimitCheckValue value is out of range. 1170 * @return "Other error code" See ::VL53L0X_Error 1171 */ 1172 VL53L0X_API VL53L0X_Error VL53L0X_SetLimitCheckValue( 1173 VL53L0X_DEV Dev, uint16_t LimitCheckId, FixPoint1616_t LimitCheckValue); 1174 1175 /** 1176 * @brief Get a specific limit check value 1177 * 1178 * @par Function Description 1179 * This function get a specific limit check value from device then it 1180 * updates internal values and check enables. The limit check is identified 1181 * with the LimitCheckId. 1182 * 1183 * @note This function Access to the device 1184 * 1185 * @param Dev Device Handle 1186 * @param LimitCheckId Limit Check ID 1187 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1188 * @param pLimitCheckValue Pointer to Limit 1189 * check Value for a given LimitCheckId. 1190 * @return VL53L0X_ERROR_NONE Success 1191 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 1192 * when LimitCheckId value is out of range. 1193 * @return "Other error code" See ::VL53L0X_Error 1194 */ 1195 VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckValue( 1196 VL53L0X_DEV Dev, uint16_t LimitCheckId, FixPoint1616_t *pLimitCheckValue); 1197 1198 /** 1199 * @brief Get the current value of the signal used for the limit check 1200 * 1201 * @par Function Description 1202 * This function get a the current value of the signal used for the limit 1203 * check. To obtain the latest value you should run a ranging before. The 1204 * value reported is linked to the limit check identified with the 1205 * LimitCheckId. 1206 * 1207 * @note This function Access to the device 1208 * 1209 * @param Dev Device Handle 1210 * @param LimitCheckId Limit Check ID 1211 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 1212 * @param pLimitCheckCurrent Pointer to current Value for a 1213 * given LimitCheckId. 1214 * @return VL53L0X_ERROR_NONE Success 1215 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when 1216 * LimitCheckId value is out of range. 1217 * @return "Other error code" See ::VL53L0X_Error 1218 */ 1219 VL53L0X_API VL53L0X_Error 1220 VL53L0X_GetLimitCheckCurrent(VL53L0X_DEV Dev, uint16_t LimitCheckId, 1221 FixPoint1616_t *pLimitCheckCurrent); 1222 1223 /** 1224 * @brief Enable (or disable) Wrap around Check 1225 * 1226 * @note This function Access to the device 1227 * 1228 * @param Dev Device Handle 1229 * @param WrapAroundCheckEnable Wrap around Check to be set 1230 * 0=disabled, other = enabled 1231 * @return VL53L0X_ERROR_NONE Success 1232 * @return "Other error code" See ::VL53L0X_Error 1233 */ 1234 VL53L0X_API VL53L0X_Error VL53L0X_SetWrapAroundCheckEnable( 1235 VL53L0X_DEV Dev, uint8_t WrapAroundCheckEnable); 1236 1237 /** 1238 * @brief Get setup of Wrap around Check 1239 * 1240 * @par Function Description 1241 * This function get the wrapAround check enable parameters 1242 * 1243 * @note This function Access to the device 1244 * 1245 * @param Dev Device Handle 1246 * @param pWrapAroundCheckEnable Pointer to the Wrap around Check state 1247 * 0=disabled or 1 = enabled 1248 * @return VL53L0X_ERROR_NONE Success 1249 * @return "Other error code" See ::VL53L0X_Error 1250 */ 1251 VL53L0X_API VL53L0X_Error VL53L0X_GetWrapAroundCheckEnable( 1252 VL53L0X_DEV Dev, uint8_t *pWrapAroundCheckEnable); 1253 1254 /** 1255 * @brief Set Dmax Calibration Parameters for a given device 1256 * When one of the parameter is zero, this function will get parameter 1257 * from NVM. 1258 * @note This function doesn't Access to the device 1259 * 1260 * @param Dev Device Handle 1261 * @param RangeMilliMeter Calibration Distance 1262 * @param SignalRateRtnMegaCps Signal rate return read at CalDistance 1263 * @return VL53L0X_ERROR_NONE Success 1264 * @return "Other error code" See ::VL53L0X_Error 1265 */ 1266 VL53L0X_API VL53L0X_Error 1267 VL53L0X_SetDmaxCalParameters(VL53L0X_DEV Dev, uint16_t RangeMilliMeter, 1268 FixPoint1616_t SignalRateRtnMegaCps); 1269 1270 /** 1271 * @brief Get Dmax Calibration Parameters for a given device 1272 * 1273 * 1274 * @note This function Access to the device 1275 * 1276 * @param Dev Device Handle 1277 * @param pRangeMilliMeter Pointer to Calibration Distance 1278 * @param pSignalRateRtnMegaCps Pointer to Signal rate return 1279 * @return VL53L0X_ERROR_NONE Success 1280 * @return "Other error code" See ::VL53L0X_Error 1281 */ 1282 VL53L0X_API VL53L0X_Error 1283 VL53L0X_GetDmaxCalParameters(VL53L0X_DEV Dev, uint16_t *pRangeMilliMeter, 1284 FixPoint1616_t *pSignalRateRtnMegaCps); 1285 1286 /** @} VL53L0X_parameters_group */ 1287 1288 /** @defgroup VL53L0X_measurement_group VL53L0X Measurement Functions 1289 * @brief Functions used for the measurements 1290 * @{ 1291 */ 1292 1293 /** 1294 * @brief Single shot measurement. 1295 * 1296 * @par Function Description 1297 * Perform simple measurement sequence (Start measure, Wait measure to end, 1298 * and returns when measurement is done). 1299 * Once function returns, user can get valid data by calling 1300 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement 1301 * depending on defined measurement mode 1302 * User should Clear the interrupt in case this are enabled by using the 1303 * function VL53L0X_ClearInterruptMask(). 1304 * 1305 * @warning This function is a blocking function 1306 * 1307 * @note This function Access to the device 1308 * 1309 * @param Dev Device Handle 1310 * @return VL53L0X_ERROR_NONE Success 1311 * @return "Other error code" See ::VL53L0X_Error 1312 */ 1313 VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleMeasurement(VL53L0X_DEV Dev); 1314 1315 /** 1316 * @brief Perform Reference Calibration 1317 * 1318 * @details Perform a reference calibration of the Device. 1319 * This function should be run from time to time before doing 1320 * a ranging measurement. 1321 * This function will launch a special ranging measurement, so 1322 * if interrupt are enable an interrupt will be done. 1323 * This function will clear the interrupt generated automatically. 1324 * 1325 * @warning This function is a blocking function 1326 * 1327 * @note This function Access to the device 1328 * 1329 * @param Dev Device Handle 1330 * @param pVhvSettings Pointer to vhv settings parameter. 1331 * @param pPhaseCal Pointer to PhaseCal parameter. 1332 * @return VL53L0X_ERROR_NONE Success 1333 * @return "Other error code" See ::VL53L0X_Error 1334 */ 1335 VL53L0X_API VL53L0X_Error VL53L0X_PerformRefCalibration( 1336 VL53L0X_DEV Dev, uint8_t *pVhvSettings, uint8_t *pPhaseCal); 1337 1338 /** 1339 * @brief Perform XTalk Measurement 1340 * 1341 * @details Measures the current cross talk from glass in front 1342 * of the sensor. 1343 * This functions performs a histogram measurement and uses the results 1344 * to measure the crosstalk. For the function to be successful, there 1345 * must be no target in front of the sensor. 1346 * 1347 * @warning This function is a blocking function 1348 * 1349 * @warning This function is not supported when the final range 1350 * vcsel clock period is set below 10 PCLKS. 1351 * 1352 * @note This function Access to the device 1353 * 1354 * @param Dev Device Handle 1355 * @param TimeoutMs Histogram measurement duration. 1356 * @param pXtalkPerSpad Output parameter containing the crosstalk 1357 * measurement result, in MCPS/Spad. Format fixpoint 16:16. 1358 * @param pAmbientTooHigh Output parameter which indicate that 1359 * pXtalkPerSpad is not good if the Ambient is too high. 1360 * @return VL53L0X_ERROR_NONE Success 1361 * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported 1362 * for this operation. Must not be less than 10PCLKS. 1363 * @return "Other error code" See ::VL53L0X_Error 1364 */ 1365 VL53L0X_API VL53L0X_Error VL53L0X_PerformXTalkMeasurement( 1366 VL53L0X_DEV Dev, uint32_t TimeoutMs, FixPoint1616_t *pXtalkPerSpad, 1367 uint8_t *pAmbientTooHigh); 1368 1369 /** 1370 * @brief Perform XTalk Calibration 1371 * 1372 * @details Perform a XTalk calibration of the Device. 1373 * This function will launch a ranging measurement, if interrupts 1374 * are enabled an interrupt will be done. 1375 * This function will clear the interrupt generated automatically. 1376 * This function will program a new value for the XTalk compensation 1377 * and it will enable the cross talk before exit. 1378 * This function will disable the 1379 * VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD. 1380 * 1381 * @warning This function is a blocking function 1382 * 1383 * @note This function Access to the device 1384 * 1385 * @note This function change the device mode to 1386 * VL53L0X_DEVICEMODE_SINGLE_RANGING 1387 * 1388 * @param Dev Device Handle 1389 * @param XTalkCalDistance XTalkCalDistance value used for the XTalk 1390 * computation. 1391 * @param pXTalkCompensationRateMegaCps Pointer to new 1392 * XTalkCompensation value. 1393 * @return VL53L0X_ERROR_NONE Success 1394 * @return "Other error code" See ::VL53L0X_Error 1395 */ 1396 VL53L0X_API VL53L0X_Error VL53L0X_PerformXTalkCalibration( 1397 VL53L0X_DEV Dev, FixPoint1616_t XTalkCalDistance, 1398 FixPoint1616_t *pXTalkCompensationRateMegaCps); 1399 1400 /** 1401 * @brief Perform Offset Calibration 1402 * 1403 * @details Perform a Offset calibration of the Device. 1404 * This function will launch a ranging measurement, if interrupts are 1405 * enabled an interrupt will be done. 1406 * This function will clear the interrupt generated automatically. 1407 * This function will program a new value for the Offset calibration value 1408 * This function will disable the 1409 * VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD. 1410 * 1411 * @warning This function is a blocking function 1412 * 1413 * @note This function Access to the device 1414 * 1415 * @note This function does not change the device mode. 1416 * 1417 * @param Dev Device Handle 1418 * @param CalDistanceMilliMeter Calibration distance value used for 1419 * the offset compensation. 1420 * @param pOffsetMicroMeter Pointer to new Offset value computed by the 1421 * function. 1422 * 1423 * @return VL53L0X_ERROR_NONE Success 1424 * @return "Other error code" See ::VL53L0X_Error 1425 */ 1426 VL53L0X_API VL53L0X_Error VL53L0X_PerformOffsetCalibration( 1427 VL53L0X_DEV Dev, FixPoint1616_t CalDistanceMilliMeter, 1428 int32_t *pOffsetMicroMeter); 1429 1430 /** 1431 * @brief Start device measurement 1432 * 1433 * @details Started measurement will depend on device parameters set through 1434 * @a VL53L0X_SetParameters() 1435 * This is a non-blocking function. 1436 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to 1437 * VL53L0X_STATE_RUNNING. 1438 * 1439 * @note This function Access to the device 1440 * 1441 1442 * @param Dev Device Handle 1443 * @return VL53L0X_ERROR_NONE Success 1444 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 1445 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the 1446 supported 1447 * list: 1448 * Supported mode are: 1449 * VL53L0X_DEVICEMODE_SINGLE_RANGING, 1450 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING, 1451 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 1452 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement 1453 * @return "Other error code" See ::VL53L0X_Error 1454 */ 1455 VL53L0X_API VL53L0X_Error VL53L0X_StartMeasurement(VL53L0X_DEV Dev); 1456 1457 /** 1458 * @brief Stop device measurement 1459 * 1460 * @details Will set the device in standby mode at end of current 1461 * measurement\n Not necessary in single mode as device shall return 1462 * automatically in standby mode at end of measurement. This function will 1463 * change the VL53L0X_State from VL53L0X_STATE_RUNNING to 1464 * VL53L0X_STATE_IDLE. 1465 * 1466 * @note This function Access to the device 1467 * 1468 * @param Dev Device Handle 1469 * @return VL53L0X_ERROR_NONE Success 1470 * @return "Other error code" See ::VL53L0X_Error 1471 */ 1472 VL53L0X_API VL53L0X_Error VL53L0X_StopMeasurement(VL53L0X_DEV Dev); 1473 1474 /** 1475 * @brief Return Measurement Data Ready 1476 * 1477 * @par Function Description 1478 * This function indicate that a measurement data is ready. 1479 * This function check if interrupt mode is used then check is done 1480 * accordingly. If perform function clear the interrupt, this function will 1481 * not work, like in case of @a VL53L0X_PerformSingleRangingMeasurement(). 1482 * The previous function is blocking function, 1483 * VL53L0X_GetMeasurementDataReady is used for non-blocking capture. 1484 * 1485 * @note This function Access to the device 1486 * 1487 * @param Dev Device Handle 1488 * @param pMeasurementDataReady Pointer to Measurement Data Ready. 1489 * 0=data not ready, 1 = data ready 1490 * @return VL53L0X_ERROR_NONE Success 1491 * @return "Other error code" See ::VL53L0X_Error 1492 */ 1493 VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementDataReady( 1494 VL53L0X_DEV Dev, uint8_t *pMeasurementDataReady); 1495 1496 /** 1497 * @brief Wait for device ready for a new measurement command. 1498 * Blocking function. 1499 * 1500 * @note This function is not Implemented 1501 * 1502 * @param Dev Device Handle 1503 * @param MaxLoop Max Number of polling loop (timeout). 1504 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 1505 */ 1506 VL53L0X_API VL53L0X_Error 1507 VL53L0X_WaitDeviceReadyForNewMeasurement(VL53L0X_DEV Dev, uint32_t MaxLoop); 1508 1509 /** 1510 * @brief Retrieve the Reference Signal after a measurements 1511 * 1512 * @par Function Description 1513 * Get Reference Signal from last successful Ranging measurement 1514 * This function return a valid value after that you call the 1515 * @a VL53L0X_GetRangingMeasurementData(). 1516 * 1517 * @note This function Access to the device 1518 * 1519 * @param Dev Device Handle 1520 * @param pMeasurementRefSignal Pointer to the Ref Signal to fill up. 1521 * @return VL53L0X_ERROR_NONE Success 1522 * @return "Other error code" See ::VL53L0X_Error 1523 */ 1524 VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementRefSignal( 1525 VL53L0X_DEV Dev, FixPoint1616_t *pMeasurementRefSignal); 1526 1527 /** 1528 * @brief Retrieve the measurements from device for a given setup 1529 * 1530 * @par Function Description 1531 * Get data from last successful Ranging measurement 1532 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones() 1533 * before get data. 1534 * PAL will fill a NumberOfROIZones times the corresponding data 1535 * structure used in the measurement function. 1536 * 1537 * @note This function Access to the device 1538 * 1539 * @param Dev Device Handle 1540 * @param pRangingMeasurementData Pointer to the data structure to fill 1541 * up. 1542 * @return VL53L0X_ERROR_NONE Success 1543 * @return "Other error code" See ::VL53L0X_Error 1544 */ 1545 VL53L0X_API VL53L0X_Error VL53L0X_GetRangingMeasurementData( 1546 VL53L0X_DEV Dev, 1547 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData); 1548 1549 /** 1550 * @brief Retrieve the measurements from device for a given setup 1551 * 1552 * @par Function Description 1553 * Get data from last successful Histogram measurement 1554 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones() 1555 * before get data. 1556 * PAL will fill a NumberOfROIZones times the corresponding data structure 1557 * used in the measurement function. 1558 * 1559 * @note This function is not Implemented 1560 * 1561 * @param Dev Device Handle 1562 * @param pHistogramMeasurementData Pointer to the histogram data 1563 * structure. 1564 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 1565 */ 1566 VL53L0X_API VL53L0X_Error VL53L0X_GetHistogramMeasurementData( 1567 VL53L0X_DEV Dev, 1568 VL53L0X_HistogramMeasurementData_t *pHistogramMeasurementData); 1569 1570 /** 1571 * @brief Performs a single ranging measurement and retrieve the ranging 1572 * measurement data 1573 * 1574 * @par Function Description 1575 * This function will change the device mode to 1576 * VL53L0X_DEVICEMODE_SINGLE_RANGING with @a VL53L0X_SetDeviceMode(), It 1577 * performs measurement with @a VL53L0X_PerformSingleMeasurement() It get 1578 * data from last successful Ranging measurement with 1579 * @a VL53L0X_GetRangingMeasurementData. 1580 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask(). 1581 * 1582 * @note This function Access to the device 1583 * 1584 * @note This function change the device mode to 1585 * VL53L0X_DEVICEMODE_SINGLE_RANGING 1586 * 1587 * @param Dev Device Handle 1588 * @param pRangingMeasurementData Pointer to the data structure to fill 1589 * up. 1590 * @return VL53L0X_ERROR_NONE Success 1591 * @return "Other error code" See ::VL53L0X_Error 1592 */ 1593 VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleRangingMeasurement( 1594 VL53L0X_DEV Dev, 1595 VL53L0X_RangingMeasurementData_t *pRangingMeasurementData); 1596 1597 /** 1598 * @brief Performs a single histogram measurement and retrieve the histogram 1599 * measurement data 1600 * Is equivalent to VL53L0X_PerformSingleMeasurement + 1601 * VL53L0X_GetHistogramMeasurementData 1602 * 1603 * @par Function Description 1604 * Get data from last successful Ranging measurement. 1605 * This function will clear the interrupt in case of these are enabled. 1606 * 1607 * @note This function is not Implemented 1608 * 1609 * @param Dev Device Handle 1610 * @param pHistogramMeasurementData Pointer to the data structure to fill 1611 * up. 1612 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 1613 */ 1614 VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleHistogramMeasurement( 1615 VL53L0X_DEV Dev, 1616 VL53L0X_HistogramMeasurementData_t *pHistogramMeasurementData); 1617 1618 /** 1619 * @brief Set the number of ROI Zones to be used for a specific Device 1620 * 1621 * @par Function Description 1622 * Set the number of ROI Zones to be used for a specific Device. 1623 * The programmed value should be less than the max number of ROI Zones 1624 * given with @a VL53L0X_GetMaxNumberOfROIZones(). This version of API 1625 * manage only one zone. 1626 * 1627 * @param Dev Device Handle 1628 * @param NumberOfROIZones Number of ROI Zones to be used for 1629 * a specific Device. 1630 * @return VL53L0X_ERROR_NONE Success 1631 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if 1632 * NumberOfROIZones != 1 1633 */ 1634 VL53L0X_API VL53L0X_Error 1635 VL53L0X_SetNumberOfROIZones(VL53L0X_DEV Dev, uint8_t NumberOfROIZones); 1636 1637 /** 1638 * @brief Get the number of ROI Zones managed by the Device 1639 * 1640 * @par Function Description 1641 * Get number of ROI Zones managed by the Device 1642 * USER should take care about @a VL53L0X_GetNumberOfROIZones() 1643 * before get data after a perform measurement. 1644 * PAL will fill a NumberOfROIZones times the corresponding data 1645 * structure used in the measurement function. 1646 * 1647 * @note This function doesn't Access to the device 1648 * 1649 * @param Dev Device Handle 1650 * @param pNumberOfROIZones Pointer to the Number of ROI Zones value. 1651 * @return VL53L0X_ERROR_NONE Success 1652 */ 1653 VL53L0X_API VL53L0X_Error 1654 VL53L0X_GetNumberOfROIZones(VL53L0X_DEV Dev, uint8_t *pNumberOfROIZones); 1655 1656 /** 1657 * @brief Get the Maximum number of ROI Zones managed by the Device 1658 * 1659 * @par Function Description 1660 * Get Maximum number of ROI Zones managed by the Device. 1661 * 1662 * @note This function doesn't Access to the device 1663 * 1664 * @param Dev Device Handle 1665 * @param pMaxNumberOfROIZones Pointer to the Maximum Number 1666 * of ROI Zones value. 1667 * @return VL53L0X_ERROR_NONE Success 1668 */ 1669 VL53L0X_API VL53L0X_Error VL53L0X_GetMaxNumberOfROIZones( 1670 VL53L0X_DEV Dev, uint8_t *pMaxNumberOfROIZones); 1671 1672 /** @} VL53L0X_measurement_group */ 1673 1674 /** @defgroup VL53L0X_interrupt_group VL53L0X Interrupt Functions 1675 * @brief Functions used for interrupt managements 1676 * @{ 1677 */ 1678 1679 /** 1680 * @brief Set the configuration of GPIO pin for a given device 1681 * 1682 * @note This function Access to the device 1683 * 1684 * @param Dev Device Handle 1685 * @param Pin ID of the GPIO Pin 1686 * @param Functionality Select Pin functionality. 1687 * Refer to ::VL53L0X_GpioFunctionality 1688 * @param DeviceMode Device Mode associated to the Gpio. 1689 * @param Polarity Set interrupt polarity. Active high 1690 * or active low see ::VL53L0X_InterruptPolarity 1691 * @return VL53L0X_ERROR_NONE Success 1692 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is 1693 accepted. 1694 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error 1695 occurs 1696 * when Functionality programmed is not in the supported list: 1697 * Supported value are: 1698 * VL53L0X_GPIOFUNCTIONALITY_OFF, 1699 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW, 1700 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH, 1701 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT, 1702 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY 1703 * @return "Other error code" See ::VL53L0X_Error 1704 */ 1705 VL53L0X_API VL53L0X_Error VL53L0X_SetGpioConfig( 1706 VL53L0X_DEV Dev, uint8_t Pin, VL53L0X_DeviceModes DeviceMode, 1707 VL53L0X_GpioFunctionality Functionality, 1708 VL53L0X_InterruptPolarity Polarity); 1709 1710 /** 1711 * @brief Get current configuration for GPIO pin for a given device 1712 * 1713 * @note This function Access to the device 1714 * 1715 * @param Dev Device Handle 1716 * @param Pin ID of the GPIO Pin 1717 * @param pDeviceMode Pointer to Device Mode associated to the 1718 * Gpio. 1719 * @param pFunctionality Pointer to Pin functionality. 1720 * Refer to ::VL53L0X_GpioFunctionality 1721 * @param pPolarity Pointer to interrupt polarity. 1722 * Active high or active low see ::VL53L0X_InterruptPolarity 1723 * @return VL53L0X_ERROR_NONE Success 1724 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is 1725 * accepted. 1726 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error 1727 * occurs when Functionality programmed is not in the supported list: 1728 * Supported value are: 1729 * VL53L0X_GPIOFUNCTIONALITY_OFF, 1730 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW, 1731 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH, 1732 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT, 1733 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY 1734 * @return "Other error code" See ::VL53L0X_Error 1735 */ 1736 VL53L0X_API VL53L0X_Error VL53L0X_GetGpioConfig( 1737 VL53L0X_DEV Dev, uint8_t Pin, VL53L0X_DeviceModes *pDeviceMode, 1738 VL53L0X_GpioFunctionality *pFunctionality, 1739 VL53L0X_InterruptPolarity *pPolarity); 1740 1741 /** 1742 * @brief Set low and high Interrupt thresholds for a given mode 1743 * (ranging, ALS, ...) for a given device 1744 * 1745 * @par Function Description 1746 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, 1747 * ...) for a given device 1748 * 1749 * @note This function Access to the device 1750 * 1751 * @note DeviceMode is ignored for the current device 1752 * 1753 * @param Dev Device Handle 1754 * @param DeviceMode Device Mode for which change thresholds 1755 * @param ThresholdLow Low threshold (mm, lux ..., depending on the 1756 * mode) 1757 * @param ThresholdHigh High threshold (mm, lux ..., depending on the 1758 * mode) 1759 * @return VL53L0X_ERROR_NONE Success 1760 * @return "Other error code" See ::VL53L0X_Error 1761 */ 1762 VL53L0X_API VL53L0X_Error VL53L0X_SetInterruptThresholds( 1763 VL53L0X_DEV Dev, VL53L0X_DeviceModes DeviceMode, 1764 FixPoint1616_t ThresholdLow, FixPoint1616_t ThresholdHigh); 1765 1766 /** 1767 * @brief Get high and low Interrupt thresholds for a given mode 1768 * (ranging, ALS, ...) for a given device 1769 * 1770 * @par Function Description 1771 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, 1772 * ...) for a given device 1773 * 1774 * @note This function Access to the device 1775 * 1776 * @note DeviceMode is ignored for the current device 1777 * 1778 * @param Dev Device Handle 1779 * @param DeviceMode Device Mode from which read thresholds 1780 * @param pThresholdLow Low threshold (mm, lux ..., depending on the 1781 * mode) 1782 * @param pThresholdHigh High threshold (mm, lux ..., depending on the 1783 * mode) 1784 * @return VL53L0X_ERROR_NONE Success 1785 * @return "Other error code" See ::VL53L0X_Error 1786 */ 1787 VL53L0X_API VL53L0X_Error VL53L0X_GetInterruptThresholds( 1788 VL53L0X_DEV Dev, VL53L0X_DeviceModes DeviceMode, 1789 FixPoint1616_t *pThresholdLow, FixPoint1616_t *pThresholdHigh); 1790 1791 /** 1792 * @brief Return device stop completion status 1793 * 1794 * @par Function Description 1795 * Returns stop completiob status. 1796 * User shall call this function after a stop command 1797 * 1798 * @note This function Access to the device 1799 * 1800 * @param Dev Device Handle 1801 * @param pStopStatus Pointer to status variable to update 1802 * @return VL53L0X_ERROR_NONE Success 1803 * @return "Other error code" See ::VL53L0X_Error 1804 */ 1805 VL53L0X_API VL53L0X_Error 1806 VL53L0X_GetStopCompletedStatus(VL53L0X_DEV Dev, uint32_t *pStopStatus); 1807 1808 1809 /** 1810 * @brief Clear given system interrupt condition 1811 * 1812 * @par Function Description 1813 * Clear given interrupt(s). 1814 * 1815 * @note This function Access to the device 1816 * 1817 * @param Dev Device Handle 1818 * @param InterruptMask Mask of interrupts to clear 1819 * @return VL53L0X_ERROR_NONE Success 1820 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts 1821 * 1822 * @return "Other error code" See ::VL53L0X_Error 1823 */ 1824 VL53L0X_API VL53L0X_Error 1825 VL53L0X_ClearInterruptMask(VL53L0X_DEV Dev, uint32_t InterruptMask); 1826 1827 /** 1828 * @brief Return device interrupt status 1829 * 1830 * @par Function Description 1831 * Returns currently raised interrupts by the device. 1832 * User shall be able to activate/deactivate interrupts through 1833 * @a VL53L0X_SetGpioConfig() 1834 * 1835 * @note This function Access to the device 1836 * 1837 * @param Dev Device Handle 1838 * @param pInterruptMaskStatus Pointer to status variable to update 1839 * @return VL53L0X_ERROR_NONE Success 1840 * @return "Other error code" See ::VL53L0X_Error 1841 */ 1842 VL53L0X_API VL53L0X_Error VL53L0X_GetInterruptMaskStatus( 1843 VL53L0X_DEV Dev, uint32_t *pInterruptMaskStatus); 1844 1845 /** 1846 * @brief Configure ranging interrupt reported to system 1847 * 1848 * @note This function is not Implemented 1849 * 1850 * @param Dev Device Handle 1851 * @param InterruptMask Mask of interrupt to Enable/disable 1852 * (0:interrupt disabled or 1: interrupt enabled) 1853 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 1854 */ 1855 VL53L0X_API VL53L0X_Error 1856 VL53L0X_EnableInterruptMask(VL53L0X_DEV Dev, uint32_t InterruptMask); 1857 1858 /** @} VL53L0X_interrupt_group */ 1859 1860 /** @defgroup VL53L0X_SPADfunctions_group VL53L0X SPAD Functions 1861 * @brief Functions used for SPAD managements 1862 * @{ 1863 */ 1864 1865 /** 1866 * @brief Set the SPAD Ambient Damper Threshold value 1867 * 1868 * @par Function Description 1869 * This function set the SPAD Ambient Damper Threshold value 1870 * 1871 * @note This function Access to the device 1872 * 1873 * @param Dev Device Handle 1874 * @param SpadAmbientDamperThreshold SPAD Ambient Damper Threshold 1875 * value 1876 * @return VL53L0X_ERROR_NONE Success 1877 * @return "Other error code" See ::VL53L0X_Error 1878 */ 1879 VL53L0X_API VL53L0X_Error VL53L0X_SetSpadAmbientDamperThreshold( 1880 VL53L0X_DEV Dev, uint16_t SpadAmbientDamperThreshold); 1881 1882 /** 1883 * @brief Get the current SPAD Ambient Damper Threshold value 1884 * 1885 * @par Function Description 1886 * This function get the SPAD Ambient Damper Threshold value 1887 * 1888 * @note This function Access to the device 1889 * 1890 * @param Dev Device Handle 1891 * @param pSpadAmbientDamperThreshold Pointer to programmed 1892 * SPAD Ambient Damper Threshold 1893 * value 1894 * @return VL53L0X_ERROR_NONE Success 1895 * @return "Other error code" See ::VL53L0X_Error 1896 */ 1897 VL53L0X_API VL53L0X_Error VL53L0X_GetSpadAmbientDamperThreshold( 1898 VL53L0X_DEV Dev, uint16_t *pSpadAmbientDamperThreshold); 1899 1900 /** 1901 * @brief Set the SPAD Ambient Damper Factor value 1902 * 1903 * @par Function Description 1904 * This function set the SPAD Ambient Damper Factor value 1905 * 1906 * @note This function Access to the device 1907 * 1908 * @param Dev Device Handle 1909 * @param SpadAmbientDamperFactor SPAD Ambient Damper Factor value 1910 * @return VL53L0X_ERROR_NONE Success 1911 * @return "Other error code" See ::VL53L0X_Error 1912 */ 1913 VL53L0X_API VL53L0X_Error VL53L0X_SetSpadAmbientDamperFactor( 1914 VL53L0X_DEV Dev, uint16_t SpadAmbientDamperFactor); 1915 1916 /** 1917 * @brief Get the current SPAD Ambient Damper Factor value 1918 * 1919 * @par Function Description 1920 * This function get the SPAD Ambient Damper Factor value 1921 * 1922 * @note This function Access to the device 1923 * 1924 * @param Dev Device Handle 1925 * @param pSpadAmbientDamperFactor Pointer to programmed SPAD Ambient 1926 * Damper Factor value 1927 * @return VL53L0X_ERROR_NONE Success 1928 * @return "Other error code" See ::VL53L0X_Error 1929 */ 1930 VL53L0X_API VL53L0X_Error VL53L0X_GetSpadAmbientDamperFactor( 1931 VL53L0X_DEV Dev, uint16_t *pSpadAmbientDamperFactor); 1932 1933 /** 1934 * @brief Performs Reference Spad Management 1935 * 1936 * @par Function Description 1937 * The reference SPAD initialization procedure determines the minimum amount 1938 * of reference spads to be enables to achieve a target reference signal 1939 * rate and should be performed once during initialization. 1940 * 1941 * @note This function Access to the device 1942 * 1943 * @note This function change the device mode to 1944 * VL53L0X_DEVICEMODE_SINGLE_RANGING 1945 * 1946 * @param Dev Device Handle 1947 * @param refSpadCount Reports ref Spad Count 1948 * @param isApertureSpads Reports if spads are of type 1949 * aperture or non-aperture. 1950 * 1:=aperture, 0:=Non-Aperture 1951 * @return VL53L0X_ERROR_NONE Success 1952 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure. 1953 * @return "Other error code" See ::VL53L0X_Error 1954 */ 1955 VL53L0X_API VL53L0X_Error VL53L0X_PerformRefSpadManagement( 1956 VL53L0X_DEV Dev, uint32_t *refSpadCount, uint8_t *isApertureSpads); 1957 1958 /** 1959 * @brief Applies Reference SPAD configuration 1960 * 1961 * @par Function Description 1962 * This function applies a given number of reference spads, identified as 1963 * either Aperture or Non-Aperture. 1964 * The requested spad count and type are stored within the device specific 1965 * parameters data for access by the host. 1966 * 1967 * @note This function Access to the device 1968 * 1969 * @param Dev Device Handle 1970 * @param refSpadCount Number of ref spads. 1971 * @param isApertureSpads Defines if spads are of type 1972 * aperture or non-aperture. 1973 * 1:=aperture, 0:=Non-Aperture 1974 * @return VL53L0X_ERROR_NONE Success 1975 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference 1976 * spad configuration. 1977 * @return "Other error code" See ::VL53L0X_Error 1978 */ 1979 VL53L0X_API VL53L0X_Error VL53L0X_SetReferenceSpads( 1980 VL53L0X_DEV Dev, uint32_t refSpadCount, uint8_t isApertureSpads); 1981 1982 /** 1983 * @brief Retrieves SPAD configuration 1984 * 1985 * @par Function Description 1986 * This function retrieves the current number of applied reference spads 1987 * and also their type : Aperture or Non-Aperture. 1988 * 1989 * @note This function Access to the device 1990 * 1991 * @param Dev Device Handle 1992 * @param refSpadCount Number ref Spad Count 1993 * @param isApertureSpads Reports if spads are of type 1994 * aperture or non-aperture. 1995 * 1:=aperture, 0:=Non-Aperture 1996 * @return VL53L0X_ERROR_NONE Success 1997 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference 1998 * spad configuration. 1999 * @return "Other error code" See ::VL53L0X_Error 2000 */ 2001 VL53L0X_API VL53L0X_Error VL53L0X_GetReferenceSpads( 2002 VL53L0X_DEV Dev, uint32_t *refSpadCount, uint8_t *isApertureSpads); 2003 2004 /** @} VL53L0X_SPADfunctions_group */ 2005 2006 /** @} VL53L0X_cut11_group */ 2007 2008 #ifdef __cplusplus 2009 } 2010 #endif 2011 2012 #endif /* _VL53L0X_API_H_ */ 2013