ST Expansion SW Team / VL53L1CB

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vl53l1_platform_ipp.c Source File

vl53l1_platform_ipp.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 
00016 #include "vl53l1_ll_def.h"
00017 #include "vl53l1_platform_user_data.h"
00018 #include "vl53l1_hist_structs.h"
00019 #include "vl53l1_hist_funcs.h"
00020 #include "vl53l1_xtalk.h"
00021 #include "vl53l1_platform_ipp.h"
00022 
00023 
00024 #define LOG_FUNCTION_START(fmt, ...) \
00025     _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__)
00026 #define LOG_FUNCTION_END(status, ...) \
00027     _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__)
00028 
00029 
00030 VL53L1_Error VL53L1_ipp_hist_process_data(
00031     VL53L1_DEV                         Dev,
00032     VL53L1_dmax_calibration_data_t    *pdmax_cal,
00033     VL53L1_hist_gen3_dmax_config_t    *pdmax_cfg,
00034     VL53L1_hist_post_process_config_t *ppost_cfg,
00035     VL53L1_histogram_bin_data_t       *pbins,
00036     VL53L1_xtalk_histogram_data_t     *pxtalk,
00037     uint8_t                           *pArea1,
00038     uint8_t                           *pArea2,
00039     uint8_t                           *phisto_merge_nb,
00040     VL53L1_range_results_t            *presults)
00041 {
00042 
00043 
00044 
00045     VL53L1_Error status         = VL53L1_ERROR_NONE;
00046 
00047     SUPPRESS_UNUSED_WARNING(Dev);
00048 
00049     status =
00050         VL53L1_hist_process_data(
00051             pdmax_cal,
00052             pdmax_cfg,
00053             ppost_cfg,
00054             pbins,
00055             pxtalk,
00056             pArea1,
00057             pArea2,
00058             presults,
00059             phisto_merge_nb);
00060 
00061     return status;
00062 }
00063 
00064 
00065 VL53L1_Error VL53L1_ipp_hist_ambient_dmax(
00066     VL53L1_DEV                         Dev,
00067     uint16_t                           target_reflectance,
00068     VL53L1_dmax_calibration_data_t    *pdmax_cal,
00069     VL53L1_hist_gen3_dmax_config_t    *pdmax_cfg,
00070     VL53L1_histogram_bin_data_t       *pbins,
00071     int16_t                           *pambient_dmax_mm)
00072 {
00073 
00074 
00075 
00076     VL53L1_Error status         = VL53L1_ERROR_NONE;
00077 
00078     SUPPRESS_UNUSED_WARNING(Dev);
00079 
00080     status =
00081         VL53L1_hist_ambient_dmax(
00082             target_reflectance,
00083             pdmax_cal,
00084             pdmax_cfg,
00085             pbins,
00086             pambient_dmax_mm);
00087 
00088     return status;
00089 }
00090 
00091 
00092 VL53L1_Error VL53L1_ipp_xtalk_calibration_process_data(
00093     VL53L1_DEV                          Dev,
00094     VL53L1_xtalk_range_results_t       *pxtalk_ranges,
00095     VL53L1_xtalk_histogram_data_t      *pxtalk_shape,
00096     VL53L1_xtalk_calibration_results_t *pxtalk_cal)
00097 {
00098 
00099 
00100 
00101     VL53L1_Error status         = VL53L1_ERROR_NONE;
00102 
00103     SUPPRESS_UNUSED_WARNING(Dev);
00104 
00105     status =
00106         VL53L1_xtalk_calibration_process_data(
00107             pxtalk_ranges,
00108             pxtalk_shape,
00109             pxtalk_cal);
00110 
00111     return status;
00112 }
00113 
00114 
00115 VL53L1_Error VL53L1_ipp_hist_xtalk_correction(
00116     VL53L1_DEV                     Dev,
00117     VL53L1_customer_nvm_managed_t *pcustomer,
00118     VL53L1_dynamic_config_t       *pdyn_cfg,
00119     VL53L1_xtalk_histogram_data_t *pxtalk_shape,
00120     VL53L1_histogram_bin_data_t   *pip_hist_data,
00121     VL53L1_histogram_bin_data_t   *pop_hist_data,
00122     VL53L1_histogram_bin_data_t   *pxtalk_count_data)
00123 {
00124 
00125 
00126 
00127     VL53L1_Error status         = VL53L1_ERROR_NONE;
00128 
00129     SUPPRESS_UNUSED_WARNING(Dev);
00130 
00131     status =
00132         VL53L1_f_054(
00133             pcustomer,
00134             pdyn_cfg,
00135             pxtalk_shape,
00136             pip_hist_data,
00137             pop_hist_data,
00138             pxtalk_count_data);
00139 
00140     return status;
00141 }
00142 
00143 VL53L1_Error VL53L1_ipp_generate_dual_reflectance_xtalk_samples(
00144     VL53L1_DEV                     Dev,
00145     VL53L1_xtalk_range_results_t  *pxtalk_results,
00146     uint16_t                       expected_target_distance_mm,
00147     uint8_t                        higher_reflectance,
00148     VL53L1_histogram_bin_data_t   *pxtalk_avg_samples)
00149 {
00150 
00151 
00152     VL53L1_Error status         = VL53L1_ERROR_NONE;
00153 
00154     SUPPRESS_UNUSED_WARNING(Dev);
00155 
00156     status = VL53L1_generate_dual_reflectance_xtalk_samples(
00157             pxtalk_results,
00158             expected_target_distance_mm,
00159             higher_reflectance,
00160             pxtalk_avg_samples);
00161 
00162     return status;
00163 
00164 }
00165