Initial release. Mbed library for VL53L1CB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vl53l1_nvm_debug.c Source File

vl53l1_nvm_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_platform.h"
00070 #include "vl53l1_platform_log.h"
00071 #include "vl53l1_register_map.h"
00072 #include "vl53l1_api_debug.h"
00073 #include "vl53l1_nvm_structs.h"
00074 #include "vl53l1_nvm_debug.h"
00075 
00076 #define LOG_FUNCTION_START(fmt, ...) \
00077     _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_NVM, fmt, ##__VA_ARGS__)
00078 #define LOG_FUNCTION_END(status, ...) \
00079     _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_NVM, status, ##__VA_ARGS__)
00080 #define LOG_FUNCTION_END_FMT(status, fmt, ...) \
00081     _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_NVM,\
00082         status, fmt, ##__VA_ARGS__)
00083 
00084 #define trace_print(level, ...) \
00085     _LOG_TRACE_PRINT(trace_flags, \
00086     level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__)
00087 
00088 #ifdef VL53L1_LOG_ENABLE
00089 
00090 void VL53L1_print_nvm_raw_data(
00091     uint8_t                       *pnvm_raw_data,
00092     uint32_t                       trace_flags)
00093 {
00094 
00095 
00096     int i = 0;
00097 
00098     LOG_FUNCTION_START("");
00099 
00100     for (i = 0 ; i < VL53L1_NVM_SIZE_IN_BYTES ; i++) {
00101         if (i % 4 == 0)
00102             trace_print(
00103                 VL53L1_TRACE_LEVEL_INFO,
00104                 "\n    NVM Addr 0x%02X : 0x",
00105                 i/4);
00106 
00107         trace_print(
00108             VL53L1_TRACE_LEVEL_INFO,
00109             "%02X",
00110             *pnvm_raw_data++);
00111     }
00112 
00113     trace_print(
00114         VL53L1_TRACE_LEVEL_INFO,
00115         "\n");
00116 
00117     LOG_FUNCTION_END(0);
00118 }
00119 
00120 
00121 void VL53L1_print_decoded_nvm_data(
00122     VL53L1_decoded_nvm_data_t *pdata,
00123     char                      *pprefix,
00124     uint32_t                   trace_flags)
00125 {
00126     char  fp_text[VL53L1_MAX_STRING_LENGTH];
00127     char  pre_text[VL53L1_MAX_STRING_LENGTH];
00128     char *ppre_text = &(pre_text[0]);
00129 
00130     uint8_t i = 0;
00131 
00132     trace_print(
00133         VL53L1_TRACE_LEVEL_INFO,
00134         "%s%s = %u\n",
00135         pprefix,
00136         "nvm__identification_model_id",
00137         pdata->nvm__identification_model_id);
00138 
00139     trace_print(
00140         VL53L1_TRACE_LEVEL_INFO,
00141         "%s%s = %u\n",
00142         pprefix,
00143         "nvm__identification_module_type",
00144         pdata->nvm__identification_module_type);
00145 
00146     trace_print(
00147         VL53L1_TRACE_LEVEL_INFO,
00148         "%s%s = %u\n",
00149         pprefix,
00150         "nvm__identification_revision_id",
00151         pdata->nvm__identification_revision_id);
00152 
00153     trace_print(
00154         VL53L1_TRACE_LEVEL_INFO,
00155         "%s%s = %u\n",
00156         pprefix,
00157         "nvm__identification_module_id",
00158         pdata->nvm__identification_module_id);
00159 
00160     trace_print(
00161         VL53L1_TRACE_LEVEL_INFO,
00162         "%s%s = %u\n",
00163         pprefix,
00164         "nvm__i2c_valid",
00165         pdata->nvm__i2c_valid);
00166 
00167     trace_print(
00168         VL53L1_TRACE_LEVEL_INFO,
00169         "%s%s = %u\n",
00170         pprefix,
00171         "nvm__i2c_device_address_ews",
00172         pdata->nvm__i2c_device_address_ews);
00173 
00174     VL53L1_signed_fixed_point_sprintf(
00175         (int32_t)pdata->nvm__ews__fast_osc_frequency,
00176         12,
00177         VL53L1_MAX_STRING_LENGTH,
00178         fp_text);
00179 
00180     trace_print(
00181         VL53L1_TRACE_LEVEL_INFO,
00182         "%s%s = %s\n",
00183         pprefix,
00184         "nvm__ews__fast_osc_frequency",
00185         fp_text);
00186 
00187     trace_print(
00188         VL53L1_TRACE_LEVEL_INFO,
00189         "%s%s = %u\n",
00190         pprefix,
00191         "nvm__ews__fast_osc_trim_max",
00192         pdata->nvm__ews__fast_osc_trim_max);
00193 
00194     trace_print(
00195         VL53L1_TRACE_LEVEL_INFO,
00196         "%s%s = %u\n",
00197         pprefix,
00198         "nvm__ews__fast_osc_freq_set",
00199         pdata->nvm__ews__fast_osc_freq_set);
00200 
00201     trace_print(
00202         VL53L1_TRACE_LEVEL_INFO,
00203         "%s%s = %u\n",
00204         pprefix,
00205         "nvm__ews__slow_osc_calibration",
00206         pdata->nvm__ews__slow_osc_calibration);
00207 
00208     VL53L1_signed_fixed_point_sprintf(
00209         (int32_t)pdata->nvm__fmt__fast_osc_frequency,
00210         12,
00211         VL53L1_MAX_STRING_LENGTH,
00212         fp_text);
00213 
00214     trace_print(
00215         VL53L1_TRACE_LEVEL_INFO,
00216         "%s%s = %s\n",
00217         pprefix,
00218         "nvm__fmt__fast_osc_frequency",
00219         fp_text);
00220 
00221     trace_print(
00222         VL53L1_TRACE_LEVEL_INFO,
00223         "%s%s = %u\n",
00224         pprefix,
00225         "nvm__fmt__fast_osc_trim_max",
00226         pdata->nvm__fmt__fast_osc_trim_max);
00227 
00228     trace_print(
00229         VL53L1_TRACE_LEVEL_INFO,
00230         "%s%s = %u\n",
00231         pprefix,
00232         "nvm__fmt__fast_osc_freq_set",
00233         pdata->nvm__fmt__fast_osc_freq_set);
00234 
00235     trace_print(
00236         VL53L1_TRACE_LEVEL_INFO,
00237         "%s%s = %u\n",
00238         pprefix,
00239         "nvm__fmt__slow_osc_calibration",
00240         pdata->nvm__fmt__slow_osc_calibration);
00241 
00242     trace_print(
00243         VL53L1_TRACE_LEVEL_INFO,
00244         "%s%s = %u\n",
00245         pprefix,
00246         "nvm__vhv_config_unlock",
00247         pdata->nvm__vhv_config_unlock);
00248 
00249     trace_print(
00250         VL53L1_TRACE_LEVEL_INFO,
00251         "%s%s = %u\n",
00252         pprefix,
00253         "nvm__ref_selvddpix",
00254         pdata->nvm__ref_selvddpix);
00255 
00256     trace_print(
00257         VL53L1_TRACE_LEVEL_INFO,
00258         "%s%s = %u\n",
00259         pprefix,
00260         "nvm__ref_selvquench",
00261         pdata->nvm__ref_selvquench);
00262 
00263     trace_print(
00264         VL53L1_TRACE_LEVEL_INFO,
00265         "%s%s = %u\n",
00266         pprefix,
00267         "nvm__regavdd1v2_sel",
00268         pdata->nvm__regavdd1v2_sel);
00269 
00270     trace_print(
00271         VL53L1_TRACE_LEVEL_INFO,
00272         "%s%s = %u\n",
00273         pprefix,
00274         "nvm__regdvdd1v2_sel",
00275         pdata->nvm__regdvdd1v2_sel);
00276 
00277     trace_print(
00278         VL53L1_TRACE_LEVEL_INFO,
00279         "%s%s = %u\n",
00280         pprefix,
00281         "nvm__vhv_timeout__macrop",
00282         pdata->nvm__vhv_timeout__macrop);
00283 
00284     trace_print(
00285         VL53L1_TRACE_LEVEL_INFO,
00286         "%s%s = %u\n",
00287         pprefix,
00288         "nvm__vhv_loop_bound",
00289         pdata->nvm__vhv_loop_bound);
00290 
00291     trace_print(
00292         VL53L1_TRACE_LEVEL_INFO,
00293         "%s%s = %u\n",
00294         pprefix,
00295         "nvm__vhv_count_threshold",
00296         pdata->nvm__vhv_count_threshold);
00297 
00298     trace_print(
00299         VL53L1_TRACE_LEVEL_INFO,
00300         "%s%s = %u\n",
00301         pprefix,
00302         "nvm__vhv_offset",
00303         pdata->nvm__vhv_offset);
00304 
00305     trace_print(
00306         VL53L1_TRACE_LEVEL_INFO,
00307         "%s%s = %u\n",
00308         pprefix,
00309         "nvm__vhv_init_enable",
00310         pdata->nvm__vhv_init_enable);
00311 
00312     trace_print(
00313         VL53L1_TRACE_LEVEL_INFO,
00314         "%s%s = %u\n",
00315         pprefix,
00316         "nvm__vhv_init_value",
00317         pdata->nvm__vhv_init_value);
00318 
00319     trace_print(
00320         VL53L1_TRACE_LEVEL_INFO,
00321         "%s%s = %u\n",
00322         pprefix,
00323         "nvm__laser_safety_vcsel_trim_ll",
00324         pdata->nvm__laser_safety_vcsel_trim_ll);
00325 
00326     trace_print(
00327         VL53L1_TRACE_LEVEL_INFO,
00328         "%s%s = %u\n",
00329         pprefix,
00330         "nvm__laser_safety_vcsel_selion_ll",
00331         pdata->nvm__laser_safety_vcsel_selion_ll);
00332 
00333     trace_print(
00334         VL53L1_TRACE_LEVEL_INFO,
00335         "%s%s = %u\n",
00336         pprefix,
00337         "nvm__laser_safety_vcsel_selion_max_ll",
00338         pdata->nvm__laser_safety_vcsel_selion_max_ll);
00339 
00340     trace_print(
00341         VL53L1_TRACE_LEVEL_INFO,
00342         "%s%s = %u\n",
00343         pprefix,
00344         "nvm__laser_safety_mult_ll",
00345         pdata->nvm__laser_safety_mult_ll);
00346 
00347     trace_print(
00348         VL53L1_TRACE_LEVEL_INFO,
00349         "%s%s = %u\n",
00350         pprefix,
00351         "nvm__laser_safety_clip_ll",
00352         pdata->nvm__laser_safety_clip_ll);
00353 
00354     trace_print(
00355         VL53L1_TRACE_LEVEL_INFO,
00356         "%s%s = %u\n",
00357         pprefix,
00358         "nvm__laser_safety_vcsel_trim_ld",
00359         pdata->nvm__laser_safety_vcsel_trim_ld);
00360 
00361     trace_print(
00362         VL53L1_TRACE_LEVEL_INFO,
00363         "%s%s = %u\n",
00364         pprefix,
00365         "nvm__laser_safety_vcsel_selion_ld",
00366         pdata->nvm__laser_safety_vcsel_selion_ld);
00367 
00368     trace_print(
00369         VL53L1_TRACE_LEVEL_INFO,
00370         "%s%s = %u\n",
00371         pprefix,
00372         "nvm__laser_safety_vcsel_selion_max_ld",
00373         pdata->nvm__laser_safety_vcsel_selion_max_ld);
00374 
00375     trace_print(
00376         VL53L1_TRACE_LEVEL_INFO,
00377         "%s%s = %u\n",
00378         pprefix,
00379         "nvm__laser_safety_mult_ld",
00380         pdata->nvm__laser_safety_mult_ld);
00381 
00382     trace_print(
00383         VL53L1_TRACE_LEVEL_INFO,
00384         "%s%s = %u\n",
00385         pprefix,
00386         "nvm__laser_safety_clip_ld",
00387         pdata->nvm__laser_safety_clip_ld);
00388 
00389     trace_print(
00390         VL53L1_TRACE_LEVEL_INFO,
00391         "%s%s = %u\n",
00392         pprefix,
00393         "nvm__laser_safety_lock_byte",
00394         pdata->nvm__laser_safety_lock_byte);
00395 
00396     trace_print(
00397         VL53L1_TRACE_LEVEL_INFO,
00398         "%s%s = %u\n",
00399         pprefix,
00400         "nvm__laser_safety_unlock_byte",
00401         pdata->nvm__laser_safety_unlock_byte);
00402 
00403 
00404 
00405     for (i = 0 ; i < VL53L1_RTN_SPAD_BUFFER_SIZE ; i++) {
00406         sprintf(
00407             ppre_text,
00408             "%snvm__ews__spad_enables_rtn[%u]",
00409             pprefix, i);
00410 
00411         trace_print(
00412             VL53L1_TRACE_LEVEL_INFO,
00413             "%s = %u\n",
00414             ppre_text,
00415             pdata->nvm__ews__spad_enables_rtn[i]);
00416     }
00417 
00418     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00419         sprintf(
00420             ppre_text,
00421             "%snvm__ews__spad_enables_ref__loc1[%u]",
00422             pprefix, i);
00423 
00424         trace_print(
00425             VL53L1_TRACE_LEVEL_INFO,
00426             "%s = %u\n",
00427             ppre_text,
00428             pdata->nvm__ews__spad_enables_ref__loc1[i]);
00429     }
00430 
00431     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00432         sprintf(
00433             ppre_text,
00434             "%snvm__ews__spad_enables_ref__loc2[%u]",
00435             pprefix, i);
00436 
00437         trace_print(
00438             VL53L1_TRACE_LEVEL_INFO,
00439             "%s = %u\n",
00440             ppre_text,
00441             pdata->nvm__ews__spad_enables_ref__loc2[i]);
00442     }
00443 
00444     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00445         sprintf(
00446             ppre_text,
00447             "%snvm__ews__spad_enables_ref__loc3[%u]",
00448             pprefix, i);
00449 
00450         trace_print(
00451             VL53L1_TRACE_LEVEL_INFO,
00452             "%s = %u\n",
00453             ppre_text,
00454             pdata->nvm__ews__spad_enables_ref__loc3[i]);
00455     }
00456 
00457 
00458 
00459 
00460     for (i = 0 ; i < VL53L1_RTN_SPAD_BUFFER_SIZE ; i++) {
00461         sprintf(
00462             ppre_text,
00463             "%snvm__fmt__spad_enables_rtn[%u]",
00464             pprefix, i);
00465 
00466         trace_print(
00467             VL53L1_TRACE_LEVEL_INFO,
00468             "%s = %u\n",
00469             ppre_text,
00470             pdata->nvm__fmt__spad_enables_rtn[i]);
00471     }
00472 
00473     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00474         sprintf(
00475             ppre_text,
00476             "%snvm__fmt__spad_enables_ref__loc1[%u]",
00477             pprefix, i);
00478 
00479         trace_print(
00480             VL53L1_TRACE_LEVEL_INFO,
00481             "%s = %u\n",
00482             ppre_text,
00483             pdata->nvm__fmt__spad_enables_ref__loc1[i]);
00484     }
00485 
00486     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00487         sprintf(
00488             ppre_text,
00489             "%snvm__fmt__spad_enables_ref__loc2[%u]",
00490             pprefix, i);
00491 
00492         trace_print(
00493             VL53L1_TRACE_LEVEL_INFO,
00494             "%s = %u\n",
00495             ppre_text,
00496             pdata->nvm__fmt__spad_enables_ref__loc2[i]);
00497     }
00498 
00499     for (i = 0 ; i < VL53L1_REF_SPAD_BUFFER_SIZE ; i++) {
00500         sprintf(
00501             ppre_text,
00502             "%snvm__fmt__spad_enables_ref__loc3[%u]",
00503             pprefix, i);
00504 
00505         trace_print(
00506             VL53L1_TRACE_LEVEL_INFO,
00507             "%s = %u\n",
00508             ppre_text,
00509             pdata->nvm__fmt__spad_enables_ref__loc3[i]);
00510     }
00511 
00512     trace_print(
00513         VL53L1_TRACE_LEVEL_INFO,
00514         "%s%s = %u\n",
00515         pprefix,
00516         "nvm__fmt__roi_config__mode_roi_centre_spad",
00517         pdata->nvm__fmt__roi_config__mode_roi_centre_spad);
00518 
00519     trace_print(
00520         VL53L1_TRACE_LEVEL_INFO,
00521         "%s%s = %u\n",
00522         pprefix,
00523         "nvm__fmt__roi_config__mode_roi_x_size",
00524         pdata->nvm__fmt__roi_config__mode_roi_x_size);
00525 
00526     trace_print(
00527         VL53L1_TRACE_LEVEL_INFO,
00528         "%s%s = %u\n",
00529         pprefix,
00530         "nvm__fmt__roi_config__mode_roi_y_size",
00531         pdata->nvm__fmt__roi_config__mode_roi_y_size);
00532 
00533     trace_print(
00534         VL53L1_TRACE_LEVEL_INFO,
00535         "%s%s = %u\n",
00536         pprefix,
00537         "nvm__fmt__ref_spad_apply__num_requested_ref_spad",
00538         pdata->nvm__fmt__ref_spad_apply__num_requested_ref_spad);
00539 
00540     trace_print(
00541         VL53L1_TRACE_LEVEL_INFO,
00542         "%s%s = %u\n",
00543         pprefix,
00544         "nvm__fmt__ref_spad_man__ref_location",
00545         pdata->nvm__fmt__ref_spad_man__ref_location);
00546 
00547     trace_print(
00548         VL53L1_TRACE_LEVEL_INFO,
00549         "%s%s = %d\n",
00550         pprefix,
00551         "nvm__fmt__mm_config__inner_offset_mm",
00552         pdata->nvm__fmt__mm_config__inner_offset_mm);
00553 
00554     trace_print(
00555         VL53L1_TRACE_LEVEL_INFO,
00556         "%s%s = %d\n",
00557         pprefix,
00558         "nvm__fmt__mm_config__outer_offset_mm",
00559         pdata->nvm__fmt__mm_config__outer_offset_mm);
00560 
00561     VL53L1_signed_fixed_point_sprintf(
00562         (int32_t)pdata->nvm__fmt__algo_part_to_part_range_offset_mm,
00563         2,
00564         VL53L1_MAX_STRING_LENGTH,
00565         fp_text);
00566 
00567     trace_print(
00568         VL53L1_TRACE_LEVEL_INFO,
00569         "%s%s = %s\n",
00570         pprefix,
00571         "nvm__fmt__algo_part_to_part_range_offset_mm",
00572         fp_text);
00573 
00574     VL53L1_signed_fixed_point_sprintf(
00575     (int32_t)(
00576     pdata->nvm__fmt__algo__crosstalk_compensation_plane_offset_kcps),
00577     9,
00578     VL53L1_MAX_STRING_LENGTH,
00579     fp_text);
00580 
00581     trace_print(
00582         VL53L1_TRACE_LEVEL_INFO,
00583         "%s%s = %s\n",
00584         pprefix,
00585         "nvm__fmt__algo__crosstalk_compensation_plane_offset_kcps",
00586         fp_text);
00587 
00588     VL53L1_signed_fixed_point_sprintf(
00589     (int32_t)(
00590     pdata->nvm__fmt__algo__crosstalk_compensation_x_plane_gradient_kcps),
00591     11,
00592     VL53L1_MAX_STRING_LENGTH,
00593     fp_text);
00594 
00595     trace_print(
00596         VL53L1_TRACE_LEVEL_INFO,
00597         "%s%s = %s\n",
00598         pprefix,
00599         "nvm__fmt__algo__crosstalk_compensation_x_plane_gradient_kcps",
00600         fp_text);
00601 
00602     VL53L1_signed_fixed_point_sprintf(
00603     (int32_t)(
00604     pdata->nvm__fmt__algo__crosstalk_compensation_y_plane_gradient_kcps),
00605     11,
00606     VL53L1_MAX_STRING_LENGTH,
00607     fp_text);
00608 
00609     trace_print(
00610         VL53L1_TRACE_LEVEL_INFO,
00611         "%s%s = %s\n",
00612         pprefix,
00613         "nvm__fmt__algo__crosstalk_compensation_y_plane_gradient_kcps",
00614         fp_text);
00615 
00616     trace_print(
00617         VL53L1_TRACE_LEVEL_INFO,
00618         "%s%s = %u\n",
00619         pprefix,
00620         "nvm__fmt__spare__host_config__nvm_config_spare_0",
00621         pdata->nvm__fmt__spare__host_config__nvm_config_spare_0);
00622 
00623     trace_print(
00624         VL53L1_TRACE_LEVEL_INFO,
00625         "%s%s = %u\n",
00626         pprefix,
00627         "nvm__fmt__spare__host_config__nvm_config_spare_1",
00628         pdata->nvm__fmt__spare__host_config__nvm_config_spare_1);
00629 
00630     trace_print(
00631         VL53L1_TRACE_LEVEL_INFO,
00632         "%s%s = %u\n",
00633         pprefix,
00634         "nvm__customer_space_programmed",
00635         pdata->nvm__customer_space_programmed);
00636 
00637     trace_print(
00638         VL53L1_TRACE_LEVEL_INFO,
00639         "%s%s = %u\n",
00640         pprefix,
00641         "nvm__cust__i2c_device_address",
00642         pdata->nvm__cust__i2c_device_address);
00643 
00644     trace_print(
00645         VL53L1_TRACE_LEVEL_INFO,
00646         "%s%s = %u\n",
00647         pprefix,
00648         "nvm__cust__ref_spad_apply__num_requested_ref_spad",
00649         pdata->nvm__cust__ref_spad_apply__num_requested_ref_spad);
00650 
00651     trace_print(
00652         VL53L1_TRACE_LEVEL_INFO,
00653         "%s%s = %u\n",
00654         pprefix,
00655         "nvm__cust__ref_spad_man__ref_location",
00656         pdata->nvm__cust__ref_spad_man__ref_location);
00657 
00658     trace_print(
00659         VL53L1_TRACE_LEVEL_INFO,
00660         "%s%s = %d\n",
00661         pprefix,
00662         "nvm__cust__mm_config__inner_offset_mm",
00663         pdata->nvm__cust__mm_config__inner_offset_mm);
00664 
00665     trace_print(
00666         VL53L1_TRACE_LEVEL_INFO,
00667         "%s%s = %d\n",
00668         pprefix,
00669         "nvm__cust__mm_config__outer_offset_mm",
00670         pdata->nvm__cust__mm_config__outer_offset_mm);
00671 
00672     VL53L1_signed_fixed_point_sprintf(
00673         (int32_t)pdata->nvm__cust__algo_part_to_part_range_offset_mm,
00674         2,
00675         VL53L1_MAX_STRING_LENGTH,
00676         fp_text);
00677 
00678     trace_print(
00679         VL53L1_TRACE_LEVEL_INFO,
00680         "%s%s = %s\n",
00681         pprefix,
00682         "nvm__cust__algo_part_to_part_range_offset_mm",
00683         fp_text);
00684 
00685     VL53L1_signed_fixed_point_sprintf(
00686     (uint32_t)(
00687     pdata->nvm__cust__algo__crosstalk_compensation_plane_offset_kcps),
00688     9,
00689     VL53L1_MAX_STRING_LENGTH,
00690     fp_text);
00691 
00692     trace_print(
00693         VL53L1_TRACE_LEVEL_INFO,
00694         "%s%s = %s\n",
00695         pprefix,
00696         "nvm__cust__algo__crosstalk_compensation_plane_offset_kcps",
00697         fp_text);
00698 
00699     VL53L1_signed_fixed_point_sprintf(
00700     (int32_t)(
00701     pdata->nvm__cust__algo__crosstalk_compensation_x_plane_gradient_kcps),
00702     11,
00703     VL53L1_MAX_STRING_LENGTH,
00704     fp_text);
00705 
00706     trace_print(
00707         VL53L1_TRACE_LEVEL_INFO,
00708         "%s%s = %s\n",
00709         pprefix,
00710         "nvm__cust__algo__crosstalk_compensation_x_plane_gradient_kcps",
00711         fp_text);
00712 
00713     VL53L1_signed_fixed_point_sprintf(
00714     (int32_t)(
00715     pdata->nvm__cust__algo__crosstalk_compensation_y_plane_gradient_kcps),
00716     11,
00717     VL53L1_MAX_STRING_LENGTH,
00718     fp_text);
00719 
00720     trace_print(
00721         VL53L1_TRACE_LEVEL_INFO,
00722         "%s%s = %s\n",
00723         pprefix,
00724         "nvm__cust__algo__crosstalk_compensation_y_plane_gradient_kcps",
00725         fp_text);
00726 
00727     trace_print(
00728         VL53L1_TRACE_LEVEL_INFO,
00729         "%s%s = %u\n",
00730         pprefix,
00731         "nvm__cust__spare__host_config__nvm_config_spare_0",
00732         pdata->nvm__cust__spare__host_config__nvm_config_spare_0);
00733 
00734     trace_print(
00735         VL53L1_TRACE_LEVEL_INFO,
00736         "%s%s = %u\n",
00737         pprefix,
00738         "nvm__cust__spare__host_config__nvm_config_spare_1",
00739         pdata->nvm__cust__spare__host_config__nvm_config_spare_1);
00740 
00741 
00742 
00743     sprintf(
00744         ppre_text,
00745         "%sfmt_optical_centre.", pprefix);
00746 
00747     VL53L1_print_optical_centre(
00748         &(pdata->fmt_optical_centre),
00749         ppre_text,
00750         VL53L1_TRACE_MODULE_NVM_DATA);
00751 
00752 
00753 
00754     sprintf(
00755         ppre_text,
00756         "%sfmt_peak_rate_map.", pprefix);
00757 
00758     VL53L1_print_cal_peak_rate_map(
00759         &(pdata->fmt_peak_rate_map),
00760         ppre_text,
00761         VL53L1_TRACE_MODULE_NVM_DATA);
00762 
00763 
00764 
00765     sprintf(
00766         ppre_text,
00767         "%sfmt_add_offset_data.",
00768         pprefix);
00769 
00770     VL53L1_print_additional_offset_cal_data(
00771         &(pdata->fmt_add_offset_data),
00772         ppre_text,
00773         VL53L1_TRACE_MODULE_NVM_DATA);
00774 
00775 
00776 
00777     for (i = 0 ; i < VL53L1_NVM_MAX_FMT_RANGE_DATA ; i++) {
00778         sprintf(
00779             ppre_text,
00780             "%sfmt_range_data[%u].",
00781             pprefix, i);
00782 
00783         VL53L1_print_decoded_nvm_fmt_range_data(
00784             &(pdata->fmt_range_data[i]),
00785             ppre_text,
00786             trace_flags);
00787     }
00788 
00789     sprintf(
00790         ppre_text,
00791         "%sfmt_info.",
00792         pprefix);
00793 
00794     VL53L1_print_decoded_nvm_fmt_info(
00795         &(pdata->fmt_info),
00796         ppre_text,
00797         trace_flags);
00798 
00799     sprintf(
00800         ppre_text,
00801         "%sews_info.",
00802         pprefix);
00803 
00804     VL53L1_print_decoded_nvm_ews_info(
00805         &(pdata->ews_info),
00806         ppre_text,
00807         trace_flags);
00808 }
00809 
00810 
00811 void VL53L1_print_decoded_nvm_fmt_range_data(
00812     VL53L1_decoded_nvm_fmt_range_data_t *pdata,
00813     char                                *pprefix,
00814     uint32_t                             trace_flags)
00815 {
00816     char  fp_text[VL53L1_MAX_STRING_LENGTH];
00817 
00818     VL53L1_signed_fixed_point_sprintf(
00819         (int32_t)pdata->result__actual_effective_rtn_spads,
00820         8,
00821         VL53L1_MAX_STRING_LENGTH,
00822         fp_text);
00823 
00824     trace_print(
00825         VL53L1_TRACE_LEVEL_INFO,
00826         "%s%s = %s\n",
00827         pprefix,
00828         "result__actual_effective_rtn_spads",
00829         fp_text);
00830 
00831     trace_print(
00832         VL53L1_TRACE_LEVEL_INFO,
00833         "%s%s = %u\n",
00834         pprefix,
00835         "ref_spad_array__num_requested_ref_spads",
00836         pdata->ref_spad_array__num_requested_ref_spads);
00837 
00838     trace_print(
00839         VL53L1_TRACE_LEVEL_INFO,
00840         "%s%s = %u\n",
00841         pprefix,
00842         "ref_spad_array__ref_location",
00843         pdata->ref_spad_array__ref_location);
00844 
00845     VL53L1_signed_fixed_point_sprintf(
00846         (int32_t)pdata->result__peak_signal_count_rate_rtn_mcps,
00847         7,
00848         VL53L1_MAX_STRING_LENGTH,
00849         fp_text);
00850 
00851     trace_print(
00852         VL53L1_TRACE_LEVEL_INFO,
00853         "%s%s = %s\n",
00854         pprefix,
00855         "result__peak_signal_count_rate_rtn_mcps",
00856         fp_text);
00857 
00858     VL53L1_signed_fixed_point_sprintf(
00859         (int32_t)pdata->result__ambient_count_rate_rtn_mcps,
00860         7,
00861         VL53L1_MAX_STRING_LENGTH,
00862         fp_text);
00863 
00864     trace_print(
00865         VL53L1_TRACE_LEVEL_INFO,
00866         "%s%s = %s\n",
00867         pprefix,
00868         "result__ambient_count_rate_rtn_mcps",
00869         fp_text);
00870 
00871     VL53L1_signed_fixed_point_sprintf(
00872         (int32_t)pdata->result__peak_signal_count_rate_ref_mcps,
00873         7,
00874         VL53L1_MAX_STRING_LENGTH,
00875         fp_text);
00876 
00877     trace_print(
00878         VL53L1_TRACE_LEVEL_INFO,
00879         "%s%s = %u\n",
00880         pprefix,
00881         "result__peak_signal_count_rate_ref_mcps",
00882         fp_text);
00883 
00884     VL53L1_signed_fixed_point_sprintf(
00885         (int32_t)pdata->result__ambient_count_rate_ref_mcps,
00886         7,
00887         VL53L1_MAX_STRING_LENGTH,
00888         fp_text);
00889 
00890     trace_print(
00891         VL53L1_TRACE_LEVEL_INFO,
00892         "%s%s = %s\n",
00893         pprefix,
00894         "result__ambient_count_rate_ref_mcps",
00895         fp_text);
00896 
00897     VL53L1_signed_fixed_point_sprintf(
00898         (int32_t)pdata->measured_distance_mm,
00899         4,
00900         VL53L1_MAX_STRING_LENGTH,
00901         fp_text);
00902 
00903     trace_print(
00904         VL53L1_TRACE_LEVEL_INFO,
00905         "%s%s = %s\n",
00906         pprefix,
00907         "measured_distance_mm",
00908         fp_text);
00909 
00910     VL53L1_signed_fixed_point_sprintf(
00911         (uint32_t)pdata->measured_distance_stdev_mm,
00912         4,
00913         VL53L1_MAX_STRING_LENGTH,
00914         fp_text);
00915 
00916     trace_print(
00917         VL53L1_TRACE_LEVEL_INFO,
00918         "%s%s = %s\n",
00919         pprefix,
00920         "measured_distance_stdev_mm",
00921         fp_text);
00922 }
00923 
00924 
00925 void VL53L1_print_decoded_nvm_fmt_info(
00926     VL53L1_decoded_nvm_fmt_info_t *pdata,
00927     char                          *pprefix,
00928     uint32_t                       trace_flags)
00929 {
00930     trace_print(VL53L1_TRACE_LEVEL_INFO,
00931         "%s%s = \"%s\"\n",
00932         pprefix,
00933         "nvm__fmt__fgc",
00934         pdata->nvm__fmt__fgc);
00935 
00936     trace_print(
00937         VL53L1_TRACE_LEVEL_INFO,
00938         "%s%s = %u\n",
00939         pprefix,
00940         "nvm__fmt__test_program_major",
00941         pdata->nvm__fmt__test_program_major);
00942 
00943     trace_print(
00944         VL53L1_TRACE_LEVEL_INFO,
00945         "%s%s = %u\n",
00946         pprefix,
00947         "nvm__fmt__test_program_minor",
00948         pdata->nvm__fmt__test_program_minor);
00949 
00950     trace_print(
00951         VL53L1_TRACE_LEVEL_INFO,
00952         "%s%s = %u\n",
00953         pprefix,
00954         "nvm__fmt__map_major",
00955         pdata->nvm__fmt__map_major);
00956 
00957     trace_print(
00958         VL53L1_TRACE_LEVEL_INFO,
00959         "%s%s = %u\n",
00960         pprefix,
00961         "nvm__fmt__map_minor",
00962         pdata->nvm__fmt__map_minor);
00963 
00964     trace_print(
00965         VL53L1_TRACE_LEVEL_INFO,
00966         "%s%s = %u\n",
00967         pprefix,
00968         "nvm__fmt__year",
00969         pdata->nvm__fmt__year);
00970 
00971     trace_print(
00972         VL53L1_TRACE_LEVEL_INFO,
00973         "%s%s = %u\n",
00974         pprefix,
00975         "nvm__fmt__month",
00976         pdata->nvm__fmt__month);
00977 
00978     trace_print(
00979         VL53L1_TRACE_LEVEL_INFO,
00980         "%s%s = %u\n",
00981         pprefix,
00982         "nvm__fmt__day",
00983         pdata->nvm__fmt__day);
00984 
00985     trace_print(
00986         VL53L1_TRACE_LEVEL_INFO,
00987         "%s%s = %u\n",
00988         pprefix,
00989         "nvm__fmt__module_date_phase",
00990         pdata->nvm__fmt__module_date_phase);
00991 
00992     trace_print(
00993         VL53L1_TRACE_LEVEL_INFO,
00994         "%s%s = %u\n",
00995         pprefix,
00996         "nvm__fmt__time",
00997         pdata->nvm__fmt__time);
00998 
00999     trace_print(
01000         VL53L1_TRACE_LEVEL_INFO,
01001         "%s%s = %u\n",
01002         pprefix,
01003         "nvm__fmt__tester_id",
01004         pdata->nvm__fmt__tester_id);
01005 
01006     trace_print(
01007         VL53L1_TRACE_LEVEL_INFO,
01008         "%s%s = %u\n",
01009         pprefix,
01010         "nvm__fmt__site_id",
01011         pdata->nvm__fmt__site_id);
01012 
01013     trace_print(
01014         VL53L1_TRACE_LEVEL_INFO,
01015         "%s%s = %u\n",
01016         pprefix,
01017         "nvm__ews__test_program_major",
01018         pdata->nvm__ews__test_program_major);
01019 
01020     trace_print(
01021         VL53L1_TRACE_LEVEL_INFO,
01022         "%s%s = %u\n",
01023         pprefix,
01024         "nvm__ews__test_program_minor",
01025         pdata->nvm__ews__test_program_minor);
01026 
01027     trace_print(
01028         VL53L1_TRACE_LEVEL_INFO,
01029         "%s%s = %u\n",
01030         pprefix,
01031         "nvm__ews__probe_card_major",
01032         pdata->nvm__ews__probe_card_major);
01033 
01034     trace_print(
01035         VL53L1_TRACE_LEVEL_INFO,
01036         "%s%s = %u\n",
01037         pprefix,
01038         "nvm__ews__probe_card_minor",
01039         pdata->nvm__ews__probe_card_minor);
01040 
01041     trace_print(
01042         VL53L1_TRACE_LEVEL_INFO,
01043         "%s%s = %u\n",
01044         pprefix,
01045         "nvm__ews__tester_id",
01046         pdata->nvm__ews__tester_id);
01047 }
01048 
01049 
01050 void VL53L1_print_decoded_nvm_ews_info(
01051     VL53L1_decoded_nvm_ews_info_t *pdata,
01052     char                          *pprefix,
01053     uint32_t                       trace_flags)
01054 {
01055     trace_print(VL53L1_TRACE_LEVEL_INFO,
01056         "%s%s = \"%s\"\n",
01057         pprefix,
01058         "nvm__ews__lot",
01059         pdata->nvm__ews__lot);
01060 
01061     trace_print(
01062         VL53L1_TRACE_LEVEL_INFO,
01063         "%s%s = %u\n",
01064         pprefix,
01065         "nvm__ews__wafer",
01066         pdata->nvm__ews__wafer);
01067 
01068     trace_print(
01069         VL53L1_TRACE_LEVEL_INFO,
01070         "%s%s = %u\n",
01071         pprefix,
01072         "nvm__ews__xcoord",
01073         pdata->nvm__ews__xcoord);
01074 
01075     trace_print(
01076         VL53L1_TRACE_LEVEL_INFO,
01077         "%s%s = %u\n",
01078         pprefix,
01079         "nvm__ews__ycoord",
01080         pdata->nvm__ews__ycoord);
01081 }
01082 
01083 #endif
01084 
01085 
01086