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