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_error_codes.h 65 * 66 * @brief Error Code definitions for VL53L1 API. 67 * 68 */ 69 70 #ifndef _VL53L1_ERROR_CODES_H_ 71 #define _VL53L1_ERROR_CODES_H_ 72 73 #include "vl53l1_types.h" 74 75 #ifdef __cplusplus 76 extern "C" { 77 #endif 78 79 80 /**************************************** 81 * PRIVATE define do not edit 82 ****************************************/ 83 84 /** @defgroup VL53L1_define_Error_group Error and Warning code returned by API 85 * The following DEFINE are used to identify the PAL ERROR 86 * @{ 87 */ 88 89 typedef int8_t VL53L1_Error; 90 91 #define VL53L1_ERROR_NONE ((VL53L1_Error) 0) 92 #define VL53L1_ERROR_CALIBRATION_WARNING ((VL53L1_Error) - 1) 93 /*!< Warning invalid calibration data may be in used 94 \a VL53L1_InitData() 95 \a VL53L1_GetOffsetCalibrationData 96 \a VL53L1_SetOffsetCalibrationData */ 97 #define VL53L1_ERROR_MIN_CLIPPED ((VL53L1_Error) - 2) 98 /*!< Warning parameter passed was clipped to min before to be applied */ 99 100 #define VL53L1_ERROR_UNDEFINED ((VL53L1_Error) - 3) 101 /*!< Unqualified error */ 102 #define VL53L1_ERROR_INVALID_PARAMS ((VL53L1_Error) - 4) 103 /*!< Parameter passed is invalid or out of range */ 104 #define VL53L1_ERROR_NOT_SUPPORTED ((VL53L1_Error) - 5) 105 /*!< Function is not supported in current mode or configuration */ 106 #define VL53L1_ERROR_RANGE_ERROR ((VL53L1_Error) - 6) 107 /*!< Device report a ranging error interrupt status */ 108 #define VL53L1_ERROR_TIME_OUT ((VL53L1_Error) - 7) 109 /*!< Aborted due to time out */ 110 #define VL53L1_ERROR_MODE_NOT_SUPPORTED ((VL53L1_Error) - 8) 111 /*!< Asked mode is not supported by the device */ 112 #define VL53L1_ERROR_BUFFER_TOO_SMALL ((VL53L1_Error) - 9) 113 /*!< ... */ 114 #define VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL ((VL53L1_Error) - 10) 115 /*!< Supplied buffer is larger than I2C supports */ 116 #define VL53L1_ERROR_GPIO_NOT_EXISTING ((VL53L1_Error) - 11) 117 /*!< User tried to setup a non-existing GPIO pin */ 118 #define VL53L1_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ((VL53L1_Error) - 12) 119 /*!< unsupported GPIO functionality */ 120 #define VL53L1_ERROR_CONTROL_INTERFACE ((VL53L1_Error) - 13) 121 /*!< error reported from IO functions */ 122 #define VL53L1_ERROR_INVALID_COMMAND ((VL53L1_Error) - 14) 123 /*!< The command is not allowed in the current device state 124 * (power down) */ 125 #define VL53L1_ERROR_DIVISION_BY_ZERO ((VL53L1_Error) - 15) 126 /*!< In the function a division by zero occurs */ 127 #define VL53L1_ERROR_REF_SPAD_INIT ((VL53L1_Error) - 16) 128 /*!< Error during reference SPAD initialization */ 129 #define VL53L1_ERROR_GPH_SYNC_CHECK_FAIL ((VL53L1_Error) - 17) 130 /*!< GPH sync interrupt check fail - API out of sync with device*/ 131 #define VL53L1_ERROR_STREAM_COUNT_CHECK_FAIL ((VL53L1_Error) - 18) 132 /*!< Stream count check fail - API out of sync with device */ 133 #define VL53L1_ERROR_GPH_ID_CHECK_FAIL ((VL53L1_Error) - 19) 134 /*!< GPH ID check fail - API out of sync with device */ 135 #define VL53L1_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL ((VL53L1_Error) - 20) 136 /*!< Zone dynamic config stream count check failed - API out of sync */ 137 #define VL53L1_ERROR_ZONE_GPH_ID_CHECK_FAIL ((VL53L1_Error) - 21) 138 /*!< Zone dynamic config GPH ID check failed - API out of sync */ 139 140 #define VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL ((VL53L1_Error) - 22) 141 /*!< Thrown when run_xtalk_extraction fn has 0 succesful samples 142 * when using the full array to sample the xtalk. In this case there is 143 * not enough information to generate new Xtalk parm info. The function 144 * will exit and leave the current xtalk parameters unaltered */ 145 #define VL53L1_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL ((VL53L1_Error) - 23) 146 /*!< Thrown when run_xtalk_extraction fn has found that the 147 * avg sigma estimate of the full array xtalk sample is > than the 148 * maximal limit allowed. In this case the xtalk sample is too noisy for 149 * measurement. The function will exit and leave the current xtalk parameters 150 * unaltered. */ 151 152 153 #define VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL ((VL53L1_Error) - 24) 154 /*!< Thrown if there one of stages has no valid offset calibration 155 * samples. A fatal error calibration not valid */ 156 #define VL53L1_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL ((VL53L1_Error) - 25) 157 /*!< Thrown if there one of stages has zero effective SPADS 158 * Traps the case when MM1 SPADs is zero. 159 * A fatal error calibration not valid */ 160 #define VL53L1_ERROR_ZONE_CAL_NO_SAMPLE_FAIL ((VL53L1_Error) - 26) 161 /*!< Thrown if then some of the zones have no valid samples 162 * A fatal error calibration not valid */ 163 164 #define VL53L1_ERROR_TUNING_PARM_KEY_MISMATCH ((VL53L1_Error) - 27) 165 /*!< Thrown if the tuning file key table version does not match with 166 * expected value. The driver expects the key table version to match 167 * the compiled default version number in the define 168 * #VL53L1_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT 169 * */ 170 171 #define VL53L1_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS ((VL53L1_Error) - 28) 172 /*!< Thrown if there are less than 5 good SPADs are available. */ 173 #define VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH ((VL53L1_Error) - 29) 174 /*!< Thrown if the final reference rate is greater than 175 the upper reference rate limit - default is 40 Mcps. 176 Implies a minimum Q3 (x10) SPAD (5) selected */ 177 #define VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW ((VL53L1_Error) - 30) 178 /*!< Thrown if the final reference rate is less than 179 the lower reference rate limit - default is 10 Mcps. 180 Implies maximum Q1 (x1) SPADs selected */ 181 182 183 #define VL53L1_WARNING_OFFSET_CAL_MISSING_SAMPLES ((VL53L1_Error) - 31) 184 /*!< Thrown if there is less than the requested number of 185 * valid samples. */ 186 #define VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH ((VL53L1_Error) - 32) 187 /*!< Thrown if the offset calibration range sigma estimate is greater 188 * than 8.0 mm. This is the recommended min value to yield a stable 189 * offset measurement */ 190 #define VL53L1_WARNING_OFFSET_CAL_RATE_TOO_HIGH ((VL53L1_Error) - 33) 191 /*!< Thrown when VL53L1_run_offset_calibration() peak rate is greater 192 than that 50.0Mcps. This is the recommended max rate to avoid 193 pile-up influencing the offset measurement */ 194 #define VL53L1_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW ((VL53L1_Error) - 34) 195 /*!< Thrown when VL53L1_run_offset_calibration() when one of stages 196 range has less that 5.0 effective SPADS. This is the recommended 197 min value to yield a stable offset */ 198 199 200 #define VL53L1_WARNING_ZONE_CAL_MISSING_SAMPLES ((VL53L1_Error) - 35) 201 /*!< Thrown if one of more of the zones have less than 202 the requested number of valid samples */ 203 #define VL53L1_WARNING_ZONE_CAL_SIGMA_TOO_HIGH ((VL53L1_Error) - 36) 204 /*!< Thrown if one or more zones have sigma estimate value greater 205 * than 8.0 mm. This is the recommended min value to yield a stable 206 * offset measurement */ 207 #define VL53L1_WARNING_ZONE_CAL_RATE_TOO_HIGH ((VL53L1_Error) - 37) 208 /*!< Thrown if one of more zones have peak rate higher than 209 that 50.0Mcps. This is the recommended max rate to avoid 210 pile-up influencing the offset measurement */ 211 212 213 #define VL53L1_WARNING_XTALK_MISSING_SAMPLES ((VL53L1_Error) - 38) 214 /*!< Thrown to notify that some of the xtalk samples did not yield 215 * valid ranging pulse data while attempting to measure 216 * the xtalk signal in vl53l1_run_xtalk_extract(). This can signify any of 217 * the zones are missing samples, for further debug information the 218 * xtalk_results struct should be referred to. This warning is for 219 * notification only, the xtalk pulse and shape have still been generated 220 */ 221 #define VL53L1_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT ((VL53L1_Error) - 39) 222 /*!< Thrown to notify that some of teh xtalk samples used for gradient 223 * generation did not yield valid ranging pulse data while attempting to 224 * measure the xtalk signal in vl53l1_run_xtalk_extract(). This can signify 225 * that any one of the zones 0-3 yielded no successful samples. The 226 * xtalk_results struct should be referred to for further debug info. 227 * This warning is for notification only, the xtalk pulse and shape 228 * have still been generated. 229 */ 230 #define VL53L1_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT ((VL53L1_Error) - 40) 231 /*!< Thrown to notify that some of the xtalk samples used for gradient 232 * generation did not pass the sigma limit check while attempting to 233 * measure the xtalk signal in vl53l1_run_xtalk_extract(). This can signify 234 * that any one of the zones 0-3 yielded an avg sigma_mm value > the limit. 235 * The xtalk_results struct should be referred to for further debug info. 236 * This warning is for notification only, the xtalk pulse and shape 237 * have still been generated. 238 */ 239 240 #define VL53L1_ERROR_NOT_IMPLEMENTED ((VL53L1_Error) - 41) 241 /*!< Tells requested functionality has not been implemented yet or 242 * not compatible with the device */ 243 #define VL53L1_ERROR_PLATFORM_SPECIFIC_START ((VL53L1_Error) - 60) 244 /*!< Tells the starting code for platform */ 245 /** @} VL53L1_define_Error_group */ 246 247 248 #ifdef __cplusplus 249 } 250 #endif 251 252 253 #endif /* _VL53L1_ERROR_CODES_H_ */ 254