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_api_debug.h 65 * 66 * @brief EwokPlus25 low level API function definitions 67 */ 68 69 #ifndef _VL53L1_API_DEBUG_H_ 70 #define _VL53L1_API_DEBUG_H_ 71 72 #include "vl53l1_platform.h" 73 74 #ifdef __cplusplus 75 extern "C" { 76 #endif 77 78 79 80 /* Start Patch_AdditionalDebugData_11823 */ 81 82 /** 83 * @brief Gets the current LL Driver configuration parameters and the last 84 * set of histogram data for debug 85 * 86 * @param[in] Dev : Device Handle 87 * @param[out] pdata : pointer to VL53L1_additional_data_t data structure 88 * 89 * @return VL53L1_ERROR_NONE Success 90 * @return "Other error code" See ::VL53L1_Error 91 */ 92 93 VL53L1_Error VL53L1_get_additional_data( 94 VL53L1_DEV Dev, 95 VL53L1_additional_data_t *pdata); 96 97 /* End Patch_AdditionalDebugData_11823 */ 98 99 100 #ifdef VL53L1_LOG_ENABLE 101 102 /** 103 * @brief Implements an sprintf function for signed fixed point numbers 104 * 105 * @param[in] fp_value : input signed fixed point number 106 * @param[in] frac_bits : number of fixed point fractional bits 107 * @param[in] buf_size : size of supplied text buffer 108 * @param[out] pbuffer : pointer to text buffer 109 * 110 */ 111 112 void VL53L1_signed_fixed_point_sprintf( 113 int32_t fp_value, 114 uint8_t frac_bits, 115 uint16_t buf_size, 116 char *pbuffer); 117 118 119 /** 120 * @brief Convenience function to print out VL53L1_static_nvm_managed_t for debug 121 * 122 * @param[in] pdata : pointer to VL53L1_static_nvm_managed_t 123 * @param[in] pprefix : pointer to name prefix string 124 * @param[in] trace_flags : logging module enable bit flags 125 */ 126 127 void VL53L1_print_static_nvm_managed( 128 VL53L1_static_nvm_managed_t *pdata, 129 char *pprefix, 130 uint32_t trace_flags); 131 132 133 /** 134 * @brief Convenience function to print out VL53L1_customer_nvm_managed_t for debug 135 * 136 * @param[in] pdata : pointer to VL53L1_customer_nvm_managed_t 137 * @param[in] pprefix : pointer to name prefix string 138 * @param[in] trace_flags : logging module enable bit flags 139 */ 140 141 void VL53L1_print_customer_nvm_managed( 142 VL53L1_customer_nvm_managed_t *pdata, 143 char *pprefix, 144 uint32_t trace_flags); 145 146 147 /** 148 * @brief Convenience function to print out VL53L1_nvm_copy_data_t for debug 149 * 150 * @param[in] pdata : pointer to VL53L1_nvm_copy_data_t 151 * @param[in] pprefix : pointer to name prefix string 152 * @param[in] trace_flags : logging module enable bit flags 153 */ 154 155 void VL53L1_print_nvm_copy_data( 156 VL53L1_nvm_copy_data_t *pdata, 157 char *pprefix, 158 uint32_t trace_flags); 159 160 161 /** 162 * @brief Convenience function to print out the contents of 163 * the Range Results structure for debug 164 * 165 * @param[in] pdata : pointer to a VL53L1_range_results_t structure 166 * @param[in] pprefix : pointer to name prefix string 167 * @param[in] trace_flags : logging module enable bit flags 168 */ 169 170 void VL53L1_print_range_results( 171 VL53L1_range_results_t *pdata, 172 char *pprefix, 173 uint32_t trace_flags); 174 175 /** 176 * @brief Convenience function to print out the contents of 177 * the Range Data structure for debug 178 * 179 * @param[in] pdata : pointer to a VL53L1_range_data_t structure 180 * @param[in] pprefix : pointer to name prefix string 181 * @param[in] trace_flags : logging module enable bit flags 182 */ 183 184 void VL53L1_print_range_data( 185 VL53L1_range_data_t *pdata, 186 char *pprefix, 187 uint32_t trace_flags); 188 189 /** 190 * @brief Convenience function to print out the contents of 191 * the offset range results structure for debug 192 * 193 * @param[in] pdata : pointer to a VL53L1_offset_range_results_t structure 194 * @param[in] pprefix : pointer to name prefix string 195 * @param[in] trace_flags : logging module enable bit flags 196 */ 197 198 void VL53L1_print_offset_range_results( 199 VL53L1_offset_range_results_t *pdata, 200 char *pprefix, 201 uint32_t trace_flags); 202 203 /** 204 * @brief Convenience function to print out the contents of 205 * the offset range data structure for debug 206 * 207 * @param[in] pdata : pointer to a VL53L1_offset_range_data_t structure 208 * @param[in] pprefix : pointer to name prefix string 209 * @param[in] trace_flags : logging module enable bit flags 210 */ 211 212 void VL53L1_print_offset_range_data( 213 VL53L1_offset_range_data_t *pdata, 214 char *pprefix, 215 uint32_t trace_flags); 216 217 218 /** 219 * @brief Convenience function to print out the contents of 220 * the peak rate map calibration data structure 221 * 222 * @param[in] pdata : pointer to a VL53L1_cal_peak_rate_map_t structure 223 * @param[in] pprefix : pointer to name prefix string 224 * @param[in] trace_flags : logging module enable bit flags 225 */ 226 227 void VL53L1_print_cal_peak_rate_map( 228 VL53L1_cal_peak_rate_map_t *pdata, 229 char *pprefix, 230 uint32_t trace_flags); 231 232 233 /** 234 * @brief Convenience function to print out the contents of 235 * the additional offset calibration data structure 236 * 237 * @param[in] pdata : pointer to a VL53L1_additional_offset_cal_data_t structure 238 * @param[in] pprefix : pointer to name prefix string 239 * @param[in] trace_flags : logging module enable bit flags 240 */ 241 242 void VL53L1_print_additional_offset_cal_data( 243 VL53L1_additional_offset_cal_data_t *pdata, 244 char *pprefix, 245 uint32_t trace_flags); 246 247 /** 248 * @brief Convenience function to print out the contents of 249 * the additional data structure 250 * 251 * @param[in] pdata : pointer to a VL53L1_additional_data_t structure 252 * @param[in] pprefix : pointer to name prefix string 253 * @param[in] trace_flags : logging module enable bit flags 254 */ 255 256 void VL53L1_print_additional_data( 257 VL53L1_additional_data_t *pdata, 258 char *pprefix, 259 uint32_t trace_flags); 260 261 262 /** 263 * @brief Convenience function to print out the contents of 264 * the LL driver gain calibration data structure 265 * 266 * @param[in] pdata : pointer to a VL53L1_gain_calibration_data_t structure 267 * @param[in] pprefix : pointer to name prefix string 268 * @param[in] trace_flags : logging module enable bit flags 269 */ 270 271 void VL53L1_print_gain_calibration_data( 272 VL53L1_gain_calibration_data_t *pdata, 273 char *pprefix, 274 uint32_t trace_flags); 275 276 277 /** 278 * @brief Convenience function to print out the contents of 279 * the xtalk configuration data for debug 280 * 281 * @param[in] pdata : pointer to a VL53L1_xtalk_config_t Structure 282 * @param[in] pprefix : pointer to name prefix string 283 * @param[in] trace_flags : logging module enable bit flags 284 */ 285 286 void VL53L1_print_xtalk_config( 287 VL53L1_xtalk_config_t *pdata, 288 char *pprefix, 289 uint32_t trace_flags); 290 291 /** 292 * @brief Convenience function to print out the contents of 293 * the Optical Centre structure for debug 294 * 295 * @param[in] pdata : pointer to a VL53L1_optical_centre_t structure 296 * @param[in] pprefix : pointer to name prefix string 297 * @param[in] trace_flags : logging module enable bit flags 298 */ 299 300 void VL53L1_print_optical_centre( 301 VL53L1_optical_centre_t *pdata, 302 char *pprefix, 303 uint32_t trace_flags); 304 305 306 /** 307 * @brief Convenience function to print out the contents of 308 * the User Zone (ROI) structure for debug 309 * 310 * @param[in] pdata : pointer to a VL53L1_user_zone_t structure 311 * @param[in] pprefix : pointer to name prefix string 312 * @param[in] trace_flags : logging module enable bit flags 313 */ 314 315 void VL53L1_print_user_zone( 316 VL53L1_user_zone_t *pdata, 317 char *pprefix, 318 uint32_t trace_flags); 319 320 /** 321 * @brief Convenience function for printing out VL53L1_spad_rate_data_t 322 * 323 * @param[in] pspad_rates : pointer to VL53L1_spad_rate_data_t 324 * @param[in] pprefix : pointer to name prefix string 325 * @param[in] trace_flags : logging module enable bit flags 326 */ 327 328 void VL53L1_print_spad_rate_data( 329 VL53L1_spad_rate_data_t *pspad_rates, 330 char *pprefix, 331 uint32_t trace_flags); 332 333 334 /** 335 * @brief Convenience function for printing out VL53L1_spad_rate_map_t 336 * 337 * @param[in] pspad_rates : pointer to VL53L1_spad_rate_map_t 338 * @param[in] pprefix : pointer to name prefix string 339 * @param[in] trace_flags : logging module enable bit flags 340 */ 341 342 void VL53L1_print_spad_rate_map( 343 VL53L1_spad_rate_data_t *pspad_rates, 344 char *pprefix, 345 uint32_t trace_flags); 346 347 348 #endif /* VL53L1_LOG_ENABLE */ 349 350 #ifdef __cplusplus 351 } 352 #endif 353 354 #endif /* _VL53L1_API_DEBUG_H_ */ 355