ST Expansion SW Team / VL53L1

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_53L1CB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vl53l1_api_core.h Source File

vl53l1_api_core.h

00001 
00002 /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
00003 /******************************************************************************
00004  * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
00005 
00006  This file is part of VL53L1 and is dual licensed,
00007  either GPL-2.0+
00008  or 'BSD 3-clause "New" or "Revised" License' , at your option.
00009  ******************************************************************************
00010  */
00011 
00012 
00013 
00014 
00015 #ifndef _VL53L1_API_CORE_H_
00016 #define _VL53L1_API_CORE_H_
00017 
00018 #include "vl53l1_platform.h"
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 
00025 
00026 
00027 VL53L1_Error VL53L1_get_version(
00028     VL53L1_DEV            Dev,
00029     VL53L1_ll_version_t  *pversion);
00030 
00031 
00032 
00033 
00034 VL53L1_Error VL53L1_get_device_firmware_version(
00035     VL53L1_DEV         Dev,
00036     uint16_t          *pfw_version);
00037 
00038 
00039 
00040 
00041 VL53L1_Error VL53L1_data_init(
00042     VL53L1_DEV         Dev,
00043     uint8_t            read_p2p_data);
00044 
00045 
00046 
00047 
00048 VL53L1_Error VL53L1_read_p2p_data(
00049     VL53L1_DEV      Dev);
00050 
00051 
00052 
00053 
00054 VL53L1_Error VL53L1_software_reset(
00055     VL53L1_DEV      Dev);
00056 
00057 
00058 
00059 
00060 VL53L1_Error VL53L1_set_part_to_part_data(
00061     VL53L1_DEV                            Dev,
00062     VL53L1_calibration_data_t            *pcal_data);
00063 
00064 
00065 
00066 
00067 VL53L1_Error VL53L1_get_part_to_part_data(
00068     VL53L1_DEV                            Dev,
00069     VL53L1_calibration_data_t            *pcal_data);
00070 
00071 
00072 
00073 
00074 VL53L1_Error VL53L1_get_tuning_debug_data(
00075     VL53L1_DEV                            Dev,
00076     VL53L1_tuning_parameters_t            *ptun_data);
00077 
00078 
00079 
00080 
00081 VL53L1_Error VL53L1_set_inter_measurement_period_ms(
00082     VL53L1_DEV          Dev,
00083     uint32_t            inter_measurement_period_ms);
00084 
00085 
00086 
00087 
00088 VL53L1_Error VL53L1_get_inter_measurement_period_ms(
00089     VL53L1_DEV          Dev,
00090     uint32_t           *pinter_measurement_period_ms);
00091 
00092 
00093 
00094 
00095 VL53L1_Error VL53L1_set_timeouts_us(
00096     VL53L1_DEV          Dev,
00097     uint32_t            phasecal_config_timeout_us,
00098     uint32_t            mm_config_timeout_us,
00099     uint32_t            range_config_timeout_us);
00100 
00101 
00102 
00103 
00104 VL53L1_Error VL53L1_get_timeouts_us(
00105     VL53L1_DEV          Dev,
00106     uint32_t           *pphasecal_config_timeout_us,
00107     uint32_t           *pmm_config_timeout_us,
00108     uint32_t           *prange_config_timeout_us);
00109 
00110 
00111 
00112 
00113 VL53L1_Error VL53L1_set_calibration_repeat_period(
00114     VL53L1_DEV          Dev,
00115     uint16_t            cal_config__repeat_period);
00116 
00117 
00118 
00119 
00120 VL53L1_Error VL53L1_get_calibration_repeat_period(
00121     VL53L1_DEV          Dev,
00122     uint16_t           *pcal_config__repeat_period);
00123 
00124 
00125 
00126 
00127 VL53L1_Error VL53L1_set_sequence_config_bit(
00128     VL53L1_DEV                   Dev,
00129     VL53L1_DeviceSequenceConfig  bit_id,
00130     uint8_t                      value);
00131 
00132 
00133 
00134 
00135 VL53L1_Error VL53L1_get_sequence_config_bit(
00136     VL53L1_DEV                   Dev,
00137     VL53L1_DeviceSequenceConfig  bit_id,
00138     uint8_t                     *pvalue);
00139 
00140 
00141 
00142 
00143 VL53L1_Error VL53L1_set_interrupt_polarity(
00144     VL53L1_DEV                       Dev,
00145     VL53L1_DeviceInterruptPolarity  interrupt_polarity);
00146 
00147 
00148 
00149 
00150 VL53L1_Error VL53L1_get_interrupt_polarity(
00151     VL53L1_DEV                      Dev,
00152     VL53L1_DeviceInterruptPolarity  *pinterrupt_polarity);
00153 
00154 
00155 
00156 VL53L1_Error VL53L1_get_refspadchar_config_struct(
00157     VL53L1_DEV                     Dev,
00158     VL53L1_refspadchar_config_t   *pdata);
00159 
00160 
00161 
00162 VL53L1_Error VL53L1_set_refspadchar_config_struct(
00163     VL53L1_DEV                     Dev,
00164     VL53L1_refspadchar_config_t   *pdata);
00165 
00166 
00167 
00168 VL53L1_Error VL53L1_set_range_ignore_threshold(
00169     VL53L1_DEV              Dev,
00170     uint8_t                 range_ignore_thresh_mult,
00171     uint16_t                range_ignore_threshold_mcps);
00172 
00173 
00174 
00175 VL53L1_Error VL53L1_get_range_ignore_threshold(
00176     VL53L1_DEV              Dev,
00177     uint8_t                *prange_ignore_thresh_mult,
00178     uint16_t               *prange_ignore_threshold_mcps_internal,
00179     uint16_t               *prange_ignore_threshold_mcps_current);
00180 
00181 
00182 
00183 
00184 VL53L1_Error VL53L1_set_user_zone(
00185     VL53L1_DEV          Dev,
00186     VL53L1_user_zone_t *puser_zone);
00187 
00188 
00189 
00190 
00191 VL53L1_Error VL53L1_get_user_zone(
00192     VL53L1_DEV          Dev,
00193     VL53L1_user_zone_t *puser_zone);
00194 
00195 
00196 
00197 
00198 VL53L1_Error VL53L1_get_mode_mitigation_roi(
00199     VL53L1_DEV          Dev,
00200     VL53L1_user_zone_t *pmm_roi);
00201 
00202 
00203 
00204 
00205 VL53L1_Error VL53L1_set_zone_config(
00206     VL53L1_DEV             Dev,
00207     VL53L1_zone_config_t  *pzone_cfg);
00208 
00209 
00210 
00211 
00212 VL53L1_Error VL53L1_get_zone_config(
00213     VL53L1_DEV             Dev,
00214     VL53L1_zone_config_t  *pzone_cfg);
00215 
00216 
00217 
00218 
00219 VL53L1_Error VL53L1_set_preset_mode(
00220     VL53L1_DEV                   Dev,
00221     VL53L1_DevicePresetModes     device_preset_mode,
00222     uint16_t                     dss_config__target_total_rate_mcps,
00223     uint32_t                     phasecal_config_timeout_us,
00224     uint32_t                     mm_config_timeout_us,
00225     uint32_t                     range_config_timeout_us,
00226     uint32_t                     inter_measurement_period_ms);
00227 
00228 
00229 
00230 
00231 VL53L1_Error VL53L1_get_preset_mode_timing_cfg(
00232     VL53L1_DEV                   Dev,
00233     VL53L1_DevicePresetModes     device_preset_mode,
00234     uint16_t                    *pdss_config__target_total_rate_mcps,
00235     uint32_t                    *pphasecal_config_timeout_us,
00236     uint32_t                    *pmm_config_timeout_us,
00237     uint32_t                    *prange_config_timeout_us);
00238 
00239 
00240 
00241 VL53L1_Error VL53L1_set_zone_preset(
00242     VL53L1_DEV               Dev,
00243     VL53L1_DeviceZonePreset  zone_preset);
00244 
00245 
00246 
00247 VL53L1_Error VL53L1_enable_xtalk_compensation(
00248     VL53L1_DEV                 Dev);
00249 
00250 
00251 
00252 VL53L1_Error VL53L1_disable_xtalk_compensation(
00253     VL53L1_DEV                 Dev);
00254 
00255 
00256 
00257 
00258 void VL53L1_get_xtalk_compensation_enable(
00259     VL53L1_DEV    Dev,
00260     uint8_t       *pcrosstalk_compensation_enable);
00261 
00262 
00263 
00264 VL53L1_Error VL53L1_init_and_start_range(
00265     VL53L1_DEV                      Dev,
00266     uint8_t                         measurement_mode,
00267     VL53L1_DeviceConfigLevel        device_config_level);
00268 
00269 
00270 
00271 
00272 VL53L1_Error VL53L1_stop_range(
00273     VL53L1_DEV  Dev);
00274 
00275 
00276 
00277 
00278 VL53L1_Error VL53L1_get_measurement_results(
00279     VL53L1_DEV                  Dev,
00280     VL53L1_DeviceResultsLevel   device_result_level);
00281 
00282 
00283 
00284 
00285 VL53L1_Error VL53L1_get_device_results(
00286     VL53L1_DEV                 Dev,
00287     VL53L1_DeviceResultsLevel  device_result_level,
00288     VL53L1_range_results_t    *prange_results);
00289 
00290 
00291 
00292 
00293 VL53L1_Error VL53L1_clear_interrupt_and_enable_next_range(
00294     VL53L1_DEV       Dev,
00295     uint8_t          measurement_mode);
00296 
00297 
00298 
00299 
00300 VL53L1_Error VL53L1_get_histogram_bin_data(
00301     VL53L1_DEV                   Dev,
00302     VL53L1_histogram_bin_data_t *phist_data);
00303 
00304 
00305 
00306 
00307 void VL53L1_copy_sys_and_core_results_to_range_results(
00308     int32_t                           gain_factor,
00309     VL53L1_system_results_t          *psys,
00310     VL53L1_core_results_t            *pcore,
00311     VL53L1_range_results_t           *presults);
00312 
00313 
00314 
00315 VL53L1_Error VL53L1_set_zone_dss_config(
00316       VL53L1_DEV                      Dev,
00317       VL53L1_zone_private_dyn_cfg_t  *pzone_dyn_cfg);
00318 
00319 
00320 
00321 
00322 VL53L1_Error VL53L1_calc_ambient_dmax(
00323     VL53L1_DEV    Dev,
00324     uint16_t      target_reflectance,
00325     int16_t      *pambient_dmax_mm);
00326 
00327 
00328 
00329 
00330 VL53L1_Error VL53L1_set_GPIO_interrupt_config(
00331     VL53L1_DEV                      Dev,
00332     VL53L1_GPIO_Interrupt_Mode  intr_mode_distance,
00333     VL53L1_GPIO_Interrupt_Mode  intr_mode_rate,
00334     uint8_t             intr_new_measure_ready,
00335     uint8_t             intr_no_target,
00336     uint8_t             intr_combined_mode,
00337     uint16_t            thresh_distance_high,
00338     uint16_t            thresh_distance_low,
00339     uint16_t            thresh_rate_high,
00340     uint16_t            thresh_rate_low
00341     );
00342 
00343 
00344 
00345 VL53L1_Error VL53L1_set_GPIO_interrupt_config_struct(
00346     VL53L1_DEV                      Dev,
00347     VL53L1_GPIO_interrupt_config_t  intconf);
00348 
00349 
00350 
00351 VL53L1_Error VL53L1_get_GPIO_interrupt_config(
00352     VL53L1_DEV                      Dev,
00353     VL53L1_GPIO_interrupt_config_t  *pintconf);
00354 
00355 
00356 
00357 
00358 VL53L1_Error VL53L1_set_dmax_mode(
00359     VL53L1_DEV              Dev,
00360     VL53L1_DeviceDmaxMode   dmax_mode);
00361 
00362 
00363 
00364 VL53L1_Error VL53L1_get_dmax_mode(
00365     VL53L1_DEV               Dev,
00366     VL53L1_DeviceDmaxMode   *pdmax_mode);
00367 
00368 
00369 
00370 
00371 VL53L1_Error VL53L1_get_dmax_calibration_data(
00372     VL53L1_DEV                      Dev,
00373     VL53L1_DeviceDmaxMode           dmax_mode,
00374     uint8_t                         zone_id,
00375     VL53L1_dmax_calibration_data_t *pdmax_cal);
00376 
00377 
00378 
00379 
00380 VL53L1_Error VL53L1_set_hist_dmax_config(
00381     VL53L1_DEV                      Dev,
00382     VL53L1_hist_gen3_dmax_config_t *pdmax_cfg);
00383 
00384 
00385 
00386 VL53L1_Error VL53L1_get_hist_dmax_config(
00387     VL53L1_DEV                      Dev,
00388     VL53L1_hist_gen3_dmax_config_t *pdmax_cfg);
00389 
00390 
00391 
00392 
00393 VL53L1_Error VL53L1_set_offset_calibration_mode(
00394     VL53L1_DEV                      Dev,
00395     VL53L1_OffsetCalibrationMode   offset_cal_mode);
00396 
00397 
00398 
00399 
00400 VL53L1_Error VL53L1_get_offset_calibration_mode(
00401     VL53L1_DEV                      Dev,
00402     VL53L1_OffsetCalibrationMode  *poffset_cal_mode);
00403 
00404 
00405 
00406 
00407 VL53L1_Error VL53L1_set_offset_correction_mode(
00408     VL53L1_DEV                     Dev,
00409     VL53L1_OffsetCalibrationMode   offset_cor_mode);
00410 
00411 
00412 
00413 
00414 VL53L1_Error VL53L1_get_offset_correction_mode(
00415     VL53L1_DEV                    Dev,
00416     VL53L1_OffsetCorrectionMode  *poffset_cor_mode);
00417 
00418 
00419 
00420 
00421 VL53L1_Error VL53L1_set_zone_calibration_data(
00422     VL53L1_DEV                         Dev,
00423     VL53L1_zone_calibration_results_t *pzone_cal);
00424 
00425 
00426 
00427 
00428 VL53L1_Error VL53L1_get_zone_calibration_data(
00429     VL53L1_DEV                         Dev,
00430     VL53L1_zone_calibration_results_t *pzone_cal);
00431 
00432 
00433 
00434 
00435 VL53L1_Error VL53L1_get_lite_xtalk_margin_kcps(
00436     VL53L1_DEV                          Dev,
00437     int16_t                           *pxtalk_margin);
00438 
00439 
00440 
00441 VL53L1_Error VL53L1_set_lite_xtalk_margin_kcps(
00442     VL53L1_DEV                          Dev,
00443     int16_t                             xtalk_margin);
00444 
00445 
00446 
00447 
00448 VL53L1_Error VL53L1_get_histogram_xtalk_margin_kcps(
00449     VL53L1_DEV                          Dev,
00450     int16_t                           *pxtalk_margin);
00451 
00452 
00453 
00454 VL53L1_Error VL53L1_set_histogram_xtalk_margin_kcps(
00455     VL53L1_DEV                          Dev,
00456     int16_t                             xtalk_margin);
00457 
00458 
00459 
00460 VL53L1_Error VL53L1_get_histogram_phase_consistency(
00461     VL53L1_DEV                          Dev,
00462     uint8_t                            *pphase_consistency);
00463 
00464 
00465 
00466 VL53L1_Error VL53L1_set_histogram_phase_consistency(
00467     VL53L1_DEV                          Dev,
00468     uint8_t                             phase_consistency);
00469 
00470 
00471 
00472 VL53L1_Error VL53L1_get_histogram_event_consistency(
00473     VL53L1_DEV                          Dev,
00474     uint8_t                            *pevent_consistency);
00475 
00476 
00477 
00478 VL53L1_Error VL53L1_set_histogram_event_consistency(
00479     VL53L1_DEV                          Dev,
00480     uint8_t                             event_consistency);
00481 
00482 
00483 
00484 VL53L1_Error VL53L1_get_histogram_ambient_threshold_sigma(
00485     VL53L1_DEV                          Dev,
00486     uint8_t                            *pamb_thresh_sigma);
00487 
00488 
00489 
00490 VL53L1_Error VL53L1_set_histogram_ambient_threshold_sigma(
00491     VL53L1_DEV                          Dev,
00492     uint8_t                             amb_thresh_sigma);
00493 
00494 
00495 
00496 VL53L1_Error VL53L1_get_lite_min_count_rate(
00497     VL53L1_DEV                          Dev,
00498     uint16_t                           *plite_mincountrate);
00499 
00500 
00501 
00502 
00503 VL53L1_Error VL53L1_set_lite_min_count_rate(
00504     VL53L1_DEV                          Dev,
00505     uint16_t                            lite_mincountrate);
00506 
00507 
00508 
00509 
00510 
00511 VL53L1_Error VL53L1_get_lite_sigma_threshold(
00512     VL53L1_DEV                          Dev,
00513     uint16_t                           *plite_sigma);
00514 
00515 
00516 
00517 
00518 VL53L1_Error VL53L1_set_lite_sigma_threshold(
00519     VL53L1_DEV                          Dev,
00520     uint16_t                            lite_sigma);
00521 
00522 
00523 
00524 
00525 VL53L1_Error VL53L1_restore_xtalk_nvm_default(
00526     VL53L1_DEV                     Dev);
00527 
00528 
00529 
00530 VL53L1_Error VL53L1_get_xtalk_detect_config(
00531     VL53L1_DEV                          Dev,
00532     int16_t                            *pmax_valid_range_mm,
00533     int16_t                            *pmin_valid_range_mm,
00534     uint16_t                           *pmax_valid_rate_kcps,
00535     uint16_t                           *pmax_sigma_mm);
00536 
00537 
00538 
00539 VL53L1_Error VL53L1_set_xtalk_detect_config(
00540     VL53L1_DEV                          Dev,
00541     int16_t                             max_valid_range_mm,
00542     int16_t                             min_valid_range_mm,
00543     uint16_t                            max_valid_rate_kcps,
00544     uint16_t                            max_sigma_mm);
00545 
00546 
00547 
00548 VL53L1_Error VL53L1_get_target_order_mode(
00549     VL53L1_DEV                          Dev,
00550     VL53L1_HistTargetOrder             *phist_target_order);
00551 
00552 
00553 
00554 VL53L1_Error VL53L1_set_target_order_mode(
00555     VL53L1_DEV                          Dev,
00556     VL53L1_HistTargetOrder              hist_target_order);
00557 
00558 
00559 
00560 
00561 VL53L1_Error VL53L1_set_dmax_reflectance_values(
00562     VL53L1_DEV                          Dev,
00563     VL53L1_dmax_reflectance_array_t    *pdmax_reflectances);
00564 
00565 
00566 
00567 VL53L1_Error VL53L1_get_dmax_reflectance_values(
00568     VL53L1_DEV                          Dev,
00569     VL53L1_dmax_reflectance_array_t    *pdmax_reflectances);
00570 
00571 
00572 
00573 VL53L1_Error VL53L1_set_vhv_config(
00574     VL53L1_DEV                   Dev,
00575     uint8_t                      vhv_init_en,
00576     uint8_t                      vhv_init_value);
00577 
00578 
00579 
00580 VL53L1_Error VL53L1_get_vhv_config(
00581     VL53L1_DEV                   Dev,
00582     uint8_t                     *pvhv_init_en,
00583     uint8_t                     *pvhv_init_value);
00584 
00585 
00586 
00587 VL53L1_Error VL53L1_set_vhv_loopbound(
00588     VL53L1_DEV                   Dev,
00589     uint8_t                      vhv_loopbound);
00590 
00591 
00592 
00593 VL53L1_Error VL53L1_get_vhv_loopbound(
00594     VL53L1_DEV                   Dev,
00595     uint8_t                     *pvhv_loopbound);
00596 
00597 
00598 
00599 VL53L1_Error VL53L1_get_tuning_parm(
00600     VL53L1_DEV                     Dev,
00601     VL53L1_TuningParms             tuning_parm_key,
00602     int32_t                       *ptuning_parm_value);
00603 
00604 
00605 
00606 VL53L1_Error VL53L1_set_tuning_parm(
00607     VL53L1_DEV                     Dev,
00608     VL53L1_TuningParms             tuning_parm_key,
00609     int32_t                        tuning_parm_value);
00610 
00611 
00612 
00613 VL53L1_Error VL53L1_dynamic_xtalk_correction_enable(
00614     VL53L1_DEV                     Dev
00615     );
00616 
00617 
00618 
00619 VL53L1_Error VL53L1_dynamic_xtalk_correction_disable(
00620     VL53L1_DEV                     Dev
00621     );
00622 
00623 
00624 
00625 
00626 VL53L1_Error VL53L1_dynamic_xtalk_correction_apply_enable(
00627     VL53L1_DEV                          Dev
00628     );
00629 
00630 
00631 
00632 VL53L1_Error VL53L1_dynamic_xtalk_correction_apply_disable(
00633     VL53L1_DEV                          Dev
00634     );
00635 
00636 
00637 
00638 VL53L1_Error VL53L1_dynamic_xtalk_correction_single_apply_enable(
00639     VL53L1_DEV                          Dev
00640     );
00641 
00642 
00643 
00644 VL53L1_Error VL53L1_dynamic_xtalk_correction_single_apply_disable(
00645     VL53L1_DEV                          Dev
00646     );
00647 
00648 
00649 
00650 VL53L1_Error VL53L1_dynamic_xtalk_correction_set_scalers(
00651     VL53L1_DEV  Dev,
00652     int16_t     x_scaler_in,
00653     int16_t     y_scaler_in,
00654     uint8_t     user_scaler_set_in
00655     );
00656 
00657 
00658 
00659 VL53L1_Error VL53L1_get_current_xtalk_settings(
00660     VL53L1_DEV                          Dev,
00661     VL53L1_xtalk_calibration_results_t *pxtalk
00662     );
00663 
00664 
00665 
00666 VL53L1_Error VL53L1_set_current_xtalk_settings(
00667     VL53L1_DEV                          Dev,
00668     VL53L1_xtalk_calibration_results_t *pxtalk
00669     );
00670 
00671 VL53L1_Error VL53L1_load_patch(VL53L1_DEV Dev);
00672 
00673 VL53L1_Error VL53L1_unload_patch(VL53L1_DEV Dev);
00674 
00675 #ifdef __cplusplus
00676 }
00677 #endif
00678 
00679 #endif
00680