Initial release. Mbed library for VL53L1CB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vl53l1_platform_ipp.c Source File

vl53l1_platform_ipp.c

00001 
00002 /*******************************************************************************
00003  This file is part of VL53L1 Platform
00004 
00005  Copyright (c) 2020, STMicroelectronics - All Rights Reserved
00006 
00007  License terms: BSD 3-clause "New" or "Revised" License.
00008 
00009  Redistribution and use in source and binary forms, with or without
00010  modification, are permitted provided that the following conditions are met:
00011 
00012  1. Redistributions of source code must retain the above copyright notice, this
00013  list of conditions and the following disclaimer.
00014 
00015  2. Redistributions in binary form must reproduce the above copyright notice,
00016  this list of conditions and the following disclaimer in the documentation
00017  and/or other materials provided with the distribution.
00018 
00019  3. Neither the name of the copyright holder nor the names of its contributors
00020  may be used to endorse or promote products derived from this software
00021  without specific prior written permission.
00022 
00023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 
00037 
00038 
00039 
00040 #include "vl53l1_ll_def.h"
00041 #include "vl53l1_platform_user_data.h"
00042 #include "vl53l1_hist_structs.h"
00043 #include "vl53l1_hist_funcs.h"
00044 #include "vl53l1_xtalk.h"
00045 #include "vl53l1_platform_ipp.h"
00046 
00047 
00048 #define LOG_FUNCTION_START(fmt, ...) \
00049     _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__)
00050 #define LOG_FUNCTION_END(status, ...) \
00051     _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__)
00052 
00053 
00054 VL53L1_Error VL53L1_ipp_hist_process_data(
00055     VL53L1_DEV                         Dev,
00056     VL53L1_dmax_calibration_data_t    *pdmax_cal,
00057     VL53L1_hist_gen3_dmax_config_t    *pdmax_cfg,
00058     VL53L1_hist_post_process_config_t *ppost_cfg,
00059     VL53L1_histogram_bin_data_t       *pbins,
00060     VL53L1_xtalk_histogram_data_t     *pxtalk,
00061     uint8_t                           *pArea1,
00062     uint8_t                           *pArea2,
00063     uint8_t                           *phisto_merge_nb,
00064     VL53L1_range_results_t            *presults)
00065 {
00066 
00067 
00068 
00069     VL53L1_Error status         = VL53L1_ERROR_NONE;
00070 
00071     SUPPRESS_UNUSED_WARNING(Dev);
00072 
00073     status =
00074         VL53L1_hist_process_data(
00075             pdmax_cal,
00076             pdmax_cfg,
00077             ppost_cfg,
00078             pbins,
00079             pxtalk,
00080             pArea1,
00081             pArea2,
00082             presults,
00083             phisto_merge_nb);
00084 
00085     return status;
00086 }
00087 
00088 
00089 VL53L1_Error VL53L1_ipp_hist_ambient_dmax(
00090     VL53L1_DEV                         Dev,
00091     uint16_t                           target_reflectance,
00092     VL53L1_dmax_calibration_data_t    *pdmax_cal,
00093     VL53L1_hist_gen3_dmax_config_t    *pdmax_cfg,
00094     VL53L1_histogram_bin_data_t       *pbins,
00095     int16_t                           *pambient_dmax_mm)
00096 {
00097 
00098 
00099 
00100     VL53L1_Error status         = VL53L1_ERROR_NONE;
00101 
00102     SUPPRESS_UNUSED_WARNING(Dev);
00103 
00104     status =
00105         VL53L1_hist_ambient_dmax(
00106             target_reflectance,
00107             pdmax_cal,
00108             pdmax_cfg,
00109             pbins,
00110             pambient_dmax_mm);
00111 
00112     return status;
00113 }
00114 
00115 
00116 VL53L1_Error VL53L1_ipp_xtalk_calibration_process_data(
00117     VL53L1_DEV                          Dev,
00118     VL53L1_xtalk_range_results_t       *pxtalk_ranges,
00119     VL53L1_xtalk_histogram_data_t      *pxtalk_shape,
00120     VL53L1_xtalk_calibration_results_t *pxtalk_cal)
00121 {
00122 
00123 
00124 
00125     VL53L1_Error status         = VL53L1_ERROR_NONE;
00126 
00127     SUPPRESS_UNUSED_WARNING(Dev);
00128 
00129     status =
00130         VL53L1_xtalk_calibration_process_data(
00131             pxtalk_ranges,
00132             pxtalk_shape,
00133             pxtalk_cal);
00134 
00135     return status;
00136 }
00137 
00138 
00139 VL53L1_Error VL53L1_ipp_hist_xtalk_correction(
00140     VL53L1_DEV                     Dev,
00141     VL53L1_customer_nvm_managed_t *pcustomer,
00142     VL53L1_dynamic_config_t       *pdyn_cfg,
00143     VL53L1_xtalk_histogram_data_t *pxtalk_shape,
00144     VL53L1_histogram_bin_data_t   *pip_hist_data,
00145     VL53L1_histogram_bin_data_t   *pop_hist_data,
00146     VL53L1_histogram_bin_data_t   *pxtalk_count_data)
00147 {
00148 
00149 
00150 
00151     VL53L1_Error status         = VL53L1_ERROR_NONE;
00152 
00153     SUPPRESS_UNUSED_WARNING(Dev);
00154 
00155     status =
00156         VL53L1_f_054(
00157             pcustomer,
00158             pdyn_cfg,
00159             pxtalk_shape,
00160             pip_hist_data,
00161             pop_hist_data,
00162             pxtalk_count_data);
00163 
00164     return status;
00165 }
00166 
00167 VL53L1_Error VL53L1_ipp_generate_dual_reflectance_xtalk_samples(
00168     VL53L1_DEV                     Dev,
00169     VL53L1_xtalk_range_results_t  *pxtalk_results,
00170     uint16_t                       expected_target_distance_mm,
00171     uint8_t                        higher_reflectance,
00172     VL53L1_histogram_bin_data_t   *pxtalk_avg_samples)
00173 {
00174 
00175 
00176     VL53L1_Error status         = VL53L1_ERROR_NONE;
00177 
00178     SUPPRESS_UNUSED_WARNING(Dev);
00179 
00180     status = VL53L1_generate_dual_reflectance_xtalk_samples(
00181             pxtalk_results,
00182             expected_target_distance_mm,
00183             higher_reflectance,
00184             pxtalk_avg_samples);
00185 
00186     return status;
00187 
00188 }
00189 
00190