Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
vl53l1_api_debug.c
00001 00002 /******************************************************************************* 00003 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved 00004 00005 This file is part of VL53L1 Core and is dual licensed, 00006 either 'STMicroelectronics 00007 Proprietary license' 00008 or 'BSD 3-clause "New" or "Revised" License' , at your option. 00009 00010 ******************************************************************************** 00011 00012 'STMicroelectronics Proprietary license' 00013 00014 ******************************************************************************** 00015 00016 License terms: STMicroelectronics Proprietary in accordance with licensing 00017 terms at www.st.com/sla0081 00018 00019 STMicroelectronics confidential 00020 Reproduction and Communication of this document is strictly prohibited unless 00021 specifically authorized in writing by STMicroelectronics. 00022 00023 00024 ******************************************************************************** 00025 00026 Alternatively, VL53L1 Core may be distributed under the terms of 00027 'BSD 3-clause "New" or "Revised" License', in which case the following 00028 provisions apply instead of the ones 00029 mentioned above : 00030 00031 ******************************************************************************** 00032 00033 License terms: BSD 3-clause "New" or "Revised" License. 00034 00035 Redistribution and use in source and binary forms, with or without 00036 modification, are permitted provided that the following conditions are met: 00037 00038 1. Redistributions of source code must retain the above copyright notice, this 00039 list of conditions and the following disclaimer. 00040 00041 2. Redistributions in binary form must reproduce the above copyright notice, 00042 this list of conditions and the following disclaimer in the documentation 00043 and/or other materials provided with the distribution. 00044 00045 3. Neither the name of the copyright holder nor the names of its contributors 00046 may be used to endorse or promote products derived from this software 00047 without specific prior written permission. 00048 00049 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00050 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00051 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00052 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00053 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00054 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00055 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00056 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00057 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00058 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00059 00060 00061 ******************************************************************************** 00062 00063 */ 00064 00065 00066 00067 00068 #include "vl53l1_ll_def.h" 00069 #include "vl53l1_ll_device.h" 00070 #include "vl53l1_register_structs.h" 00071 #include "vl53l1_hist_structs.h" 00072 #include "vl53l1_nvm_structs.h" 00073 #include "vl53l1_nvm.h" 00074 #include "vl53l1_core.h" 00075 #include "vl53l1_api_debug.h" 00076 00077 #ifdef VL53L1_LOG_ENABLE 00078 #include "vl53l1_nvm_debug.h" 00079 #endif 00080 00081 #define LOG_FUNCTION_START(fmt, ...) \ 00082 _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__) 00083 #define LOG_FUNCTION_END(status, ...) \ 00084 _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__) 00085 #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ 00086 _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE, status, \ 00087 fmt, ##__VA_ARGS__) 00088 00089 #define trace_print(level, ...) \ 00090 _LOG_TRACE_PRINT(trace_flags, \ 00091 level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__) 00092 00093 00094 VL53L1_Error VL53L1_decode_calibration_data_buffer( 00095 uint16_t buf_size, 00096 uint8_t *pbuffer, 00097 VL53L1_calibration_data_t *pdata) 00098 { 00099 VL53L1_Error status = VL53L1_ERROR_NONE; 00100 00101 LOG_FUNCTION_START(""); 00102 00103 if (sizeof(VL53L1_calibration_data_t) > buf_size) 00104 return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; 00105 00106 memcpy(pdata, pbuffer, sizeof(VL53L1_calibration_data_t)); 00107 00108 LOG_FUNCTION_END(status); 00109 00110 return status; 00111 } 00112 00113 00114 VL53L1_Error VL53L1_get_nvm_debug_data( 00115 VL53L1_DEV Dev, 00116 VL53L1_decoded_nvm_data_t *pdata) 00117 { 00118 00119 00120 VL53L1_Error status = VL53L1_ERROR_NONE; 00121 00122 LOG_FUNCTION_START(""); 00123 00124 status = VL53L1_read_nvm(Dev, 0, pdata); 00125 00126 #ifdef VL53L1_LOG_ENABLE 00127 if (status == VL53L1_ERROR_NONE) 00128 VL53L1_print_decoded_nvm_data( 00129 pdata, 00130 "get_nvm_debug_data():pnvm_info.", 00131 VL53L1_TRACE_MODULE_NVM_DATA); 00132 #endif 00133 00134 LOG_FUNCTION_END(status); 00135 00136 return status; 00137 } 00138 00139 00140 VL53L1_Error VL53L1_get_histogram_debug_data( 00141 VL53L1_DEV Dev, 00142 VL53L1_histogram_bin_data_t *pdata) 00143 { 00144 00145 00146 VL53L1_Error status = VL53L1_ERROR_NONE; 00147 00148 VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); 00149 00150 LOG_FUNCTION_START(""); 00151 00152 00153 memcpy( 00154 pdata, 00155 &(pdev->hist_data), 00156 sizeof(VL53L1_histogram_bin_data_t)); 00157 00158 LOG_FUNCTION_END(status); 00159 00160 return status; 00161 } 00162 00163 00164 00165 00166 VL53L1_Error VL53L1_get_additional_data( 00167 VL53L1_DEV Dev, 00168 VL53L1_additional_data_t *pdata) 00169 { 00170 00171 00172 VL53L1_Error status = VL53L1_ERROR_NONE; 00173 00174 VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); 00175 00176 LOG_FUNCTION_START(""); 00177 00178 00179 00180 pdata->preset_mode = pdev->preset_mode; 00181 pdata->zone_preset = pdev->zone_preset; 00182 pdata->measurement_mode = pdev->measurement_mode; 00183 pdata->offset_calibration_mode = pdev->offset_calibration_mode; 00184 pdata->offset_correction_mode = pdev->offset_correction_mode; 00185 pdata->dmax_mode = pdev->dmax_mode; 00186 00187 pdata->phasecal_config_timeout_us = pdev->phasecal_config_timeout_us; 00188 pdata->mm_config_timeout_us = pdev->mm_config_timeout_us; 00189 pdata->range_config_timeout_us = pdev->range_config_timeout_us; 00190 pdata->inter_measurement_period_ms = pdev->inter_measurement_period_ms; 00191 pdata->dss_config__target_total_rate_mcps = 00192 pdev->dss_config__target_total_rate_mcps; 00193 00194 00195 00196 status = 00197 VL53L1_get_histogram_debug_data( 00198 Dev, 00199 &(pdata->VL53L1_p_010)); 00200 00201 LOG_FUNCTION_END(status); 00202 00203 return status; 00204 } 00205 00206 00207 00208 00209 VL53L1_Error VL53L1_get_xtalk_debug_data( 00210 VL53L1_DEV Dev, 00211 VL53L1_xtalk_debug_data_t *pdata) 00212 { 00213 00214 00215 VL53L1_Error status = VL53L1_ERROR_NONE; 00216 00217 VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); 00218 00219 LOG_FUNCTION_START(""); 00220 00221 00222 memcpy( 00223 &(pdata->customer), 00224 &(pdev->customer), 00225 sizeof(VL53L1_customer_nvm_managed_t)); 00226 00227 memcpy( 00228 &(pdata->xtalk_cfg), 00229 &(pdev->xtalk_cfg), 00230 sizeof(VL53L1_xtalk_config_t)); 00231 00232 memcpy( 00233 &(pdata->hist_data), 00234 &(pdev->hist_data), 00235 sizeof(VL53L1_histogram_bin_data_t)); 00236 00237 memcpy( 00238 &(pdata->xtalk_shapes), 00239 &(pdev->xtalk_shapes), 00240 sizeof(VL53L1_xtalk_histogram_data_t)); 00241 00242 memcpy( 00243 &(pdata->xtalk_results), 00244 &(pdev->xtalk_results), 00245 sizeof(VL53L1_xtalk_range_results_t)); 00246 00247 LOG_FUNCTION_END(status); 00248 00249 return status; 00250 } 00251 00252 00253 VL53L1_Error VL53L1_get_offset_debug_data( 00254 VL53L1_DEV Dev, 00255 VL53L1_offset_debug_data_t *pdata) 00256 { 00257 00258 00259 VL53L1_Error status = VL53L1_ERROR_NONE; 00260 00261 VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); 00262 00263 LOG_FUNCTION_START(""); 00264 00265 00266 memcpy( 00267 &(pdata->customer), 00268 &(pdev->customer), 00269 sizeof(VL53L1_customer_nvm_managed_t)); 00270 00271 memcpy( 00272 &(pdata->fmt_dmax_cal), 00273 &(pdev->fmt_dmax_cal), 00274 sizeof(VL53L1_dmax_calibration_data_t)); 00275 00276 memcpy( 00277 &(pdata->cust_dmax_cal), 00278 &(pdev->cust_dmax_cal), 00279 sizeof(VL53L1_dmax_calibration_data_t)); 00280 00281 memcpy( 00282 &(pdata->add_off_cal_data), 00283 &(pdev->add_off_cal_data), 00284 sizeof(VL53L1_additional_offset_cal_data_t)); 00285 00286 memcpy( 00287 &(pdata->offset_results), 00288 &(pdev->offset_results), 00289 sizeof(VL53L1_offset_range_results_t)); 00290 00291 LOG_FUNCTION_END(status); 00292 00293 return status; 00294 } 00295 00296 #ifdef VL53L1_LOG_ENABLE 00297 00298 void VL53L1_signed_fixed_point_sprintf( 00299 int32_t signed_fp_value, 00300 uint8_t frac_bits, 00301 uint16_t buf_size, 00302 char *pbuffer) 00303 { 00304 00305 00306 uint32_t fp_value = 0; 00307 uint32_t unity_fp_value = 0; 00308 uint32_t sign_bit = 0; 00309 uint32_t int_part = 0; 00310 uint32_t frac_part = 0; 00311 uint32_t dec_points = 0; 00312 uint32_t dec_scaler = 0; 00313 uint32_t dec_part = 0; 00314 00315 uint64_t tmp_long_int = 0; 00316 00317 char fmt[VL53L1_MAX_STRING_LENGTH]; 00318 00319 SUPPRESS_UNUSED_WARNING(buf_size); 00320 00321 00322 00323 sign_bit = signed_fp_value >> 31; 00324 00325 if (sign_bit > 0) { 00326 fp_value = 0x80000000 - 00327 (0x7FFFFFFF & (uint32_t)signed_fp_value); 00328 } else 00329 fp_value = (uint32_t)signed_fp_value; 00330 00331 int_part = fp_value >> frac_bits; 00332 unity_fp_value = 0x01 << frac_bits; 00333 frac_part = fp_value & (unity_fp_value-1); 00334 00335 00336 dec_points = 2; 00337 dec_scaler = 100; 00338 00339 while (dec_scaler < unity_fp_value) { 00340 dec_points++; 00341 dec_scaler *= 10; 00342 } 00343 00344 00345 if (sign_bit > 0) 00346 sprintf(fmt, "-%%u.%%0%uu", dec_points); 00347 else 00348 sprintf(fmt, "%%u.%%0%uu", dec_points); 00349 00350 00351 tmp_long_int = (uint64_t)frac_part * (uint64_t)dec_scaler; 00352 tmp_long_int += (uint64_t)unity_fp_value/2; 00353 00354 tmp_long_int = do_division_u(tmp_long_int, (uint64_t)unity_fp_value); 00355 00356 dec_part = (uint32_t)tmp_long_int; 00357 00358 00359 sprintf( 00360 pbuffer, 00361 fmt, 00362 int_part, 00363 dec_part); 00364 } 00365 00366 00367 void VL53L1_print_static_nvm_managed( 00368 VL53L1_static_nvm_managed_t *pdata, 00369 char *pprefix, 00370 uint32_t trace_flags) 00371 { 00372 00373 00374 char fp_text[VL53L1_MAX_STRING_LENGTH]; 00375 00376 trace_print( 00377 VL53L1_TRACE_LEVEL_INFO, 00378 "%s%s = 0x%02X\n", 00379 pprefix, 00380 "i2c_slave__device_address", 00381 pdata->i2c_slave__device_address); 00382 00383 trace_print( 00384 VL53L1_TRACE_LEVEL_INFO, 00385 "%s%s = %u\n", 00386 pprefix, 00387 "ana_config__vhv_ref_sel_vddpix", 00388 pdata->ana_config__vhv_ref_sel_vddpix); 00389 00390 trace_print( 00391 VL53L1_TRACE_LEVEL_INFO, 00392 "%s%s = %u\n", 00393 pprefix, 00394 "ana_config__vhv_ref_sel_vquench", 00395 pdata->ana_config__vhv_ref_sel_vquench); 00396 00397 trace_print( 00398 VL53L1_TRACE_LEVEL_INFO, 00399 "%s%s = %u\n", 00400 pprefix, 00401 "ana_config__reg_avdd1v2_sel", 00402 pdata->ana_config__reg_avdd1v2_sel); 00403 00404 trace_print( 00405 VL53L1_TRACE_LEVEL_INFO, 00406 "%s%s = %u\n", 00407 pprefix, 00408 "ana_config__fast_osc__trim", 00409 pdata->ana_config__fast_osc__trim); 00410 00411 VL53L1_signed_fixed_point_sprintf( 00412 (int32_t)pdata->osc_measured__fast_osc__frequency, 00413 12, 00414 VL53L1_MAX_STRING_LENGTH, 00415 fp_text); 00416 00417 trace_print( 00418 VL53L1_TRACE_LEVEL_INFO, 00419 "%s%s = %s\n", 00420 pprefix, 00421 "osc_measured__fast_osc__frequency", 00422 fp_text); 00423 00424 trace_print( 00425 VL53L1_TRACE_LEVEL_INFO, 00426 "%s%s = %u\n", 00427 pprefix, 00428 "vhv_config__timeout_macrop_loop_bound", 00429 pdata->vhv_config__timeout_macrop_loop_bound); 00430 00431 trace_print( 00432 VL53L1_TRACE_LEVEL_INFO, 00433 "%s%s = %u\n", 00434 pprefix, 00435 "vhv_config__count_thresh", 00436 pdata->vhv_config__count_thresh); 00437 00438 trace_print( 00439 VL53L1_TRACE_LEVEL_INFO, 00440 "%s%s = %u\n", 00441 pprefix, 00442 "vhv_config__offset", 00443 pdata->vhv_config__offset); 00444 00445 trace_print( 00446 VL53L1_TRACE_LEVEL_INFO, 00447 "%s%s = %u\n", 00448 pprefix, 00449 "vhv_config__init", 00450 pdata->vhv_config__init); 00451 } 00452 00453 00454 void VL53L1_print_customer_nvm_managed( 00455 VL53L1_customer_nvm_managed_t *pdata, 00456 char *pprefix, 00457 uint32_t trace_flags) 00458 { 00459 00460 00461 char fp_text[VL53L1_MAX_STRING_LENGTH]; 00462 int16_t tmpi16; 00463 00464 trace_print(VL53L1_TRACE_LEVEL_INFO, 00465 "%s%s = %u\n", 00466 pprefix, 00467 "global_config__spad_enables_ref_0", 00468 pdata->global_config__spad_enables_ref_0); 00469 00470 trace_print(VL53L1_TRACE_LEVEL_INFO, 00471 "%s%s = %u\n", 00472 pprefix, 00473 "global_config__spad_enables_ref_1", 00474 pdata->global_config__spad_enables_ref_1); 00475 00476 trace_print(VL53L1_TRACE_LEVEL_INFO, 00477 "%s%s = %u\n", 00478 pprefix, 00479 "global_config__spad_enables_ref_2", 00480 pdata->global_config__spad_enables_ref_2); 00481 00482 trace_print(VL53L1_TRACE_LEVEL_INFO, 00483 "%s%s = %u\n", 00484 pprefix, 00485 "global_config__spad_enables_ref_3", 00486 pdata->global_config__spad_enables_ref_3); 00487 00488 trace_print(VL53L1_TRACE_LEVEL_INFO, 00489 "%s%s = %u\n", 00490 pprefix, 00491 "global_config__spad_enables_ref_4", 00492 pdata->global_config__spad_enables_ref_4); 00493 00494 trace_print(VL53L1_TRACE_LEVEL_INFO, 00495 "%s%s = %u\n", 00496 pprefix, 00497 "global_config__spad_enables_ref_5", 00498 pdata->global_config__spad_enables_ref_5); 00499 00500 trace_print(VL53L1_TRACE_LEVEL_INFO, 00501 "%s%s = %u\n", 00502 pprefix, 00503 "global_config__ref_en_start_select", 00504 pdata->global_config__ref_en_start_select); 00505 00506 trace_print(VL53L1_TRACE_LEVEL_INFO, 00507 "%s%s = %u\n", 00508 pprefix, 00509 "ref_spad_man__num_requested_ref_spads", 00510 pdata->ref_spad_man__num_requested_ref_spads); 00511 00512 trace_print(VL53L1_TRACE_LEVEL_INFO, 00513 "%s%s = %u\n", 00514 pprefix, 00515 "ref_spad_man__ref_location", 00516 pdata->ref_spad_man__ref_location); 00517 00518 VL53L1_signed_fixed_point_sprintf( 00519 (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps, 00520 9, 00521 VL53L1_MAX_STRING_LENGTH, 00522 fp_text); 00523 00524 trace_print(VL53L1_TRACE_LEVEL_INFO, 00525 "%s%s = %s\n", 00526 pprefix, 00527 "algo__crosstalk_compensation_plane_offset_kcps", 00528 fp_text); 00529 00530 tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; 00531 VL53L1_signed_fixed_point_sprintf( 00532 (int32_t)tmpi16, 00533 11, 00534 VL53L1_MAX_STRING_LENGTH, 00535 fp_text); 00536 00537 trace_print(VL53L1_TRACE_LEVEL_INFO, 00538 "%s%s = %s\n", 00539 pprefix, 00540 "algo__crosstalk_compensation_x_plane_gradient_kcps", 00541 fp_text); 00542 00543 tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; 00544 VL53L1_signed_fixed_point_sprintf( 00545 (int32_t)tmpi16, 00546 11, 00547 VL53L1_MAX_STRING_LENGTH, 00548 fp_text); 00549 00550 trace_print(VL53L1_TRACE_LEVEL_INFO, 00551 "%s%s = %s\n", 00552 pprefix, 00553 "algo__crosstalk_compensation_y_plane_gradient_kcps", 00554 fp_text); 00555 00556 VL53L1_signed_fixed_point_sprintf( 00557 (int32_t)pdata->ref_spad_char__total_rate_target_mcps, 00558 7, 00559 VL53L1_MAX_STRING_LENGTH, 00560 fp_text); 00561 00562 trace_print(VL53L1_TRACE_LEVEL_INFO, 00563 "%s%s = %s\n", 00564 pprefix, 00565 "ref_spad_char__total_rate_target_mcps", 00566 fp_text); 00567 00568 VL53L1_signed_fixed_point_sprintf( 00569 (int32_t)pdata->algo__part_to_part_range_offset_mm, 00570 2, 00571 VL53L1_MAX_STRING_LENGTH, 00572 fp_text); 00573 00574 trace_print(VL53L1_TRACE_LEVEL_INFO, 00575 "%s%s = %s\n", 00576 pprefix, 00577 "algo__part_to_part_range_offset_mm", 00578 fp_text); 00579 00580 trace_print(VL53L1_TRACE_LEVEL_INFO, 00581 "%s%s = %d\n", 00582 pprefix, 00583 "mm_config__inner_offset_mm", 00584 pdata->mm_config__inner_offset_mm); 00585 00586 trace_print(VL53L1_TRACE_LEVEL_INFO, 00587 "%s%s = %d\n", 00588 pprefix, 00589 "mm_config__outer_offset_mm", 00590 pdata->mm_config__outer_offset_mm); 00591 } 00592 00593 00594 void VL53L1_print_nvm_copy_data( 00595 VL53L1_nvm_copy_data_t *pdata, 00596 char *pprefix, 00597 uint32_t trace_flags) 00598 { 00599 00600 00601 trace_print( 00602 VL53L1_TRACE_LEVEL_INFO, 00603 "%s%s = %u\n", 00604 pprefix, 00605 "identification__model_id", 00606 pdata->identification__model_id); 00607 00608 trace_print( 00609 VL53L1_TRACE_LEVEL_INFO, 00610 "%s%s = %u\n", 00611 pprefix, 00612 "identification__module_type", 00613 pdata->identification__module_type); 00614 00615 trace_print( 00616 VL53L1_TRACE_LEVEL_INFO, 00617 "%s%s = %u\n", 00618 pprefix, 00619 "identification__revision_id", 00620 pdata->identification__revision_id); 00621 00622 trace_print( 00623 VL53L1_TRACE_LEVEL_INFO, 00624 "%s%s = %u\n", 00625 pprefix, 00626 "identification__module_id", 00627 pdata->identification__module_id); 00628 00629 trace_print( 00630 VL53L1_TRACE_LEVEL_INFO, 00631 "%s%s = %u\n", 00632 pprefix, 00633 "ana_config__fast_osc__trim_max", 00634 pdata->ana_config__fast_osc__trim_max); 00635 00636 trace_print( 00637 VL53L1_TRACE_LEVEL_INFO, 00638 "%s%s = %u\n", 00639 pprefix, 00640 "ana_config__fast_osc__freq_set", 00641 pdata->ana_config__fast_osc__freq_set); 00642 00643 trace_print( 00644 VL53L1_TRACE_LEVEL_INFO, 00645 "%s%s = %u\n", 00646 pprefix, 00647 "ana_config__vcsel_trim", 00648 pdata->ana_config__vcsel_trim); 00649 00650 trace_print( 00651 VL53L1_TRACE_LEVEL_INFO, 00652 "%s%s = %u\n", 00653 pprefix, 00654 "ana_config__vcsel_selion", 00655 pdata->ana_config__vcsel_selion); 00656 00657 trace_print( 00658 VL53L1_TRACE_LEVEL_INFO, 00659 "%s%s = %u\n", 00660 pprefix, 00661 "ana_config__vcsel_selion_max", 00662 pdata->ana_config__vcsel_selion_max); 00663 00664 trace_print( 00665 VL53L1_TRACE_LEVEL_INFO, 00666 "%s%s = %u\n", 00667 pprefix, 00668 "protected_laser_safety__lock_bit", 00669 pdata->protected_laser_safety__lock_bit); 00670 00671 trace_print( 00672 VL53L1_TRACE_LEVEL_INFO, 00673 "%s%s = %u\n", 00674 pprefix, 00675 "laser_safety__key", 00676 pdata->laser_safety__key); 00677 00678 trace_print( 00679 VL53L1_TRACE_LEVEL_INFO, 00680 "%s%s = %u\n", 00681 pprefix, 00682 "laser_safety__key_ro", 00683 pdata->laser_safety__key_ro); 00684 00685 trace_print( 00686 VL53L1_TRACE_LEVEL_INFO, 00687 "%s%s = %u\n", 00688 pprefix, 00689 "laser_safety__clip", 00690 pdata->laser_safety__clip); 00691 00692 trace_print( 00693 VL53L1_TRACE_LEVEL_INFO, 00694 "%s%s = %u\n", 00695 pprefix, 00696 "laser_safety__mult", 00697 pdata->laser_safety__mult); 00698 00699 trace_print( 00700 VL53L1_TRACE_LEVEL_INFO, 00701 "%s%s = %u\n", 00702 pprefix, 00703 "global_config__spad_enables_rtn_0", 00704 pdata->global_config__spad_enables_rtn_0); 00705 00706 trace_print( 00707 VL53L1_TRACE_LEVEL_INFO, 00708 "%s%s = %u\n", 00709 pprefix, 00710 "global_config__spad_enables_rtn_1", 00711 pdata->global_config__spad_enables_rtn_1); 00712 00713 trace_print( 00714 VL53L1_TRACE_LEVEL_INFO, 00715 "%s%s = %u\n", 00716 pprefix, 00717 "global_config__spad_enables_rtn_2", 00718 pdata->global_config__spad_enables_rtn_2); 00719 00720 trace_print( 00721 VL53L1_TRACE_LEVEL_INFO, 00722 "%s%s = %u\n", 00723 pprefix, 00724 "global_config__spad_enables_rtn_3", 00725 pdata->global_config__spad_enables_rtn_3); 00726 00727 trace_print( 00728 VL53L1_TRACE_LEVEL_INFO, 00729 "%s%s = %u\n", 00730 pprefix, 00731 "global_config__spad_enables_rtn_4", 00732 pdata->global_config__spad_enables_rtn_4); 00733 00734 trace_print( 00735 VL53L1_TRACE_LEVEL_INFO, 00736 "%s%s = %u\n", 00737 pprefix, 00738 "global_config__spad_enables_rtn_5", 00739 pdata->global_config__spad_enables_rtn_5); 00740 00741 trace_print( 00742 VL53L1_TRACE_LEVEL_INFO, 00743 "%s%s = %u\n", 00744 pprefix, 00745 "global_config__spad_enables_rtn_6", 00746 pdata->global_config__spad_enables_rtn_6); 00747 00748 trace_print( 00749 VL53L1_TRACE_LEVEL_INFO, 00750 "%s%s = %u\n", 00751 pprefix, 00752 "global_config__spad_enables_rtn_7", 00753 pdata->global_config__spad_enables_rtn_7); 00754 00755 trace_print( 00756 VL53L1_TRACE_LEVEL_INFO, 00757 "%s%s = %u\n", 00758 pprefix, 00759 "global_config__spad_enables_rtn_8", 00760 pdata->global_config__spad_enables_rtn_8); 00761 00762 trace_print( 00763 VL53L1_TRACE_LEVEL_INFO, 00764 "%s%s = %u\n", 00765 pprefix, 00766 "global_config__spad_enables_rtn_9", 00767 pdata->global_config__spad_enables_rtn_9); 00768 00769 trace_print( 00770 VL53L1_TRACE_LEVEL_INFO, 00771 "%s%s = %u\n", 00772 pprefix, 00773 "global_config__spad_enables_rtn_10", 00774 pdata->global_config__spad_enables_rtn_10); 00775 00776 trace_print( 00777 VL53L1_TRACE_LEVEL_INFO, 00778 "%s%s = %u\n", 00779 pprefix, 00780 "global_config__spad_enables_rtn_11", 00781 pdata->global_config__spad_enables_rtn_11); 00782 00783 trace_print( 00784 VL53L1_TRACE_LEVEL_INFO, 00785 "%s%s = %u\n", 00786 pprefix, 00787 "global_config__spad_enables_rtn_12", 00788 pdata->global_config__spad_enables_rtn_12); 00789 00790 trace_print( 00791 VL53L1_TRACE_LEVEL_INFO, 00792 "%s%s = %u\n", 00793 pprefix, 00794 "global_config__spad_enables_rtn_13", 00795 pdata->global_config__spad_enables_rtn_13); 00796 00797 trace_print( 00798 VL53L1_TRACE_LEVEL_INFO, 00799 "%s%s = %u\n", 00800 pprefix, 00801 "global_config__spad_enables_rtn_14", 00802 pdata->global_config__spad_enables_rtn_14); 00803 00804 trace_print( 00805 VL53L1_TRACE_LEVEL_INFO, 00806 "%s%s = %u\n", 00807 pprefix, 00808 "global_config__spad_enables_rtn_15", 00809 pdata->global_config__spad_enables_rtn_15); 00810 00811 trace_print( 00812 VL53L1_TRACE_LEVEL_INFO, 00813 "%s%s = %u\n", 00814 pprefix, 00815 "global_config__spad_enables_rtn_16", 00816 pdata->global_config__spad_enables_rtn_16); 00817 00818 trace_print( 00819 VL53L1_TRACE_LEVEL_INFO, 00820 "%s%s = %u\n", 00821 pprefix, 00822 "global_config__spad_enables_rtn_17", 00823 pdata->global_config__spad_enables_rtn_17); 00824 00825 trace_print( 00826 VL53L1_TRACE_LEVEL_INFO, 00827 "%s%s = %u\n", 00828 pprefix, 00829 "global_config__spad_enables_rtn_18", 00830 pdata->global_config__spad_enables_rtn_18); 00831 00832 trace_print( 00833 VL53L1_TRACE_LEVEL_INFO, 00834 "%s%s = %u\n", 00835 pprefix, 00836 "global_config__spad_enables_rtn_19", 00837 pdata->global_config__spad_enables_rtn_19); 00838 00839 trace_print( 00840 VL53L1_TRACE_LEVEL_INFO, 00841 "%s%s = %u\n", 00842 pprefix, 00843 "global_config__spad_enables_rtn_20", 00844 pdata->global_config__spad_enables_rtn_20); 00845 00846 trace_print( 00847 VL53L1_TRACE_LEVEL_INFO, 00848 "%s%s = %u\n", 00849 pprefix, 00850 "global_config__spad_enables_rtn_21", 00851 pdata->global_config__spad_enables_rtn_21); 00852 00853 trace_print( 00854 VL53L1_TRACE_LEVEL_INFO, 00855 "%s%s = %u\n", 00856 pprefix, 00857 "global_config__spad_enables_rtn_22", 00858 pdata->global_config__spad_enables_rtn_22); 00859 00860 trace_print( 00861 VL53L1_TRACE_LEVEL_INFO, 00862 "%s%s = %u\n", 00863 pprefix, 00864 "global_config__spad_enables_rtn_23", 00865 pdata->global_config__spad_enables_rtn_23); 00866 00867 trace_print( 00868 VL53L1_TRACE_LEVEL_INFO, 00869 "%s%s = %u\n", 00870 pprefix, 00871 "global_config__spad_enables_rtn_24", 00872 pdata->global_config__spad_enables_rtn_24); 00873 00874 trace_print( 00875 VL53L1_TRACE_LEVEL_INFO, 00876 "%s%s = %u\n", 00877 pprefix, 00878 "global_config__spad_enables_rtn_25", 00879 pdata->global_config__spad_enables_rtn_25); 00880 00881 trace_print( 00882 VL53L1_TRACE_LEVEL_INFO, 00883 "%s%s = %u\n", 00884 pprefix, 00885 "global_config__spad_enables_rtn_26", 00886 pdata->global_config__spad_enables_rtn_26); 00887 00888 trace_print( 00889 VL53L1_TRACE_LEVEL_INFO, 00890 "%s%s = %u\n", 00891 pprefix, 00892 "global_config__spad_enables_rtn_27", 00893 pdata->global_config__spad_enables_rtn_27); 00894 00895 trace_print( 00896 VL53L1_TRACE_LEVEL_INFO, 00897 "%s%s = %u\n", 00898 pprefix, 00899 "global_config__spad_enables_rtn_28", 00900 pdata->global_config__spad_enables_rtn_28); 00901 00902 trace_print( 00903 VL53L1_TRACE_LEVEL_INFO, 00904 "%s%s = %u\n", 00905 pprefix, 00906 "global_config__spad_enables_rtn_29", 00907 pdata->global_config__spad_enables_rtn_29); 00908 00909 trace_print( 00910 VL53L1_TRACE_LEVEL_INFO, 00911 "%s%s = %u\n", 00912 pprefix, 00913 "global_config__spad_enables_rtn_30", 00914 pdata->global_config__spad_enables_rtn_30); 00915 00916 trace_print( 00917 VL53L1_TRACE_LEVEL_INFO, 00918 "%s%s = %u\n", 00919 pprefix, 00920 "global_config__spad_enables_rtn_31", 00921 pdata->global_config__spad_enables_rtn_31); 00922 00923 trace_print( 00924 VL53L1_TRACE_LEVEL_INFO, 00925 "%s%s = %u\n", 00926 pprefix, 00927 "roi_config__mode_roi_centre_spad", 00928 pdata->roi_config__mode_roi_centre_spad); 00929 00930 trace_print( 00931 VL53L1_TRACE_LEVEL_INFO, 00932 "%s%s = 0x%02X\n", 00933 pprefix, 00934 "roi_config__mode_roi_xy_size", 00935 pdata->roi_config__mode_roi_xy_size); 00936 } 00937 00938 00939 void VL53L1_print_histogram_bin_data( 00940 VL53L1_histogram_bin_data_t *pdata, 00941 char *pprefix, 00942 uint32_t trace_flags) 00943 { 00944 00945 00946 char fp_text[VL53L1_MAX_STRING_LENGTH]; 00947 char pre_text[VL53L1_MAX_STRING_LENGTH]; 00948 char *ppre_text = &(pre_text[0]); 00949 00950 uint8_t i = 0; 00951 00952 trace_print( 00953 VL53L1_TRACE_LEVEL_INFO, 00954 "%s%s = %u\n", 00955 pprefix, 00956 "cfg_device_state", 00957 pdata->cfg_device_state); 00958 00959 trace_print( 00960 VL53L1_TRACE_LEVEL_INFO, 00961 "%s%s = %u\n", 00962 pprefix, 00963 "rd_device_state", 00964 pdata->rd_device_state); 00965 00966 trace_print( 00967 VL53L1_TRACE_LEVEL_INFO, 00968 "%s%s = %u\n", 00969 pprefix, 00970 "VL53L1_p_022", 00971 pdata->VL53L1_p_022); 00972 00973 trace_print( 00974 VL53L1_TRACE_LEVEL_INFO, 00975 "%s%s = %u\n", 00976 pprefix, 00977 "VL53L1_p_023", 00978 pdata->VL53L1_p_023); 00979 00980 trace_print( 00981 VL53L1_TRACE_LEVEL_INFO, 00982 "%s%s = %u\n", 00983 pprefix, 00984 "VL53L1_p_024", 00985 pdata->VL53L1_p_024); 00986 00987 trace_print( 00988 VL53L1_TRACE_LEVEL_INFO, 00989 "%s%s = %u\n", 00990 pprefix, 00991 "number_of_ambient_bins", 00992 pdata->number_of_ambient_bins); 00993 00994 for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) { 00995 sprintf(ppre_text, "%sbin_seq[%u]", pprefix, i); 00996 trace_print( 00997 VL53L1_TRACE_LEVEL_INFO, 00998 "%s = %u\n", 00999 ppre_text, 01000 pdata->bin_seq[i]); 01001 } 01002 01003 for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) { 01004 sprintf(ppre_text, "%sbin_rep[%u]", pprefix, i); 01005 trace_print( 01006 VL53L1_TRACE_LEVEL_INFO, 01007 "%s = %u\n", 01008 ppre_text, 01009 pdata->bin_rep[i]); 01010 } 01011 01012 for (i = 0; i < pdata->VL53L1_p_024; i++) { 01013 sprintf(ppre_text, "%sbin_data[%u]", pprefix, i); 01014 trace_print( 01015 VL53L1_TRACE_LEVEL_INFO, 01016 "%s = %d\n", 01017 ppre_text, 01018 pdata->bin_data[i]); 01019 } 01020 01021 trace_print( 01022 VL53L1_TRACE_LEVEL_INFO, 01023 "%s%s = %u\n", 01024 pprefix, 01025 "result__interrupt_status", 01026 pdata->result__interrupt_status); 01027 01028 trace_print( 01029 VL53L1_TRACE_LEVEL_INFO, 01030 "%s%s = %u\n", 01031 pprefix, 01032 "result__range_status", 01033 pdata->result__range_status); 01034 01035 trace_print( 01036 VL53L1_TRACE_LEVEL_INFO, 01037 "%s%s = %u\n", 01038 pprefix, 01039 "result__report_status", 01040 pdata->result__report_status); 01041 01042 trace_print( 01043 VL53L1_TRACE_LEVEL_INFO, 01044 "%s%s = %u\n", 01045 pprefix, 01046 "result__stream_count", 01047 pdata->result__stream_count); 01048 01049 VL53L1_signed_fixed_point_sprintf( 01050 (int32_t)pdata->result__dss_actual_effective_spads, 01051 8, 01052 VL53L1_MAX_STRING_LENGTH, 01053 fp_text); 01054 01055 trace_print( 01056 VL53L1_TRACE_LEVEL_INFO, 01057 "%s%s = %s\n", 01058 pprefix, 01059 "result__dss_actual_effective_spads", 01060 fp_text); 01061 01062 VL53L1_signed_fixed_point_sprintf( 01063 (int32_t)pdata->phasecal_result__reference_phase, 01064 11, 01065 VL53L1_MAX_STRING_LENGTH, 01066 fp_text); 01067 01068 trace_print( 01069 VL53L1_TRACE_LEVEL_INFO, 01070 "%s%s = %s\n", 01071 pprefix, 01072 "phasecal_result__reference_phase", 01073 fp_text); 01074 01075 trace_print( 01076 VL53L1_TRACE_LEVEL_INFO, 01077 "%s%s = %u\n", 01078 pprefix, 01079 "phasecal_result__vcsel_start", 01080 pdata->phasecal_result__vcsel_start); 01081 01082 trace_print( 01083 VL53L1_TRACE_LEVEL_INFO, 01084 "%s%s = %u\n", 01085 pprefix, 01086 "cal_config__vcsel_start", 01087 pdata->cal_config__vcsel_start); 01088 01089 VL53L1_signed_fixed_point_sprintf( 01090 (uint32_t)pdata->vcsel_width, 01091 4, 01092 VL53L1_MAX_STRING_LENGTH, 01093 fp_text); 01094 01095 trace_print( 01096 VL53L1_TRACE_LEVEL_INFO, 01097 "%s%s = %s\n", 01098 pprefix, 01099 "vcsel_width", 01100 fp_text); 01101 01102 trace_print( 01103 VL53L1_TRACE_LEVEL_INFO, 01104 "%s%s = %u\n", 01105 pprefix, 01106 "VL53L1_p_009", 01107 pdata->VL53L1_p_009); 01108 01109 VL53L1_signed_fixed_point_sprintf( 01110 (int32_t)pdata->VL53L1_p_019, 01111 12, 01112 VL53L1_MAX_STRING_LENGTH, 01113 fp_text); 01114 01115 trace_print( 01116 VL53L1_TRACE_LEVEL_INFO, 01117 "%s%s = %s\n", 01118 pprefix, 01119 "VL53L1_p_019", 01120 fp_text); 01121 01122 trace_print( 01123 VL53L1_TRACE_LEVEL_INFO, 01124 "%s%s = %u\n", 01125 pprefix, 01126 "total_periods_elapsed", 01127 pdata->total_periods_elapsed); 01128 01129 trace_print( 01130 VL53L1_TRACE_LEVEL_INFO, 01131 "%s%s = %u\n", 01132 pprefix, 01133 "peak_duration_us", 01134 pdata->peak_duration_us); 01135 01136 trace_print( 01137 VL53L1_TRACE_LEVEL_INFO, 01138 "%s%s = %u\n", 01139 pprefix, 01140 "woi_duration_us", 01141 pdata->woi_duration_us); 01142 01143 trace_print( 01144 VL53L1_TRACE_LEVEL_INFO, 01145 "%s%s = %u\n", 01146 pprefix, 01147 "min_bin_value", 01148 pdata->min_bin_value); 01149 01150 trace_print( 01151 VL53L1_TRACE_LEVEL_INFO, 01152 "%s%s = %u\n", 01153 pprefix, 01154 "max_bin_value", 01155 pdata->max_bin_value); 01156 01157 VL53L1_signed_fixed_point_sprintf( 01158 (int32_t)pdata->zero_distance_phase, 01159 11, 01160 VL53L1_MAX_STRING_LENGTH, 01161 fp_text); 01162 01163 trace_print( 01164 VL53L1_TRACE_LEVEL_INFO, 01165 "%s%s = %s\n", 01166 pprefix, 01167 "zero_distance_phase", 01168 fp_text); 01169 01170 trace_print( 01171 VL53L1_TRACE_LEVEL_INFO, 01172 "%s%s = %u\n", 01173 pprefix, 01174 "number_of_ambient_samples", 01175 pdata->number_of_ambient_samples); 01176 01177 trace_print( 01178 VL53L1_TRACE_LEVEL_INFO, 01179 "%s%s = %d\n", 01180 pprefix, 01181 "ambient_events_sum", 01182 pdata->ambient_events_sum); 01183 01184 trace_print( 01185 VL53L1_TRACE_LEVEL_INFO, 01186 "%s%s = %d\n", 01187 pprefix, 01188 "VL53L1_p_004", 01189 pdata->VL53L1_p_004); 01190 01191 trace_print( 01192 VL53L1_TRACE_LEVEL_INFO, 01193 "%s%s = 0x%02X\n", 01194 pprefix, 01195 "roi_config__user_roi_centre_spad", 01196 pdata->roi_config__user_roi_centre_spad); 01197 01198 trace_print( 01199 VL53L1_TRACE_LEVEL_INFO, 01200 "%s%s = 0x%02X\n", 01201 pprefix, 01202 "roi_config__user_roi_requested_global_xy_size", 01203 pdata->roi_config__user_roi_requested_global_xy_size); 01204 } 01205 01206 01207 void VL53L1_print_xtalk_histogram_shape_data( 01208 VL53L1_xtalk_histogram_shape_t *pdata, 01209 char *pprefix, 01210 uint32_t trace_flags) 01211 { 01212 01213 01214 char fp_text[VL53L1_MAX_STRING_LENGTH]; 01215 char pre_text[VL53L1_MAX_STRING_LENGTH]; 01216 char *ppre_text = &(pre_text[0]); 01217 01218 uint8_t i = 0; 01219 01220 trace_print( 01221 VL53L1_TRACE_LEVEL_INFO, 01222 "%s%s = %u\n", 01223 pprefix, 01224 "VL53L1_p_022", 01225 pdata->VL53L1_p_022); 01226 01227 trace_print( 01228 VL53L1_TRACE_LEVEL_INFO, 01229 "%s%s = %u\n", 01230 pprefix, 01231 "VL53L1_p_023", 01232 pdata->VL53L1_p_023); 01233 01234 trace_print( 01235 VL53L1_TRACE_LEVEL_INFO, 01236 "%s%s = %u\n", 01237 pprefix, 01238 "VL53L1_p_024", 01239 pdata->VL53L1_p_024); 01240 01241 for (i = 0; i < pdata->VL53L1_p_024; i++) { 01242 01243 sprintf(ppre_text, "%sbin_data[%u]", pprefix, i); 01244 01245 VL53L1_signed_fixed_point_sprintf( 01246 (int32_t)pdata->bin_data[i], 01247 10, 01248 VL53L1_MAX_STRING_LENGTH, 01249 fp_text); 01250 01251 trace_print( 01252 VL53L1_TRACE_LEVEL_INFO, 01253 "%s = %s\n", 01254 ppre_text, 01255 fp_text); 01256 } 01257 01258 VL53L1_signed_fixed_point_sprintf( 01259 (int32_t)pdata->phasecal_result__reference_phase, 01260 11, 01261 VL53L1_MAX_STRING_LENGTH, 01262 fp_text); 01263 01264 trace_print( 01265 VL53L1_TRACE_LEVEL_INFO, 01266 "%s%s = %s\n", 01267 pprefix, 01268 "phasecal_result__reference_phase", 01269 fp_text); 01270 01271 trace_print( 01272 VL53L1_TRACE_LEVEL_INFO, 01273 "%s%s = %u\n", 01274 pprefix, 01275 "phasecal_result__vcsel_start", 01276 pdata->phasecal_result__vcsel_start); 01277 01278 trace_print( 01279 VL53L1_TRACE_LEVEL_INFO, 01280 "%s%s = %u\n", 01281 pprefix, 01282 "cal_config__vcsel_start", 01283 pdata->cal_config__vcsel_start); 01284 01285 VL53L1_signed_fixed_point_sprintf( 01286 (int32_t)pdata->vcsel_width, 01287 4, 01288 VL53L1_MAX_STRING_LENGTH, 01289 fp_text); 01290 01291 trace_print( 01292 VL53L1_TRACE_LEVEL_INFO, 01293 "%s%s = %s\n", 01294 pprefix, 01295 "vcsel_width", 01296 fp_text); 01297 01298 VL53L1_signed_fixed_point_sprintf( 01299 (int32_t)pdata->VL53L1_p_019, 01300 12, 01301 VL53L1_MAX_STRING_LENGTH, 01302 fp_text); 01303 01304 trace_print( 01305 VL53L1_TRACE_LEVEL_INFO, 01306 "%s%s = %s\n", 01307 pprefix, 01308 "VL53L1_p_019", 01309 fp_text); 01310 01311 VL53L1_signed_fixed_point_sprintf( 01312 (int32_t)pdata->zero_distance_phase, 01313 11, 01314 VL53L1_MAX_STRING_LENGTH, 01315 fp_text); 01316 01317 trace_print( 01318 VL53L1_TRACE_LEVEL_INFO, 01319 "%s%s = %s\n", 01320 pprefix, 01321 "zero_distance_phase", 01322 fp_text); 01323 } 01324 01325 01326 void VL53L1_print_xtalk_histogram_data( 01327 VL53L1_xtalk_histogram_data_t *pdata, 01328 char *pprefix, 01329 uint32_t trace_flags) 01330 { 01331 01332 01333 char pre_text[VL53L1_MAX_STRING_LENGTH]; 01334 char *ppre_text = &(pre_text[0]); 01335 01336 01337 sprintf(ppre_text, "%sxtalk_shape.", pprefix); 01338 VL53L1_print_xtalk_histogram_shape_data( 01339 &(pdata->xtalk_shape), 01340 ppre_text, trace_flags); 01341 01342 01343 sprintf(ppre_text, "%sxtalk_hist_removed.", pprefix); 01344 VL53L1_print_histogram_bin_data( 01345 &(pdata->xtalk_hist_removed), 01346 ppre_text, trace_flags); 01347 } 01348 01349 01350 void VL53L1_print_range_data( 01351 VL53L1_range_data_t *pdata, 01352 char *pprefix, 01353 uint32_t trace_flags) 01354 { 01355 01356 01357 char fp_text[VL53L1_MAX_STRING_LENGTH]; 01358 01359 trace_print( 01360 VL53L1_TRACE_LEVEL_INFO, 01361 "%s%s = %u\n", 01362 pprefix, 01363 "range_id", 01364 pdata->range_id); 01365 01366 trace_print( 01367 VL53L1_TRACE_LEVEL_INFO, 01368 "%s%s = %u\n", 01369 pprefix, 01370 "time_stamp", 01371 pdata->time_stamp); 01372 01373 trace_print( 01374 VL53L1_TRACE_LEVEL_INFO, 01375 "%s%s = %u\n", 01376 pprefix, 01377 "VL53L1_p_015", 01378 pdata->VL53L1_p_015); 01379 01380 trace_print( 01381 VL53L1_TRACE_LEVEL_INFO, 01382 "%s%s = %u\n", 01383 pprefix, 01384 "VL53L1_p_022", 01385 pdata->VL53L1_p_022); 01386 01387 trace_print( 01388 VL53L1_TRACE_LEVEL_INFO, 01389 "%s%s = %u\n", 01390 pprefix, 01391 "VL53L1_p_025", 01392 pdata->VL53L1_p_025); 01393 01394 trace_print( 01395 VL53L1_TRACE_LEVEL_INFO, 01396 "%s%s = %u\n", 01397 pprefix, 01398 "VL53L1_p_026", 01399 pdata->VL53L1_p_026); 01400 01401 trace_print( 01402 VL53L1_TRACE_LEVEL_INFO, 01403 "%s%s = %u\n", 01404 pprefix, 01405 "VL53L1_p_016", 01406 pdata->VL53L1_p_016); 01407 01408 trace_print( 01409 VL53L1_TRACE_LEVEL_INFO, 01410 "%s%s = %u\n", 01411 pprefix, 01412 "VL53L1_p_027", 01413 pdata->VL53L1_p_027); 01414 01415 VL53L1_signed_fixed_point_sprintf( 01416 (int32_t)pdata->width, 01417 4, VL53L1_MAX_STRING_LENGTH, fp_text); 01418 01419 trace_print( 01420 VL53L1_TRACE_LEVEL_INFO, 01421 "%s%s = %s\n", 01422 pprefix, 01423 "width", 01424 fp_text); 01425 01426 trace_print( 01427 VL53L1_TRACE_LEVEL_INFO, 01428 "%s%s = %u\n", 01429 pprefix, 01430 "VL53L1_p_030", 01431 pdata->VL53L1_p_030); 01432 01433 01434 01435 VL53L1_signed_fixed_point_sprintf( 01436 (int32_t)pdata->fast_osc_frequency, 01437 12, VL53L1_MAX_STRING_LENGTH, fp_text); 01438 01439 trace_print( 01440 VL53L1_TRACE_LEVEL_INFO, 01441 "%s%s = %s\n", 01442 pprefix, 01443 "fast_osc_frequency", 01444 fp_text); 01445 01446 01447 01448 VL53L1_signed_fixed_point_sprintf( 01449 (int32_t)pdata->zero_distance_phase, 01450 11, VL53L1_MAX_STRING_LENGTH, fp_text); 01451 01452 trace_print( 01453 VL53L1_TRACE_LEVEL_INFO, 01454 "%s%s = %s\n", 01455 pprefix, 01456 "zero_distance_phase", 01457 fp_text); 01458 01459 01460 01461 VL53L1_signed_fixed_point_sprintf( 01462 (int32_t)pdata->VL53L1_p_006, 01463 8, VL53L1_MAX_STRING_LENGTH, fp_text); 01464 01465 trace_print( 01466 VL53L1_TRACE_LEVEL_INFO, 01467 "%s%s = %s\n", 01468 pprefix, 01469 "actual_effective_spad", 01470 fp_text); 01471 01472 01473 trace_print(VL53L1_TRACE_LEVEL_INFO, 01474 "%s%s = %u\n", 01475 pprefix, 01476 "total_periods_elapsed", 01477 pdata->total_periods_elapsed); 01478 01479 trace_print( 01480 VL53L1_TRACE_LEVEL_INFO, 01481 "%s%s = %u\n", 01482 pprefix, 01483 "peak_duration_us", 01484 pdata->peak_duration_us); 01485 01486 trace_print( 01487 VL53L1_TRACE_LEVEL_INFO, 01488 "%s%s = %u\n", 01489 pprefix, 01490 "woi_duration_us", 01491 pdata->woi_duration_us); 01492 01493 trace_print( 01494 VL53L1_TRACE_LEVEL_INFO, 01495 "%s%s = %d\n", 01496 pprefix, 01497 "VL53L1_p_020", 01498 pdata->VL53L1_p_020); 01499 01500 trace_print( 01501 VL53L1_TRACE_LEVEL_INFO, 01502 "%s%s = %d\n", 01503 pprefix, 01504 "VL53L1_p_021", 01505 pdata->VL53L1_p_021); 01506 01507 trace_print( 01508 VL53L1_TRACE_LEVEL_INFO, 01509 "%s%s = %d\n", 01510 pprefix, 01511 "VL53L1_p_013", 01512 pdata->VL53L1_p_013); 01513 01514 01515 01516 VL53L1_signed_fixed_point_sprintf( 01517 (int32_t)pdata->peak_signal_count_rate_mcps, 01518 7, VL53L1_MAX_STRING_LENGTH, fp_text); 01519 01520 trace_print( 01521 VL53L1_TRACE_LEVEL_INFO, 01522 "%s%s = %s\n", 01523 pprefix, 01524 "peak_signal_count_rate_mcps", 01525 fp_text); 01526 01527 VL53L1_signed_fixed_point_sprintf( 01528 (int32_t)pdata->avg_signal_count_rate_mcps, 01529 7, VL53L1_MAX_STRING_LENGTH, fp_text); 01530 01531 trace_print( 01532 VL53L1_TRACE_LEVEL_INFO, 01533 "%s%s = %s\n", 01534 pprefix, 01535 "avg_signal_count_rate_mcps", 01536 fp_text); 01537 01538 VL53L1_signed_fixed_point_sprintf( 01539 (int32_t)pdata->ambient_count_rate_mcps, 01540 7, VL53L1_MAX_STRING_LENGTH, fp_text); 01541 01542 trace_print( 01543 VL53L1_TRACE_LEVEL_INFO, 01544 "%s%s = %s\n", 01545 pprefix, 01546 "ambient_count_rate_mcps", 01547 fp_text); 01548 01549 VL53L1_signed_fixed_point_sprintf( 01550 (int32_t)pdata->total_rate_per_spad_mcps, 01551 13, VL53L1_MAX_STRING_LENGTH, fp_text); 01552 01553 trace_print( 01554 VL53L1_TRACE_LEVEL_INFO, 01555 "%s%s = %s\n", 01556 pprefix, 01557 "total_rate_per_spad_mcps", 01558 fp_text); 01559 01560 VL53L1_signed_fixed_point_sprintf( 01561 (int32_t)pdata->VL53L1_p_012, 01562 11, VL53L1_MAX_STRING_LENGTH, fp_text); 01563 01564 trace_print( 01565 VL53L1_TRACE_LEVEL_INFO, 01566 "%s%s = %s\n", 01567 pprefix, 01568 "VL53L1_p_012", 01569 fp_text); 01570 01571 01572 01573 VL53L1_signed_fixed_point_sprintf( 01574 (int32_t)pdata->VL53L1_p_005, 01575 2, VL53L1_MAX_STRING_LENGTH, fp_text); 01576 01577 trace_print( 01578 VL53L1_TRACE_LEVEL_INFO, 01579 "%s%s = %s\n", 01580 pprefix, 01581 "VL53L1_p_005", 01582 fp_text); 01583 01584 01585 01586 VL53L1_signed_fixed_point_sprintf( 01587 (int32_t)pdata->VL53L1_p_028, 01588 11, VL53L1_MAX_STRING_LENGTH, fp_text); 01589 01590 trace_print( 01591 VL53L1_TRACE_LEVEL_INFO, 01592 "%s%s = %s\n", 01593 pprefix, 01594 "VL53L1_p_028", 01595 fp_text); 01596 01597 VL53L1_signed_fixed_point_sprintf( 01598 (int32_t)pdata->VL53L1_p_014, 01599 11, VL53L1_MAX_STRING_LENGTH, fp_text); 01600 01601 trace_print( 01602 VL53L1_TRACE_LEVEL_INFO, 01603 "%s%s = %s\n", 01604 pprefix, 01605 "VL53L1_p_014", 01606 fp_text); 01607 01608 VL53L1_signed_fixed_point_sprintf( 01609 (int32_t)pdata->VL53L1_p_029, 01610 11, VL53L1_MAX_STRING_LENGTH, fp_text); 01611 01612 trace_print( 01613 VL53L1_TRACE_LEVEL_INFO, 01614 "%s%s = %s\n", 01615 pprefix, 01616 "VL53L1_p_029", 01617 fp_text); 01618 01619 01620 01621 trace_print( 01622 VL53L1_TRACE_LEVEL_INFO, 01623 "%s%s = %d\n", 01624 pprefix, 01625 "min_range_mm", 01626 pdata->min_range_mm); 01627 01628 trace_print( 01629 VL53L1_TRACE_LEVEL_INFO, 01630 "%s%s = %d\n", 01631 pprefix, 01632 "median_range_mm", 01633 pdata->median_range_mm); 01634 01635 trace_print( 01636 VL53L1_TRACE_LEVEL_INFO, 01637 "%s%s = %d\n", 01638 pprefix, 01639 "max_range_mm", 01640 pdata->max_range_mm); 01641 01642 trace_print( 01643 VL53L1_TRACE_LEVEL_INFO, 01644 "%s%s = %u\n", 01645 pprefix, 01646 "range_status", 01647 pdata->range_status); 01648 } 01649 01650 01651 void VL53L1_print_range_results( 01652 VL53L1_range_results_t *pdata, 01653 char *pprefix, 01654 uint32_t trace_flags) 01655 { 01656 01657 01658 char pre_text[VL53L1_MAX_STRING_LENGTH]; 01659 char *ppre_text = &(pre_text[0]); 01660 01661 uint8_t i = 0; 01662 01663 trace_print( 01664 VL53L1_TRACE_LEVEL_INFO, 01665 "%s%s = %u\n", 01666 pprefix, 01667 "cfg_device_state", 01668 pdata->cfg_device_state); 01669 01670 trace_print( 01671 VL53L1_TRACE_LEVEL_INFO, 01672 "%s%s = %u\n", 01673 pprefix, 01674 "rd_device_state", 01675 pdata->rd_device_state); 01676 01677 trace_print( 01678 VL53L1_TRACE_LEVEL_INFO, 01679 "%s%s = %u\n", 01680 pprefix, 01681 "zone_id", 01682 pdata->zone_id); 01683 01684 trace_print( 01685 VL53L1_TRACE_LEVEL_INFO, 01686 "%s%s = %u\n", 01687 pprefix, 01688 "stream_count", 01689 pdata->stream_count); 01690 01691 for (i = 0; i < VL53L1_MAX_AMBIENT_DMAX_VALUES; i++) { 01692 sprintf( 01693 ppre_text, 01694 "%sambient_dmax_mm[%u]", 01695 pprefix, i); 01696 01697 trace_print( 01698 VL53L1_TRACE_LEVEL_INFO, 01699 "%s = %u\n", 01700 ppre_text, 01701 pdata->VL53L1_p_007[i]); 01702 } 01703 01704 trace_print( 01705 VL53L1_TRACE_LEVEL_INFO, 01706 "%s%s = %u\n", 01707 pprefix, 01708 "device_status", 01709 pdata->device_status); 01710 01711 trace_print( 01712 VL53L1_TRACE_LEVEL_INFO, 01713 "%s%s = %u\n", 01714 pprefix, 01715 "wrap_dmax_mm", 01716 pdata->wrap_dmax_mm); 01717 01718 trace_print( 01719 VL53L1_TRACE_LEVEL_INFO, 01720 "%s%s = %u\n", 01721 pprefix, 01722 "max_results", 01723 pdata->max_results); 01724 01725 trace_print( 01726 VL53L1_TRACE_LEVEL_INFO, 01727 "%s%s = %u\n", 01728 pprefix, 01729 "active_results", 01730 pdata->active_results); 01731 01732 for (i = 0; i < pdata->active_results; i++) { 01733 sprintf(ppre_text, "%sdata[%u].", pprefix, i); 01734 VL53L1_print_range_data( 01735 &pdata->VL53L1_p_002[i], 01736 ppre_text, trace_flags); 01737 } 01738 01739 sprintf(ppre_text, "%sxmonitor.", pprefix); 01740 VL53L1_print_range_data( 01741 &pdata->xmonitor, 01742 ppre_text, trace_flags); 01743 } 01744 01745 01746 void VL53L1_print_offset_range_results( 01747 VL53L1_offset_range_results_t *pdata, 01748 char *pprefix, 01749 uint32_t trace_flags) 01750 { 01751 01752 01753 char fp_text[VL53L1_MAX_STRING_LENGTH]; 01754 char pre_text[VL53L1_MAX_STRING_LENGTH]; 01755 char *ppre_text = &(pre_text[0]); 01756 01757 uint8_t i = 0; 01758 01759 trace_print( 01760 VL53L1_TRACE_LEVEL_INFO, 01761 "%s%s = %u\n", 01762 pprefix, 01763 "cal_distance_mm", 01764 pdata->cal_distance_mm); 01765 01766 VL53L1_signed_fixed_point_sprintf( 01767 (int32_t)pdata->cal_reflectance_pc, 01768 2, 01769 VL53L1_MAX_STRING_LENGTH, 01770 fp_text); 01771 01772 trace_print( 01773 VL53L1_TRACE_LEVEL_INFO, 01774 "%s%s = %s\n", 01775 pprefix, 01776 "cal_reflectance_pc", 01777 fp_text); 01778 01779 trace_print( 01780 VL53L1_TRACE_LEVEL_INFO, 01781 "%s%s = %u\n", 01782 pprefix, 01783 "cal_status", 01784 pdata->cal_status); 01785 01786 trace_print( 01787 VL53L1_TRACE_LEVEL_INFO, 01788 "%s%s = %u\n", 01789 pprefix, 01790 "cal_report", 01791 pdata->cal_report); 01792 01793 trace_print( 01794 VL53L1_TRACE_LEVEL_INFO, 01795 "%s%s = %u\n", 01796 pprefix, 01797 "max_results", 01798 pdata->max_results); 01799 01800 trace_print( 01801 VL53L1_TRACE_LEVEL_INFO, 01802 "%s%s = %u\n", 01803 pprefix, 01804 "active_results", 01805 pdata->active_results); 01806 01807 for (i = 0; i < pdata->active_results; i++) { 01808 sprintf(ppre_text, "%sdata[%u].", pprefix, i); 01809 VL53L1_print_offset_range_data( 01810 &(pdata->VL53L1_p_002[i]), 01811 ppre_text, trace_flags); 01812 } 01813 } 01814 01815 01816 void VL53L1_print_offset_range_data( 01817 VL53L1_offset_range_data_t *pdata, 01818 char *pprefix, 01819 uint32_t trace_flags) 01820 { 01821 01822 01823 char fp_text[VL53L1_MAX_STRING_LENGTH]; 01824 01825 trace_print( 01826 VL53L1_TRACE_LEVEL_INFO, 01827 "%s%s = %u\n", 01828 pprefix, 01829 "preset_mode", 01830 pdata->preset_mode); 01831 01832 trace_print( 01833 VL53L1_TRACE_LEVEL_INFO, 01834 "%s%s = %u\n", 01835 pprefix, 01836 "dss_config__roi_mode_control", 01837 pdata->dss_config__roi_mode_control); 01838 01839 VL53L1_signed_fixed_point_sprintf( 01840 (int32_t)pdata->dss_config__manual_effective_spads_select, 01841 8, 01842 VL53L1_MAX_STRING_LENGTH, 01843 fp_text); 01844 01845 trace_print( 01846 VL53L1_TRACE_LEVEL_INFO, 01847 "%s%s = %s\n", 01848 pprefix, 01849 "dss_config__manual_effective_spads_select", 01850 fp_text); 01851 01852 trace_print( 01853 VL53L1_TRACE_LEVEL_INFO, 01854 "%s%s = %u\n", 01855 pprefix, 01856 "no_of_samples", 01857 pdata->no_of_samples); 01858 01859 01860 VL53L1_signed_fixed_point_sprintf( 01861 (int32_t)pdata->effective_spads, 01862 8, 01863 VL53L1_MAX_STRING_LENGTH, 01864 fp_text); 01865 01866 trace_print( 01867 VL53L1_TRACE_LEVEL_INFO, 01868 "%s%s = %s\n", 01869 pprefix, 01870 "effective_spads", 01871 fp_text); 01872 01873 VL53L1_signed_fixed_point_sprintf( 01874 (int32_t)pdata->peak_rate_mcps, 01875 7, 01876 VL53L1_MAX_STRING_LENGTH, 01877 fp_text); 01878 01879 trace_print( 01880 VL53L1_TRACE_LEVEL_INFO, 01881 "%s%s = %s\n", 01882 pprefix, 01883 "peak_rate_mcps", 01884 fp_text); 01885 01886 VL53L1_signed_fixed_point_sprintf( 01887 (int32_t)pdata->VL53L1_p_005, 01888 2, 01889 VL53L1_MAX_STRING_LENGTH, 01890 fp_text); 01891 01892 trace_print( 01893 VL53L1_TRACE_LEVEL_INFO, 01894 "%s%s = %s\n", 01895 pprefix, 01896 "VL53L1_p_005", 01897 fp_text); 01898 01899 trace_print( 01900 VL53L1_TRACE_LEVEL_INFO, 01901 "%s%s = %d\n", 01902 pprefix, 01903 "median_range_mm", 01904 pdata->median_range_mm); 01905 01906 trace_print( 01907 VL53L1_TRACE_LEVEL_INFO, 01908 "%s%s = %d\n", 01909 pprefix, 01910 "range_mm_offset", 01911 pdata->range_mm_offset); 01912 } 01913 01914 01915 void VL53L1_print_cal_peak_rate_map( 01916 VL53L1_cal_peak_rate_map_t *pdata, 01917 char *pprefix, 01918 uint32_t trace_flags) 01919 { 01920 01921 01922 char fp_text[VL53L1_MAX_STRING_LENGTH]; 01923 char pre_text[VL53L1_MAX_STRING_LENGTH]; 01924 char *ppre_text = &(pre_text[0]); 01925 01926 uint8_t i = 0; 01927 uint8_t x = 0; 01928 uint8_t y = 0; 01929 01930 VL53L1_signed_fixed_point_sprintf( 01931 (int32_t)pdata->cal_distance_mm, 01932 2, 01933 VL53L1_MAX_STRING_LENGTH, 01934 fp_text); 01935 01936 trace_print( 01937 VL53L1_TRACE_LEVEL_INFO, 01938 "%s%s = %s\n", 01939 pprefix, 01940 "cal_distance_mm", 01941 fp_text); 01942 01943 VL53L1_signed_fixed_point_sprintf( 01944 (int32_t)pdata->cal_reflectance_pc, 01945 2, 01946 VL53L1_MAX_STRING_LENGTH, 01947 fp_text); 01948 01949 trace_print( 01950 VL53L1_TRACE_LEVEL_INFO, 01951 "%s%s = %s\n", 01952 pprefix, 01953 "cal_reflectance_pc", 01954 fp_text); 01955 01956 trace_print( 01957 VL53L1_TRACE_LEVEL_INFO, 01958 "%s%s = %u\n", 01959 pprefix, 01960 "max_samples", 01961 pdata->max_samples); 01962 01963 trace_print( 01964 VL53L1_TRACE_LEVEL_INFO, 01965 "%s%s = %u\n", 01966 pprefix, 01967 "width", 01968 pdata->width); 01969 01970 trace_print( 01971 VL53L1_TRACE_LEVEL_INFO, 01972 "%s%s = %u\n", 01973 pprefix, 01974 "height", 01975 pdata->height); 01976 01977 i = 0; 01978 for (y = 0; y < pdata->height; y++) { 01979 for (x = 0; x < pdata->width; x++) { 01980 01981 sprintf(ppre_text, "%speak_rate_mcps[%u]", pprefix, i); 01982 01983 VL53L1_signed_fixed_point_sprintf( 01984 (int32_t)pdata->peak_rate_mcps[i], 01985 7, 01986 VL53L1_MAX_STRING_LENGTH, 01987 fp_text); 01988 01989 trace_print( 01990 VL53L1_TRACE_LEVEL_INFO, 01991 "%s = %s\n", 01992 ppre_text, 01993 fp_text); 01994 01995 i++; 01996 } 01997 } 01998 } 01999 02000 void VL53L1_print_additional_data( 02001 VL53L1_additional_data_t *pdata, 02002 char *pprefix, 02003 uint32_t trace_flags) 02004 { 02005 02006 02007 02008 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02009 char pre_text[VL53L1_MAX_STRING_LENGTH]; 02010 char *ppre_text = &(pre_text[0]); 02011 02012 trace_print( 02013 VL53L1_TRACE_LEVEL_INFO, 02014 "%s%s = %u\n", 02015 pprefix, 02016 "preset_mode", 02017 pdata->preset_mode); 02018 02019 trace_print( 02020 VL53L1_TRACE_LEVEL_INFO, 02021 "%s%s = %u\n", 02022 pprefix, 02023 "zone_preset", 02024 pdata->zone_preset); 02025 02026 trace_print( 02027 VL53L1_TRACE_LEVEL_INFO, 02028 "%s%s = %u\n", 02029 pprefix, 02030 "measurement_mode", 02031 pdata->measurement_mode); 02032 02033 trace_print( 02034 VL53L1_TRACE_LEVEL_INFO, 02035 "%s%s = %u\n", 02036 pprefix, 02037 "offset_calibration_mode", 02038 pdata->offset_calibration_mode); 02039 02040 trace_print( 02041 VL53L1_TRACE_LEVEL_INFO, 02042 "%s%s = %u\n", 02043 pprefix, 02044 "offset_correction_mode", 02045 pdata->offset_correction_mode); 02046 02047 trace_print( 02048 VL53L1_TRACE_LEVEL_INFO, 02049 "%s%s = %u\n", 02050 pprefix, 02051 "dmax_mode", 02052 pdata->dmax_mode); 02053 02054 trace_print( 02055 VL53L1_TRACE_LEVEL_INFO, 02056 "%s%s = %u\n", 02057 pprefix, 02058 "phasecal_config_timeout_us", 02059 pdata->phasecal_config_timeout_us); 02060 02061 trace_print( 02062 VL53L1_TRACE_LEVEL_INFO, 02063 "%s%s = %u\n", 02064 pprefix, 02065 "mm_config_timeout_us", 02066 pdata->mm_config_timeout_us); 02067 02068 trace_print( 02069 VL53L1_TRACE_LEVEL_INFO, 02070 "%s%s = %u\n", 02071 pprefix, 02072 "range_config_timeout_us", 02073 pdata->range_config_timeout_us); 02074 02075 trace_print( 02076 VL53L1_TRACE_LEVEL_INFO, 02077 "%s%s = %u\n", 02078 pprefix, 02079 "inter_measurement_period_ms", 02080 pdata->inter_measurement_period_ms); 02081 02082 02083 VL53L1_signed_fixed_point_sprintf( 02084 (int32_t)pdata->dss_config__target_total_rate_mcps, 02085 7, 02086 VL53L1_MAX_STRING_LENGTH, 02087 fp_text); 02088 02089 trace_print( 02090 VL53L1_TRACE_LEVEL_INFO, 02091 "%s%s = %s\n", 02092 pprefix, 02093 "dss_config__target_total_rate_mcps", 02094 fp_text); 02095 02096 sprintf(ppre_text, "%s VL53L1_p_010.", pprefix); 02097 VL53L1_print_histogram_bin_data( 02098 &pdata->VL53L1_p_010, 02099 ppre_text, trace_flags); 02100 02101 02102 } 02103 02104 02105 void VL53L1_print_additional_offset_cal_data( 02106 VL53L1_additional_offset_cal_data_t *pdata, 02107 char *pprefix, 02108 uint32_t trace_flags) 02109 { 02110 02111 02112 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02113 02114 VL53L1_signed_fixed_point_sprintf( 02115 (int32_t)pdata->result__mm_inner_actual_effective_spads, 02116 8, 02117 VL53L1_MAX_STRING_LENGTH, 02118 fp_text); 02119 02120 trace_print( 02121 VL53L1_TRACE_LEVEL_INFO, 02122 "%s%s = %s\n", 02123 pprefix, 02124 "result__mm_inner_actual_effective_spads", 02125 fp_text); 02126 02127 VL53L1_signed_fixed_point_sprintf( 02128 (int32_t)pdata->result__mm_outer_actual_effective_spads, 02129 8, 02130 VL53L1_MAX_STRING_LENGTH, 02131 fp_text); 02132 02133 trace_print( 02134 VL53L1_TRACE_LEVEL_INFO, 02135 "%s%s = %s\n", 02136 pprefix, 02137 "result__mm_outer_actual_effective_spads", 02138 fp_text); 02139 02140 VL53L1_signed_fixed_point_sprintf( 02141 (int32_t)pdata->result__mm_inner_peak_signal_count_rtn_mcps, 02142 7, 02143 VL53L1_MAX_STRING_LENGTH, 02144 fp_text); 02145 02146 trace_print( 02147 VL53L1_TRACE_LEVEL_INFO, 02148 "%s%s = %s\n", 02149 pprefix, 02150 "result__mm_inner_peak_signal_count_rtn_mcps", 02151 fp_text); 02152 02153 VL53L1_signed_fixed_point_sprintf( 02154 (int32_t)pdata->result__mm_outer_peak_signal_count_rtn_mcps, 02155 7, 02156 VL53L1_MAX_STRING_LENGTH, 02157 fp_text); 02158 02159 trace_print( 02160 VL53L1_TRACE_LEVEL_INFO, 02161 "%s%s = %s\n", 02162 pprefix, 02163 "result__mm_outer_peak_signal_count_rtn_mcps", 02164 fp_text); 02165 } 02166 02167 02168 void VL53L1_print_gain_calibration_data( 02169 VL53L1_gain_calibration_data_t *pdata, 02170 char *pprefix, 02171 uint32_t trace_flags) 02172 { 02173 02174 02175 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02176 02177 VL53L1_signed_fixed_point_sprintf( 02178 (int32_t)pdata->standard_ranging_gain_factor, 02179 11, 02180 VL53L1_MAX_STRING_LENGTH, 02181 fp_text); 02182 02183 trace_print( 02184 VL53L1_TRACE_LEVEL_INFO, 02185 "%s%s = %s\n", 02186 pprefix, 02187 "standard_ranging_gain_factor", 02188 fp_text); 02189 02190 VL53L1_signed_fixed_point_sprintf( 02191 (int32_t)pdata->histogram_ranging_gain_factor, 02192 11, 02193 VL53L1_MAX_STRING_LENGTH, 02194 fp_text); 02195 02196 trace_print( 02197 VL53L1_TRACE_LEVEL_INFO, 02198 "%s%s = %s\n", 02199 pprefix, 02200 "histogram_ranging_gain_factor", 02201 fp_text); 02202 } 02203 02204 02205 void VL53L1_print_zone_calibration_data( 02206 VL53L1_zone_calibration_data_t *pdata, 02207 char *pprefix, 02208 uint32_t trace_flags) 02209 { 02210 02211 02212 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02213 02214 trace_print( 02215 VL53L1_TRACE_LEVEL_INFO, 02216 "%s%s = %u\n", 02217 pprefix, 02218 "no_of_samples", 02219 pdata->no_of_samples); 02220 02221 VL53L1_signed_fixed_point_sprintf( 02222 (int32_t)pdata->effective_spads, 02223 8, 02224 VL53L1_MAX_STRING_LENGTH, 02225 fp_text); 02226 02227 trace_print( 02228 VL53L1_TRACE_LEVEL_INFO, 02229 "%s%s = %s\n", 02230 pprefix, 02231 "effective_spads", 02232 fp_text); 02233 02234 VL53L1_signed_fixed_point_sprintf( 02235 (int32_t)pdata->peak_rate_mcps, 02236 7, 02237 VL53L1_MAX_STRING_LENGTH, 02238 fp_text); 02239 02240 trace_print( 02241 VL53L1_TRACE_LEVEL_INFO, 02242 "%s%s = %s\n", 02243 pprefix, 02244 "peak_rate_mcps", 02245 fp_text); 02246 02247 VL53L1_signed_fixed_point_sprintf( 02248 (int32_t)pdata->VL53L1_p_014, 02249 11, 02250 VL53L1_MAX_STRING_LENGTH, 02251 fp_text); 02252 02253 trace_print( 02254 VL53L1_TRACE_LEVEL_INFO, 02255 "%s%s = %s\n", 02256 pprefix, 02257 "VL53L1_p_014", 02258 fp_text); 02259 02260 VL53L1_signed_fixed_point_sprintf( 02261 (int32_t)pdata->VL53L1_p_005, 02262 2, 02263 VL53L1_MAX_STRING_LENGTH, 02264 fp_text); 02265 02266 trace_print( 02267 VL53L1_TRACE_LEVEL_INFO, 02268 "%s%s = %s\n", 02269 pprefix, 02270 "VL53L1_p_005", 02271 fp_text); 02272 02273 VL53L1_signed_fixed_point_sprintf( 02274 (int32_t)pdata->median_range_mm, 02275 2, 02276 VL53L1_MAX_STRING_LENGTH, 02277 fp_text); 02278 02279 trace_print( 02280 VL53L1_TRACE_LEVEL_INFO, 02281 "%s%s = %s\n", 02282 pprefix, 02283 "median_range_mm", 02284 fp_text); 02285 02286 VL53L1_signed_fixed_point_sprintf( 02287 (int32_t)pdata->range_mm_offset, 02288 2, 02289 VL53L1_MAX_STRING_LENGTH, 02290 fp_text); 02291 02292 trace_print( 02293 VL53L1_TRACE_LEVEL_INFO, 02294 "%s%s = %s\n", 02295 pprefix, 02296 "range_mm_offset", 02297 fp_text); 02298 } 02299 02300 02301 void VL53L1_print_zone_calibration_results( 02302 VL53L1_zone_calibration_results_t *pdata, 02303 char *pprefix, 02304 uint32_t trace_flags) 02305 { 02306 02307 02308 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02309 char pre_text[VL53L1_MAX_STRING_LENGTH]; 02310 char *ppre_text = &(pre_text[0]); 02311 02312 uint8_t i = 0; 02313 02314 trace_print( 02315 VL53L1_TRACE_LEVEL_INFO, 02316 "%s%s = %u\n", 02317 pprefix, 02318 "preset_mode", 02319 pdata->preset_mode); 02320 02321 trace_print( 02322 VL53L1_TRACE_LEVEL_INFO, 02323 "%s%s = %u\n", 02324 pprefix, 02325 "zone_preset", 02326 pdata->zone_preset); 02327 02328 trace_print( 02329 VL53L1_TRACE_LEVEL_INFO, 02330 "%s%s = %u\n", 02331 pprefix, 02332 "cal_distance_mm", 02333 pdata->cal_distance_mm); 02334 02335 VL53L1_signed_fixed_point_sprintf( 02336 (int32_t)pdata->cal_reflectance_pc, 02337 2, 02338 VL53L1_MAX_STRING_LENGTH, 02339 fp_text); 02340 02341 trace_print( 02342 VL53L1_TRACE_LEVEL_INFO, 02343 "%s%s = %s\n", 02344 pprefix, 02345 "cal_reflectance_pc", 02346 fp_text); 02347 02348 VL53L1_signed_fixed_point_sprintf( 02349 (int32_t)pdata->phasecal_result__reference_phase, 02350 11, 02351 VL53L1_MAX_STRING_LENGTH, 02352 fp_text); 02353 02354 trace_print( 02355 VL53L1_TRACE_LEVEL_INFO, 02356 "%s%s = %s\n", 02357 pprefix, 02358 "phasecal_result__reference_phase", 02359 fp_text); 02360 02361 VL53L1_signed_fixed_point_sprintf( 02362 (int32_t)pdata->zero_distance_phase, 02363 11, 02364 VL53L1_MAX_STRING_LENGTH, 02365 fp_text); 02366 02367 trace_print( 02368 VL53L1_TRACE_LEVEL_INFO, 02369 "%s%s = %s\n", 02370 pprefix, 02371 "zero_distance_phase", 02372 fp_text); 02373 02374 trace_print( 02375 VL53L1_TRACE_LEVEL_INFO, 02376 "%s%s = %u\n", 02377 pprefix, 02378 "cal_status", 02379 pdata->cal_status); 02380 02381 trace_print( 02382 VL53L1_TRACE_LEVEL_INFO, 02383 "%s%s = %u\n", 02384 pprefix, 02385 "max_zones", 02386 pdata->max_zones); 02387 02388 trace_print( 02389 VL53L1_TRACE_LEVEL_INFO, 02390 "%s%s = %u\n", 02391 pprefix, 02392 "active_zones", 02393 pdata->active_zones); 02394 02395 for (i = 0; i < pdata->active_zones; i++) { 02396 sprintf(ppre_text, "%sdata[%u].", pprefix, i); 02397 VL53L1_print_zone_calibration_data( 02398 &(pdata->VL53L1_p_002[i]), 02399 ppre_text, trace_flags); 02400 } 02401 } 02402 02403 void VL53L1_print_xtalk_range_results( 02404 VL53L1_xtalk_range_results_t *pdata, 02405 char *pprefix, 02406 uint32_t trace_flags) 02407 { 02408 02409 02410 char pre_text[VL53L1_MAX_STRING_LENGTH]; 02411 char *ppre_text = &(pre_text[0]); 02412 uint8_t i = 0; 02413 02414 VL53L1_histogram_bin_data_t *pbin_data; 02415 02416 trace_print( 02417 VL53L1_TRACE_LEVEL_INFO, 02418 "%s%s = %u\n", 02419 pprefix, 02420 "cal_status", 02421 pdata->cal_status); 02422 02423 trace_print( 02424 VL53L1_TRACE_LEVEL_INFO, 02425 "%s%s = %u\n", 02426 pprefix, 02427 "num_of_samples_status", 02428 pdata->num_of_samples_status); 02429 02430 trace_print( 02431 VL53L1_TRACE_LEVEL_INFO, 02432 "%s%s = %u\n", 02433 pprefix, 02434 "zero_samples_status", 02435 pdata->zero_samples_status); 02436 02437 trace_print( 02438 VL53L1_TRACE_LEVEL_INFO, 02439 "%s%s = %u\n", 02440 pprefix, 02441 "max_sigma_status", 02442 pdata->max_sigma_status); 02443 02444 trace_print( 02445 VL53L1_TRACE_LEVEL_INFO, 02446 "%s%s = %u\n", 02447 pprefix, 02448 "max_results", 02449 pdata->max_results); 02450 02451 trace_print( 02452 VL53L1_TRACE_LEVEL_INFO, 02453 "%s%s = %u\n", 02454 pprefix, 02455 "active_results", 02456 pdata->active_results); 02457 02458 for (i = 0; i < pdata->active_results; i++) { 02459 sprintf(ppre_text, "%sdata[%u].", pprefix, i); 02460 VL53L1_print_xtalk_range_data( 02461 &(pdata->VL53L1_p_002[i]), 02462 ppre_text, trace_flags); 02463 } 02464 02465 sprintf(ppre_text, "%scentral_histogram_sum.", pprefix); 02466 VL53L1_print_histogram_bin_data( 02467 &pdata->central_histogram_sum, 02468 ppre_text, trace_flags); 02469 02470 sprintf(ppre_text, "%scentral_histogram_avg.", pprefix); 02471 VL53L1_print_histogram_bin_data( 02472 &pdata->central_histogram_avg, 02473 ppre_text, trace_flags); 02474 02475 trace_print( 02476 VL53L1_TRACE_LEVEL_INFO, 02477 "%s%s = %u\n", 02478 pprefix, 02479 "VL53L1_p_015", 02480 pdata->central_histogram__window_start); 02481 02482 trace_print( 02483 VL53L1_TRACE_LEVEL_INFO, 02484 "%s%s = %u\n", 02485 pprefix, 02486 "VL53L1_p_016", 02487 pdata->central_histogram__window_end); 02488 02489 pbin_data = &(pdata->histogram_avg_1[0]); 02490 02491 for (i = 0; i < 5; i++) { 02492 sprintf(ppre_text, "%shistogram_avg_1[%u].", pprefix, i); 02493 VL53L1_print_histogram_bin_data( 02494 pbin_data, 02495 ppre_text, trace_flags); 02496 pbin_data++; 02497 } 02498 02499 pbin_data = &(pdata->histogram_avg_2[0]); 02500 02501 for (i = 0; i < 5; i++) { 02502 sprintf(ppre_text, "%shistogram_avg_2[%u].", pprefix, i); 02503 VL53L1_print_histogram_bin_data( 02504 pbin_data, 02505 ppre_text, trace_flags); 02506 pbin_data++; 02507 } 02508 02509 pbin_data = &(pdata->xtalk_avg[0]); 02510 02511 for (i = 0; i < 5; i++) { 02512 sprintf(ppre_text, "%sxtalk_avg[%u].", pprefix, i); 02513 VL53L1_print_histogram_bin_data( 02514 pbin_data, 02515 ppre_text, trace_flags); 02516 pbin_data++; 02517 } 02518 } 02519 02520 02521 void VL53L1_print_xtalk_range_data( 02522 VL53L1_xtalk_range_data_t *pdata, 02523 char *pprefix, 02524 uint32_t trace_flags) 02525 { 02526 02527 02528 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02529 02530 trace_print( 02531 VL53L1_TRACE_LEVEL_INFO, 02532 "%s%s = %u\n", 02533 pprefix, 02534 "no_of_samples", 02535 pdata->no_of_samples); 02536 02537 trace_print( 02538 VL53L1_TRACE_LEVEL_INFO, 02539 "%s%s = %d\n", 02540 pprefix, 02541 "signal_total_events_sum", 02542 pdata->signal_total_events_sum); 02543 02544 trace_print( 02545 VL53L1_TRACE_LEVEL_INFO, 02546 "%s%s = %d\n", 02547 pprefix, 02548 "signal_total_events_avg", 02549 pdata->signal_total_events_avg); 02550 02551 VL53L1_signed_fixed_point_sprintf( 02552 (int32_t)pdata->rate_per_spad_kcps_sum, 02553 11, 02554 VL53L1_MAX_STRING_LENGTH, 02555 fp_text); 02556 02557 trace_print( 02558 VL53L1_TRACE_LEVEL_INFO, 02559 "%s%s = %s\n", 02560 pprefix, 02561 "rate_per_spad_kcps_sum", 02562 fp_text); 02563 02564 02565 VL53L1_signed_fixed_point_sprintf( 02566 (int32_t)pdata->rate_per_spad_kcps_avg, 02567 11, 02568 VL53L1_MAX_STRING_LENGTH, 02569 fp_text); 02570 02571 trace_print( 02572 VL53L1_TRACE_LEVEL_INFO, 02573 "%s%s = %s\n", 02574 pprefix, 02575 "rate_per_spad_kcps_avg", 02576 fp_text); 02577 } 02578 02579 02580 void VL53L1_print_xtalk_calibration_results( 02581 VL53L1_xtalk_calibration_results_t *pdata, 02582 char *pprefix, 02583 uint32_t trace_flags) 02584 { 02585 02586 02587 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02588 int16_t tmpi16; 02589 02590 VL53L1_signed_fixed_point_sprintf( 02591 (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps, 02592 9, 02593 VL53L1_MAX_STRING_LENGTH, 02594 fp_text); 02595 02596 trace_print( 02597 VL53L1_TRACE_LEVEL_INFO, 02598 "%s%s = %s\n", 02599 pprefix, 02600 "algo__crosstalk_compensation_plane_offset_kcps", 02601 fp_text); 02602 02603 tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; 02604 VL53L1_signed_fixed_point_sprintf( 02605 (int32_t)tmpi16, 02606 11, 02607 VL53L1_MAX_STRING_LENGTH, 02608 fp_text); 02609 02610 trace_print( 02611 VL53L1_TRACE_LEVEL_INFO, 02612 "%s%s = %s\n", 02613 pprefix, 02614 "algo__crosstalk_compensation_x_plane_gradient_kcps", 02615 fp_text); 02616 02617 tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; 02618 VL53L1_signed_fixed_point_sprintf( 02619 (int32_t)tmpi16, 02620 11, 02621 VL53L1_MAX_STRING_LENGTH, 02622 fp_text); 02623 02624 trace_print( 02625 VL53L1_TRACE_LEVEL_INFO, 02626 "%s%s = %s\n", 02627 pprefix, 02628 "algo__crosstalk_compensation_y_plane_gradient_kcps", 02629 fp_text); 02630 } 02631 02632 02633 void VL53L1_print_xtalk_config( 02634 VL53L1_xtalk_config_t *pdata, 02635 char *pprefix, 02636 uint32_t trace_flags) 02637 { 02638 02639 02640 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02641 int16_t tmpi16; 02642 02643 VL53L1_signed_fixed_point_sprintf( 02644 (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps, 02645 9, 02646 VL53L1_MAX_STRING_LENGTH, 02647 fp_text); 02648 02649 trace_print( 02650 VL53L1_TRACE_LEVEL_INFO, 02651 "%s%s = %s\n", 02652 pprefix, 02653 "algo__crosstalk_compensation_plane_offset_kcps", 02654 fp_text); 02655 02656 tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; 02657 VL53L1_signed_fixed_point_sprintf( 02658 (int32_t)tmpi16, 02659 11, 02660 VL53L1_MAX_STRING_LENGTH, 02661 fp_text); 02662 02663 trace_print( 02664 VL53L1_TRACE_LEVEL_INFO, 02665 "%s%s = %s\n", 02666 pprefix, 02667 "algo__crosstalk_compensation_x_plane_gradient_kcps", 02668 fp_text); 02669 02670 tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; 02671 VL53L1_signed_fixed_point_sprintf( 02672 (int32_t)tmpi16, 02673 11, 02674 VL53L1_MAX_STRING_LENGTH, 02675 fp_text); 02676 02677 trace_print( 02678 VL53L1_TRACE_LEVEL_INFO, 02679 "%s%s = %s\n", 02680 pprefix, 02681 "algo__crosstalk_compensation_y_plane_gradient_kcps", 02682 fp_text); 02683 02684 trace_print( 02685 VL53L1_TRACE_LEVEL_INFO, 02686 "%s%s = %u\n", 02687 pprefix, 02688 "global_crosstalk_compensation_enable", 02689 pdata->global_crosstalk_compensation_enable); 02690 02691 VL53L1_signed_fixed_point_sprintf( 02692 (int32_t)pdata->histogram_mode_crosstalk_margin_kcps, 02693 9, 02694 VL53L1_MAX_STRING_LENGTH, 02695 fp_text); 02696 02697 trace_print( 02698 VL53L1_TRACE_LEVEL_INFO, 02699 "%s%s = %s\n", 02700 pprefix, 02701 "histogram_mode_crosstalk_margin_kcps", 02702 fp_text); 02703 02704 VL53L1_signed_fixed_point_sprintf( 02705 (int32_t)pdata->lite_mode_crosstalk_margin_kcps, 02706 9, 02707 VL53L1_MAX_STRING_LENGTH, 02708 fp_text); 02709 02710 trace_print( 02711 VL53L1_TRACE_LEVEL_INFO, 02712 "%s%s = %s\n", 02713 pprefix, 02714 "lite_mode_crosstalk_margin_kcps", 02715 fp_text); 02716 02717 VL53L1_signed_fixed_point_sprintf( 02718 (int32_t)pdata->crosstalk_range_ignore_threshold_mult, 02719 5, 02720 VL53L1_MAX_STRING_LENGTH, 02721 fp_text); 02722 02723 trace_print( 02724 VL53L1_TRACE_LEVEL_INFO, 02725 "%s%s = %s\n", 02726 pprefix, 02727 "crosstalk_range_ignore_threshold_mult", 02728 fp_text); 02729 02730 02731 VL53L1_signed_fixed_point_sprintf( 02732 (int32_t)pdata->crosstalk_range_ignore_threshold_rate_mcps, 02733 13, 02734 VL53L1_MAX_STRING_LENGTH, 02735 fp_text); 02736 02737 trace_print( 02738 VL53L1_TRACE_LEVEL_INFO, 02739 "%s%s = %s\n", 02740 pprefix, 02741 "crosstalk_range_ignore_threshold_rate_mcps", 02742 fp_text); 02743 02744 trace_print( 02745 VL53L1_TRACE_LEVEL_INFO, 02746 "%s%s = %u\n", 02747 pprefix, 02748 "algo__crosstalk_detect_max_valid_range_mm", 02749 pdata->algo__crosstalk_detect_max_valid_range_mm); 02750 02751 trace_print( 02752 VL53L1_TRACE_LEVEL_INFO, 02753 "%s%s = %u\n", 02754 pprefix, 02755 "algo__crosstalk_detect_min_valid_range_mm", 02756 pdata->algo__crosstalk_detect_min_valid_range_mm); 02757 02758 VL53L1_signed_fixed_point_sprintf( 02759 (int32_t)pdata->algo__crosstalk_detect_max_valid_rate_kcps, 02760 7, 02761 VL53L1_MAX_STRING_LENGTH, 02762 fp_text); 02763 02764 trace_print( 02765 VL53L1_TRACE_LEVEL_INFO, 02766 "%s%s = %s\n", 02767 pprefix, 02768 "algo__crosstalk_detect_max_valid_rate_kcps", 02769 fp_text); 02770 02771 VL53L1_signed_fixed_point_sprintf( 02772 (int32_t)pdata->algo__crosstalk_detect_max_sigma_mm, 02773 2, 02774 VL53L1_MAX_STRING_LENGTH, 02775 fp_text); 02776 02777 trace_print( 02778 VL53L1_TRACE_LEVEL_INFO, 02779 "%s%s = %s\n", 02780 pprefix, 02781 "algo__crosstalk_detect_max_sigma_mm", 02782 fp_text); 02783 02784 } 02785 02786 02787 void VL53L1_print_xtalk_extract_config( 02788 VL53L1_xtalkextract_config_t *pdata, 02789 char *pprefix, 02790 uint32_t trace_flags) 02791 { 02792 02793 02794 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02795 02796 02797 VL53L1_signed_fixed_point_sprintf( 02798 (int32_t)pdata->dss_config__target_total_rate_mcps, 02799 7, 02800 VL53L1_MAX_STRING_LENGTH, 02801 fp_text); 02802 02803 trace_print( 02804 VL53L1_TRACE_LEVEL_INFO, 02805 "%s%s = %s\n", 02806 pprefix, 02807 "dss_config__target_total_rate_mcps", 02808 fp_text); 02809 02810 trace_print( 02811 VL53L1_TRACE_LEVEL_INFO, 02812 "%s%s = %u\n", 02813 pprefix, 02814 "mm_config_timeout_us", 02815 pdata->mm_config_timeout_us); 02816 02817 trace_print( 02818 VL53L1_TRACE_LEVEL_INFO, 02819 "%s%s = %u\n", 02820 pprefix, 02821 "range_config_timeout_us", 02822 pdata->range_config_timeout_us); 02823 02824 trace_print( 02825 VL53L1_TRACE_LEVEL_INFO, 02826 "%s%s = %u\n", 02827 pprefix, 02828 "num_of_samples", 02829 pdata->num_of_samples); 02830 02831 02832 trace_print( 02833 VL53L1_TRACE_LEVEL_INFO, 02834 "%s%s = %u\n", 02835 pprefix, 02836 "algo__crosstalk_extract_max_valid_range_mm", 02837 pdata->algo__crosstalk_extract_max_valid_range_mm); 02838 02839 trace_print( 02840 VL53L1_TRACE_LEVEL_INFO, 02841 "%s%s = %u\n", 02842 pprefix, 02843 "algo__crosstalk_extract_min_valid_range_mm", 02844 pdata->algo__crosstalk_extract_min_valid_range_mm); 02845 02846 VL53L1_signed_fixed_point_sprintf( 02847 (int32_t)pdata->algo__crosstalk_extract_max_valid_rate_kcps, 02848 9, 02849 VL53L1_MAX_STRING_LENGTH, 02850 fp_text); 02851 02852 trace_print( 02853 VL53L1_TRACE_LEVEL_INFO, 02854 "%s%s = %s\n", 02855 pprefix, 02856 "algo__crosstalk_extract_max_valid_rate_kcps", 02857 fp_text); 02858 02859 VL53L1_signed_fixed_point_sprintf( 02860 (int32_t)pdata->algo__crosstalk_extract_max_sigma_mm, 02861 2, 02862 VL53L1_MAX_STRING_LENGTH, 02863 fp_text); 02864 02865 trace_print( 02866 VL53L1_TRACE_LEVEL_INFO, 02867 "%s%s = %s\n", 02868 pprefix, 02869 "algo__crosstalk_extract_max_sigma_mm", 02870 fp_text); 02871 02872 } 02873 02874 02875 void VL53L1_print_zone_cal_config( 02876 VL53L1_zonecal_config_t *pdata, 02877 char *pprefix, 02878 uint32_t trace_flags) 02879 { 02880 02881 02882 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02883 02884 VL53L1_signed_fixed_point_sprintf( 02885 (int32_t)pdata->dss_config__target_total_rate_mcps, 02886 7, 02887 VL53L1_MAX_STRING_LENGTH, 02888 fp_text); 02889 02890 trace_print( 02891 VL53L1_TRACE_LEVEL_INFO, 02892 "%s%s = %s\n", 02893 pprefix, 02894 "dss_config__target_total_rate_mcps", 02895 fp_text); 02896 02897 02898 trace_print( 02899 VL53L1_TRACE_LEVEL_INFO, 02900 "%s%s = %u\n", 02901 pprefix, 02902 "mm_config_timeout_us", 02903 pdata->mm_config_timeout_us); 02904 02905 trace_print( 02906 VL53L1_TRACE_LEVEL_INFO, 02907 "%s%s = %u\n", 02908 pprefix, 02909 "range_config_timeout_us", 02910 pdata->range_config_timeout_us); 02911 02912 trace_print( 02913 VL53L1_TRACE_LEVEL_INFO, 02914 "%s%s = %u\n", 02915 pprefix, 02916 "phasecal_config_timeout_us", 02917 pdata->phasecal_config_timeout_us); 02918 02919 02920 trace_print( 02921 VL53L1_TRACE_LEVEL_INFO, 02922 "%s%s = %u\n", 02923 pprefix, 02924 "phasecal_num_of_samples", 02925 pdata->phasecal_num_of_samples); 02926 02927 02928 trace_print( 02929 VL53L1_TRACE_LEVEL_INFO, 02930 "%s%s = %u\n", 02931 pprefix, 02932 "zone_num_of_samples", 02933 pdata->zone_num_of_samples); 02934 02935 } 02936 02937 void VL53L1_print_offset_cal_config( 02938 VL53L1_offsetcal_config_t *pdata, 02939 char *pprefix, 02940 uint32_t trace_flags) 02941 { 02942 02943 02944 char fp_text[VL53L1_MAX_STRING_LENGTH]; 02945 02946 VL53L1_signed_fixed_point_sprintf( 02947 (int32_t)pdata->dss_config__target_total_rate_mcps, 02948 7, 02949 VL53L1_MAX_STRING_LENGTH, 02950 fp_text); 02951 02952 trace_print( 02953 VL53L1_TRACE_LEVEL_INFO, 02954 "%s%s = %s\n", 02955 pprefix, 02956 "dss_config__target_total_rate_mcps", 02957 fp_text); 02958 02959 trace_print( 02960 VL53L1_TRACE_LEVEL_INFO, 02961 "%s%s = %u\n", 02962 pprefix, 02963 "phasecal_config_timeout_us", 02964 pdata->phasecal_config_timeout_us); 02965 02966 trace_print( 02967 VL53L1_TRACE_LEVEL_INFO, 02968 "%s%s = %u\n", 02969 pprefix, 02970 "range_config_timeout_us", 02971 pdata->range_config_timeout_us); 02972 02973 trace_print( 02974 VL53L1_TRACE_LEVEL_INFO, 02975 "%s%s = %u\n", 02976 pprefix, 02977 "pre_num_of_samples", 02978 pdata->pre_num_of_samples); 02979 02980 trace_print( 02981 VL53L1_TRACE_LEVEL_INFO, 02982 "%s%s = %u\n", 02983 pprefix, 02984 "mm1_num_of_samples", 02985 pdata->mm1_num_of_samples); 02986 02987 trace_print( 02988 VL53L1_TRACE_LEVEL_INFO, 02989 "%s%s = %u\n", 02990 pprefix, 02991 "mm2_num_of_samples", 02992 pdata->mm2_num_of_samples); 02993 02994 02995 } 02996 02997 02998 void VL53L1_print_dmax_calibration_data( 02999 VL53L1_dmax_calibration_data_t *pdata, 03000 char *pprefix, 03001 uint32_t trace_flags) 03002 { 03003 03004 03005 char fp_text[VL53L1_MAX_STRING_LENGTH]; 03006 03007 VL53L1_signed_fixed_point_sprintf( 03008 (int32_t)pdata->ref__actual_effective_spads, 03009 8, 03010 VL53L1_MAX_STRING_LENGTH, 03011 fp_text); 03012 03013 trace_print( 03014 VL53L1_TRACE_LEVEL_INFO, 03015 "%s%s = %s\n", 03016 pprefix, 03017 "ref__actual_effective_spads", 03018 fp_text); 03019 03020 VL53L1_signed_fixed_point_sprintf( 03021 (int32_t)pdata->ref__peak_signal_count_rate_mcps, 03022 7, 03023 VL53L1_MAX_STRING_LENGTH, 03024 fp_text); 03025 03026 trace_print( 03027 VL53L1_TRACE_LEVEL_INFO, 03028 "%s%s = %s\n", 03029 pprefix, 03030 "ref__peak_signal_count_rate_mcps", 03031 fp_text); 03032 03033 VL53L1_signed_fixed_point_sprintf( 03034 (int32_t)pdata->ref__distance_mm, 03035 4, 03036 VL53L1_MAX_STRING_LENGTH, 03037 fp_text); 03038 03039 trace_print( 03040 VL53L1_TRACE_LEVEL_INFO, 03041 "%s%s = %s\n", 03042 pprefix, 03043 "ref__distance_mm", 03044 fp_text); 03045 03046 VL53L1_signed_fixed_point_sprintf( 03047 (int32_t)pdata->ref_reflectance_pc, 03048 2, 03049 VL53L1_MAX_STRING_LENGTH, 03050 fp_text); 03051 03052 trace_print( 03053 VL53L1_TRACE_LEVEL_INFO, 03054 "%s%s = %s\n", 03055 pprefix, 03056 "ref_reflectance_pc", 03057 fp_text); 03058 03059 VL53L1_signed_fixed_point_sprintf( 03060 (int32_t)pdata->coverglass_transmission, 03061 8, 03062 VL53L1_MAX_STRING_LENGTH, 03063 fp_text); 03064 03065 trace_print( 03066 VL53L1_TRACE_LEVEL_INFO, 03067 "%s%s = %s\n", 03068 pprefix, 03069 "coverglass_transmission", 03070 fp_text); 03071 } 03072 03073 03074 void VL53L1_print_calibration_data( 03075 VL53L1_calibration_data_t *pdata, 03076 char *pprefix, 03077 uint32_t trace_flags) 03078 { 03079 03080 03081 char pre_text[VL53L1_MAX_STRING_LENGTH]; 03082 char *ppre_text = &(pre_text[0]); 03083 03084 trace_print( 03085 VL53L1_TRACE_LEVEL_INFO, 03086 "%s%s = 0x%08X\n", 03087 pprefix, 03088 "struct_version", 03089 pdata->struct_version); 03090 03091 sprintf(ppre_text, "%scustomer.", pprefix); 03092 VL53L1_print_customer_nvm_managed( 03093 &(pdata->customer), 03094 ppre_text, trace_flags); 03095 03096 sprintf(ppre_text, "%sfmt_dmax_cal.", pprefix); 03097 VL53L1_print_dmax_calibration_data( 03098 &(pdata->fmt_dmax_cal), 03099 ppre_text, trace_flags); 03100 03101 sprintf(ppre_text, "%scust_dmax_cal.", pprefix); 03102 VL53L1_print_dmax_calibration_data( 03103 &(pdata->cust_dmax_cal), 03104 ppre_text, trace_flags); 03105 03106 sprintf(ppre_text, "%sadd_off_cal_data.", pprefix); 03107 VL53L1_print_additional_offset_cal_data( 03108 &(pdata->add_off_cal_data), 03109 ppre_text, trace_flags); 03110 03111 sprintf(ppre_text, "%soptical_centre.", pprefix); 03112 VL53L1_print_optical_centre( 03113 &(pdata->optical_centre), 03114 ppre_text, trace_flags); 03115 03116 sprintf(ppre_text, "%sxtalkhisto.", pprefix); 03117 VL53L1_print_xtalk_histogram_data( 03118 &(pdata->xtalkhisto), 03119 ppre_text, trace_flags); 03120 03121 sprintf(ppre_text, "%sgain_cal.", pprefix); 03122 VL53L1_print_gain_calibration_data( 03123 &(pdata->gain_cal), 03124 ppre_text, trace_flags); 03125 03126 sprintf(ppre_text, "%scal_peak_rate_map.", pprefix); 03127 VL53L1_print_cal_peak_rate_map( 03128 &(pdata->cal_peak_rate_map), 03129 ppre_text, trace_flags); 03130 } 03131 03132 03133 void VL53L1_print_xtalk_debug_data( 03134 VL53L1_xtalk_debug_data_t *pdata, 03135 char *pprefix, 03136 uint32_t trace_flags) 03137 { 03138 03139 03140 char pre_text[VL53L1_MAX_STRING_LENGTH]; 03141 char *ppre_text = &(pre_text[0]); 03142 03143 sprintf(ppre_text, "%scustomer.", pprefix); 03144 VL53L1_print_customer_nvm_managed( 03145 &(pdata->customer), 03146 ppre_text, trace_flags); 03147 03148 sprintf(ppre_text, "%sxtalk_cfg.", pprefix); 03149 VL53L1_print_xtalk_config( 03150 &(pdata->xtalk_cfg), 03151 ppre_text, trace_flags); 03152 03153 sprintf(ppre_text, "%sxtalk_extract_cfg.", pprefix); 03154 VL53L1_print_xtalk_extract_config( 03155 &(pdata->xtalk_extract_cfg), 03156 ppre_text, trace_flags); 03157 03158 sprintf(ppre_text, "%shist_data.", pprefix); 03159 VL53L1_print_histogram_bin_data( 03160 &(pdata->hist_data), 03161 ppre_text, trace_flags); 03162 03163 sprintf(ppre_text, "%sxtalk_shapes.", pprefix); 03164 VL53L1_print_xtalk_histogram_data( 03165 &(pdata->xtalk_shapes), 03166 ppre_text, trace_flags); 03167 03168 sprintf(ppre_text, "%sgain_cal.", pprefix); 03169 VL53L1_print_xtalk_range_results( 03170 &(pdata->xtalk_results), 03171 ppre_text, trace_flags); 03172 } 03173 03174 03175 void VL53L1_print_offset_debug_data( 03176 VL53L1_offset_debug_data_t *pdata, 03177 char *pprefix, 03178 uint32_t trace_flags) 03179 { 03180 03181 03182 char pre_text[VL53L1_MAX_STRING_LENGTH]; 03183 char *ppre_text = &(pre_text[0]); 03184 03185 sprintf(ppre_text, "%scustomer.", pprefix); 03186 VL53L1_print_customer_nvm_managed( 03187 &(pdata->customer), 03188 ppre_text, trace_flags); 03189 03190 sprintf(ppre_text, "%sfmt_dmax_cal.", pprefix); 03191 VL53L1_print_dmax_calibration_data( 03192 &(pdata->fmt_dmax_cal), 03193 ppre_text, trace_flags); 03194 03195 sprintf(ppre_text, "%scust_dmax_cal.", pprefix); 03196 VL53L1_print_dmax_calibration_data( 03197 &(pdata->cust_dmax_cal), 03198 ppre_text, trace_flags); 03199 03200 sprintf(ppre_text, "%sadd_off_cal_data.", pprefix); 03201 VL53L1_print_additional_offset_cal_data( 03202 &(pdata->add_off_cal_data), 03203 ppre_text, trace_flags); 03204 03205 sprintf(ppre_text, "%soffset_results.", pprefix); 03206 VL53L1_print_offset_range_results( 03207 &(pdata->offset_results), 03208 ppre_text, trace_flags); 03209 } 03210 03211 03212 void VL53L1_print_zone_config( 03213 VL53L1_zone_config_t *pdata, 03214 char *pprefix, 03215 uint32_t trace_flags) 03216 { 03217 03218 03219 03220 char pre_text[VL53L1_MAX_STRING_LENGTH]; 03221 char *ppre_text = &(pre_text[0]); 03222 03223 uint8_t i = 0; 03224 03225 trace_print( 03226 VL53L1_TRACE_LEVEL_INFO, 03227 "%s%s = %u\n", 03228 pprefix, 03229 "max_zones", 03230 pdata->max_zones); 03231 03232 trace_print( 03233 VL53L1_TRACE_LEVEL_INFO, 03234 "%s%s = %u\n", 03235 pprefix, 03236 "active_zones", 03237 pdata->active_zones); 03238 03239 for (i = 0; i < pdata->active_zones; i++) { 03240 sprintf(ppre_text, "%suser_zones[%u].", pprefix, i); 03241 VL53L1_print_user_zone( 03242 &pdata->user_zones[i], 03243 ppre_text, 03244 trace_flags); 03245 } 03246 } 03247 03248 03249 void VL53L1_print_optical_centre( 03250 VL53L1_optical_centre_t *pdata, 03251 char *pprefix, 03252 uint32_t trace_flags) 03253 { 03254 03255 03256 03257 char fp_text[VL53L1_MAX_STRING_LENGTH]; 03258 03259 VL53L1_signed_fixed_point_sprintf( 03260 (int32_t)pdata->x_centre, 03261 4, 03262 VL53L1_MAX_STRING_LENGTH, 03263 fp_text); 03264 03265 trace_print( 03266 VL53L1_TRACE_LEVEL_INFO, 03267 "%s%s = %s\n", 03268 pprefix, 03269 "x_centre", 03270 fp_text); 03271 03272 VL53L1_signed_fixed_point_sprintf( 03273 (int32_t)pdata->y_centre, 03274 4, 03275 VL53L1_MAX_STRING_LENGTH, 03276 fp_text); 03277 03278 trace_print( 03279 VL53L1_TRACE_LEVEL_INFO, 03280 "%s%s = %s\n", 03281 pprefix, 03282 "y_centre", 03283 fp_text); 03284 } 03285 03286 03287 void VL53L1_print_user_zone( 03288 VL53L1_user_zone_t *pdata, 03289 char *pprefix, 03290 uint32_t trace_flags) 03291 { 03292 03293 03294 03295 trace_print( 03296 VL53L1_TRACE_LEVEL_INFO, 03297 "%s%s = %u\n", 03298 pprefix, 03299 "x_centre", 03300 pdata->x_centre); 03301 03302 trace_print( 03303 VL53L1_TRACE_LEVEL_INFO, 03304 "%s%s = %u\n", 03305 pprefix, 03306 "y_centre", 03307 pdata->y_centre); 03308 03309 trace_print( 03310 VL53L1_TRACE_LEVEL_INFO, 03311 "%s%s = %u\n", 03312 pprefix, 03313 "width", 03314 pdata->width); 03315 03316 trace_print(VL53L1_TRACE_LEVEL_INFO, 03317 "%s%s = %u\n", 03318 pprefix, 03319 "height", 03320 pdata->height); 03321 } 03322 03323 03324 void VL53L1_print_spad_rate_data( 03325 VL53L1_spad_rate_data_t *pspad_rates, 03326 char *pprefix, 03327 uint32_t trace_flags) 03328 { 03329 03330 03331 03332 uint16_t spad_no = 0; 03333 uint8_t row = 0; 03334 uint8_t col = 0; 03335 03336 char fp_text[VL53L1_MAX_STRING_LENGTH]; 03337 03338 trace_print( 03339 VL53L1_TRACE_LEVEL_INFO, 03340 "%s%8s,%4s,%4s, %s\n", 03341 pprefix, 03342 "spad_no", 03343 "row", 03344 "col", 03345 "peak_rate_mcps"); 03346 03347 for (spad_no = 0; spad_no < pspad_rates->no_of_values; spad_no++) { 03348 03349 03350 VL53L1_decode_row_col( 03351 (uint8_t)spad_no, 03352 &row, 03353 &col); 03354 03355 03356 03357 VL53L1_signed_fixed_point_sprintf( 03358 (int32_t)pspad_rates->rate_data[spad_no], 03359 pspad_rates->fractional_bits, 03360 VL53L1_MAX_STRING_LENGTH, 03361 fp_text); 03362 03363 03364 03365 trace_print( 03366 VL53L1_TRACE_LEVEL_INFO, 03367 "%s%8u,%4u,%4u, %s\n", 03368 pprefix, 03369 spad_no, 03370 row, 03371 col, 03372 fp_text); 03373 } 03374 } 03375 03376 03377 void VL53L1_print_spad_rate_map( 03378 VL53L1_spad_rate_data_t *pspad_rates, 03379 char *pprefix, 03380 uint32_t trace_flags) 03381 { 03382 03383 03384 03385 uint8_t spad_no = 0; 03386 uint8_t row = 0; 03387 uint8_t col = 0; 03388 03389 char fp_text[VL53L1_MAX_STRING_LENGTH]; 03390 03391 03392 trace_print( 03393 VL53L1_TRACE_LEVEL_INFO, 03394 "%s%4s", 03395 pprefix, 03396 " "); 03397 03398 for (col = 0; col < VL53L1_SPAD_ARRAY_WIDTH; col++) 03399 trace_print( 03400 VL53L1_TRACE_LEVEL_INFO, 03401 ",%8u", 03402 col); 03403 03404 trace_print( 03405 VL53L1_TRACE_LEVEL_INFO, 03406 "\n"); 03407 03408 03409 03410 for (row = 0; row < VL53L1_SPAD_ARRAY_HEIGHT; row++) { 03411 03412 trace_print( 03413 VL53L1_TRACE_LEVEL_INFO, 03414 "%s%4u", 03415 pprefix, 03416 row); 03417 03418 for (col = 0; col < VL53L1_SPAD_ARRAY_HEIGHT; col++) { 03419 03420 03421 03422 VL53L1_encode_row_col( 03423 row, 03424 col, 03425 &spad_no); 03426 03427 03428 03429 VL53L1_signed_fixed_point_sprintf( 03430 (int32_t)pspad_rates->rate_data[spad_no], 03431 pspad_rates->fractional_bits, 03432 VL53L1_MAX_STRING_LENGTH, 03433 fp_text); 03434 03435 03436 03437 trace_print( 03438 VL53L1_TRACE_LEVEL_INFO, 03439 ",%8s", 03440 fp_text); 03441 } 03442 03443 trace_print( 03444 VL53L1_TRACE_LEVEL_INFO, 03445 "\n"); 03446 } 03447 } 03448 03449 03450 #endif 03451 03452 03453
Generated on Tue Jul 12 2022 20:07:14 by
1.7.2