1 
2 /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
3 /******************************************************************************
4  * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
5 
6  This file is part of VL53L1 and is dual licensed,
7  either GPL-2.0+
8  or 'BSD 3-clause "New" or "Revised" License' , at your option.
9  ******************************************************************************
10  */
11 
12 /**
13  * @file   vl53l1_api_strings.h
14  * @brief  VL53L1 API function declarations for decoding error codes to a
15  *         text strings
16  */
17 
18 
19 #ifndef VL53L1_API_STRINGS_H_
20 #define VL53L1_API_STRINGS_H_
21 
22 #include "vl53l1_def.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 
29 
30 /**
31  * @brief Generates a string for the input device range status code
32  *
33  * @param[in]   RangeStatus           : Device Range AStatus Code
34  * @param[out]  pRangeStatusString    : pointer to character buffer
35  *
36  * @return  VL53L1_ERROR_NONE     Success
37  * @return  "Other error code"    See ::VL53L1_Error
38  */
39 
40 VL53L1_Error VL53L1_get_range_status_string(
41 	uint8_t   RangeStatus,
42 	char    *pRangeStatusString);
43 
44 /**
45  * @brief Generates an error string for the input PAL error code
46  *
47  * @param[in]   PalErrorCode         : PAL Error Code
48  * @param[out]  pPalErrorString      : pointer to character buffer
49  *
50  * @return  VL53L1_ERROR_NONE     Success
51  * @return  "Other error code"    See ::VL53L1_Error
52  */
53 
54 VL53L1_Error VL53L1_get_pal_error_string(
55 	VL53L1_Error   PalErrorCode,
56 	char         *pPalErrorString);
57 
58 /**
59  * @brief Generates a string for the input PAL State code
60  *
61  * @param[in]   PalStateCode         : PAL State Code
62  * @param[out]  pPalStateString      : pointer to character buffer
63  *
64  * @return  VL53L1_ERROR_NONE     Success
65  * @return  "Other error code"    See ::VL53L1_Error
66  */
67 
68 VL53L1_Error VL53L1_get_pal_state_string(
69 	VL53L1_State   PalStateCode,
70 	char         *pPalStateString);
71 
72 
73 /**
74  * @brief Generates a string for the sequence step Id
75  *
76  * @param[in]   SequenceStepId            : Sequence Step Id
77  * @param[out]  pSequenceStepsString      : pointer to character buffer
78  *
79  * @return  VL53L1_ERROR_NONE     Success
80  * @return  "Other error code"    See ::VL53L1_Error
81  */
82 VL53L1_Error VL53L1_get_sequence_steps_info(
83 		VL53L1_SequenceStepId SequenceStepId,
84 		char *pSequenceStepsString);
85 
86 /**
87  * @brief Generates a string for the limit check Id
88  *
89  * @param[in]   LimitCheckId            : Limit check Id
90  * @param[out]  pLimitCheckString       : pointer to character buffer
91  *
92  * @return  VL53L1_ERROR_NONE     Success
93  * @return  "Other error code"    See ::VL53L1_Error
94  */
95 VL53L1_Error VL53L1_get_limit_check_info(uint16_t LimitCheckId,
96 	char *pLimitCheckString);
97 
98 #ifndef VL53L1_USE_EMPTY_STRING
99 	#define  VL53L1_STRING_DEVICE_INFO_NAME0          "VL53L1 cut1.0"
100 	#define  VL53L1_STRING_DEVICE_INFO_NAME1          "VL53L1 cut1.1"
101 	#define  VL53L1_STRING_DEVICE_INFO_TYPE          "VL53L1"
102 
103 	/* Range Status */
104 	#define  VL53L1_STRING_RANGESTATUS_NONE                 "No Update"
105 	#define  VL53L1_STRING_RANGESTATUS_RANGEVALID           "Range Valid"
106 	#define  VL53L1_STRING_RANGESTATUS_SIGMA                "Sigma Fail"
107 	#define  VL53L1_STRING_RANGESTATUS_SIGNAL               "Signal Fail"
108 	#define  VL53L1_STRING_RANGESTATUS_MINRANGE             "Min Range Fail"
109 	#define  VL53L1_STRING_RANGESTATUS_PHASE                "Phase Fail"
110 	#define  VL53L1_STRING_RANGESTATUS_HW                   "Hardware Fail"
111 
112 
113 	/* Range Status */
114 	#define  VL53L1_STRING_STATE_POWERDOWN               "POWERDOWN State"
115 	#define  VL53L1_STRING_STATE_WAIT_STATICINIT \
116 			"Wait for staticinit State"
117 	#define  VL53L1_STRING_STATE_STANDBY                 "STANDBY State"
118 	#define  VL53L1_STRING_STATE_IDLE                    "IDLE State"
119 	#define  VL53L1_STRING_STATE_RUNNING                 "RUNNING State"
120 	#define  VL53L1_STRING_STATE_RESET                   "RESET State"
121 	#define  VL53L1_STRING_STATE_UNKNOWN                 "UNKNOWN State"
122 	#define  VL53L1_STRING_STATE_ERROR                   "ERROR State"
123 
124 
125 
126 	/* Check Enable */
127 	#define  VL53L1_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
128 			"SIGMA FINAL RANGE"
129 	#define  VL53L1_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
130 			"SIGNAL RATE FINAL RANGE"
131 	#define  VL53L1_STRING_CHECKENABLE_SIGNAL_MIN_CLIP \
132 			"SIGNAL MIN CLIP"
133 	#define  VL53L1_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
134 			"RANGE IGNORE THRESHOLD"
135 	#define  VL53L1_STRING_CHECKENABLE_RANGE_PHASE_HIGH \
136 			"RANGE PHASE HIGH"
137 	#define  VL53L1_STRING_CHECKENABLE_RANGE_PHASE_LOW \
138 			"RANGE PHASE LOW"
139 	#define  VL53L1_STRING_CHECKENABLE_RANGE_PHASE_CONSISTENCY \
140 			"RANGE PHASE CONSISTENCY"
141 
142 	/* Sequence Step */
143 	#define  VL53L1_STRING_SEQUENCESTEP_VHV         "VHV"
144 	#define  VL53L1_STRING_SEQUENCESTEP_PHASECAL    "PHASE CAL"
145 	#define  VL53L1_STRING_SEQUENCESTEP_REFPHASE    "REF PHASE"
146 	#define  VL53L1_STRING_SEQUENCESTEP_DSS1        "DSS1"
147 	#define  VL53L1_STRING_SEQUENCESTEP_DSS2        "DSS2"
148 	#define  VL53L1_STRING_SEQUENCESTEP_MM1         "MM1"
149 	#define  VL53L1_STRING_SEQUENCESTEP_MM2         "MM2"
150 	#define  VL53L1_STRING_SEQUENCESTEP_RANGE       "RANGE"
151 #endif /* VL53L1_USE_EMPTY_STRING */
152 
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif
159 
160