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_preset_modes.h
65  *
66  * @brief EwokPlus25 API core function definition
67  */
68 
69 #ifndef _VL53L1_API_PRESET_MODES_H_
70 #define _VL53L1_API_PRESET_MODES_H_
71 
72 #include "vl53l1_ll_def.h"
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 
79 /**
80  * @brief Initializes Ref SPAD Char Configuration Parameters
81  *
82  * @param[out]   pdata    : pointer to VL53L1_refspadchar_config_t  data structure
83  *
84  * @return  VL53L1_ERROR_NONE     Success
85  * @return  "Other error code"    See ::VL53L1_Error
86  */
87 
88 #ifndef VL53L1_NOCALIB
89 VL53L1_Error VL53L1_init_refspadchar_config_struct(
90 	VL53L1_refspadchar_config_t     *pdata);
91 #endif
92 
93 
94 /**
95  * @brief Initializes SPAD Self Check (SSC) Configuration Parameters
96  *
97  * @param[out]   pdata    : pointer to VL53L1_ssc_config_t  data structure
98  *
99  * @return  VL53L1_ERROR_NONE     Success
100  * @return  "Other error code"    See ::VL53L1_Error
101  */
102 
103 VL53L1_Error VL53L1_init_ssc_config_struct(
104 	VL53L1_ssc_config_t     *pdata);
105 
106 /**
107  * @brief Initializes Xtalk Configuration Parameters
108  *
109  * @param[in]    pnvm     : pointer to VL53L1_customer_nvm_managed_t data structure
110  * @param[out]   pdata    : pointer to VL53L1_xtalk_config_t  data structure
111  *
112  * @return  VL53L1_ERROR_NONE     Success
113  * @return  "Other error code"    See ::VL53L1_Error
114  */
115 
116 VL53L1_Error VL53L1_init_xtalk_config_struct(
117 		VL53L1_customer_nvm_managed_t *pnvm,
118 		VL53L1_xtalk_config_t   *pdata);
119 
120 /**
121  * @brief Initializes Offset Calibration Configuration Parameters
122  *
123  * @param[out]   pdata    : pointer to VL53L1_offsetcal_config_t  data structure
124  *
125  * @return  VL53L1_ERROR_NONE     Success
126  * @return  "Other error code"    See ::VL53L1_Error
127  */
128 
129 #ifndef VL53L1_NOCALIB
130 VL53L1_Error VL53L1_init_offset_cal_config_struct(
131 	VL53L1_offsetcal_config_t   *pdata);
132 #endif
133 
134 
135 /**
136  * @brief Initializes Tuning Parameter Storage Values
137  *
138  * @param[out]   pdata : pointer to VL53L1_tuning_parm_storage_t  data structure
139  *
140  * @return  VL53L1_ERROR_NONE     Success
141  * @return  "Other error code"    See ::VL53L1_Error
142  */
143 
144 VL53L1_Error VL53L1_init_tuning_parm_storage_struct(
145 	VL53L1_tuning_parm_storage_t   *pdata);
146 
147 /**
148  * @brief Initializes static and dynamic configuration settings for
149  *        preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING
150  *
151  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
152  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
153  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
154  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
155  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
156  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
157  *
158  * @return  VL53L1_ERROR_NONE     Success
159  * @return  "Other error code"    See ::VL53L1_Error
160  */
161 
162 VL53L1_Error VL53L1_preset_mode_standard_ranging(
163 	VL53L1_static_config_t     *pstatic,
164 	VL53L1_general_config_t    *pgeneral,
165 	VL53L1_timing_config_t     *ptiming,
166 	VL53L1_dynamic_config_t    *pdynamic,
167 	VL53L1_system_control_t    *psystem,
168 	VL53L1_tuning_parm_storage_t *ptuning_parms);
169 
170 /**
171  * @brief Initializes static and dynamic configuration settings for
172  *        preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_SHORT_RANGE
173  *
174  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
175  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
176  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
177  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
178  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
179  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
180  *
181  * @return  VL53L1_ERROR_NONE     Success
182  * @return  "Other error code"    See ::VL53L1_Error
183  */
184 
185 VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range(
186 	VL53L1_static_config_t     *pstatic,
187 	VL53L1_general_config_t    *pgeneral,
188 	VL53L1_timing_config_t     *ptiming,
189 	VL53L1_dynamic_config_t    *pdynamic,
190 	VL53L1_system_control_t    *psystem,
191 	VL53L1_tuning_parm_storage_t *ptuning_parms);
192 
193 
194 /**
195  * @brief Initializes static and dynamic configuration settings for
196  *        preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_LONG_RANGE
197  *
198  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
199  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
200  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
201  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
202  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
203  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
204  *
205  * @return  VL53L1_ERROR_NONE     Success
206  * @return  "Other error code"    See ::VL53L1_Error
207  */
208 
209 VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range(
210 	VL53L1_static_config_t     *pstatic,
211 	VL53L1_general_config_t    *pgeneral,
212 	VL53L1_timing_config_t     *ptiming,
213 	VL53L1_dynamic_config_t    *pdynamic,
214 	VL53L1_system_control_t    *psystem,
215 	VL53L1_tuning_parm_storage_t *ptuning_parms);
216 
217 /**
218  * @brief Initializes static and dynamic configuration settings for
219  *        preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM1_CAL
220  *
221  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
222  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
223  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
224  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
225  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
226  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
227  *
228  * @return  VL53L1_ERROR_NONE     Success
229  * @return  "Other error code"    See ::VL53L1_Error
230  */
231 
232 #ifndef VL53L1_NOCALIB
233 VL53L1_Error VL53L1_preset_mode_standard_ranging_mm1_cal(
234 	VL53L1_static_config_t     *pstatic,
235 	VL53L1_general_config_t    *pgeneral,
236 	VL53L1_timing_config_t     *ptiming,
237 	VL53L1_dynamic_config_t    *pdynamic,
238 	VL53L1_system_control_t    *psystem,
239 	VL53L1_tuning_parm_storage_t *ptuning_parms);
240 #endif
241 
242 
243 /**
244  * @brief Initializes static and dynamic configuration settings for
245  *        preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM2_CAL
246  *
247  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
248  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
249  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
250  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
251  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
252  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
253  *
254  * @return  VL53L1_ERROR_NONE     Success
255  * @return  "Other error code"    See ::VL53L1_Error
256  */
257 
258 #ifndef VL53L1_NOCALIB
259 VL53L1_Error VL53L1_preset_mode_standard_ranging_mm2_cal(
260 	VL53L1_static_config_t     *pstatic,
261 	VL53L1_general_config_t    *pgeneral,
262 	VL53L1_timing_config_t     *ptiming,
263 	VL53L1_dynamic_config_t    *pdynamic,
264 	VL53L1_system_control_t    *psystem,
265 	VL53L1_tuning_parm_storage_t *ptuning_parms);
266 #endif
267 
268 
269 /**
270  * @brief Initializes static and dynamic configuration settings for
271  *        preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING
272  *
273  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
274  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
275  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
276  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
277  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
278  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
279  *
280  * @return  VL53L1_ERROR_NONE     Success
281  * @return  "Other error code"    See ::VL53L1_Error
282  */
283 
284 VL53L1_Error VL53L1_preset_mode_timed_ranging(
285 
286 	VL53L1_static_config_t    *pstatic,
287 	VL53L1_general_config_t   *pgeneral,
288 	VL53L1_timing_config_t    *ptiming,
289 	VL53L1_dynamic_config_t   *pdynamic,
290 	VL53L1_system_control_t   *psystem,
291 	VL53L1_tuning_parm_storage_t *ptuning_parms);
292 
293 /**
294  * @brief Initializes static and dynamic configuration settings for
295  *        preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING_SHORT_RANGE
296  *
297  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
298  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
299  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
300  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
301  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
302  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
303  *
304  * @return  VL53L1_ERROR_NONE     Success
305  * @return  "Other error code"    See ::VL53L1_Error
306  */
307 
308 VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range(
309 
310 	VL53L1_static_config_t    *pstatic,
311 	VL53L1_general_config_t   *pgeneral,
312 	VL53L1_timing_config_t    *ptiming,
313 	VL53L1_dynamic_config_t   *pdynamic,
314 	VL53L1_system_control_t   *psystem,
315 	VL53L1_tuning_parm_storage_t *ptuning_parms);
316 
317 /**
318  * @brief Initializes static and dynamic configuration settings for
319  *        preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING_LONG_RANGE
320  *
321  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
322  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
323  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
324  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
325  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
326  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
327  *
328  * @return  VL53L1_ERROR_NONE     Success
329  * @return  "Other error code"    See ::VL53L1_Error
330  */
331 
332 VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range(
333 
334 	VL53L1_static_config_t    *pstatic,
335 	VL53L1_general_config_t   *pgeneral,
336 	VL53L1_timing_config_t    *ptiming,
337 	VL53L1_dynamic_config_t   *pdynamic,
338 	VL53L1_system_control_t   *psystem,
339 	VL53L1_tuning_parm_storage_t *ptuning_parms);
340 
341 /**
342  * @brief Initializes static and dynamic configuration settings for
343  *        preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_MEDIUM_RANGE
344  *
345  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
346  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
347  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
348  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
349  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
350  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
351  * @param[out]   plpadata   : pointer to VL53L1_low_power_auto_data_t data structure
352  *
353  * @return  VL53L1_ERROR_NONE     Success
354  * @return  "Other error code"    See ::VL53L1_Error
355  */
356 
357 VL53L1_Error VL53L1_preset_mode_low_power_auto_ranging(
358 
359 	VL53L1_static_config_t    *pstatic,
360 	VL53L1_general_config_t   *pgeneral,
361 	VL53L1_timing_config_t    *ptiming,
362 	VL53L1_dynamic_config_t   *pdynamic,
363 	VL53L1_system_control_t   *psystem,
364 	VL53L1_tuning_parm_storage_t *ptuning_parms,
365 	VL53L1_low_power_auto_data_t *plpadata);
366 
367 /**
368  * @brief Initializes static and dynamic configuration settings for
369  *        preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_SHORT_RANGE
370  *
371  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
372  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
373  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
374  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
375  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
376  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
377  * @param[out]   plpadata   : pointer to VL53L1_low_power_auto_data_t data structure
378  *
379  * @return  VL53L1_ERROR_NONE     Success
380  * @return  "Other error code"    See ::VL53L1_Error
381  */
382 
383 VL53L1_Error VL53L1_preset_mode_low_power_auto_short_ranging(
384 
385 	VL53L1_static_config_t    *pstatic,
386 	VL53L1_general_config_t   *pgeneral,
387 	VL53L1_timing_config_t    *ptiming,
388 	VL53L1_dynamic_config_t   *pdynamic,
389 	VL53L1_system_control_t   *psystem,
390 	VL53L1_tuning_parm_storage_t *ptuning_parms,
391 	VL53L1_low_power_auto_data_t *plpadata);
392 
393 /**
394  * @brief Initializes static and dynamic configuration settings for
395  *        preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_LONG_RANGE
396  *
397  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
398  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
399  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
400  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
401  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
402  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
403  * @param[out]   plpadata   : pointer to VL53L1_low_power_auto_data_t data structure
404  *
405  * @return  VL53L1_ERROR_NONE     Success
406  * @return  "Other error code"    See ::VL53L1_Error
407  */
408 
409 VL53L1_Error VL53L1_preset_mode_low_power_auto_long_ranging(
410 
411 	VL53L1_static_config_t    *pstatic,
412 	VL53L1_general_config_t   *pgeneral,
413 	VL53L1_timing_config_t    *ptiming,
414 	VL53L1_dynamic_config_t   *pdynamic,
415 	VL53L1_system_control_t   *psystem,
416 	VL53L1_tuning_parm_storage_t *ptuning_parms,
417 	VL53L1_low_power_auto_data_t *plpadata);
418 
419 
420 /**
421  * @brief Initializes static and dynamic configuration settings for
422  *        preset mode VL53L1_DEVICEPRESETMODE_OLT
423  *
424  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
425  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
426  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
427  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
428  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
429  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
430  *
431  * @return  VL53L1_ERROR_NONE     Success
432  * @return  "Other error code"    See ::VL53L1_Error
433  */
434 
435 VL53L1_Error VL53L1_preset_mode_olt(
436 	VL53L1_static_config_t     *pstatic,
437 	VL53L1_general_config_t    *pgeneral,
438 	VL53L1_timing_config_t     *ptiming,
439 	VL53L1_dynamic_config_t    *pdynamic,
440 	VL53L1_system_control_t    *psystem,
441 	VL53L1_tuning_parm_storage_t *ptuning_parms);
442 
443 /**
444  * @brief Initializes static and dynamic configuration settings for
445  *        preset mode VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING
446  *
447  * @param[out]   pstatic    : pointer to VL53L1_static_config_t  data structure
448  * @param[out]   pgeneral   : pointer to VL53L1_general_config_t data structure
449  * @param[out]   ptiming    : pointer to VL53L1_timing_config_t data structure
450  * @param[out]   pdynamic   : pointer to VL53L1_dynamic_config_t data structure
451  * @param[out]   psystem    : pointer to VL53L1_system_control_t data structure
452  * @param[out]   ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
453  *
454  * @return  VL53L1_ERROR_NONE     Success
455  * @return  "Other error code"    See ::VL53L1_Error
456  */
457 
458 VL53L1_Error VL53L1_preset_mode_singleshot_ranging(
459 
460 	VL53L1_static_config_t    *pstatic,
461 	VL53L1_general_config_t   *pgeneral,
462 	VL53L1_timing_config_t    *ptiming,
463 	VL53L1_dynamic_config_t   *pdynamic,
464 	VL53L1_system_control_t   *psystem,
465 	VL53L1_tuning_parm_storage_t *ptuning_parms);
466 
467 #ifdef __cplusplus
468 }
469 #endif
470 
471 #endif /* _VL53L1_API_CORE_H_ */
472