The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2

Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.

Committer:
lugandc
Date:
Wed Jul 21 17:06:38 2021 +0200
Revision:
18:0696efe39d08
Parent:
0:3ac96e360672
Cleanup i2c functions, removed all bad references to L1X
Cleanup VL53L1CB class:
- i2c device object is passed in a consistent way in MyDevice structure
- removed useless functions
Updated VL53L1CB component driver with bare driver release 6.6.7 content

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charlesmn 0:3ac96e360672 1
lugandc 18:0696efe39d08 2 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
lugandc 18:0696efe39d08 3 /******************************************************************************
lugandc 18:0696efe39d08 4 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
charlesmn 0:3ac96e360672 5
lugandc 18:0696efe39d08 6 This file is part of VL53L1 and is dual licensed,
lugandc 18:0696efe39d08 7 either GPL-2.0+
lugandc 18:0696efe39d08 8 or 'BSD 3-clause "New" or "Revised" License' , at your option.
lugandc 18:0696efe39d08 9 ******************************************************************************
lugandc 18:0696efe39d08 10 */
charlesmn 0:3ac96e360672 11
charlesmn 0:3ac96e360672 12
charlesmn 0:3ac96e360672 13
charlesmn 0:3ac96e360672 14
charlesmn 0:3ac96e360672 15
charlesmn 0:3ac96e360672 16 #include "vl53l1_ll_def.h"
charlesmn 0:3ac96e360672 17 #include "vl53l1_platform_user_data.h"
charlesmn 0:3ac96e360672 18 #include "vl53l1_hist_structs.h"
charlesmn 0:3ac96e360672 19 #include "vl53l1_hist_funcs.h"
charlesmn 0:3ac96e360672 20 #include "vl53l1_xtalk.h"
charlesmn 0:3ac96e360672 21 #include "vl53l1_platform_ipp.h"
charlesmn 0:3ac96e360672 22
charlesmn 0:3ac96e360672 23
charlesmn 0:3ac96e360672 24 #define LOG_FUNCTION_START(fmt, ...) \
charlesmn 0:3ac96e360672 25 _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__)
charlesmn 0:3ac96e360672 26 #define LOG_FUNCTION_END(status, ...) \
charlesmn 0:3ac96e360672 27 _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__)
charlesmn 0:3ac96e360672 28
charlesmn 0:3ac96e360672 29
charlesmn 0:3ac96e360672 30 VL53L1_Error VL53L1_ipp_hist_process_data(
charlesmn 0:3ac96e360672 31 VL53L1_DEV Dev,
charlesmn 0:3ac96e360672 32 VL53L1_dmax_calibration_data_t *pdmax_cal,
charlesmn 0:3ac96e360672 33 VL53L1_hist_gen3_dmax_config_t *pdmax_cfg,
charlesmn 0:3ac96e360672 34 VL53L1_hist_post_process_config_t *ppost_cfg,
charlesmn 0:3ac96e360672 35 VL53L1_histogram_bin_data_t *pbins,
charlesmn 0:3ac96e360672 36 VL53L1_xtalk_histogram_data_t *pxtalk,
charlesmn 0:3ac96e360672 37 uint8_t *pArea1,
charlesmn 0:3ac96e360672 38 uint8_t *pArea2,
charlesmn 0:3ac96e360672 39 uint8_t *phisto_merge_nb,
charlesmn 0:3ac96e360672 40 VL53L1_range_results_t *presults)
charlesmn 0:3ac96e360672 41 {
charlesmn 0:3ac96e360672 42
charlesmn 0:3ac96e360672 43
charlesmn 0:3ac96e360672 44
charlesmn 0:3ac96e360672 45 VL53L1_Error status = VL53L1_ERROR_NONE;
charlesmn 0:3ac96e360672 46
charlesmn 0:3ac96e360672 47 SUPPRESS_UNUSED_WARNING(Dev);
charlesmn 0:3ac96e360672 48
charlesmn 0:3ac96e360672 49 status =
charlesmn 0:3ac96e360672 50 VL53L1_hist_process_data(
charlesmn 0:3ac96e360672 51 pdmax_cal,
charlesmn 0:3ac96e360672 52 pdmax_cfg,
charlesmn 0:3ac96e360672 53 ppost_cfg,
charlesmn 0:3ac96e360672 54 pbins,
charlesmn 0:3ac96e360672 55 pxtalk,
charlesmn 0:3ac96e360672 56 pArea1,
charlesmn 0:3ac96e360672 57 pArea2,
charlesmn 0:3ac96e360672 58 presults,
charlesmn 0:3ac96e360672 59 phisto_merge_nb);
charlesmn 0:3ac96e360672 60
charlesmn 0:3ac96e360672 61 return status;
charlesmn 0:3ac96e360672 62 }
charlesmn 0:3ac96e360672 63
charlesmn 0:3ac96e360672 64
charlesmn 0:3ac96e360672 65 VL53L1_Error VL53L1_ipp_hist_ambient_dmax(
charlesmn 0:3ac96e360672 66 VL53L1_DEV Dev,
charlesmn 0:3ac96e360672 67 uint16_t target_reflectance,
charlesmn 0:3ac96e360672 68 VL53L1_dmax_calibration_data_t *pdmax_cal,
charlesmn 0:3ac96e360672 69 VL53L1_hist_gen3_dmax_config_t *pdmax_cfg,
charlesmn 0:3ac96e360672 70 VL53L1_histogram_bin_data_t *pbins,
charlesmn 0:3ac96e360672 71 int16_t *pambient_dmax_mm)
charlesmn 0:3ac96e360672 72 {
charlesmn 0:3ac96e360672 73
charlesmn 0:3ac96e360672 74
charlesmn 0:3ac96e360672 75
charlesmn 0:3ac96e360672 76 VL53L1_Error status = VL53L1_ERROR_NONE;
charlesmn 0:3ac96e360672 77
charlesmn 0:3ac96e360672 78 SUPPRESS_UNUSED_WARNING(Dev);
charlesmn 0:3ac96e360672 79
charlesmn 0:3ac96e360672 80 status =
charlesmn 0:3ac96e360672 81 VL53L1_hist_ambient_dmax(
charlesmn 0:3ac96e360672 82 target_reflectance,
charlesmn 0:3ac96e360672 83 pdmax_cal,
charlesmn 0:3ac96e360672 84 pdmax_cfg,
charlesmn 0:3ac96e360672 85 pbins,
charlesmn 0:3ac96e360672 86 pambient_dmax_mm);
charlesmn 0:3ac96e360672 87
charlesmn 0:3ac96e360672 88 return status;
charlesmn 0:3ac96e360672 89 }
charlesmn 0:3ac96e360672 90
charlesmn 0:3ac96e360672 91
charlesmn 0:3ac96e360672 92 VL53L1_Error VL53L1_ipp_xtalk_calibration_process_data(
charlesmn 0:3ac96e360672 93 VL53L1_DEV Dev,
charlesmn 0:3ac96e360672 94 VL53L1_xtalk_range_results_t *pxtalk_ranges,
charlesmn 0:3ac96e360672 95 VL53L1_xtalk_histogram_data_t *pxtalk_shape,
charlesmn 0:3ac96e360672 96 VL53L1_xtalk_calibration_results_t *pxtalk_cal)
charlesmn 0:3ac96e360672 97 {
charlesmn 0:3ac96e360672 98
charlesmn 0:3ac96e360672 99
charlesmn 0:3ac96e360672 100
charlesmn 0:3ac96e360672 101 VL53L1_Error status = VL53L1_ERROR_NONE;
charlesmn 0:3ac96e360672 102
charlesmn 0:3ac96e360672 103 SUPPRESS_UNUSED_WARNING(Dev);
charlesmn 0:3ac96e360672 104
charlesmn 0:3ac96e360672 105 status =
charlesmn 0:3ac96e360672 106 VL53L1_xtalk_calibration_process_data(
charlesmn 0:3ac96e360672 107 pxtalk_ranges,
charlesmn 0:3ac96e360672 108 pxtalk_shape,
charlesmn 0:3ac96e360672 109 pxtalk_cal);
charlesmn 0:3ac96e360672 110
charlesmn 0:3ac96e360672 111 return status;
charlesmn 0:3ac96e360672 112 }
charlesmn 0:3ac96e360672 113
charlesmn 0:3ac96e360672 114
charlesmn 0:3ac96e360672 115 VL53L1_Error VL53L1_ipp_hist_xtalk_correction(
charlesmn 0:3ac96e360672 116 VL53L1_DEV Dev,
charlesmn 0:3ac96e360672 117 VL53L1_customer_nvm_managed_t *pcustomer,
charlesmn 0:3ac96e360672 118 VL53L1_dynamic_config_t *pdyn_cfg,
charlesmn 0:3ac96e360672 119 VL53L1_xtalk_histogram_data_t *pxtalk_shape,
charlesmn 0:3ac96e360672 120 VL53L1_histogram_bin_data_t *pip_hist_data,
charlesmn 0:3ac96e360672 121 VL53L1_histogram_bin_data_t *pop_hist_data,
charlesmn 0:3ac96e360672 122 VL53L1_histogram_bin_data_t *pxtalk_count_data)
charlesmn 0:3ac96e360672 123 {
charlesmn 0:3ac96e360672 124
charlesmn 0:3ac96e360672 125
charlesmn 0:3ac96e360672 126
charlesmn 0:3ac96e360672 127 VL53L1_Error status = VL53L1_ERROR_NONE;
charlesmn 0:3ac96e360672 128
charlesmn 0:3ac96e360672 129 SUPPRESS_UNUSED_WARNING(Dev);
charlesmn 0:3ac96e360672 130
charlesmn 0:3ac96e360672 131 status =
charlesmn 0:3ac96e360672 132 VL53L1_f_054(
charlesmn 0:3ac96e360672 133 pcustomer,
charlesmn 0:3ac96e360672 134 pdyn_cfg,
charlesmn 0:3ac96e360672 135 pxtalk_shape,
charlesmn 0:3ac96e360672 136 pip_hist_data,
charlesmn 0:3ac96e360672 137 pop_hist_data,
charlesmn 0:3ac96e360672 138 pxtalk_count_data);
charlesmn 0:3ac96e360672 139
charlesmn 0:3ac96e360672 140 return status;
charlesmn 0:3ac96e360672 141 }
charlesmn 0:3ac96e360672 142
charlesmn 0:3ac96e360672 143 VL53L1_Error VL53L1_ipp_generate_dual_reflectance_xtalk_samples(
charlesmn 0:3ac96e360672 144 VL53L1_DEV Dev,
charlesmn 0:3ac96e360672 145 VL53L1_xtalk_range_results_t *pxtalk_results,
charlesmn 0:3ac96e360672 146 uint16_t expected_target_distance_mm,
charlesmn 0:3ac96e360672 147 uint8_t higher_reflectance,
charlesmn 0:3ac96e360672 148 VL53L1_histogram_bin_data_t *pxtalk_avg_samples)
charlesmn 0:3ac96e360672 149 {
charlesmn 0:3ac96e360672 150
charlesmn 0:3ac96e360672 151
charlesmn 0:3ac96e360672 152 VL53L1_Error status = VL53L1_ERROR_NONE;
charlesmn 0:3ac96e360672 153
charlesmn 0:3ac96e360672 154 SUPPRESS_UNUSED_WARNING(Dev);
charlesmn 0:3ac96e360672 155
charlesmn 0:3ac96e360672 156 status = VL53L1_generate_dual_reflectance_xtalk_samples(
charlesmn 0:3ac96e360672 157 pxtalk_results,
charlesmn 0:3ac96e360672 158 expected_target_distance_mm,
charlesmn 0:3ac96e360672 159 higher_reflectance,
charlesmn 0:3ac96e360672 160 pxtalk_avg_samples);
charlesmn 0:3ac96e360672 161
charlesmn 0:3ac96e360672 162 return status;
charlesmn 0:3ac96e360672 163
charlesmn 0:3ac96e360672 164 }
charlesmn 0:3ac96e360672 165