The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2
Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.
inc/vl53l1_platform_log.h@18:0696efe39d08, 2021-07-21 (annotated)
- Committer:
- lugandc
- Date:
- Wed Jul 21 17:06:38 2021 +0200
- Revision:
- 18:0696efe39d08
- Parent:
- 0:3ac96e360672
Cleanup i2c functions, removed all bad references to L1X
Cleanup VL53L1CB class:
- i2c device object is passed in a consistent way in MyDevice structure
- removed useless functions
Updated VL53L1CB component driver with bare driver release 6.6.7 content
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
charlesmn | 0:3ac96e360672 | 1 | |
lugandc | 18:0696efe39d08 | 2 | /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ |
lugandc | 18:0696efe39d08 | 3 | /****************************************************************************** |
lugandc | 18:0696efe39d08 | 4 | * Copyright (c) 2020, STMicroelectronics - All Rights Reserved |
charlesmn | 0:3ac96e360672 | 5 | |
lugandc | 18:0696efe39d08 | 6 | This file is part of VL53L1 and is dual licensed, |
lugandc | 18:0696efe39d08 | 7 | either GPL-2.0+ |
lugandc | 18:0696efe39d08 | 8 | or 'BSD 3-clause "New" or "Revised" License' , at your option. |
lugandc | 18:0696efe39d08 | 9 | ****************************************************************************** |
lugandc | 18:0696efe39d08 | 10 | */ |
charlesmn | 0:3ac96e360672 | 11 | |
charlesmn | 0:3ac96e360672 | 12 | |
charlesmn | 0:3ac96e360672 | 13 | |
charlesmn | 0:3ac96e360672 | 14 | |
charlesmn | 0:3ac96e360672 | 15 | |
charlesmn | 0:3ac96e360672 | 16 | |
charlesmn | 0:3ac96e360672 | 17 | |
charlesmn | 0:3ac96e360672 | 18 | #ifndef _VL53L1_PLATFORM_LOG_H_ |
charlesmn | 0:3ac96e360672 | 19 | #define _VL53L1_PLATFORM_LOG_H_ |
charlesmn | 0:3ac96e360672 | 20 | |
charlesmn | 0:3ac96e360672 | 21 | |
charlesmn | 0:3ac96e360672 | 22 | #ifdef VL53L1_LOG_ENABLE |
charlesmn | 0:3ac96e360672 | 23 | #include "vl53l1_platform_user_config.h" |
charlesmn | 0:3ac96e360672 | 24 | |
charlesmn | 0:3ac96e360672 | 25 | #ifdef _MSC_VER |
charlesmn | 0:3ac96e360672 | 26 | # define EWOKPLUS_EXPORTS __declspec(dllexport) |
charlesmn | 0:3ac96e360672 | 27 | #else |
charlesmn | 0:3ac96e360672 | 28 | # define EWOKPLUS_EXPORTS |
charlesmn | 0:3ac96e360672 | 29 | #endif |
charlesmn | 0:3ac96e360672 | 30 | |
charlesmn | 0:3ac96e360672 | 31 | #include "vl53l1_types.h" |
charlesmn | 0:3ac96e360672 | 32 | |
charlesmn | 0:3ac96e360672 | 33 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 34 | extern "C" { |
charlesmn | 0:3ac96e360672 | 35 | #endif |
charlesmn | 0:3ac96e360672 | 36 | |
charlesmn | 0:3ac96e360672 | 37 | #include <time.h> |
charlesmn | 0:3ac96e360672 | 38 | |
charlesmn | 0:3ac96e360672 | 39 | |
charlesmn | 0:3ac96e360672 | 40 | |
charlesmn | 0:3ac96e360672 | 41 | #define VL53L1_TRACE_LEVEL_NONE 0x00000000 |
charlesmn | 0:3ac96e360672 | 42 | #define VL53L1_TRACE_LEVEL_ERRORS 0x00000001 |
charlesmn | 0:3ac96e360672 | 43 | #define VL53L1_TRACE_LEVEL_WARNING 0x00000002 |
charlesmn | 0:3ac96e360672 | 44 | #define VL53L1_TRACE_LEVEL_INFO 0x00000004 |
charlesmn | 0:3ac96e360672 | 45 | #define VL53L1_TRACE_LEVEL_DEBUG 0x00000008 |
charlesmn | 0:3ac96e360672 | 46 | #define VL53L1_TRACE_LEVEL_ALL 0x00000010 |
charlesmn | 0:3ac96e360672 | 47 | #define VL53L1_TRACE_LEVEL_IGNORE 0x00000020 |
charlesmn | 0:3ac96e360672 | 48 | |
charlesmn | 0:3ac96e360672 | 49 | #define VL53L1_TRACE_FUNCTION_NONE 0x00000000 |
charlesmn | 0:3ac96e360672 | 50 | #define VL53L1_TRACE_FUNCTION_I2C 0x00000001 |
charlesmn | 0:3ac96e360672 | 51 | #define VL53L1_TRACE_FUNCTION_ALL 0x7fffffff |
charlesmn | 0:3ac96e360672 | 52 | |
charlesmn | 0:3ac96e360672 | 53 | #define VL53L1_TRACE_MODULE_NONE 0x00000000 |
charlesmn | 0:3ac96e360672 | 54 | #define VL53L1_TRACE_MODULE_API 0x00000001 |
charlesmn | 0:3ac96e360672 | 55 | #define VL53L1_TRACE_MODULE_CORE 0x00000002 |
charlesmn | 0:3ac96e360672 | 56 | #define VL53L1_TRACE_MODULE_PROTECTED 0x00000004 |
charlesmn | 0:3ac96e360672 | 57 | #define VL53L1_TRACE_MODULE_HISTOGRAM 0x00000008 |
charlesmn | 0:3ac96e360672 | 58 | #define VL53L1_TRACE_MODULE_REGISTERS 0x00000010 |
charlesmn | 0:3ac96e360672 | 59 | #define VL53L1_TRACE_MODULE_PLATFORM 0x00000020 |
charlesmn | 0:3ac96e360672 | 60 | #define VL53L1_TRACE_MODULE_NVM 0x00000040 |
charlesmn | 0:3ac96e360672 | 61 | #define VL53L1_TRACE_MODULE_CALIBRATION_DATA 0x00000080 |
charlesmn | 0:3ac96e360672 | 62 | #define VL53L1_TRACE_MODULE_NVM_DATA 0x00000100 |
charlesmn | 0:3ac96e360672 | 63 | #define VL53L1_TRACE_MODULE_HISTOGRAM_DATA 0x00000200 |
charlesmn | 0:3ac96e360672 | 64 | #define VL53L1_TRACE_MODULE_RANGE_RESULTS_DATA 0x00000400 |
charlesmn | 0:3ac96e360672 | 65 | #define VL53L1_TRACE_MODULE_XTALK_DATA 0x00000800 |
charlesmn | 0:3ac96e360672 | 66 | #define VL53L1_TRACE_MODULE_OFFSET_DATA 0x00001000 |
charlesmn | 0:3ac96e360672 | 67 | #define VL53L1_TRACE_MODULE_DATA_INIT 0x00002000 |
charlesmn | 0:3ac96e360672 | 68 | #define VL53L1_TRACE_MODULE_REF_SPAD_CHAR 0x00004000 |
charlesmn | 0:3ac96e360672 | 69 | #define VL53L1_TRACE_MODULE_SPAD_RATE_MAP 0x00008000 |
charlesmn | 0:3ac96e360672 | 70 | #ifdef PAL_EXTENDED |
charlesmn | 0:3ac96e360672 | 71 | #define VL53L1_TRACE_MODULE_SPAD 0x01000000 |
charlesmn | 0:3ac96e360672 | 72 | #define VL53L1_TRACE_MODULE_FMT 0x02000000 |
charlesmn | 0:3ac96e360672 | 73 | #define VL53L1_TRACE_MODULE_UTILS 0x04000000 |
charlesmn | 0:3ac96e360672 | 74 | #define VL53L1_TRACE_MODULE_BENCH_FUNCS 0x08000000 |
charlesmn | 0:3ac96e360672 | 75 | #endif |
charlesmn | 0:3ac96e360672 | 76 | #define VL53L1_TRACE_MODULE_CUSTOMER_API 0x40000000 |
charlesmn | 0:3ac96e360672 | 77 | #define VL53L1_TRACE_MODULE_ALL 0x7fffffff |
charlesmn | 0:3ac96e360672 | 78 | |
charlesmn | 0:3ac96e360672 | 79 | |
charlesmn | 0:3ac96e360672 | 80 | extern uint32_t _trace_level; |
charlesmn | 0:3ac96e360672 | 81 | |
charlesmn | 0:3ac96e360672 | 82 | |
charlesmn | 0:3ac96e360672 | 83 | EWOKPLUS_EXPORTS int8_t VL53L1_trace_config( |
charlesmn | 0:3ac96e360672 | 84 | char *filename, |
charlesmn | 0:3ac96e360672 | 85 | uint32_t modules, |
charlesmn | 0:3ac96e360672 | 86 | uint32_t level, |
charlesmn | 0:3ac96e360672 | 87 | uint32_t functions); |
charlesmn | 0:3ac96e360672 | 88 | |
charlesmn | 0:3ac96e360672 | 89 | |
charlesmn | 0:3ac96e360672 | 90 | |
charlesmn | 0:3ac96e360672 | 91 | EWOKPLUS_EXPORTS void VL53L1_trace_print_module_function( |
charlesmn | 0:3ac96e360672 | 92 | uint32_t module, |
charlesmn | 0:3ac96e360672 | 93 | uint32_t level, |
charlesmn | 0:3ac96e360672 | 94 | uint32_t function, |
charlesmn | 0:3ac96e360672 | 95 | const char *format, ...); |
charlesmn | 0:3ac96e360672 | 96 | |
charlesmn | 0:3ac96e360672 | 97 | |
charlesmn | 0:3ac96e360672 | 98 | |
charlesmn | 0:3ac96e360672 | 99 | uint32_t VL53L1_get_trace_functions(void); |
charlesmn | 0:3ac96e360672 | 100 | |
charlesmn | 0:3ac96e360672 | 101 | |
charlesmn | 0:3ac96e360672 | 102 | |
charlesmn | 0:3ac96e360672 | 103 | void VL53L1_set_trace_functions(uint32_t function); |
charlesmn | 0:3ac96e360672 | 104 | |
charlesmn | 0:3ac96e360672 | 105 | |
charlesmn | 0:3ac96e360672 | 106 | |
charlesmn | 0:3ac96e360672 | 107 | |
charlesmn | 0:3ac96e360672 | 108 | uint32_t VL53L1_clock(void); |
charlesmn | 0:3ac96e360672 | 109 | |
charlesmn | 0:3ac96e360672 | 110 | #define LOG_GET_TIME() \ |
charlesmn | 0:3ac96e360672 | 111 | ((int)VL53L1_clock()) |
charlesmn | 0:3ac96e360672 | 112 | |
charlesmn | 0:3ac96e360672 | 113 | #define _LOG_TRACE_PRINT(module, level, function, ...) \ |
charlesmn | 0:3ac96e360672 | 114 | VL53L1_trace_print_module_function(module, level, function, ##__VA_ARGS__); |
charlesmn | 0:3ac96e360672 | 115 | |
charlesmn | 0:3ac96e360672 | 116 | #define _LOG_FUNCTION_START(module, fmt, ...) \ |
charlesmn | 0:3ac96e360672 | 117 | VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <START> %s "fmt"\n", LOG_GET_TIME(), __FUNCTION__, ##__VA_ARGS__); |
charlesmn | 0:3ac96e360672 | 118 | |
charlesmn | 0:3ac96e360672 | 119 | #define _LOG_FUNCTION_END(module, status, ...)\ |
charlesmn | 0:3ac96e360672 | 120 | VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <END> %s %d\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__) |
charlesmn | 0:3ac96e360672 | 121 | |
charlesmn | 0:3ac96e360672 | 122 | #define _LOG_FUNCTION_END_FMT(module, status, fmt, ...)\ |
charlesmn | 0:3ac96e360672 | 123 | VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL, "%6ld <END> %s %d "fmt"\n", LOG_GET_TIME(), __FUNCTION__, (int)status, ##__VA_ARGS__) |
charlesmn | 0:3ac96e360672 | 124 | |
charlesmn | 0:3ac96e360672 | 125 | #define _LOG_GET_TRACE_FUNCTIONS()\ |
charlesmn | 0:3ac96e360672 | 126 | VL53L1_get_trace_functions() |
charlesmn | 0:3ac96e360672 | 127 | |
charlesmn | 0:3ac96e360672 | 128 | #define _LOG_SET_TRACE_FUNCTIONS(functions)\ |
charlesmn | 0:3ac96e360672 | 129 | VL53L1_set_trace_functions(functions) |
charlesmn | 0:3ac96e360672 | 130 | |
charlesmn | 0:3ac96e360672 | 131 | #define _LOG_STRING_BUFFER(x) char x[VL53L1_MAX_STRING_LENGTH] |
charlesmn | 0:3ac96e360672 | 132 | |
charlesmn | 0:3ac96e360672 | 133 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 134 | } |
charlesmn | 0:3ac96e360672 | 135 | #endif |
charlesmn | 0:3ac96e360672 | 136 | |
charlesmn | 0:3ac96e360672 | 137 | #else |
charlesmn | 0:3ac96e360672 | 138 | |
charlesmn | 0:3ac96e360672 | 139 | #define _LOG_TRACE_PRINT(module, level, function, ...) |
charlesmn | 0:3ac96e360672 | 140 | #define _LOG_FUNCTION_START(module, fmt, ...) |
charlesmn | 0:3ac96e360672 | 141 | #define _LOG_FUNCTION_END(module, status, ...) |
charlesmn | 0:3ac96e360672 | 142 | #define _LOG_FUNCTION_END_FMT(module, status, fmt, ...) |
charlesmn | 0:3ac96e360672 | 143 | #define _LOG_GET_TRACE_FUNCTIONS() 0 |
charlesmn | 0:3ac96e360672 | 144 | #define _LOG_SET_TRACE_FUNCTIONS(functions) |
charlesmn | 0:3ac96e360672 | 145 | #define _LOG_STRING_BUFFER(x) |
charlesmn | 0:3ac96e360672 | 146 | |
charlesmn | 0:3ac96e360672 | 147 | #endif |
charlesmn | 0:3ac96e360672 | 148 | |
charlesmn | 0:3ac96e360672 | 149 | #endif |
charlesmn | 0:3ac96e360672 | 150 |