1 
2 /*
3 * Copyright (c) 2017, STMicroelectronics - All Rights Reserved
4 *
5 * This file is part of VL53L1 Core and is dual licensed,
6 * either 'STMicroelectronics
7 * Proprietary license'
8 * or 'BSD 3-clause "New" or "Revised" License' , at your option.
9 *
10 ********************************************************************************
11 *
12 * 'STMicroelectronics Proprietary license'
13 *
14 ********************************************************************************
15 *
16 * License terms: STMicroelectronics Proprietary in accordance with licensing
17 * terms at www.st.com/sla0081
18 *
19 * STMicroelectronics confidential
20 * Reproduction and Communication of this document is strictly prohibited unless
21 * specifically authorized in writing by STMicroelectronics.
22 *
23 *
24 ********************************************************************************
25 *
26 * Alternatively, VL53L1 Core may be distributed under the terms of
27 * 'BSD 3-clause "New" or "Revised" License', in which case the following
28 * provisions apply instead of the ones mentioned above :
29 *
30 ********************************************************************************
31 *
32 * License terms: BSD 3-clause "New" or "Revised" License.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions are met:
36 *
37 * 1. Redistributions of source code must retain the above copyright notice, this
38 * list of conditions and the following disclaimer.
39 *
40 * 2. Redistributions in binary form must reproduce the above copyright notice,
41 * this list of conditions and the following disclaimer in the documentation
42 * and/or other materials provided with the distribution.
43 *
44 * 3. Neither the name of the copyright holder nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 *
59 *
60 ********************************************************************************
61 *
62 */
63 
64 #ifndef _VL53L1_PRESET_SETUP_H_
65 #define _VL53L1_PRESET_SETUP_H_
66 
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif
71 
72 /* indexes for the bare driver tuning setting API function */
73 enum VL53L1_Tuning_t {
74 	VL53L1_TUNING_VERSION = 0,
75 	VL53L1_TUNING_PROXY_MIN,
76 	VL53L1_TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM,
77 	VL53L1_TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER,
78 	VL53L1_TUNING_MIN_AMBIENT_DMAX_VALID,
79 	VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER,
80 	VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM,
81 	VL53L1_TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT,
82 
83 	VL53L1_TUNING_MAX_TUNABLE_KEY
84 };
85 
86 /* default values for the tuning settings parameters */
87 #define TUNING_VERSION	0x0004
88 
89 #define TUNING_PROXY_MIN -30 /* min distance in mm */
90 #define TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM 600
91 /* Target distance in mm for single target Xtalk */
92 #define TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER 50
93 /* Number of sample used for single target Xtalk */
94 #define TUNING_MIN_AMBIENT_DMAX_VALID 8
95 /* Minimum ambient level to state the Dmax returned by the device is valid */
96 #define TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER 50
97 /* Maximum loops to perform simple offset calibration */
98 #define TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM 600
99 /* Target distance in mm for target Xtalk from Bins method*/
100 #define TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT 1
101 /* Number of loops done during the simple offset calibration*/
102 
103 /* the following table should actually be defined as static and shall be part
104  * of the VL53L1_StaticInit() function code
105  */
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* _VL53L1_PRESET_SETUP_H_ */
112