amiro-lld / drivers / VL53L1X / v1 / api / core / vl53l1_api_calibration.h @ 4dba9195
History | View | Annotate | Download (8.923 KB)
1 |
/*
|
---|---|
2 |
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
|
3 |
*
|
4 |
* This file is part of VL53L1 Core and is dual licensed,
|
5 |
* either 'STMicroelectronics
|
6 |
* Proprietary license'
|
7 |
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
|
8 |
*
|
9 |
********************************************************************************
|
10 |
*
|
11 |
* 'STMicroelectronics Proprietary license'
|
12 |
*
|
13 |
********************************************************************************
|
14 |
*
|
15 |
* License terms: STMicroelectronics Proprietary in accordance with licensing
|
16 |
* terms at www.st.com/sla0081
|
17 |
*
|
18 |
* STMicroelectronics confidential
|
19 |
* Reproduction and Communication of this document is strictly prohibited unless
|
20 |
* specifically authorized in writing by STMicroelectronics.
|
21 |
*
|
22 |
*
|
23 |
********************************************************************************
|
24 |
*
|
25 |
* Alternatively, VL53L1 Core may be distributed under the terms of
|
26 |
* 'BSD 3-clause "New" or "Revised" License', in which case the following
|
27 |
* provisions apply instead of the ones mentioned above :
|
28 |
*
|
29 |
********************************************************************************
|
30 |
*
|
31 |
* License terms: BSD 3-clause "New" or "Revised" License.
|
32 |
*
|
33 |
* Redistribution and use in source and binary forms, with or without
|
34 |
* modification, are permitted provided that the following conditions are met:
|
35 |
*
|
36 |
* 1. Redistributions of source code must retain the above copyright notice, this
|
37 |
* list of conditions and the following disclaimer.
|
38 |
*
|
39 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
40 |
* this list of conditions and the following disclaimer in the documentation
|
41 |
* and/or other materials provided with the distribution.
|
42 |
*
|
43 |
* 3. Neither the name of the copyright holder nor the names of its contributors
|
44 |
* may be used to endorse or promote products derived from this software
|
45 |
* without specific prior written permission.
|
46 |
*
|
47 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
48 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
49 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
50 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
51 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
52 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
53 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
54 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
55 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
56 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
57 |
*
|
58 |
*
|
59 |
********************************************************************************
|
60 |
*
|
61 |
*/
|
62 |
|
63 |
/**
|
64 |
* @file vl53l1_api_core.h
|
65 |
*
|
66 |
* @brief EwokPlus25 low level API function definitions
|
67 |
*/
|
68 |
|
69 |
#ifndef _VL53L1_API_CALIBRATION_H_
|
70 |
#define _VL53L1_API_CALIBRATION_H_
|
71 |
|
72 |
#include "vl53l1_platform.h" |
73 |
|
74 |
#ifdef __cplusplus
|
75 |
extern "C" { |
76 |
#endif
|
77 |
|
78 |
|
79 |
/**
|
80 |
* @brief Run Reference Array SPAD Characterisation.
|
81 |
*
|
82 |
* This function finds the required number of reference SPAD
|
83 |
* to meet the input required peak reference rate.
|
84 |
*
|
85 |
* The algorithm first tries the non apertured reference SPAD's,
|
86 |
* if the rate is too high for the minimum allowed SPAD count (5)
|
87 |
* then the algo switches to 5x apertured SPAD's and if the rate
|
88 |
* is still to high then the 10x apertured SPAD are selected.
|
89 |
*
|
90 |
* The function reads the following results from the device and
|
91 |
* both caches the values in the pdev->customer structure and
|
92 |
* writes the data into the G02 customer register group.
|
93 |
*
|
94 |
* - num_ref_spads
|
95 |
* - ref_location
|
96 |
* - DCR SPAD enables for selected reference location
|
97 |
*
|
98 |
* Note power force is enabled as the function needs to read
|
99 |
* data from the Patch RAM.
|
100 |
*
|
101 |
* Should only be called once per part with coverglass attached to
|
102 |
* generate the required num of SPAD, Ref location and DCR SPAD enable
|
103 |
* data
|
104 |
*
|
105 |
* @param[in] Dev : Device Handle
|
106 |
* @param[out] pcal_status : Pointer to unfiltered calibration status
|
107 |
*
|
108 |
* @return VL53L1_ERROR_NONE Success
|
109 |
* @return VL53L1_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS
|
110 |
* Less than 5 Good SPAD available, output not valid
|
111 |
* @return VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH
|
112 |
* At end of search reference rate > 40.0 Mcps
|
113 |
* Offset stability may be degraded.
|
114 |
* @return VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW
|
115 |
* At end of search reference rate < 10.0 Mcps
|
116 |
* Offset stability may be degraded.
|
117 |
*
|
118 |
*/
|
119 |
|
120 |
#ifndef VL53L1_NOCALIB
|
121 |
VL53L1_Error VL53L1_run_ref_spad_char(VL53L1_DEV Dev, VL53L1_Error *pcal_status); |
122 |
#endif
|
123 |
|
124 |
|
125 |
/**
|
126 |
* @brief Runs the input Device Test
|
127 |
*
|
128 |
* Calls
|
129 |
*
|
130 |
* - VL53L1_enable_powerforce()
|
131 |
* - VL53L1_start_test()
|
132 |
* - VL53L1_poll_for_range_completion()
|
133 |
*
|
134 |
* @param[in] Dev : Device handle
|
135 |
* @param[in] device_test_mode : Device test mode register value
|
136 |
*
|
137 |
* @return VL53L1_ERROR_NONE Success
|
138 |
* @return "Other error code" See ::VL53L1_Error
|
139 |
*/
|
140 |
|
141 |
#ifndef VL53L1_NOCALIB
|
142 |
VL53L1_Error VL53L1_run_device_test( |
143 |
VL53L1_DEV Dev, |
144 |
VL53L1_DeviceTestMode device_test_mode); |
145 |
#endif
|
146 |
|
147 |
|
148 |
/**
|
149 |
* @brief Runs SPAD rate map
|
150 |
*
|
151 |
* Output structure contains SPAD rate data in SPAD number order
|
152 |
*
|
153 |
* @param[in] Dev : Device handle
|
154 |
* @param[in] device_test_mode : Device test mode register value.
|
155 |
* Valid options: \n
|
156 |
* - VL53L1_DEVICETESTMODE_LCR_VCSEL_OFF \n
|
157 |
* - VL53L1_DEVICETESTMODE_LCR_VCSEL_ON
|
158 |
* @param[in] array_select : Device SPAD array select
|
159 |
* Valid options: \n
|
160 |
* - VL53L1_DEVICESSCARRAY_RTN \n
|
161 |
* - VL53L1_DEVICESSCARRAY_REF
|
162 |
* @param[in] ssc_config_timeout_us : SSC timeout in [us] e.g 36000us
|
163 |
* @param[out] pspad_rate_data : pointer to output rates structure
|
164 |
* 1.15 format for LCR_VCSEL_OFF
|
165 |
* 9.7 format for LCR_VCSEL_ON
|
166 |
*
|
167 |
* @return VL53L1_ERROR_NONE Success
|
168 |
* @return "Other error code" See ::VL53L1_Error
|
169 |
*/
|
170 |
|
171 |
#ifndef VL53L1_NOCALIB
|
172 |
VL53L1_Error VL53L1_run_spad_rate_map( |
173 |
VL53L1_DEV Dev, |
174 |
VL53L1_DeviceTestMode device_test_mode, |
175 |
VL53L1_DeviceSscArray array_select, |
176 |
uint32_t ssc_config_timeout_us, |
177 |
VL53L1_spad_rate_data_t *pspad_rate_data); |
178 |
#endif
|
179 |
|
180 |
|
181 |
/**
|
182 |
* @brief Run offset calibration
|
183 |
*
|
184 |
* Runs the standard ranging MM1 and MM2 calibration presets
|
185 |
* to generate the MM1 and MM2 range offset data
|
186 |
*
|
187 |
* The range config timeout is used for both MM1 and MM2 so that
|
188 |
* the sigma delta settling is the same as for the 'real' range
|
189 |
*
|
190 |
* Places results into VL53L1_customer_nvm_managed_t within pdev
|
191 |
*
|
192 |
* Use VL53L1_get_part_to_part_data() to get the offset calibration
|
193 |
* results
|
194 |
*
|
195 |
* Current FMT settings:
|
196 |
*
|
197 |
* - offset_calibration_mode = VL53L1_OFFSETCALIBRATIONMODE__STANDARD_RANGING
|
198 |
* - dss_config__target_total_rate_mcps = 0x0A00 (20.0Mcps) to 0x1400 (40.0Mcps)
|
199 |
* - phasecal_config_timeout_us = 1000
|
200 |
* - range_config_timeout_us = 13000
|
201 |
* - pre_num_of_samples = 32
|
202 |
* - mm1_num_of_samples = 100
|
203 |
* - mm2_range_num_of_samples = 64
|
204 |
* - target_distance_mm = 140 mm
|
205 |
* - target reflectance = 5%
|
206 |
*
|
207 |
* Note: function parms simplified as part of Patch_CalFunctionSimplification_11791
|
208 |
*
|
209 |
* @param[in] Dev : Device handle
|
210 |
* @param[in] cal_distance_mm : Distance to target in [mm] - the ground truth
|
211 |
* @param[out] pcal_status : Pointer to unfiltered calibration status
|
212 |
*
|
213 |
* @return VL53L1_ERROR_NONE Success
|
214 |
* @return VL53L1_WARNING_OFFSET_CAL_INSUFFICIENT_MM1_SPADS
|
215 |
* Effective MM1 SPAD count too low (<5.0).
|
216 |
* Out with recommended calibration condition.
|
217 |
* Accuracy of offset calibration may be degraded.
|
218 |
* @return VL53L1_WARNING_OFFSET_CAL_PRE_RANGE_RATE_TOO_HIGH
|
219 |
* Pre range too high (>40.0) in pile up region.
|
220 |
* Out with recommended calibration condition.
|
221 |
* Accuracy of offset calibration may be degraded.
|
222 |
*/
|
223 |
|
224 |
#ifndef VL53L1_NOCALIB
|
225 |
VL53L1_Error VL53L1_run_offset_calibration( |
226 |
VL53L1_DEV Dev, |
227 |
int16_t cal_distance_mm, |
228 |
VL53L1_Error *pcal_status); |
229 |
#endif
|
230 |
|
231 |
|
232 |
#ifdef __cplusplus
|
233 |
} |
234 |
#endif
|
235 |
|
236 |
#endif /* _VL53L1_API_CALIBRATION_H_ */ |