Fork, renaming of VL53L1CB-2

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_53L1CB

Committer:
Charles MacNeill
Date:
Fri Jun 11 17:08:27 2021 +0100
Revision:
13:3f1b341901dd
Parent:
7:1add29d51e72
changing case of vl53l1cb.* so it works in linux

Who changed what in which revision?

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