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.
Dependents: Check_VL53L0X_simple_with_three_ToF Check_VL53L0X_simple_ToF_Sensor Check_VL53L0X_simple_with_three_ToF Check_VL53L0X_simple_ToF_Sensor ... more
Fork of VL53L0X by
VL53L0X_2nd.h
00001 00002 /** 00003 * @brief Start the measure indicated by operating mode 00004 * @param[in] operating_mode specifies requested measure 00005 * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure 00006 * @return "0" on success 00007 */ 00008 int start_measurement(OperatingMode operating_mode, void (*fptr)(void)); 00009 00010 /** 00011 * @brief Get results for the measure indicated by operating mode 00012 * @param[in] operating_mode specifies requested measure results 00013 * @param[out] p_data pointer to the MeasureData_t structure to read data in to 00014 * @return "0" on success 00015 */ 00016 int get_measurement(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *p_data); 00017 00018 /** 00019 * @brief Stop the currently running measure indicate by operating_mode 00020 * @param[in] operating_mode specifies requested measure to stop 00021 * @return "0" on success 00022 */ 00023 int stop_measurement(OperatingMode operating_mode); 00024 00025 /** 00026 * @brief Interrupt handling func to be called by user after an INT is occourred 00027 * @param[in] opeating_mode indicating the in progress measure 00028 * @param[out] Data pointer to the MeasureData_t structure to read data in to 00029 * @return "0" on success 00030 */ 00031 int handle_irq(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *data); 00032 00033 /** 00034 * @brief Enable interrupt measure IRQ 00035 * @return "0" on success 00036 */ 00037 void enable_interrupt_measure_detection_irq(void) 00038 { 00039 if (_gpio1Int != NULL) { 00040 _gpio1Int->enable_irq(); 00041 } 00042 } 00043 00044 /** 00045 * @brief Disable interrupt measure IRQ 00046 * @return "0" on success 00047 */ 00048 void disable_interrupt_measure_detection_irq(void) 00049 { 00050 if (_gpio1Int != NULL) { 00051 _gpio1Int->disable_irq(); 00052 } 00053 } 00054 00055 /** 00056 * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready 00057 * @param[in] fptr pointer to call back function to be called whenever an interrupt occours 00058 * @return "0" on success 00059 */ 00060 void attach_interrupt_measure_detection_irq(void (*fptr)(void)) 00061 { 00062 if (_gpio1Int != NULL) { 00063 _gpio1Int->rise(fptr); 00064 } 00065 } 00066 00067 00068 /** Wrapper functions */ 00069 /** @defgroup api_init Init functions 00070 * @brief API init functions 00071 * @ingroup api_hl 00072 * @{ 00073 */ 00074 00075 /** 00076 * 00077 * @brief One time device initialization 00078 * 00079 * To be called once and only once after device is brought out of reset (Chip enable) and booted. 00080 * 00081 * @par Function Description 00082 * When not used after a fresh device "power up" or reset, it may return @a #CALIBRATION_WARNING 00083 * meaning wrong calibration data may have been fetched from device that can result in ranging offset error\n 00084 * If application cannot execute device reset or need to run VL53L0X_data_init multiple time 00085 * then it must ensure proper offset calibration saving and restore on its own 00086 * by using @a VL53L0X_get_offset_calibration_data_micro_meter() on first power up and then @a VL53L0X_set_offset_calibration_data_micro_meter() all all subsequent init 00087 * 00088 * @param void 00089 * @return "0" on success, @a #CALIBRATION_WARNING if failed 00090 */ 00091 virtual int init(void *init) 00092 { 00093 return VL53L0X_data_init(_device); 00094 } 00095 00096 /** 00097 * @brief Prepare device for operation 00098 * @par Function Description 00099 * Does static initialization and reprogram common default settings \n 00100 * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n 00101 * After prepare user can : \n 00102 * @li Call other API function to set other settings\n 00103 * @li Configure the interrupt pins, etc... \n 00104 * @li Then start ranging or ALS operations in single shot or continuous mode 00105 * 00106 * @param void 00107 * @return "0" on success 00108 */ 00109 int prepare() 00110 { 00111 VL53L0X_Error status = VL53L0X_ERROR_NONE; 00112 uint32_t ref_spad_count; 00113 uint8_t is_aperture_spads; 00114 uint8_t vhv_settings; 00115 uint8_t phase_cal; 00116 00117 if (status == VL53L0X_ERROR_NONE) { 00118 //printf("Call of VL53L0X_StaticInit\r\n"); 00119 status = VL53L0X_static_init(_device); // Device Initialization 00120 } 00121 00122 if (status == VL53L0X_ERROR_NONE) { 00123 //printf("Call of VL53L0X_PerformRefCalibration\r\n"); 00124 status = VL53L0X_perform_ref_calibration(_device, 00125 &vhv_settings, &phase_cal); // Device Initialization 00126 } 00127 00128 if (status == VL53L0X_ERROR_NONE) { 00129 //printf("Call of VL53L0X_PerformRefSpadManagement\r\n"); 00130 status = VL53L0X_perform_ref_spad_management(_device, 00131 &ref_spad_count, &is_aperture_spads); // Device Initialization 00132 // printf ("refSpadCount = %d, isApertureSpads = %d\r\n", refSpadCount, isApertureSpads); 00133 } 00134 00135 return status; 00136 } 00137 00138 /** 00139 * @brief Start continuous ranging mode 00140 * 00141 * @details End user should ensure device is in idle state and not already running 00142 * @return "0" on success 00143 */ 00144 int range_start_continuous_mode() 00145 { 00146 int status; 00147 status = VL53L0X_set_device_mode(_device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING); 00148 00149 if (status == VL53L0X_ERROR_NONE) { 00150 //printf ("Call of VL53L0X_StartMeasurement\r\n"); 00151 status = VL53L0X_start_measurement(_device); 00152 } 00153 00154 return status; 00155 } 00156 00157 //------- Feburary 4th, 2018 by JH1PJL / K.Arai -------------------------------- 00158 #if ORIGINAL 00159 /** 00160 * @brief Get ranging result and only that 00161 * 00162 * @par Function Description 00163 * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in millimeter \n 00164 * It does any required up-scale translation\n 00165 * It can be called after success status polling or in interrupt mode \n 00166 * @warning these function is not doing wrap around filtering \n 00167 * This function doesn't perform any data ready check! 00168 * 00169 * @param p_data Pointer to range distance 00170 * @return "0" on success 00171 */ 00172 virtual int get_distance(uint32_t *p_data) 00173 { 00174 int status = 0; 00175 VL53L0X_RangingMeasurementData_t p_ranging_measurement_data; 00176 00177 status = start_measurement(range_single_shot_polling, NULL); 00178 if (!status) { 00179 status = get_measurement(range_single_shot_polling, &p_ranging_measurement_data); 00180 } 00181 if (p_ranging_measurement_data.RangeStatus == 0) { 00182 // we have a valid range. 00183 *p_data = p_ranging_measurement_data.RangeMilliMeter; 00184 } else { 00185 *p_data = 0; 00186 status = VL53L0X_ERROR_RANGE_ERROR; 00187 } 00188 stop_measurement(range_single_shot_polling); 00189 return status; 00190 } 00191 #endif 00192 00193 /** @} */ 00194 00195 /** 00196 * @brief Set new device i2c address 00197 * 00198 * After completion the device will answer to the new address programmed. 00199 * 00200 * @param new_addr The new i2c address (7bit) 00201 * @return "0" on success 00202 */ 00203 int set_device_address(int new_addr) 00204 { 00205 int status; 00206 00207 status = VL53L0X_set_device_address(_device, new_addr); 00208 if (!status) { 00209 _device->I2cDevAddr = new_addr; 00210 } 00211 return status; 00212 00213 } 00214 00215 /** 00216 * @brief Clear given system interrupt condition 00217 * 00218 * @par Function Description 00219 * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register. 00220 * @param dev The device 00221 * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR. 00222 * @return "0" on success 00223 */ 00224 int clear_interrupt(uint8_t int_clear) 00225 { 00226 return VL53L0X_clear_interrupt_mask(_device, int_clear); 00227 } 00228 00229 /** 00230 * 00231 * @brief Get the 53L0 device 00232 * 00233 * To be called to retrive the internal device descriptor to allow usage of 00234 * low level API having device as parameter. To be called after set_device_address() 00235 * (if any). 00236 * 00237 * @par Function Description 00238 * To be called if low level API usage is needed as those functions requires 00239 * device as a parameter.TICINIT. 00240 * 00241 * @note This function return a pointer to an object internal structure 00242 * 00243 * @param dev ptr to ptr to Device Handle 00244 * @return VL53L0X_ERROR_NONE Success 00245 * @return "Other error code" See ::VL53L0X_Error 00246 */ 00247 VL53L0X_Error vl53l0x_get_device(VL53L0X_DEV *dev) 00248 { 00249 *dev = _device; 00250 return VL53L0X_ERROR_NONE; 00251 } 00252 00253 /** 00254 * 00255 * @brief One time device initialization 00256 * 00257 * To be called once and only once after device is brought out of reset 00258 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted() 00259 * 00260 * @par Function Description 00261 * When not used after a fresh device "power up" or reset, it may return 00262 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data 00263 * may have been fetched from device that can result in ranging offset error\n 00264 * If application cannot execute device reset or need to run VL53L0X_DataInit 00265 * multiple time then it must ensure proper offset calibration saving and 00266 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first 00267 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init 00268 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to 00269 * VL53L0X_STATE_WAIT_STATICINIT. 00270 * 00271 * @note This function accesses to the device 00272 * 00273 * @param dev Device Handle 00274 * @return VL53L0X_ERROR_NONE Success 00275 * @return "Other error code" See ::VL53L0X_Error 00276 */ 00277 VL53L0X_Error VL53L0X_data_init(VL53L0X_DEV dev); 00278 00279 /** 00280 * @brief Do basic device init (and eventually patch loading) 00281 * This function will change the VL53L0X_State from 00282 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE. 00283 * In this stage all default setting will be applied. 00284 * 00285 * @note This function Access to the device 00286 * 00287 * @param dev Device Handle 00288 * @return VL53L0X_ERROR_NONE Success 00289 * @return "Other error code" See ::VL53L0X_Error 00290 */ 00291 VL53L0X_Error VL53L0X_static_init(VL53L0X_DEV dev); 00292 00293 /** 00294 * @brief Perform Reference Calibration 00295 * 00296 * @details Perform a reference calibration of the Device. 00297 * This function should be run from time to time before doing 00298 * a ranging measurement. 00299 * This function will launch a special ranging measurement, so 00300 * if interrupt are enable an interrupt will be done. 00301 * This function will clear the interrupt generated automatically. 00302 * 00303 * @warning This function is a blocking function 00304 * 00305 * @note This function Access to the device 00306 * 00307 * @param dev Device Handle 00308 * @param p_vhv_settings Pointer to vhv settings parameter. 00309 * @param p_phase_cal Pointer to PhaseCal parameter. 00310 * @return VL53L0X_ERROR_NONE Success 00311 * @return "Other error code" See ::VL53L0X_Error 00312 */ 00313 VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev, uint8_t *p_vhv_settings, 00314 uint8_t *p_phase_cal); 00315 00316 /** 00317 * @brief Get Reference Calibration Parameters 00318 * 00319 * @par Function Description 00320 * Get Reference Calibration Parameters. 00321 * 00322 * @note This function Access to the device 00323 * 00324 * @param dev Device Handle 00325 * @param p_vhv_settings Pointer to VHV parameter 00326 * @param p_phase_cal Pointer to PhaseCal Parameter 00327 * @return VL53L0X_ERROR_NONE Success 00328 * @return "Other error code" See ::VL53L0X_Error 00329 */ 00330 VL53L0X_Error VL53L0X_get_ref_calibration(VL53L0X_DEV dev, 00331 uint8_t *p_vhv_settings, uint8_t *p_phase_cal); 00332 00333 VL53L0X_Error VL53L0X_set_ref_calibration(VL53L0X_DEV dev, 00334 uint8_t vhv_settings, uint8_t phase_cal); 00335 00336 /** 00337 * @brief Performs Reference Spad Management 00338 * 00339 * @par Function Description 00340 * The reference SPAD initialization procedure determines the minimum amount 00341 * of reference spads to be enables to achieve a target reference signal rate 00342 * and should be performed once during initialization. 00343 * 00344 * @note This function Access to the device 00345 * 00346 * @note This function change the device mode to 00347 * VL53L0X_DEVICEMODE_SINGLE_RANGING 00348 * 00349 * @param dev Device Handle 00350 * @param ref_spad_count Reports ref Spad Count 00351 * @param is_aperture_spads Reports if spads are of type 00352 * aperture or non-aperture. 00353 * 1:=aperture, 0:=Non-Aperture 00354 * @return VL53L0X_ERROR_NONE Success 00355 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure. 00356 * @return "Other error code" See ::VL53L0X_Error 00357 */ 00358 VL53L0X_Error VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev, 00359 uint32_t *ref_spad_count, uint8_t *is_aperture_spads); 00360 00361 /** 00362 * @brief Applies Reference SPAD configuration 00363 * 00364 * @par Function Description 00365 * This function applies a given number of reference spads, identified as 00366 * either Aperture or Non-Aperture. 00367 * The requested spad count and type are stored within the device specific 00368 * parameters data for access by the host. 00369 * 00370 * @note This function Access to the device 00371 * 00372 * @param dev Device Handle 00373 * @param refSpadCount Number of ref spads. 00374 * @param is_aperture_spads Defines if spads are of type 00375 * aperture or non-aperture. 00376 * 1:=aperture, 0:=Non-Aperture 00377 * @return VL53L0X_ERROR_NONE Success 00378 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference 00379 * spad configuration. 00380 * @return "Other error code" See ::VL53L0X_Error 00381 */ 00382 VL53L0X_Error VL53L0X_set_reference_spads(VL53L0X_DEV dev, 00383 uint32_t refSpadCount, uint8_t is_aperture_spads); 00384 00385 /** 00386 * @brief Retrieves SPAD configuration 00387 * 00388 * @par Function Description 00389 * This function retrieves the current number of applied reference spads 00390 * and also their type : Aperture or Non-Aperture. 00391 * 00392 * @note This function Access to the device 00393 * 00394 * @param dev Device Handle 00395 * @param p_spad_count Number ref Spad Count 00396 * @param p_is_aperture_spads Reports if spads are of type 00397 * aperture or non-aperture. 00398 * 1:=aperture, 0:=Non-Aperture 00399 * @return VL53L0X_ERROR_NONE Success 00400 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference 00401 * spad configuration. 00402 * @return "Other error code" See ::VL53L0X_Error 00403 */ 00404 VL53L0X_Error VL53L0X_get_reference_spads(VL53L0X_DEV dev, 00405 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads); 00406 00407 /** 00408 * @brief Get part to part calibration offset 00409 * 00410 * @par Function Description 00411 * Should only be used after a successful call to @a VL53L0X_DataInit to backup 00412 * device NVM value 00413 * 00414 * @note This function Access to the device 00415 * 00416 * @param dev Device Handle 00417 * @param p_offset_calibration_data_micro_meter Return part to part 00418 * calibration offset from device (microns) 00419 * @return VL53L0X_ERROR_NONE Success 00420 * @return "Other error code" See ::VL53L0X_Error 00421 */ 00422 VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev, 00423 int32_t *p_offset_calibration_data_micro_meter); 00424 /** 00425 * Set or over-hide part to part calibration offset 00426 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter() 00427 * 00428 * @note This function Access to the device 00429 * 00430 * @param dev Device Handle 00431 * @param p_offset_calibration_data_micro_meter Offset (microns) 00432 * @return VL53L0X_ERROR_NONE Success 00433 * @return "Other error code" See ::VL53L0X_Error 00434 */ 00435 VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev, 00436 int32_t offset_calibration_data_micro_meter); 00437 00438 VL53L0X_Error VL53L0X_perform_offset_calibration(VL53L0X_DEV dev, 00439 FixPoint1616_t cal_distance_milli_meter, 00440 int32_t *p_offset_micro_meter); 00441 00442 VL53L0X_Error VL53L0X_perform_xtalk_calibration(VL53L0X_DEV dev, 00443 FixPoint1616_t xtalk_cal_distance, 00444 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); 00445 00446 /** 00447 * @brief Perform XTalk Measurement 00448 * 00449 * @details Measures the current cross talk from glass in front 00450 * of the sensor. 00451 * This functions performs a histogram measurement and uses the results 00452 * to measure the crosstalk. For the function to be successful, there 00453 * must be no target in front of the sensor. 00454 * 00455 * @warning This function is a blocking function 00456 * 00457 * @warning This function is not supported when the final range 00458 * vcsel clock period is set below 10 PCLKS. 00459 * 00460 * @note This function Access to the device 00461 * 00462 * @param dev Device Handle 00463 * @param timeout_ms Histogram measurement duration. 00464 * @param p_xtalk_per_spad Output parameter containing the crosstalk 00465 * measurement result, in MCPS/Spad. 00466 * Format fixpoint 16:16. 00467 * @param p_ambient_too_high Output parameter which indicate that 00468 * pXtalkPerSpad is not good if the Ambient 00469 * is too high. 00470 * @return VL53L0X_ERROR_NONE Success 00471 * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported 00472 * for this operation. 00473 * Must not be less than 10PCLKS. 00474 * @return "Other error code" See ::VL53L0X_Error 00475 */ 00476 VL53L0X_Error VL53L0X_perform_xtalk_measurement(VL53L0X_DEV dev, 00477 uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad, 00478 uint8_t *p_ambient_too_high); 00479 00480 /** 00481 * @brief Enable/Disable Cross talk compensation feature 00482 * 00483 * @note This function is not Implemented. 00484 * Enable/Disable Cross Talk by set to zero the Cross Talk value 00485 * by using @a VL53L0X_SetXTalkCompensationRateMegaCps(). 00486 * 00487 * @param dev Device Handle 00488 * @param x_talk_compensation_enable Cross talk compensation 00489 * to be set 0=disabled else = enabled 00490 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 00491 */ 00492 VL53L0X_Error VL53L0X_set_x_talk_compensation_enable(VL53L0X_DEV dev, 00493 uint8_t x_talk_compensation_enable); 00494 00495 /** 00496 * @brief Get Cross talk compensation rate 00497 * 00498 * @note This function is not Implemented. 00499 * Enable/Disable Cross Talk by set to zero the Cross Talk value by 00500 * using @a VL53L0X_SetXTalkCompensationRateMegaCps(). 00501 * 00502 * @param dev Device Handle 00503 * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation 00504 * state 0=disabled or 1 = enabled 00505 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented 00506 */ 00507 VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(VL53L0X_DEV dev, 00508 uint8_t *p_x_talk_compensation_enable); 00509 /** 00510 * @brief Set Cross talk compensation rate 00511 * 00512 * @par Function Description 00513 * Set Cross talk compensation rate. 00514 * 00515 * @note This function Access to the device 00516 * 00517 * @param dev Device Handle 00518 * @param x_talk_compensation_rate_mega_cps Compensation rate in 00519 * Mega counts per second 00520 * (16.16 fix point) see 00521 * datasheet for details 00522 * @return VL53L0X_ERROR_NONE Success 00523 * @return "Other error code" See ::VL53L0X_Error 00524 */ 00525 VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev, 00526 FixPoint1616_t x_talk_compensation_rate_mega_cps); 00527 00528 /** 00529 * @brief Get Cross talk compensation rate 00530 * 00531 * @par Function Description 00532 * Get Cross talk compensation rate. 00533 * 00534 * @note This function Access to the device 00535 * 00536 * @param dev Device Handle 00537 * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate 00538 * in Mega counts per second 00539 * (16.16 fix point) see 00540 * datasheet for details 00541 * @return VL53L0X_ERROR_NONE Success 00542 * @return "Other error code" See ::VL53L0X_Error 00543 */ 00544 VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev, 00545 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); 00546 00547 /** 00548 * @brief Set a new device mode 00549 * @par Function Description 00550 * Set device to a new mode (ranging, histogram ...) 00551 * 00552 * @note This function doesn't Access to the device 00553 * 00554 * @param dev Device Handle 00555 * @param device_mode New device mode to apply 00556 * Valid values are: 00557 * VL53L0X_DEVICEMODE_SINGLE_RANGING 00558 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING 00559 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 00560 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 00561 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 00562 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 00563 * VL53L0X_HISTOGRAMMODE_BOTH 00564 * 00565 * 00566 * @return VL53L0X_ERROR_NONE Success 00567 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 00568 * DeviceMode is not in the 00569 * supported list 00570 */ 00571 VL53L0X_Error VL53L0X_set_device_mode(VL53L0X_DEV dev, VL53L0X_DeviceModes device_mode); 00572 00573 /** 00574 * @brief Get current new device mode 00575 * @par Function Description 00576 * Get actual mode of the device(ranging, histogram ...) 00577 * 00578 * @note This function doesn't Access to the device 00579 * 00580 * @param dev Device Handle 00581 * @param p_device_mode Pointer to current apply mode value 00582 * Valid values are: 00583 * VL53L0X_DEVICEMODE_SINGLE_RANGING 00584 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING 00585 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 00586 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM 00587 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY 00588 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY 00589 * VL53L0X_HISTOGRAMMODE_BOTH 00590 * 00591 * @return VL53L0X_ERROR_NONE Success 00592 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 00593 * DeviceMode is not in the 00594 * supported list 00595 */ 00596 VL53L0X_Error VL53L0X_get_device_mode(VL53L0X_DEV dev, 00597 VL53L0X_DeviceModes *p_device_mode); 00598 00599 /** 00600 * @brief Get current configuration for GPIO pin for a given device 00601 * 00602 * @note This function Access to the device 00603 * 00604 * @param dev Device Handle 00605 * @param pin ID of the GPIO Pin 00606 * @param p_device_mode Pointer to Device Mode associated to the Gpio. 00607 * @param p_functionality Pointer to Pin functionality. 00608 * Refer to ::VL53L0X_GpioFunctionality 00609 * @param p_polarity Pointer to interrupt polarity. 00610 * Active high or active low see 00611 * ::VL53L0X_InterruptPolarity 00612 * @return VL53L0X_ERROR_NONE Success 00613 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted. 00614 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED 00615 * This error occurs 00616 * when Funcionality programmed is not in the supported list: 00617 * Supported value are: 00618 * VL53L0X_GPIOFUNCTIONALITY_OFF, 00619 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW, 00620 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH, 00621 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT, 00622 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY 00623 * @return "Other error code" See ::VL53L0X_Error 00624 */ 00625 VL53L0X_Error VL53L0X_get_gpio_config(VL53L0X_DEV dev, uint8_t pin, 00626 VL53L0X_DeviceModes *p_device_mode, 00627 VL53L0X_GpioFunctionality *p_functionality, 00628 VL53L0X_InterruptPolarity *p_polarity); 00629 00630 /** 00631 * @brief Set the configuration of GPIO pin for a given device 00632 * 00633 * @note This function Access to the device 00634 * 00635 * @param dev Device Handle 00636 * @param pin ID of the GPIO Pin 00637 * @param functionality Select Pin functionality. 00638 * Refer to ::VL53L0X_GpioFunctionality 00639 * @param device_mode Device Mode associated to the Gpio. 00640 * @param polarity Set interrupt polarity. Active high 00641 * or active low see ::VL53L0X_InterruptPolarity 00642 * @return VL53L0X_ERROR_NONE Success 00643 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted. 00644 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs 00645 * when Functionality programmed is not in the supported list: 00646 * Supported value are: 00647 * VL53L0X_GPIOFUNCTIONALITY_OFF, 00648 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW, 00649 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH, 00650 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT, 00651 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY 00652 * @return "Other error code" See ::VL53L0X_Error 00653 */ 00654 VL53L0X_Error VL53L0X_set_gpio_config(VL53L0X_DEV dev, uint8_t pin, 00655 VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality, 00656 VL53L0X_InterruptPolarity polarity); 00657 00658 /** 00659 * @brief Start device measurement 00660 * 00661 * @details Started measurement will depend on device parameters set through 00662 * @a VL53L0X_SetParameters() 00663 * This is a non-blocking function. 00664 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to 00665 * VL53L0X_STATE_RUNNING. 00666 * 00667 * @note This function Access to the device 00668 * 00669 00670 * @param dev Device Handle 00671 * @return VL53L0X_ERROR_NONE Success 00672 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when 00673 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported 00674 * list: 00675 * Supported mode are: 00676 * VL53L0X_DEVICEMODE_SINGLE_RANGING, 00677 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING, 00678 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING 00679 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement 00680 * @return "Other error code" See ::VL53L0X_Error 00681 */ 00682 VL53L0X_Error VL53L0X_start_measurement(VL53L0X_DEV dev); 00683 00684 /** 00685 * @brief Stop device measurement 00686 * 00687 * @details Will set the device in standby mode at end of current measurement\n 00688 * Not necessary in single mode as device shall return automatically 00689 * in standby mode at end of measurement. 00690 * This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING 00691 * to VL53L0X_STATE_IDLE. 00692 * 00693 * @note This function Access to the device 00694 * 00695 * @param dev Device Handle 00696 * @return VL53L0X_ERROR_NONE Success 00697 * @return "Other error code" See ::VL53L0X_Error 00698 */ 00699 VL53L0X_Error VL53L0X_stop_measurement(VL53L0X_DEV dev); 00700 00701 /** 00702 * @brief Return device stop completion status 00703 * 00704 * @par Function Description 00705 * Returns stop completiob status. 00706 * User shall call this function after a stop command 00707 * 00708 * @note This function Access to the device 00709 * 00710 * @param dev Device Handle 00711 * @param p_stop_status Pointer to status variable to update 00712 * @return VL53L0X_ERROR_NONE Success 00713 * @return "Other error code" See ::VL53L0X_Error 00714 */ 00715 VL53L0X_Error VL53L0X_get_stop_completed_status(VL53L0X_DEV dev, 00716 uint32_t *p_stop_status); 00717 00718 /** 00719 * @brief Return Measurement Data Ready 00720 * 00721 * @par Function Description 00722 * This function indicate that a measurement data is ready. 00723 * This function check if interrupt mode is used then check is done accordingly. 00724 * If perform function clear the interrupt, this function will not work, 00725 * like in case of @a VL53L0X_PerformSingleRangingMeasurement(). 00726 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady 00727 * is used for non-blocking capture. 00728 * 00729 * @note This function Access to the device 00730 * 00731 * @param dev Device Handle 00732 * @param p_measurement_data_ready Pointer to Measurement Data Ready. 00733 * 0=data not ready, 1 = data ready 00734 * @return VL53L0X_ERROR_NONE Success 00735 * @return "Other error code" See ::VL53L0X_Error 00736 */ 00737 VL53L0X_Error VL53L0X_get_measurement_data_ready(VL53L0X_DEV dev, 00738 uint8_t *p_measurement_data_ready); 00739 00740 /** 00741 * @brief Retrieve the measurements from device for a given setup 00742 * 00743 * @par Function Description 00744 * Get data from last successful Ranging measurement 00745 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones() 00746 * before get data. 00747 * PAL will fill a NumberOfROIZones times the corresponding data 00748 * structure used in the measurement function. 00749 * 00750 * @note This function Access to the device 00751 * 00752 * @param dev Device Handle 00753 * @param p_ranging_measurement_data Pointer to the data structure to fill up. 00754 * @return VL53L0X_ERROR_NONE Success 00755 * @return "Other error code" See ::VL53L0X_Error 00756 */ 00757 VL53L0X_Error VL53L0X_get_ranging_measurement_data(VL53L0X_DEV dev, 00758 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data); 00759 00760 /** 00761 * @brief Clear given system interrupt condition 00762 * 00763 * @par Function Description 00764 * Clear given interrupt(s). 00765 * 00766 * @note This function Access to the device 00767 * 00768 * @param dev Device Handle 00769 * @param interrupt_mask Mask of interrupts to clear 00770 * @return VL53L0X_ERROR_NONE Success 00771 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts 00772 * 00773 * @return "Other error code" See ::VL53L0X_Error 00774 */ 00775 VL53L0X_Error VL53L0X_clear_interrupt_mask(VL53L0X_DEV dev, uint32_t interrupt_mask); 00776 00777 /** 00778 * @brief Return device interrupt status 00779 * 00780 * @par Function Description 00781 * Returns currently raised interrupts by the device. 00782 * User shall be able to activate/deactivate interrupts through 00783 * @a VL53L0X_SetGpioConfig() 00784 * 00785 * @note This function Access to the device 00786 * 00787 * @param dev Device Handle 00788 * @param p_interrupt_mask_status Pointer to status variable to update 00789 * @return VL53L0X_ERROR_NONE Success 00790 * @return "Other error code" See ::VL53L0X_Error 00791 */ 00792 VL53L0X_Error VL53L0X_get_interrupt_mask_status(VL53L0X_DEV dev, 00793 uint32_t *p_interrupt_mask_status); 00794 00795 /** 00796 * @brief Performs a single ranging measurement and retrieve the ranging 00797 * measurement data 00798 * 00799 * @par Function Description 00800 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING 00801 * with @a VL53L0X_SetDeviceMode(), 00802 * It performs measurement with @a VL53L0X_PerformSingleMeasurement() 00803 * It get data from last successful Ranging measurement with 00804 * @a VL53L0X_GetRangingMeasurementData. 00805 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask(). 00806 * 00807 * @note This function Access to the device 00808 * 00809 * @note This function change the device mode to 00810 * VL53L0X_DEVICEMODE_SINGLE_RANGING 00811 * 00812 * @param dev Device Handle 00813 * @param p_ranging_measurement_data Pointer to the data structure to fill up. 00814 * @return VL53L0X_ERROR_NONE Success 00815 * @return "Other error code" See ::VL53L0X_Error 00816 */ 00817 VL53L0X_Error VL53L0X_perform_single_ranging_measurement(VL53L0X_DEV dev, 00818 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data); 00819 00820 /** 00821 * @brief Single shot measurement. 00822 * 00823 * @par Function Description 00824 * Perform simple measurement sequence (Start measure, Wait measure to end, 00825 * and returns when measurement is done). 00826 * Once function returns, user can get valid data by calling 00827 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement 00828 * depending on defined measurement mode 00829 * User should Clear the interrupt in case this are enabled by using the 00830 * function VL53L0X_ClearInterruptMask(). 00831 * 00832 * @warning This function is a blocking function 00833 * 00834 * @note This function Access to the device 00835 * 00836 * @param dev Device Handle 00837 * @return VL53L0X_ERROR_NONE Success 00838 * @return "Other error code" See ::VL53L0X_Error 00839 */ 00840 VL53L0X_Error VL53L0X_perform_single_measurement(VL53L0X_DEV dev); 00841 00842 /** 00843 * @brief Read current status of the error register for the selected device 00844 * 00845 * @note This function Access to the device 00846 * 00847 * @param dev Device Handle 00848 * @param p_device_error_status Pointer to current error code of the device 00849 * @return VL53L0X_ERROR_NONE Success 00850 * @return "Other error code" See ::VL53L0X_Error 00851 */ 00852 VL53L0X_Error VL53L0X_get_device_error_status(VL53L0X_DEV dev, 00853 VL53L0X_DeviceError *p_device_error_status); 00854 00855 /** 00856 * @brief Human readable error string for a given Error Code 00857 * 00858 * @note This function doesn't access to the device 00859 * 00860 * @param error_code The error code as stored on ::VL53L0X_DeviceError 00861 * @param p_device_error_string The error string corresponding to the ErrorCode 00862 * @return VL53L0X_ERROR_NONE Success 00863 * @return "Other error code" See ::VL53L0X_Error 00864 */ 00865 VL53L0X_Error VL53L0X_get_device_error_string( 00866 VL53L0X_DeviceError error_code, char *p_device_error_string); 00867 00868 /** 00869 * @brief Human readable Range Status string for a given RangeStatus 00870 * 00871 * @note This function doesn't access to the device 00872 * 00873 * @param range_status The RangeStatus code as stored on 00874 * @a VL53L0X_RangingMeasurementData_t 00875 * @param p_range_status_string The returned RangeStatus string. 00876 * @return VL53L0X_ERROR_NONE Success 00877 * @return "Other error code" See ::VL53L0X_Error 00878 */ 00879 VL53L0X_Error VL53L0X_get_range_status_string(uint8_t range_status, 00880 char *p_range_status_string); 00881 00882 VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV dev, 00883 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, 00884 FixPoint1616_t *p_total_signal_rate_mcps); 00885 00886 VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV dev, 00887 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, 00888 FixPoint1616_t *p_total_xtalk_rate_mcps); 00889 00890 /** 00891 * @brief Get Ranging Timing Budget in microseconds 00892 * 00893 * @par Function Description 00894 * Returns the programmed the maximum time allowed by the user to the 00895 * device to run a full ranging sequence for the current mode 00896 * (ranging, histogram, ASL ...) 00897 * 00898 * @note This function Access to the device 00899 * 00900 * @param dev Device Handle 00901 * @param p_measurement_timing_budget_micro_seconds Max measurement time in 00902 * microseconds. 00903 * Valid values are: 00904 * >= 17000 microsecs when wraparound enabled 00905 * >= 12000 microsecs when wraparound disabled 00906 * @return VL53L0X_ERROR_NONE Success 00907 * @return "Other error code" See ::VL53L0X_Error 00908 */ 00909 VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, 00910 uint32_t *p_measurement_timing_budget_micro_seconds); 00911 00912 /** 00913 * @brief Set Ranging Timing Budget in microseconds 00914 * 00915 * @par Function Description 00916 * Defines the maximum time allowed by the user to the device to run a 00917 * full ranging sequence for the current mode (ranging, histogram, ASL ...) 00918 * 00919 * @note This function Access to the device 00920 * 00921 * @param dev Device Handle 00922 * @param measurement_timing_budget_micro_seconds Max measurement time in 00923 * microseconds. 00924 * Valid values are: 00925 * >= 17000 microsecs when wraparound enabled 00926 * >= 12000 microsecs when wraparound disabled 00927 * @return VL53L0X_ERROR_NONE Success 00928 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if 00929 MeasurementTimingBudgetMicroSeconds out of range 00930 * @return "Other error code" See ::VL53L0X_Error 00931 */ 00932 VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev, 00933 uint32_t measurement_timing_budget_micro_seconds); 00934 00935 /** 00936 * @brief Get specific limit check enable state 00937 * 00938 * @par Function Description 00939 * This function get the enable state of a specific limit check. 00940 * The limit check is identified with the LimitCheckId. 00941 * 00942 * @note This function Access to the device 00943 * 00944 * @param dev Device Handle 00945 * @param limit_check_id Limit Check ID 00946 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 00947 * @param p_limit_check_enable Pointer to the check limit enable 00948 * value. 00949 * if 1 the check limit 00950 * corresponding to LimitCheckId is Enabled 00951 * if 0 the check limit 00952 * corresponding to LimitCheckId is disabled 00953 * @return VL53L0X_ERROR_NONE Success 00954 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 00955 * when LimitCheckId value is out of range. 00956 * @return "Other error code" See ::VL53L0X_Error 00957 */ 00958 VL53L0X_Error VL53L0X_get_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id, 00959 uint8_t *p_limit_check_enable); 00960 00961 /** 00962 * @brief Enable/Disable a specific limit check 00963 * 00964 * @par Function Description 00965 * This function Enable/Disable a specific limit check. 00966 * The limit check is identified with the LimitCheckId. 00967 * 00968 * @note This function doesn't Access to the device 00969 * 00970 * @param dev Device Handle 00971 * @param limit_check_id Limit Check ID 00972 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 00973 * @param limit_check_enable if 1 the check limit 00974 * corresponding to LimitCheckId is Enabled 00975 * if 0 the check limit 00976 * corresponding to LimitCheckId is disabled 00977 * @return VL53L0X_ERROR_NONE Success 00978 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 00979 * when LimitCheckId value is out of range. 00980 * @return "Other error code" See ::VL53L0X_Error 00981 */ 00982 VL53L0X_Error VL53L0X_set_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id, 00983 uint8_t limit_check_enable); 00984 00985 /** 00986 * @brief Get a specific limit check value 00987 * 00988 * @par Function Description 00989 * This function get a specific limit check value from device then it updates 00990 * internal values and check enables. 00991 * The limit check is identified with the LimitCheckId. 00992 * 00993 * @note This function Access to the device 00994 * 00995 * @param dev Device Handle 00996 * @param limit_check_id Limit Check ID 00997 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 00998 * @param p_limit_check_value Pointer to Limit 00999 * check Value for a given LimitCheckId. 01000 * @return VL53L0X_ERROR_NONE Success 01001 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned 01002 * when LimitCheckId value is out of range. 01003 * @return "Other error code" See ::VL53L0X_Error 01004 */ 01005 VL53L0X_Error VL53L0X_get_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id, 01006 FixPoint1616_t *p_limit_check_value); 01007 01008 /** 01009 * @brief Set a specific limit check value 01010 * 01011 * @par Function Description 01012 * This function set a specific limit check value. 01013 * The limit check is identified with the LimitCheckId. 01014 * 01015 * @note This function Access to the device 01016 * 01017 * @param dev Device Handle 01018 * @param limit_check_id Limit Check ID 01019 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 01020 * @param limit_check_value Limit check Value for a given 01021 * LimitCheckId 01022 * @return VL53L0X_ERROR_NONE Success 01023 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when either 01024 * LimitCheckId or LimitCheckValue value is out of range. 01025 * @return "Other error code" See ::VL53L0X_Error 01026 */ 01027 VL53L0X_Error VL53L0X_set_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id, 01028 FixPoint1616_t limit_check_value); 01029 01030 /** 01031 * @brief Get the current value of the signal used for the limit check 01032 * 01033 * @par Function Description 01034 * This function get a the current value of the signal used for the limit check. 01035 * To obtain the latest value you should run a ranging before. 01036 * The value reported is linked to the limit check identified with the 01037 * LimitCheckId. 01038 * 01039 * @note This function Access to the device 01040 * 01041 * @param dev Device Handle 01042 * @param limit_check_id Limit Check ID 01043 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 01044 * @param p_limit_check_current Pointer to current Value for a 01045 * given LimitCheckId. 01046 * @return VL53L0X_ERROR_NONE Success 01047 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when 01048 * LimitCheckId value is out of range. 01049 * @return "Other error code" See ::VL53L0X_Error 01050 */ 01051 VL53L0X_Error VL53L0X_get_limit_check_current(VL53L0X_DEV dev, uint16_t limit_check_id, 01052 FixPoint1616_t *p_limit_check_current); 01053 01054 /** 01055 * @brief Return a the Status of the specified check limit 01056 * 01057 * @par Function Description 01058 * This function returns the Status of the specified check limit. 01059 * The value indicate if the check is fail or not. 01060 * The limit check is identified with the LimitCheckId. 01061 * 01062 * @note This function doesn't Access to the device 01063 * 01064 * @param dev Device Handle 01065 * @param limit_check_id Limit Check ID 01066 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ). 01067 * @param p_limit_check_status Pointer to the 01068 Limit Check Status of the given check limit. 01069 * LimitCheckStatus : 01070 * 0 the check is not fail 01071 * 1 the check if fail or not enabled 01072 * 01073 * @return VL53L0X_ERROR_NONE Success 01074 * @return VL53L0X_ERROR_INVALID_PARAMS This error is 01075 returned when LimitCheckId value is out of range. 01076 * @return "Other error code" See ::VL53L0X_Error 01077 */ 01078 VL53L0X_Error VL53L0X_get_limit_check_status(VL53L0X_DEV dev, 01079 uint16_t limit_check_id, uint8_t *p_limit_check_status); 01080 01081 /** 01082 * Get continuous mode Inter-Measurement period in milliseconds 01083 * 01084 * @par Function Description 01085 * When trying to set too short time return INVALID_PARAMS minimal value 01086 * 01087 * @note This function Access to the device 01088 * 01089 * @param dev Device Handle 01090 * @param p_inter_measurement_period_milli_seconds Pointer to programmed 01091 * Inter-Measurement Period in milliseconds. 01092 * @return VL53L0X_ERROR_NONE Success 01093 * @return "Other error code" See ::VL53L0X_Error 01094 */ 01095 VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds(VL53L0X_DEV dev, 01096 uint32_t *p_inter_measurement_period_milli_seconds); 01097 01098 /** 01099 * Program continuous mode Inter-Measurement period in milliseconds 01100 * 01101 * @par Function Description 01102 * When trying to set too short time return INVALID_PARAMS minimal value 01103 * 01104 * @note This function Access to the device 01105 * 01106 * @param dev Device Handle 01107 * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms. 01108 * @return VL53L0X_ERROR_NONE Success 01109 * @return "Other error code" See ::VL53L0X_Error 01110 */ 01111 VL53L0X_Error VL53L0X_set_inter_measurement_period_milli_seconds( 01112 VL53L0X_DEV dev, uint32_t inter_measurement_period_milli_seconds); 01113 01114 /** 01115 * @brief Set new device address 01116 * 01117 * After completion the device will answer to the new address programmed. 01118 * This function should be called when several devices are used in parallel 01119 * before start programming the sensor. 01120 * When a single device us used, there is no need to call this function. 01121 * 01122 * @note This function Access to the device 01123 * 01124 * @param dev Device Handle 01125 * @param device_address The new Device address 01126 * @return VL53L0X_ERROR_NONE Success 01127 * @return "Other error code" See ::VL53L0X_Error 01128 */ 01129 VL53L0X_Error VL53L0X_set_device_address(VL53L0X_DEV dev, uint8_t device_address); 01130 01131 /** 01132 * @brief Do an hard reset or soft reset (depending on implementation) of the 01133 * device \nAfter call of this function, device must be in same state as right 01134 * after a power-up sequence.This function will change the VL53L0X_State to 01135 * VL53L0X_STATE_POWERDOWN. 01136 * 01137 * @note This function Access to the device 01138 * 01139 * @param dev Device Handle 01140 * @return VL53L0X_ERROR_NONE Success 01141 * @return "Other error code" See ::VL53L0X_Error 01142 */ 01143 VL53L0X_Error VL53L0X_reset_device(VL53L0X_DEV dev); 01144 01145 /** 01146 * @brief Get setup of Wrap around Check 01147 * 01148 * @par Function Description 01149 * This function get the wrapAround check enable parameters 01150 * 01151 * @note This function Access to the device 01152 * 01153 * @param dev Device Handle 01154 * @param p_wrap_around_check_enable Pointer to the Wrap around Check state 01155 * 0=disabled or 1 = enabled 01156 * @return VL53L0X_ERROR_NONE Success 01157 * @return "Other error code" See ::VL53L0X_Error 01158 */ 01159 VL53L0X_Error VL53L0X_get_wrap_around_check_enable(VL53L0X_DEV dev, 01160 uint8_t *p_wrap_around_check_enable); 01161 01162 /** 01163 * @brief Enable (or disable) Wrap around Check 01164 * 01165 * @note This function Access to the device 01166 * 01167 * @param dev Device Handle 01168 * @param wrap_around_check_enable Wrap around Check to be set 01169 * 0=disabled, other = enabled 01170 * @return VL53L0X_ERROR_NONE Success 01171 * @return "Other error code" See ::VL53L0X_Error 01172 */ 01173 VL53L0X_Error VL53L0X_set_wrap_around_check_enable(VL53L0X_DEV dev, 01174 uint8_t wrap_around_check_enable); 01175 01176 /** 01177 * @brief Gets the VCSEL pulse period. 01178 * 01179 * @par Function Description 01180 * This function retrieves the VCSEL pulse period for the given period type. 01181 * 01182 * @note This function Accesses the device 01183 * 01184 * @param dev Device Handle 01185 * @param vcsel_period_type VCSEL period identifier (pre-range|final). 01186 * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value. 01187 * @return VL53L0X_ERROR_NONE Success 01188 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not 01189 * supported. 01190 * @return "Other error code" See ::VL53L0X_Error 01191 */ 01192 VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev, 01193 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk); 01194 01195 /** 01196 * @brief Sets the VCSEL pulse period. 01197 * 01198 * @par Function Description 01199 * This function retrieves the VCSEL pulse period for the given period type. 01200 * 01201 * @note This function Accesses the device 01202 * 01203 * @param dev Device Handle 01204 * @param vcsel_period_type VCSEL period identifier (pre-range|final). 01205 * @param vcsel_pulse_period VCSEL period value 01206 * @return VL53L0X_ERROR_NONE Success 01207 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not 01208 * supported. 01209 * @return "Other error code" See ::VL53L0X_Error 01210 */ 01211 VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev, 01212 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period); 01213 01214 /** 01215 * @brief Set low and high Interrupt thresholds for a given mode 01216 * (ranging, ALS, ...) for a given device 01217 * 01218 * @par Function Description 01219 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...) 01220 * for a given device 01221 * 01222 * @note This function Access to the device 01223 * 01224 * @note DeviceMode is ignored for the current device 01225 * 01226 * @param dev Device Handle 01227 * @param device_mode Device Mode for which change thresholds 01228 * @param threshold_low Low threshold (mm, lux ..., depending on the mode) 01229 * @param threshold_high High threshold (mm, lux ..., depending on the mode) 01230 * @return VL53L0X_ERROR_NONE Success 01231 * @return "Other error code" See ::VL53L0X_Error 01232 */ 01233 VL53L0X_Error VL53L0X_set_interrupt_thresholds(VL53L0X_DEV dev, 01234 VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low, 01235 FixPoint1616_t threshold_high); 01236 01237 /** 01238 * @brief Get high and low Interrupt thresholds for a given mode 01239 * (ranging, ALS, ...) for a given device 01240 * 01241 * @par Function Description 01242 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...) 01243 * for a given device 01244 * 01245 * @note This function Access to the device 01246 * 01247 * @note DeviceMode is ignored for the current device 01248 * 01249 * @param dev Device Handle 01250 * @param device_mode Device Mode from which read thresholds 01251 * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode) 01252 * @param p_threshold_high High threshold (mm, lux ..., depending on the mode) 01253 * @return VL53L0X_ERROR_NONE Success 01254 * @return "Other error code" See ::VL53L0X_Error 01255 */ 01256 VL53L0X_Error VL53L0X_get_interrupt_thresholds(VL53L0X_DEV dev, 01257 VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low, 01258 FixPoint1616_t *p_threshold_high); 01259 01260 /** 01261 * @brief Reads the Device information for given Device 01262 * 01263 * @note This function Access to the device 01264 * 01265 * @param dev Device Handle 01266 * @param p_VL53L0X_device_info Pointer to current device info for a given 01267 * Device 01268 * @return VL53L0X_ERROR_NONE Success 01269 * @return "Other error code" See ::VL53L0X_Error 01270 */ 01271 VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV dev, 01272 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info); 01273 01274 /** 01275 * @brief Gets the (on/off) state of all sequence steps. 01276 * 01277 * @par Function Description 01278 * This function retrieves the state of all sequence step in the scheduler. 01279 * 01280 * @note This function Accesses the device 01281 * 01282 * @param dev Device Handle 01283 * @param p_scheduler_sequence_steps Pointer to struct containing result. 01284 * @return VL53L0X_ERROR_NONE Success 01285 * @return "Other error code" See ::VL53L0X_Error 01286 */ 01287 VL53L0X_Error VL53L0X_get_sequence_step_enables(VL53L0X_DEV dev, 01288 VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps); 01289 01290 /** 01291 * @brief Sets the (on/off) state of a requested sequence step. 01292 * 01293 * @par Function Description 01294 * This function enables/disables a requested sequence step. 01295 * 01296 * @note This function Accesses the device 01297 * 01298 * @param dev Device Handle 01299 * @param sequence_step_id Sequence step identifier. 01300 * @param sequence_step_enabled Demanded state {0=Off,1=On} 01301 * is enabled. 01302 * @return VL53L0X_ERROR_NONE Success 01303 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not 01304 * supported. 01305 * @return "Other error code" See ::VL53L0X_Error 01306 */ 01307 VL53L0X_Error VL53L0X_set_sequence_step_enable(VL53L0X_DEV dev, 01308 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled); 01309 01310 /** 01311 * @brief Gets the fraction enable parameter indicating the resolution of 01312 * range measurements. 01313 * 01314 * @par Function Description 01315 * Gets the fraction enable state, which translates to the resolution of 01316 * range measurements as follows :Enabled:=0.25mm resolution, 01317 * Not Enabled:=1mm resolution. 01318 * 01319 * @note This function Accesses the device 01320 * 01321 * @param dev Device Handle 01322 * @param p_enabled Output Parameter reporting the fraction enable state. 01323 * 01324 * @return VL53L0X_ERROR_NONE Success 01325 * @return "Other error code" See ::VL53L0X_Error 01326 */ 01327 VL53L0X_Error VL53L0X_get_fraction_enable(VL53L0X_DEV dev, uint8_t *p_enabled); 01328 01329 /** 01330 * @brief Sets the resolution of range measurements. 01331 * @par Function Description 01332 * Set resolution of range measurements to either 0.25mm if 01333 * fraction enabled or 1mm if not enabled. 01334 * 01335 * @note This function Accesses the device 01336 * 01337 * @param dev Device Handle 01338 * @param enable Enable high resolution 01339 * 01340 * @return VL53L0X_ERROR_NONE Success 01341 * @return "Other error code" See ::VL53L0X_Error 01342 */ 01343 VL53L0X_Error VL53L0X_set_range_fraction_enable(VL53L0X_DEV dev, 01344 uint8_t enable); 01345 01346 /** 01347 * @brief Return the VL53L0X PAL Implementation Version 01348 * 01349 * @note This function doesn't access to the device 01350 * 01351 * @param p_version Pointer to current PAL Implementation Version 01352 * @return VL53L0X_ERROR_NONE Success 01353 * @return "Other error code" See ::VL53L0X_Error 01354 */ 01355 VL53L0X_Error VL53L0X_get_version(VL53L0X_Version_t *p_version); 01356 01357 /** 01358 * @brief Reads the Product Revision for a for given Device 01359 * This function can be used to distinguish cut1.0 from cut1.1. 01360 * 01361 * @note This function Access to the device 01362 * 01363 * @param dev Device Handle 01364 * @param p_product_revision_major Pointer to Product Revision Major 01365 * for a given Device 01366 * @param p_product_revision_minor Pointer to Product Revision Minor 01367 * for a given Device 01368 * @return VL53L0X_ERROR_NONE Success 01369 * @return "Other error code" See ::VL53L0X_Error 01370 */ 01371 VL53L0X_Error VL53L0X_get_product_revision(VL53L0X_DEV dev, 01372 uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor); 01373 01374 /** 01375 * @brief Retrieve current device parameters 01376 * @par Function Description 01377 * Get actual parameters of the device 01378 * @li Then start ranging operation. 01379 * 01380 * @note This function Access to the device 01381 * 01382 * @param dev Device Handle 01383 * @param p_device_parameters Pointer to store current device parameters. 01384 * @return VL53L0X_ERROR_NONE Success 01385 * @return "Other error code" See ::VL53L0X_Error 01386 */ 01387 VL53L0X_Error VL53L0X_get_device_parameters(VL53L0X_DEV dev, 01388 VL53L0X_DeviceParameters_t *p_device_parameters); 01389 01390 /** 01391 * @brief Human readable error string for current PAL error status 01392 * 01393 * @note This function doesn't access to the device 01394 * 01395 * @param pal_error_code The error code as stored on @a VL53L0X_Error 01396 * @param p_pal_error_string The error string corresponding to the 01397 * PalErrorCode 01398 * @return VL53L0X_ERROR_NONE Success 01399 * @return "Other error code" See ::VL53L0X_Error 01400 */ 01401 VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code, 01402 char *p_pal_error_string); 01403 01404 /** 01405 * @brief Return the PAL Specification Version used for the current 01406 * implementation. 01407 * 01408 * @note This function doesn't access to the device 01409 * 01410 * @param p_pal_spec_version Pointer to current PAL Specification Version 01411 * @return VL53L0X_ERROR_NONE Success 01412 * @return "Other error code" See ::VL53L0X_Error 01413 */ 01414 VL53L0X_Error VL53L0X_get_pal_spec_version( 01415 VL53L0X_Version_t *p_pal_spec_version); 01416 01417 /** 01418 * @brief Reads the internal state of the PAL for a given Device 01419 * 01420 * @note This function doesn't access to the device 01421 * 01422 * @param dev Device Handle 01423 * @param p_pal_state Pointer to current state of the PAL for a 01424 * given Device 01425 * @return VL53L0X_ERROR_NONE Success 01426 * @return "Other error code" See ::VL53L0X_Error 01427 */ 01428 VL53L0X_Error VL53L0X_get_pal_state(VL53L0X_DEV dev, 01429 VL53L0X_State *p_pal_state); 01430 01431 /** 01432 * @brief Human readable PAL State string 01433 * 01434 * @note This function doesn't access to the device 01435 * 01436 * @param pal_state_code The State code as stored on @a VL53L0X_State 01437 * @param p_pal_state_string The State string corresponding to the 01438 * PalStateCode 01439 * @return VL53L0X_ERROR_NONE Success 01440 * @return "Other error code" See ::VL53L0X_Error 01441 */ 01442 VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code, 01443 char *p_pal_state_string); 01444 01445 /*** End High level API ***/ 01446
Generated on Wed Jul 13 2022 18:43:14 by
1.7.2
