1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741 |
- /*
- * Copyright (c) 2017, STMicroelectronics - All Rights Reserved
- *
- * This file is part of VL53L1 Core and is dual licensed,
- * either 'STMicroelectronics
- * Proprietary license'
- * or 'BSD 3-clause "New" or "Revised" License' , at your option.
- *
- ********************************************************************************
- *
- * 'STMicroelectronics Proprietary license'
- *
- ********************************************************************************
- *
- * License terms: STMicroelectronics Proprietary in accordance with licensing
- * terms at www.st.com/sla0081
- *
- * STMicroelectronics confidential
- * Reproduction and Communication of this document is strictly prohibited unless
- * specifically authorized in writing by STMicroelectronics.
- *
- *
- ********************************************************************************
- *
- * Alternatively, VL53L1 Core may be distributed under the terms of
- * 'BSD 3-clause "New" or "Revised" License', in which case the following
- * provisions apply instead of the ones mentioned above :
- *
- ********************************************************************************
- *
- * License terms: BSD 3-clause "New" or "Revised" License.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- ********************************************************************************
- *
- */
- /**
- * @file vl53l1_api_debug.c
- * @brief EwokPlus25 low level Driver debug function definition
- */
- #include "vl53l1_ll_def.h"
- #include "vl53l1_ll_device.h"
- #include "vl53l1_register_structs.h"
- #include "vl53l1_core.h"
- #include "vl53l1_api_debug.h"
- #define LOG_FUNCTION_START(fmt, ...) \
- _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__)
- #define LOG_FUNCTION_END(status, ...) \
- _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__)
- #define LOG_FUNCTION_END_FMT(status, fmt, ...) \
- _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE, status, \
- fmt, ##__VA_ARGS__)
- #define trace_print(level, ...) \
- _LOG_TRACE_PRINT(trace_flags, \
- level, VL53L1_TRACE_FUNCTION_NONE, ##__VA_ARGS__)
- /* Start Patch_AdditionalDebugData_11823 */
- VL53L1_Error VL53L1_get_additional_data(
- VL53L1_DEV Dev,
- VL53L1_additional_data_t *pdata)
- {
- /*
- * Gets the addition debug data
- */
- VL53L1_Error status = VL53L1_ERROR_NONE;
- VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev);
- LOG_FUNCTION_START("");
- /* get LL Driver configuration parameters */
- pdata->preset_mode = pdev->preset_mode;
- pdata->measurement_mode = pdev->measurement_mode;
- pdata->phasecal_config_timeout_us = pdev->phasecal_config_timeout_us;
- pdata->mm_config_timeout_us = pdev->mm_config_timeout_us;
- pdata->range_config_timeout_us = pdev->range_config_timeout_us;
- pdata->inter_measurement_period_ms = pdev->inter_measurement_period_ms;
- pdata->dss_config__target_total_rate_mcps =
- pdev->dss_config__target_total_rate_mcps;
- LOG_FUNCTION_END(status);
- return status;
- }
- /* End Patch_AdditionalDebugData_11823 */
- #ifdef VL53L1_LOG_ENABLE
- void VL53L1_signed_fixed_point_sprintf(
- int32_t signed_fp_value,
- uint8_t frac_bits,
- uint16_t buf_size,
- char *pbuffer)
- {
- /*
- * Converts input signed fixed point number into a string
- */
- uint32_t fp_value = 0;
- uint32_t unity_fp_value = 0;
- uint32_t sign_bit = 0;
- uint32_t int_part = 0;
- uint32_t frac_part = 0;
- uint32_t dec_points = 0;
- uint32_t dec_scaler = 0;
- uint32_t dec_part = 0;
- uint64_t tmp_long_int = 0;
- char fmt[VL53L1_MAX_STRING_LENGTH];
- SUPPRESS_UNUSED_WARNING(buf_size);
- /* split into integer and fractional values */
- sign_bit = signed_fp_value >> 31;
- if (sign_bit > 0) {
- fp_value = 0x80000000 -
- (0x7FFFFFFF & (uint32_t)signed_fp_value);
- } else
- fp_value = (uint32_t)signed_fp_value;
- int_part = fp_value >> frac_bits;
- unity_fp_value = 0x01 << frac_bits;
- frac_part = fp_value & (unity_fp_value-1);
- /* Calculate decimal scale factor and required decimal points
- * min number of displayed places is 2
- */
- dec_points = 2;
- dec_scaler = 100;
- while (dec_scaler < unity_fp_value) {
- dec_points++;
- dec_scaler *= 10;
- }
- /* Build format string */
- if (sign_bit > 0)
- sprintf(fmt, "-%%u.%%0%uu", dec_points);
- else
- sprintf(fmt, "%%u.%%0%uu", dec_points);
- /* Convert fractional part into a decimal
- * need 64-bit head room at this point
- */
- tmp_long_int = (uint64_t)frac_part * (uint64_t)dec_scaler;
- tmp_long_int += (uint64_t)unity_fp_value/2;
- tmp_long_int = do_division_u(tmp_long_int, (uint64_t)unity_fp_value);
- dec_part = (uint32_t)tmp_long_int;
- /* Generate string for fixed point number */
- sprintf(
- pbuffer,
- fmt,
- int_part,
- dec_part);
- }
- void VL53L1_print_static_nvm_managed(
- VL53L1_static_nvm_managed_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /**
- * Prints out VL53L1_static_nvm_managed_t for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = 0x%02X\n",
- pprefix,
- "i2c_slave__device_address",
- pdata->i2c_slave__device_address);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__vhv_ref_sel_vddpix",
- pdata->ana_config__vhv_ref_sel_vddpix);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__vhv_ref_sel_vquench",
- pdata->ana_config__vhv_ref_sel_vquench);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__reg_avdd1v2_sel",
- pdata->ana_config__reg_avdd1v2_sel);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__fast_osc__trim",
- pdata->ana_config__fast_osc__trim);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->osc_measured__fast_osc__frequency,
- 12,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "osc_measured__fast_osc__frequency",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "vhv_config__timeout_macrop_loop_bound",
- pdata->vhv_config__timeout_macrop_loop_bound);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "vhv_config__count_thresh",
- pdata->vhv_config__count_thresh);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "vhv_config__offset",
- pdata->vhv_config__offset);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "vhv_config__init",
- pdata->vhv_config__init);
- }
- void VL53L1_print_customer_nvm_managed(
- VL53L1_customer_nvm_managed_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out VL53L1_customer_nvm_managed_t for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_0",
- pdata->global_config__spad_enables_ref_0);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_1",
- pdata->global_config__spad_enables_ref_1);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_2",
- pdata->global_config__spad_enables_ref_2);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_3",
- pdata->global_config__spad_enables_ref_3);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_4",
- pdata->global_config__spad_enables_ref_4);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_ref_5",
- pdata->global_config__spad_enables_ref_5);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__ref_en_start_select",
- pdata->global_config__ref_en_start_select);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ref_spad_man__num_requested_ref_spads",
- pdata->ref_spad_man__num_requested_ref_spads);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ref_spad_man__ref_location",
- pdata->ref_spad_man__ref_location);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps,
- 9,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_plane_offset_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_x_plane_gradient_kcps,
- 11,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_x_plane_gradient_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_y_plane_gradient_kcps,
- 11,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_y_plane_gradient_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->ref_spad_char__total_rate_target_mcps,
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "ref_spad_char__total_rate_target_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__part_to_part_range_offset_mm,
- 2,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__part_to_part_range_offset_mm",
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "mm_config__inner_offset_mm",
- pdata->mm_config__inner_offset_mm);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "mm_config__outer_offset_mm",
- pdata->mm_config__outer_offset_mm);
- }
- void VL53L1_print_nvm_copy_data(
- VL53L1_nvm_copy_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /**
- * Prints out VL53L1_nvm_copy_data_t for debug
- */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "identification__model_id",
- pdata->identification__model_id);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "identification__module_type",
- pdata->identification__module_type);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "identification__revision_id",
- pdata->identification__revision_id);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "identification__module_id",
- pdata->identification__module_id);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__fast_osc__trim_max",
- pdata->ana_config__fast_osc__trim_max);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__fast_osc__freq_set",
- pdata->ana_config__fast_osc__freq_set);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__vcsel_trim",
- pdata->ana_config__vcsel_trim);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__vcsel_selion",
- pdata->ana_config__vcsel_selion);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "ana_config__vcsel_selion_max",
- pdata->ana_config__vcsel_selion_max);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "protected_laser_safety__lock_bit",
- pdata->protected_laser_safety__lock_bit);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "laser_safety__key",
- pdata->laser_safety__key);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "laser_safety__key_ro",
- pdata->laser_safety__key_ro);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "laser_safety__clip",
- pdata->laser_safety__clip);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "laser_safety__mult",
- pdata->laser_safety__mult);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_0",
- pdata->global_config__spad_enables_rtn_0);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_1",
- pdata->global_config__spad_enables_rtn_1);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_2",
- pdata->global_config__spad_enables_rtn_2);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_3",
- pdata->global_config__spad_enables_rtn_3);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_4",
- pdata->global_config__spad_enables_rtn_4);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_5",
- pdata->global_config__spad_enables_rtn_5);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_6",
- pdata->global_config__spad_enables_rtn_6);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_7",
- pdata->global_config__spad_enables_rtn_7);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_8",
- pdata->global_config__spad_enables_rtn_8);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_9",
- pdata->global_config__spad_enables_rtn_9);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_10",
- pdata->global_config__spad_enables_rtn_10);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_11",
- pdata->global_config__spad_enables_rtn_11);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_12",
- pdata->global_config__spad_enables_rtn_12);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_13",
- pdata->global_config__spad_enables_rtn_13);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_14",
- pdata->global_config__spad_enables_rtn_14);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_15",
- pdata->global_config__spad_enables_rtn_15);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_16",
- pdata->global_config__spad_enables_rtn_16);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_17",
- pdata->global_config__spad_enables_rtn_17);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_18",
- pdata->global_config__spad_enables_rtn_18);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_19",
- pdata->global_config__spad_enables_rtn_19);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_20",
- pdata->global_config__spad_enables_rtn_20);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_21",
- pdata->global_config__spad_enables_rtn_21);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_22",
- pdata->global_config__spad_enables_rtn_22);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_23",
- pdata->global_config__spad_enables_rtn_23);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_24",
- pdata->global_config__spad_enables_rtn_24);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_25",
- pdata->global_config__spad_enables_rtn_25);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_26",
- pdata->global_config__spad_enables_rtn_26);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_27",
- pdata->global_config__spad_enables_rtn_27);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_28",
- pdata->global_config__spad_enables_rtn_28);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_29",
- pdata->global_config__spad_enables_rtn_29);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_30",
- pdata->global_config__spad_enables_rtn_30);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_config__spad_enables_rtn_31",
- pdata->global_config__spad_enables_rtn_31);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "roi_config__mode_roi_centre_spad",
- pdata->roi_config__mode_roi_centre_spad);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = 0x%02X\n",
- pprefix,
- "roi_config__mode_roi_xy_size",
- pdata->roi_config__mode_roi_xy_size);
- }
- void VL53L1_print_range_data(
- VL53L1_range_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the range data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "range_id",
- pdata->range_id);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "time_stamp",
- pdata->time_stamp);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->width,
- 4, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "width",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "woi",
- pdata->woi);
- /* Fast Oscillator Frequency */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->fast_osc_frequency,
- 12, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "fast_osc_frequency",
- fp_text);
- /* Zero Distance Phase */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->zero_distance_phase,
- 11, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "zero_distance_phase",
- fp_text);
- /* Actual effective SPAD count */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->actual_effective_spads,
- 8, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "actual_effective_spad",
- fp_text);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "total_periods_elapsed",
- pdata->total_periods_elapsed);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "peak_duration_us",
- pdata->peak_duration_us);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "woi_duration_us",
- pdata->woi_duration_us);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "ambient_window_events",
- pdata->ambient_window_events);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "ranging_total_events",
- pdata->ranging_total_events);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "signal_total_events",
- pdata->signal_total_events);
- /* Rates */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->peak_signal_count_rate_mcps,
- 7, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "peak_signal_count_rate_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->avg_signal_count_rate_mcps,
- 7, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "avg_signal_count_rate_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->ambient_count_rate_mcps,
- 7, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "ambient_count_rate_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->total_rate_per_spad_mcps,
- 13, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "total_rate_per_spad_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->peak_rate_per_spad_kcps,
- 11, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "peak_rate_per_spad_kcps",
- fp_text);
- /* Sigma */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->sigma_mm,
- 2, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "sigma_mm",
- fp_text);
- /* Phase */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->median_phase,
- 11, VL53L1_MAX_STRING_LENGTH, fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "median_phase",
- fp_text);
- /* Offset Corrected Range */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "median_range_mm",
- pdata->median_range_mm);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "range_status",
- pdata->range_status);
- }
- void VL53L1_print_range_results(
- VL53L1_range_results_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the range results data structure for debug
- */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "cfg_device_state",
- pdata->cfg_device_state);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "rd_device_state",
- pdata->rd_device_state);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "stream_count",
- pdata->stream_count);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "device_status",
- pdata->device_status);
- }
- void VL53L1_print_offset_range_results(
- VL53L1_offset_range_results_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the offset range results data structure for debug
- */
- char pre_text[VL53L1_MAX_STRING_LENGTH];
- char *ppre_text = &(pre_text[0]);
- uint8_t i = 0;
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "cal_distance_mm",
- pdata->cal_distance_mm);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "cal_status",
- pdata->cal_status);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "cal_report",
- pdata->cal_report);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "max_results",
- pdata->max_results);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "active_results",
- pdata->active_results);
- for (i = 0 ; i < pdata->active_results ; i++) {
- sprintf(ppre_text, "%sdata[%u].", pprefix, i);
- VL53L1_print_offset_range_data(
- &(pdata->data[i]),
- ppre_text, trace_flags);
- }
- }
- void VL53L1_print_offset_range_data(
- VL53L1_offset_range_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the xtalk range (ROI) data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "preset_mode",
- pdata->preset_mode);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "dss_config__roi_mode_control",
- pdata->dss_config__roi_mode_control);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->dss_config__manual_effective_spads_select,
- 8,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "dss_config__manual_effective_spads_select",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "no_of_samples",
- pdata->no_of_samples);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->effective_spads,
- 8,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "effective_spads",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->peak_rate_mcps,
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "peak_rate_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->sigma_mm,
- 2,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "sigma_mm",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "median_range_mm",
- pdata->median_range_mm);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %d\n",
- pprefix,
- "range_mm_offset",
- pdata->range_mm_offset);
- }
- void VL53L1_print_additional_offset_cal_data(
- VL53L1_additional_offset_cal_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the xtalk range (ROI) data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->result__mm_inner_actual_effective_spads,
- 8,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "result__mm_inner_actual_effective_spads",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->result__mm_outer_actual_effective_spads,
- 8,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "result__mm_outer_actual_effective_spads",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->result__mm_inner_peak_signal_count_rtn_mcps,
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "result__mm_inner_peak_signal_count_rtn_mcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->result__mm_outer_peak_signal_count_rtn_mcps,
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "result__mm_outer_peak_signal_count_rtn_mcps",
- fp_text);
- }
- void VL53L1_print_cal_peak_rate_map(
- VL53L1_cal_peak_rate_map_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out peak rate map structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- char pre_text[VL53L1_MAX_STRING_LENGTH];
- char *ppre_text = &(pre_text[0]);
- uint8_t i = 0;
- uint8_t x = 0;
- uint8_t y = 0;
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->cal_distance_mm,
- 2,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "cal_distance_mm",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "max_samples",
- pdata->max_samples);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "width",
- pdata->width);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "height",
- pdata->height);
- i = 0;
- for (y = 0 ; y < pdata->height ; y++) {
- for (x = 0 ; x < pdata->width ; x++) {
- sprintf(ppre_text, "%speak_rate_mcps[%u]", pprefix, i);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->peak_rate_mcps[i],
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s = %s\n",
- ppre_text,
- fp_text);
- i++;
- }
- }
- }
- void VL53L1_print_additional_data(
- VL53L1_additional_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the Additional data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "preset_mode",
- pdata->preset_mode);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "measurement_mode",
- pdata->measurement_mode);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "phasecal_config_timeout_us",
- pdata->phasecal_config_timeout_us);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "mm_config_timeout_us",
- pdata->mm_config_timeout_us);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "range_config_timeout_us",
- pdata->range_config_timeout_us);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "inter_measurement_period_ms",
- pdata->inter_measurement_period_ms);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->dss_config__target_total_rate_mcps,
- 7,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "dss_config__target_total_rate_mcps",
- fp_text);
- }
- void VL53L1_print_gain_calibration_data(
- VL53L1_gain_calibration_data_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the LL Driver state data for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->standard_ranging_gain_factor,
- 11,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "standard_ranging_gain_factor",
- fp_text);
- }
- void VL53L1_print_xtalk_config(
- VL53L1_xtalk_config_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /*
- * Prints out the xtalk config data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps,
- 9,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_plane_offset_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_x_plane_gradient_kcps,
- 11,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_x_plane_gradient_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->algo__crosstalk_compensation_y_plane_gradient_kcps,
- 11,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "algo__crosstalk_compensation_y_plane_gradient_kcps",
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "global_crosstalk_compensation_enable",
- pdata->global_crosstalk_compensation_enable);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->lite_mode_crosstalk_margin_kcps,
- 9,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "lite_mode_crosstalk_margin_kcps",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->crosstalk_range_ignore_threshold_mult,
- 5,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "crosstalk_range_ignore_threshold_mult",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->crosstalk_range_ignore_threshold_rate_mcps,
- 13,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "crosstalk_range_ignore_threshold_rate_mcps",
- fp_text);
- }
- void VL53L1_print_optical_centre(
- VL53L1_optical_centre_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /* Prints out the optical centre data structure for debug
- */
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->x_centre,
- 4,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "x_centre",
- fp_text);
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pdata->y_centre,
- 4,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %s\n",
- pprefix,
- "y_centre",
- fp_text);
- }
- void VL53L1_print_user_zone(
- VL53L1_user_zone_t *pdata,
- char *pprefix,
- uint32_t trace_flags)
- {
- /* Prints out the zone (ROI) data structure for debug
- */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "x_centre",
- pdata->x_centre);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "y_centre",
- pdata->y_centre);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "width",
- pdata->width);
- trace_print(VL53L1_TRACE_LEVEL_INFO,
- "%s%s = %u\n",
- pprefix,
- "height",
- pdata->height);
- }
- void VL53L1_print_spad_rate_data(
- VL53L1_spad_rate_data_t *pspad_rates,
- char *pprefix,
- uint32_t trace_flags)
- {
- /**
- * Print per SPAD rates generated by SSC
- */
- uint16_t spad_no = 0;
- uint8_t row = 0;
- uint8_t col = 0;
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%8s,%4s,%4s, %s\n",
- pprefix,
- "spad_no",
- "row",
- "col",
- "peak_rate_mcps");
- for (spad_no = 0 ; spad_no < pspad_rates->no_of_values ; spad_no++) {
- /* generate row / col location from SPAD number */
- VL53L1_decode_row_col(
- (uint8_t)spad_no,
- &row,
- &col);
- /* Convert fixed point rate value to string */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pspad_rates->rate_data[spad_no],
- pspad_rates->fractional_bits,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- /* Print data */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%8u,%4u,%4u, %s\n",
- pprefix,
- spad_no,
- row,
- col,
- fp_text);
- }
- }
- void VL53L1_print_spad_rate_map(
- VL53L1_spad_rate_data_t *pspad_rates,
- char *pprefix,
- uint32_t trace_flags)
- {
- /**
- * Print per SPAD rates generated by SSC as a map
- */
- uint8_t spad_no = 0;
- uint8_t row = 0;
- uint8_t col = 0;
- char fp_text[VL53L1_MAX_STRING_LENGTH];
- /* Print column headers */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%4s",
- pprefix,
- " ");
- for (col = 0 ; col < VL53L1_SPAD_ARRAY_WIDTH ; col++)
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- ",%8u",
- col);
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "\n");
- /* Print rate data */
- for (row = 0 ; row < VL53L1_SPAD_ARRAY_HEIGHT ; row++) {
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "%s%4u",
- pprefix,
- row);
- for (col = 0 ; col < VL53L1_SPAD_ARRAY_HEIGHT ; col++) {
- /* generate SPAD number from (row, col) location */
- VL53L1_encode_row_col(
- row,
- col,
- &spad_no);
- /* Convert fixed point rate value to string */
- VL53L1_signed_fixed_point_sprintf(
- (int32_t)pspad_rates->rate_data[spad_no],
- pspad_rates->fractional_bits,
- VL53L1_MAX_STRING_LENGTH,
- fp_text);
- /* Print data */
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- ",%8s",
- fp_text);
- }
- trace_print(
- VL53L1_TRACE_LEVEL_INFO,
- "\n");
- }
- }
- #endif /* VL53L1_LOG_ENABLE */
|