1 /*******************************************************************************
2 Copyright � 2016, STMicroelectronics International N.V.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in the
11       documentation and/or other materials provided with the distribution.
12     * Neither the name of STMicroelectronics nor the
13       names of its contributors may be used to endorse or promote products
14       derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *******************************************************************************/
28 
29 #ifndef VL53L0X_API_STRINGS_H_
30 #define VL53L0X_API_STRINGS_H_
31 
32 #include "vl53l0x_def.h"
33 #include "vl53l0x_platform.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV Dev,
41 			VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
42 
43 VL53L0X_Error VL53L0X_get_device_error_string(VL53L0X_DeviceError ErrorCode,
44 		char *pDeviceErrorString);
45 
46 VL53L0X_Error VL53L0X_get_range_status_string(uint8_t RangeStatus,
47 		char *pRangeStatusString);
48 
49 VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error PalErrorCode,
50 		char *pPalErrorString);
51 
52 VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State PalStateCode,
53 		char *pPalStateString);
54 
55 VL53L0X_Error VL53L0X_get_sequence_steps_info(
56 		VL53L0X_SequenceStepId SequenceStepId,
57 		char *pSequenceStepsString);
58 
59 VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV Dev, uint16_t LimitCheckId,
60 	char *pLimitCheckString);
61 
62 
63 #ifdef USE_EMPTY_STRING
64 	#define  VL53L0X_STRING_DEVICE_INFO_NAME                             ""
65 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS0                         ""
66 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS1                         ""
67 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS2                         ""
68 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_ES1                         ""
69 	#define  VL53L0X_STRING_DEVICE_INFO_TYPE                             ""
70 
71 	/* PAL ERROR strings */
72 	#define  VL53L0X_STRING_ERROR_NONE                                   ""
73 	#define  VL53L0X_STRING_ERROR_CALIBRATION_WARNING                    ""
74 	#define  VL53L0X_STRING_ERROR_MIN_CLIPPED                            ""
75 	#define  VL53L0X_STRING_ERROR_UNDEFINED                              ""
76 	#define  VL53L0X_STRING_ERROR_INVALID_PARAMS                         ""
77 	#define  VL53L0X_STRING_ERROR_NOT_SUPPORTED                          ""
78 	#define  VL53L0X_STRING_ERROR_RANGE_ERROR                            ""
79 	#define  VL53L0X_STRING_ERROR_TIME_OUT                               ""
80 	#define  VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED                     ""
81 	#define  VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL                       ""
82 	#define  VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING                      ""
83 	#define  VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED       ""
84 	#define  VL53L0X_STRING_ERROR_CONTROL_INTERFACE                      ""
85 	#define  VL53L0X_STRING_ERROR_INVALID_COMMAND                        ""
86 	#define  VL53L0X_STRING_ERROR_DIVISION_BY_ZERO                       ""
87 	#define  VL53L0X_STRING_ERROR_REF_SPAD_INIT                          ""
88 	#define  VL53L0X_STRING_ERROR_NOT_IMPLEMENTED                        ""
89 
90 	#define  VL53L0X_STRING_UNKNOW_ERROR_CODE                            ""
91 
92 
93 
94 	/* Range Status */
95 	#define  VL53L0X_STRING_RANGESTATUS_NONE                             ""
96 	#define  VL53L0X_STRING_RANGESTATUS_RANGEVALID                       ""
97 	#define  VL53L0X_STRING_RANGESTATUS_SIGMA                            ""
98 	#define  VL53L0X_STRING_RANGESTATUS_SIGNAL                           ""
99 	#define  VL53L0X_STRING_RANGESTATUS_MINRANGE                         ""
100 	#define  VL53L0X_STRING_RANGESTATUS_PHASE                            ""
101 	#define  VL53L0X_STRING_RANGESTATUS_HW                               ""
102 
103 
104 	/* Range Status */
105 	#define  VL53L0X_STRING_STATE_POWERDOWN                              ""
106 	#define  VL53L0X_STRING_STATE_WAIT_STATICINIT                        ""
107 	#define  VL53L0X_STRING_STATE_STANDBY                                ""
108 	#define  VL53L0X_STRING_STATE_IDLE                                   ""
109 	#define  VL53L0X_STRING_STATE_RUNNING                                ""
110 	#define  VL53L0X_STRING_STATE_UNKNOWN                                ""
111 	#define  VL53L0X_STRING_STATE_ERROR                                  ""
112 
113 
114 	/* Device Specific */
115 	#define  VL53L0X_STRING_DEVICEERROR_NONE                             ""
116 	#define  VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE       ""
117 	#define  VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE         ""
118 	#define  VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND                  ""
119 	#define  VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET                     ""
120 	#define  VL53L0X_STRING_DEVICEERROR_SNRCHECK                         ""
121 	#define  VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK                  ""
122 	#define  VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK              ""
123 	#define  VL53L0X_STRING_DEVICEERROR_TCC                              ""
124 	#define  VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY                 ""
125 	#define  VL53L0X_STRING_DEVICEERROR_MINCLIP                          ""
126 	#define  VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE                    ""
127 	#define  VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW                    ""
128 	#define  VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW                     ""
129 	#define  VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD             ""
130 	#define  VL53L0X_STRING_DEVICEERROR_UNKNOWN                          ""
131 
132 	/* Check Enable */
133 	#define  VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE                ""
134 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE          ""
135 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP                  ""
136 	#define  VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD           ""
137 
138 	/* Sequence Step */
139 	#define  VL53L0X_STRING_SEQUENCESTEP_TCC                             ""
140 	#define  VL53L0X_STRING_SEQUENCESTEP_DSS                             ""
141 	#define  VL53L0X_STRING_SEQUENCESTEP_MSRC                            ""
142 	#define  VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE                       ""
143 	#define  VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE                     ""
144 #else
145 	#define  VL53L0X_STRING_DEVICE_INFO_NAME          "VL53L0X cut1.0"
146 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS0      "VL53L0X TS0"
147 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS1      "VL53L0X TS1"
148 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_TS2      "VL53L0X TS2"
149 	#define  VL53L0X_STRING_DEVICE_INFO_NAME_ES1      "VL53L0X ES1 or later"
150 	#define  VL53L0X_STRING_DEVICE_INFO_TYPE          "VL53L0X"
151 
152 	/* PAL ERROR strings */
153 	#define  VL53L0X_STRING_ERROR_NONE \
154 			"No Error"
155 	#define  VL53L0X_STRING_ERROR_CALIBRATION_WARNING \
156 			"Calibration Warning Error"
157 	#define  VL53L0X_STRING_ERROR_MIN_CLIPPED \
158 			"Min clipped error"
159 	#define  VL53L0X_STRING_ERROR_UNDEFINED \
160 			"Undefined error"
161 	#define  VL53L0X_STRING_ERROR_INVALID_PARAMS \
162 			"Invalid parameters error"
163 	#define  VL53L0X_STRING_ERROR_NOT_SUPPORTED \
164 			"Not supported error"
165 	#define  VL53L0X_STRING_ERROR_RANGE_ERROR \
166 			"Range error"
167 	#define  VL53L0X_STRING_ERROR_TIME_OUT \
168 			"Time out error"
169 	#define  VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED \
170 			"Mode not supported error"
171 	#define  VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL \
172 			"Buffer too small"
173 	#define  VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING \
174 			"GPIO not existing"
175 	#define  VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \
176 			"GPIO funct not supported"
177 	#define  VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED \
178 			"Interrupt not Cleared"
179 	#define  VL53L0X_STRING_ERROR_CONTROL_INTERFACE \
180 			"Control Interface Error"
181 	#define  VL53L0X_STRING_ERROR_INVALID_COMMAND \
182 			"Invalid Command Error"
183 	#define  VL53L0X_STRING_ERROR_DIVISION_BY_ZERO \
184 			"Division by zero Error"
185 	#define  VL53L0X_STRING_ERROR_REF_SPAD_INIT \
186 			"Reference Spad Init Error"
187 	#define  VL53L0X_STRING_ERROR_NOT_IMPLEMENTED \
188 			"Not implemented error"
189 
190 	#define  VL53L0X_STRING_UNKNOW_ERROR_CODE \
191 			"Unknown Error Code"
192 
193 
194 
195 	/* Range Status */
196 	#define  VL53L0X_STRING_RANGESTATUS_NONE                 "No Update"
197 	#define  VL53L0X_STRING_RANGESTATUS_RANGEVALID           "Range Valid"
198 	#define  VL53L0X_STRING_RANGESTATUS_SIGMA                "Sigma Fail"
199 	#define  VL53L0X_STRING_RANGESTATUS_SIGNAL               "Signal Fail"
200 	#define  VL53L0X_STRING_RANGESTATUS_MINRANGE             "Min Range Fail"
201 	#define  VL53L0X_STRING_RANGESTATUS_PHASE                "Phase Fail"
202 	#define  VL53L0X_STRING_RANGESTATUS_HW                   "Hardware Fail"
203 
204 
205 	/* Range Status */
206 	#define  VL53L0X_STRING_STATE_POWERDOWN               "POWERDOWN State"
207 	#define  VL53L0X_STRING_STATE_WAIT_STATICINIT \
208 			"Wait for staticinit State"
209 	#define  VL53L0X_STRING_STATE_STANDBY                 "STANDBY State"
210 	#define  VL53L0X_STRING_STATE_IDLE                    "IDLE State"
211 	#define  VL53L0X_STRING_STATE_RUNNING                 "RUNNING State"
212 	#define  VL53L0X_STRING_STATE_UNKNOWN                 "UNKNOWN State"
213 	#define  VL53L0X_STRING_STATE_ERROR                   "ERROR State"
214 
215 
216 	/* Device Specific */
217 	#define  VL53L0X_STRING_DEVICEERROR_NONE                   "No Update"
218 	#define  VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE \
219 			"VCSEL Continuity Test Failure"
220 	#define  VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE \
221 			"VCSEL Watchdog Test Failure"
222 	#define  VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND \
223 			"No VHV Value found"
224 	#define  VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET \
225 			"MSRC No Target Error"
226 	#define  VL53L0X_STRING_DEVICEERROR_SNRCHECK \
227 			"SNR Check Exit"
228 	#define  VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK \
229 			"Range Phase Check Error"
230 	#define  VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK \
231 			"Sigma Threshold Check Error"
232 	#define  VL53L0X_STRING_DEVICEERROR_TCC \
233 			"TCC Error"
234 	#define  VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY \
235 			"Phase Consistency Error"
236 	#define  VL53L0X_STRING_DEVICEERROR_MINCLIP \
237 			"Min Clip Error"
238 	#define  VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE \
239 			"Range Complete"
240 	#define  VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW \
241 			"Range Algo Underflow Error"
242 	#define  VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW \
243 			"Range Algo Overlow Error"
244 	#define  VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD \
245 			"Range Ignore Threshold Error"
246 	#define  VL53L0X_STRING_DEVICEERROR_UNKNOWN \
247 			"Unknown error code"
248 
249 	/* Check Enable */
250 	#define  VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
251 			"SIGMA FINAL RANGE"
252 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
253 			"SIGNAL RATE FINAL RANGE"
254 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP \
255 			"SIGNAL REF CLIP"
256 	#define  VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
257 			"RANGE IGNORE THRESHOLD"
258 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_MSRC \
259 			"SIGNAL RATE MSRC"
260 	#define  VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_PRE_RANGE \
261 			"SIGNAL RATE PRE RANGE"
262 
263 	/* Sequence Step */
264 	#define  VL53L0X_STRING_SEQUENCESTEP_TCC                   "TCC"
265 	#define  VL53L0X_STRING_SEQUENCESTEP_DSS                   "DSS"
266 	#define  VL53L0X_STRING_SEQUENCESTEP_MSRC                  "MSRC"
267 	#define  VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE             "PRE RANGE"
268 	#define  VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE           "FINAL RANGE"
269 #endif /* USE_EMPTY_STRING */
270 
271 
272 #ifdef __cplusplus
273 }
274 #endif
275 
276 #endif
277 
278