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_strings.h 65 * @brief VL53L1 function declarations for decoding error codes to a 66 * text strings 67 */ 68 69 70 #ifndef VL53L1_ERROR_STRINGS_H_ 71 #define VL53L1_ERROR_STRINGS_H_ 72 73 #include "vl53l1_error_codes.h" 74 75 #ifdef __cplusplus 76 extern "C" { 77 #endif 78 79 80 /** 81 * @brief Generates an error string for the input PAL error code 82 * 83 * @param[in] PalErrorCode : PAL Error Code 84 * @param[out] pPalErrorString : pointer to character buffer 85 * 86 * @return VL53L1_ERROR_NONE Success 87 * @return "Other error code" See ::VL53L1_Error 88 */ 89 90 VL53L1_Error VL53L1_get_pal_error_string( 91 VL53L1_Error PalErrorCode, 92 char *pPalErrorString); 93 94 95 #ifndef VL53L1_USE_EMPTY_STRING 96 97 /* PAL ERROR strings */ 98 #define VL53L1_STRING_ERROR_NONE \ 99 "No Error" 100 #define VL53L1_STRING_ERROR_CALIBRATION_WARNING \ 101 "Calibration Warning Error" 102 #define VL53L1_STRING_ERROR_MIN_CLIPPED \ 103 "Min clipped error" 104 #define VL53L1_STRING_ERROR_UNDEFINED \ 105 "Undefined error" 106 #define VL53L1_STRING_ERROR_INVALID_PARAMS \ 107 "Invalid parameters error" 108 #define VL53L1_STRING_ERROR_NOT_SUPPORTED \ 109 "Not supported error" 110 #define VL53L1_STRING_ERROR_RANGE_ERROR \ 111 "Range error" 112 #define VL53L1_STRING_ERROR_TIME_OUT \ 113 "Time out error" 114 #define VL53L1_STRING_ERROR_MODE_NOT_SUPPORTED \ 115 "Mode not supported error" 116 #define VL53L1_STRING_ERROR_BUFFER_TOO_SMALL \ 117 "Buffer too small" 118 #define VL53L1_STRING_ERROR_COMMS_BUFFER_TOO_SMALL \ 119 "Comms Buffer too small" 120 #define VL53L1_STRING_ERROR_GPIO_NOT_EXISTING \ 121 "GPIO not existing" 122 #define VL53L1_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \ 123 "GPIO funct not supported" 124 #define VL53L1_STRING_ERROR_CONTROL_INTERFACE \ 125 "Control Interface Error" 126 #define VL53L1_STRING_ERROR_INVALID_COMMAND \ 127 "Invalid Command Error" 128 #define VL53L1_STRING_ERROR_DIVISION_BY_ZERO \ 129 "Division by zero Error" 130 #define VL53L1_STRING_ERROR_REF_SPAD_INIT \ 131 "Reference Spad Init Error" 132 #define VL53L1_STRING_ERROR_GPH_SYNC_CHECK_FAIL \ 133 "GPH Sync Check Fail - API out of sync" 134 #define VL53L1_STRING_ERROR_STREAM_COUNT_CHECK_FAIL \ 135 "Stream Count Check Fail - API out of sync" 136 #define VL53L1_STRING_ERROR_GPH_ID_CHECK_FAIL \ 137 "GPH ID Check Fail - API out of sync" 138 #define VL53L1_STRING_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL \ 139 "Zone Stream Count Check Fail - API out of sync" 140 #define VL53L1_STRING_ERROR_ZONE_GPH_ID_CHECK_FAIL \ 141 "Zone GPH ID Check Fail - API out of sync" 142 143 #define VL53L1_STRING_ERROR_XTALK_EXTRACTION_NO_SAMPLES_FAIL \ 144 "No Xtalk using full array - Xtalk Extract Fail" 145 #define VL53L1_STRING_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL \ 146 "Xtalk does not meet required sigma limit - Xtalk Extract Fail" 147 148 #define VL53L1_STRING_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL \ 149 "Offset Cal - one of more stages with no valid samples - fatal" 150 #define VL53L1_STRING_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL \ 151 "Offset Cal - one of more stages with no SPADS enables - fatal" 152 #define VL53L1_STRING_ERROR_ZONE_CAL_NO_SAMPLE_FAIL \ 153 "Zone Cal - one of more zones with no valid samples - fatal" 154 155 #define VL53L1_STRING_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS \ 156 "Ref SPAD Char - Not Enough Good SPADs" 157 #define VL53L1_STRING_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH \ 158 "Ref SPAD Char - Final Ref Rate too high" 159 #define VL53L1_STRING_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW \ 160 "Ref SPAD Char - Final Ref Rate too low" 161 162 #define VL53L1_STRING_WARNING_OFFSET_CAL_MISSING_SAMPLES \ 163 "Offset Cal - Less than the requested number of valid samples" 164 #define VL53L1_STRING_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH \ 165 "Offset Cal - Sigma estimate value too high - offset not stable" 166 #define VL53L1_STRING_WARNING_OFFSET_CAL_RATE_TOO_HIGH \ 167 "Offset Cal - Rate too high - in pile up" 168 #define VL53L1_STRING_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW \ 169 "Offset Cal - Insufficient SPADs - offset may not be stable" 170 171 #define VL53L1_STRING_WARNING_ZONE_CAL_MISSING_SAMPLES \ 172 "Zone Cal - One or more zone with less than requested valid samples" 173 #define VL53L1_STRING_WARNING_ZONE_CAL_SIGMA_TOO_HIGH \ 174 "Zone Cal - One of more zones the sigma estimate too high" 175 #define VL53L1_STRING_WARNING_ZONE_CAL_RATE_TOO_HIGH \ 176 "Zone Cal - One of more zones with rate too high - in pile up" 177 178 #define VL53L1_STRING_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT \ 179 "Xtalk - Gradient sample num = 0" 180 #define VL53L1_STRING_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT \ 181 "Xtalk - Gradient Sigma > Limit" 182 #define VL53L1_STRING_WARNING_XTALK_MISSING_SAMPLES \ 183 "Xtalk - Some missing and invalid samples" 184 185 #define VL53L1_STRING_ERROR_DEVICE_FIRMWARE_TOO_OLD \ 186 "Device Firmware too old" 187 #define VL53L1_STRING_ERROR_DEVICE_FIRMWARE_TOO_NEW \ 188 "Device Firmware too new" 189 #define VL53L1_STRING_ERROR_UNIT_TEST_FAIL \ 190 "Unit Test Fail" 191 #define VL53L1_STRING_ERROR_FILE_READ_FAIL \ 192 "File Read Fail" 193 #define VL53L1_STRING_ERROR_FILE_WRITE_FAIL \ 194 "File Write Fail" 195 196 #define VL53L1_STRING_ERROR_NOT_IMPLEMENTED \ 197 "Not implemented error" 198 #define VL53L1_STRING_UNKNOW_ERROR_CODE \ 199 "Unknown Error Code" 200 201 #endif /* VL53L1_USE_EMPTY_STRING */ 202 203 204 #ifdef __cplusplus 205 } 206 #endif 207 208 #endif 209 210