Rename library

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   VL53L3CX_NoShield_1Sensor_poll_Mb06x VL53L3_NoShield_1Sensor_polling_Mb63 X_NUCLEO_53L3A2 53L3A2_Ranging

Committer:
charlesmn
Date:
Wed Jul 21 14:07:59 2021 +0000
Revision:
7:7f1bbf370283
Parent:
5:89031b2f5316
Moved vl53l3cx_class.cpp and .h to 53l3a2_RangingClass

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Charles MacNeill 5:89031b2f5316 1 /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
Charles MacNeill 5:89031b2f5316 2 /******************************************************************************
Charles MacNeill 5:89031b2f5316 3 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
Charles MacNeill 5:89031b2f5316 4
Charles MacNeill 5:89031b2f5316 5 This file is part of VL53LX and is dual licensed,
Charles MacNeill 5:89031b2f5316 6 either GPL-2.0+
Charles MacNeill 5:89031b2f5316 7 or 'BSD 3-clause "New" or "Revised" License' , at your option.
Charles MacNeill 5:89031b2f5316 8 ******************************************************************************
Charles MacNeill 5:89031b2f5316 9 */
Charles MacNeill 5:89031b2f5316 10
Charles MacNeill 5:89031b2f5316 11 /**
Charles MacNeill 5:89031b2f5316 12 * @file vl53lx_error_codes.h
Charles MacNeill 5:89031b2f5316 13 *
Charles MacNeill 5:89031b2f5316 14 * @brief Error Code definitions for VL53LX API.
Charles MacNeill 5:89031b2f5316 15 *
Charles MacNeill 5:89031b2f5316 16 */
Charles MacNeill 5:89031b2f5316 17
Charles MacNeill 5:89031b2f5316 18 #ifndef _VL53LX_ERROR_CODES_H_
Charles MacNeill 5:89031b2f5316 19 #define _VL53LX_ERROR_CODES_H_
Charles MacNeill 5:89031b2f5316 20
Charles MacNeill 5:89031b2f5316 21 #include "vl53lx_types.h"
Charles MacNeill 5:89031b2f5316 22
Charles MacNeill 5:89031b2f5316 23 #ifdef __cplusplus
Charles MacNeill 5:89031b2f5316 24 extern "C" {
Charles MacNeill 5:89031b2f5316 25 #endif
Charles MacNeill 5:89031b2f5316 26
Charles MacNeill 5:89031b2f5316 27
Charles MacNeill 5:89031b2f5316 28 /*
Charles MacNeill 5:89031b2f5316 29 ****************************************
Charles MacNeill 5:89031b2f5316 30 * PRIVATE define do not edit
Charles MacNeill 5:89031b2f5316 31 ***************************************
Charles MacNeill 5:89031b2f5316 32 */
Charles MacNeill 5:89031b2f5316 33
Charles MacNeill 5:89031b2f5316 34 /*
Charles MacNeill 5:89031b2f5316 35 * @defgroup VL53LX_define_Error_group Error and Warning code returned by API
Charles MacNeill 5:89031b2f5316 36 * The following DEFINE are used to identify the PAL ERROR
Charles MacNeill 5:89031b2f5316 37 * @{
Charles MacNeill 5:89031b2f5316 38 */
Charles MacNeill 5:89031b2f5316 39
Charles MacNeill 5:89031b2f5316 40 typedef int8_t VL53LX_Error;
Charles MacNeill 5:89031b2f5316 41
Charles MacNeill 5:89031b2f5316 42 #define VL53LX_ERROR_NONE ((VL53LX_Error) 0)
Charles MacNeill 5:89031b2f5316 43 #define VL53LX_ERROR_CALIBRATION_WARNING ((VL53LX_Error) - 1)
Charles MacNeill 5:89031b2f5316 44 /*!< Warning invalid calibration data may be in used
Charles MacNeill 5:89031b2f5316 45 * \a VL53LX_InitData()
Charles MacNeill 5:89031b2f5316 46 * \a VL53LX_GetOffsetCalibrationData
Charles MacNeill 5:89031b2f5316 47 * \a VL53LX_SetOffsetCalibrationData
Charles MacNeill 5:89031b2f5316 48 */
Charles MacNeill 5:89031b2f5316 49 #define VL53LX_ERROR_MIN_CLIPPED ((VL53LX_Error) - 2)
Charles MacNeill 5:89031b2f5316 50 /*!< Warning parameter passed was clipped to min before to be applied */
Charles MacNeill 5:89031b2f5316 51
Charles MacNeill 5:89031b2f5316 52 #define VL53LX_ERROR_UNDEFINED ((VL53LX_Error) - 3)
Charles MacNeill 5:89031b2f5316 53 /*!< Unqualified error */
Charles MacNeill 5:89031b2f5316 54 #define VL53LX_ERROR_INVALID_PARAMS ((VL53LX_Error) - 4)
Charles MacNeill 5:89031b2f5316 55 /*!< Parameter passed is invalid or out of range */
Charles MacNeill 5:89031b2f5316 56 #define VL53LX_ERROR_NOT_SUPPORTED ((VL53LX_Error) - 5)
Charles MacNeill 5:89031b2f5316 57 /*!< Function is not supported in current mode or configuration */
Charles MacNeill 5:89031b2f5316 58 #define VL53LX_ERROR_RANGE_ERROR ((VL53LX_Error) - 6)
Charles MacNeill 5:89031b2f5316 59 /*!< Device report a ranging error interrupt status */
Charles MacNeill 5:89031b2f5316 60 #define VL53LX_ERROR_TIME_OUT ((VL53LX_Error) - 7)
Charles MacNeill 5:89031b2f5316 61 /*!< Aborted due to time out */
Charles MacNeill 5:89031b2f5316 62 #define VL53LX_ERROR_MODE_NOT_SUPPORTED ((VL53LX_Error) - 8)
Charles MacNeill 5:89031b2f5316 63 /*!< Asked mode is not supported by the device */
Charles MacNeill 5:89031b2f5316 64 #define VL53LX_ERROR_BUFFER_TOO_SMALL ((VL53LX_Error) - 9)
Charles MacNeill 5:89031b2f5316 65 /*!< ... */
Charles MacNeill 5:89031b2f5316 66 #define VL53LX_ERROR_COMMS_BUFFER_TOO_SMALL ((VL53LX_Error) - 10)
Charles MacNeill 5:89031b2f5316 67 /*!< Supplied buffer is larger than I2C supports */
Charles MacNeill 5:89031b2f5316 68 #define VL53LX_ERROR_GPIO_NOT_EXISTING ((VL53LX_Error) - 11)
Charles MacNeill 5:89031b2f5316 69 /*!< User tried to setup a non-existing GPIO pin */
Charles MacNeill 5:89031b2f5316 70 #define VL53LX_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ((VL53LX_Error) - 12)
Charles MacNeill 5:89031b2f5316 71 /*!< unsupported GPIO functionality */
Charles MacNeill 5:89031b2f5316 72 #define VL53LX_ERROR_CONTROL_INTERFACE ((VL53LX_Error) - 13)
Charles MacNeill 5:89031b2f5316 73 /*!< error reported from IO functions */
Charles MacNeill 5:89031b2f5316 74 #define VL53LX_ERROR_INVALID_COMMAND ((VL53LX_Error) - 14)
Charles MacNeill 5:89031b2f5316 75 /*!< The command is not allowed in the current device state
Charles MacNeill 5:89031b2f5316 76 * (power down)
Charles MacNeill 5:89031b2f5316 77 */
Charles MacNeill 5:89031b2f5316 78 #define VL53LX_ERROR_DIVISION_BY_ZERO ((VL53LX_Error) - 15)
Charles MacNeill 5:89031b2f5316 79 /*!< In the function a division by zero occurs */
Charles MacNeill 5:89031b2f5316 80 #define VL53LX_ERROR_REF_SPAD_INIT ((VL53LX_Error) - 16)
Charles MacNeill 5:89031b2f5316 81 /*!< Error during reference SPAD initialization */
Charles MacNeill 5:89031b2f5316 82 #define VL53LX_ERROR_GPH_SYNC_CHECK_FAIL ((VL53LX_Error) - 17)
Charles MacNeill 5:89031b2f5316 83 /*!< GPH sync interrupt check fail - API out of sync with device*/
Charles MacNeill 5:89031b2f5316 84 #define VL53LX_ERROR_STREAM_COUNT_CHECK_FAIL ((VL53LX_Error) - 18)
Charles MacNeill 5:89031b2f5316 85 /*!< Stream count check fail - API out of sync with device */
Charles MacNeill 5:89031b2f5316 86 #define VL53LX_ERROR_GPH_ID_CHECK_FAIL ((VL53LX_Error) - 19)
Charles MacNeill 5:89031b2f5316 87 /*!< GPH ID check fail - API out of sync with device */
Charles MacNeill 5:89031b2f5316 88 #define VL53LX_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL ((VL53LX_Error) - 20)
Charles MacNeill 5:89031b2f5316 89 /*!< Zone dynamic config stream count check failed - API out of sync */
Charles MacNeill 5:89031b2f5316 90 #define VL53LX_ERROR_ZONE_GPH_ID_CHECK_FAIL ((VL53LX_Error) - 21)
Charles MacNeill 5:89031b2f5316 91 /*!< Zone dynamic config GPH ID check failed - API out of sync */
Charles MacNeill 5:89031b2f5316 92
Charles MacNeill 5:89031b2f5316 93 #define VL53LX_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL ((VL53LX_Error) - 22)
Charles MacNeill 5:89031b2f5316 94 /*!< Thrown when run_xtalk_extraction fn has 0 succesful samples
Charles MacNeill 5:89031b2f5316 95 * when using the full array to sample the xtalk. In this case there is
Charles MacNeill 5:89031b2f5316 96 * not enough information to generate new Xtalk parm info. The function
Charles MacNeill 5:89031b2f5316 97 * will exit and leave the current xtalk parameters unaltered
Charles MacNeill 5:89031b2f5316 98 */
Charles MacNeill 5:89031b2f5316 99 #define VL53LX_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL ((VL53LX_Error) - 23)
Charles MacNeill 5:89031b2f5316 100 /*!< Thrown when run_xtalk_extraction fn has found that the
Charles MacNeill 5:89031b2f5316 101 * avg sigma estimate of the full array xtalk sample is > than the
Charles MacNeill 5:89031b2f5316 102 * maximal limit allowed. In this case the xtalk sample is too noisy for
Charles MacNeill 5:89031b2f5316 103 * measurement. The function will exit and leave the current xtalk
Charles MacNeill 5:89031b2f5316 104 * parameters unaltered.
Charles MacNeill 5:89031b2f5316 105 */
Charles MacNeill 5:89031b2f5316 106
Charles MacNeill 5:89031b2f5316 107
Charles MacNeill 5:89031b2f5316 108 #define VL53LX_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL ((VL53LX_Error) - 24)
Charles MacNeill 5:89031b2f5316 109 /*!< Thrown if there one of stages has no valid offset calibration
Charles MacNeill 5:89031b2f5316 110 * samples. A fatal error calibration not valid
Charles MacNeill 5:89031b2f5316 111 */
Charles MacNeill 5:89031b2f5316 112 #define VL53LX_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL ((VL53LX_Error) - 25)
Charles MacNeill 5:89031b2f5316 113 /*!< Thrown if there one of stages has zero effective SPADS
Charles MacNeill 5:89031b2f5316 114 * Traps the case when MM1 SPADs is zero.
Charles MacNeill 5:89031b2f5316 115 * A fatal error calibration not valid
Charles MacNeill 5:89031b2f5316 116 */
Charles MacNeill 5:89031b2f5316 117 #define VL53LX_ERROR_ZONE_CAL_NO_SAMPLE_FAIL ((VL53LX_Error) - 26)
Charles MacNeill 5:89031b2f5316 118 /*!< Thrown if then some of the zones have no valid samples
Charles MacNeill 5:89031b2f5316 119 * A fatal error calibration not valid
Charles MacNeill 5:89031b2f5316 120 */
Charles MacNeill 5:89031b2f5316 121
Charles MacNeill 5:89031b2f5316 122 #define VL53LX_ERROR_TUNING_PARM_KEY_MISMATCH ((VL53LX_Error) - 27)
Charles MacNeill 5:89031b2f5316 123 /*!< Thrown if the tuning file key table version does not match with
Charles MacNeill 5:89031b2f5316 124 * expected value. The driver expects the key table version to match
Charles MacNeill 5:89031b2f5316 125 * the compiled default version number in the define
Charles MacNeill 5:89031b2f5316 126 * #VL53LX_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT
Charles MacNeill 5:89031b2f5316 127 */
Charles MacNeill 5:89031b2f5316 128
Charles MacNeill 5:89031b2f5316 129 #define VL53LX_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS ((VL53LX_Error) - 28)
Charles MacNeill 5:89031b2f5316 130 /*!< Thrown if there are less than 5 good SPADs are available. */
Charles MacNeill 5:89031b2f5316 131 #define VL53LX_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH ((VL53LX_Error) - 29)
Charles MacNeill 5:89031b2f5316 132 /*!< Thrown if the final reference rate is greater than
Charles MacNeill 5:89031b2f5316 133 * the upper reference rate limit - default is 40 Mcps.
Charles MacNeill 5:89031b2f5316 134 * Implies a minimum Q3 (x10) SPAD (5) selected
Charles MacNeill 5:89031b2f5316 135 */
Charles MacNeill 5:89031b2f5316 136 #define VL53LX_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW ((VL53LX_Error) - 30)
Charles MacNeill 5:89031b2f5316 137 /*!< Thrown if the final reference rate is less than
Charles MacNeill 5:89031b2f5316 138 * the lower reference rate limit - default is 10 Mcps.
Charles MacNeill 5:89031b2f5316 139 * Implies maximum Q1 (x1) SPADs selected
Charles MacNeill 5:89031b2f5316 140 */
Charles MacNeill 5:89031b2f5316 141
Charles MacNeill 5:89031b2f5316 142
Charles MacNeill 5:89031b2f5316 143 #define VL53LX_WARNING_OFFSET_CAL_MISSING_SAMPLES ((VL53LX_Error) - 31)
Charles MacNeill 5:89031b2f5316 144 /*!< Thrown if there is less than the requested number of
Charles MacNeill 5:89031b2f5316 145 * valid samples.
Charles MacNeill 5:89031b2f5316 146 */
Charles MacNeill 5:89031b2f5316 147 #define VL53LX_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH ((VL53LX_Error) - 32)
Charles MacNeill 5:89031b2f5316 148 /*!< Thrown if the offset calibration range sigma estimate is greater
Charles MacNeill 5:89031b2f5316 149 * than 8.0 mm. This is the recommended min value to yield a stable
Charles MacNeill 5:89031b2f5316 150 * offset measurement
Charles MacNeill 5:89031b2f5316 151 */
Charles MacNeill 5:89031b2f5316 152 #define VL53LX_WARNING_OFFSET_CAL_RATE_TOO_HIGH ((VL53LX_Error) - 33)
Charles MacNeill 5:89031b2f5316 153 /*!< Thrown when VL53LX_run_offset_calibration() peak rate is greater
Charles MacNeill 5:89031b2f5316 154 * than that 50.0Mcps. This is the recommended max rate to avoid
Charles MacNeill 5:89031b2f5316 155 * pile-up influencing the offset measurement
Charles MacNeill 5:89031b2f5316 156 */
Charles MacNeill 5:89031b2f5316 157 #define VL53LX_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW ((VL53LX_Error) - 34)
Charles MacNeill 5:89031b2f5316 158 /*!< Thrown when VL53LX_run_offset_calibration() when one of stages
Charles MacNeill 5:89031b2f5316 159 * range has less that 5.0 effective SPADS. This is the recommended
Charles MacNeill 5:89031b2f5316 160 * min value to yield a stable offset
Charles MacNeill 5:89031b2f5316 161 */
Charles MacNeill 5:89031b2f5316 162
Charles MacNeill 5:89031b2f5316 163
Charles MacNeill 5:89031b2f5316 164 #define VL53LX_WARNING_ZONE_CAL_MISSING_SAMPLES ((VL53LX_Error) - 35)
Charles MacNeill 5:89031b2f5316 165 /*!< Thrown if one of more of the zones have less than
Charles MacNeill 5:89031b2f5316 166 * the requested number of valid samples
Charles MacNeill 5:89031b2f5316 167 */
Charles MacNeill 5:89031b2f5316 168 #define VL53LX_WARNING_ZONE_CAL_SIGMA_TOO_HIGH ((VL53LX_Error) - 36)
Charles MacNeill 5:89031b2f5316 169 /*!< Thrown if one or more zones have sigma estimate value greater
Charles MacNeill 5:89031b2f5316 170 * than 8.0 mm. This is the recommended min value to yield a stable
Charles MacNeill 5:89031b2f5316 171 * offset measurement
Charles MacNeill 5:89031b2f5316 172 */
Charles MacNeill 5:89031b2f5316 173 #define VL53LX_WARNING_ZONE_CAL_RATE_TOO_HIGH ((VL53LX_Error) - 37)
Charles MacNeill 5:89031b2f5316 174 /*!< Thrown if one of more zones have peak rate higher than
Charles MacNeill 5:89031b2f5316 175 * that 50.0Mcps. This is the recommended max rate to avoid
Charles MacNeill 5:89031b2f5316 176 * pile-up influencing the offset measurement
Charles MacNeill 5:89031b2f5316 177 */
Charles MacNeill 5:89031b2f5316 178
Charles MacNeill 5:89031b2f5316 179
Charles MacNeill 5:89031b2f5316 180 #define VL53LX_WARNING_XTALK_MISSING_SAMPLES ((VL53LX_Error) - 38)
Charles MacNeill 5:89031b2f5316 181 /*!< Thrown to notify that some of the xtalk samples did not yield
Charles MacNeill 5:89031b2f5316 182 * valid ranging pulse data while attempting to measure
Charles MacNeill 5:89031b2f5316 183 * the xtalk signal in vl53lx_run_xtalk_extract(). This can signify any
Charles MacNeill 5:89031b2f5316 184 * of the zones are missing samples, for further debug information the
Charles MacNeill 5:89031b2f5316 185 * xtalk_results struct should be referred to. This warning is for
Charles MacNeill 5:89031b2f5316 186 * notification only, xtalk pulse and shape have still been generated
Charles MacNeill 5:89031b2f5316 187 */
Charles MacNeill 5:89031b2f5316 188 #define VL53LX_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT ((VL53LX_Error) - 39)
Charles MacNeill 5:89031b2f5316 189 /*!< Thrown to notify that some of teh xtalk samples used for gradient
Charles MacNeill 5:89031b2f5316 190 * generation did not yield valid ranging pulse data while attempting to
Charles MacNeill 5:89031b2f5316 191 * measure the xtalk signal in vl53lx_run_xtalk_extract(). This can
Charles MacNeill 5:89031b2f5316 192 * signify that any one of the zones 0-3 yielded no successful samples.
Charles MacNeill 5:89031b2f5316 193 * xtalk_results struct should be referred to for further debug info.
Charles MacNeill 5:89031b2f5316 194 * This warning is for notification only, the xtalk pulse and shape
Charles MacNeill 5:89031b2f5316 195 * have still been generated.
Charles MacNeill 5:89031b2f5316 196 */
Charles MacNeill 5:89031b2f5316 197 #define VL53LX_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT ((VL53LX_Error) - 40)
Charles MacNeill 5:89031b2f5316 198 /*!< Thrown to notify that some of the xtalk samples used for gradient
Charles MacNeill 5:89031b2f5316 199 * generation did not pass the sigma limit check while attempting to
Charles MacNeill 5:89031b2f5316 200 * measure the xtalk signal in vl53lx_run_xtalk_extract(). This can
Charles MacNeill 5:89031b2f5316 201 * signify that any one of the zones 0-3 yielded an avg sigma_mm
Charles MacNeill 5:89031b2f5316 202 * value > the limit. The xtalk_results struct should be referred to for
Charles MacNeill 5:89031b2f5316 203 * further debug info.
Charles MacNeill 5:89031b2f5316 204 * This warning is for notification only, the xtalk pulse and shape
Charles MacNeill 5:89031b2f5316 205 * have still been generated.
Charles MacNeill 5:89031b2f5316 206 */
Charles MacNeill 5:89031b2f5316 207
Charles MacNeill 5:89031b2f5316 208 #define VL53LX_ERROR_NOT_IMPLEMENTED ((VL53LX_Error) - 41)
Charles MacNeill 5:89031b2f5316 209 /*!< Tells requested functionality has not been implemented yet or
Charles MacNeill 5:89031b2f5316 210 * not compatible with the device
Charles MacNeill 5:89031b2f5316 211 */
Charles MacNeill 5:89031b2f5316 212 #define VL53LX_ERROR_PLATFORM_SPECIFIC_START ((VL53LX_Error) - 60)
Charles MacNeill 5:89031b2f5316 213 /*!< Tells the starting code for platform */
Charles MacNeill 5:89031b2f5316 214 /** @} VL53LX_define_Error_group */
Charles MacNeill 5:89031b2f5316 215
Charles MacNeill 5:89031b2f5316 216
Charles MacNeill 5:89031b2f5316 217 #ifdef __cplusplus
Charles MacNeill 5:89031b2f5316 218 }
Charles MacNeill 5:89031b2f5316 219 #endif
Charles MacNeill 5:89031b2f5316 220
Charles MacNeill 5:89031b2f5316 221
Charles MacNeill 5:89031b2f5316 222 #endif /* _VL53LX_ERROR_CODES_H_ */