Condensed Version of Public VL53L0X
VL53L0X_def.h@12:aa177f0e4c10, 2019-04-10 (annotated)
- Committer:
- sepp_nepp
- Date:
- Wed Apr 10 19:03:16 2019 +0000
- Revision:
- 12:aa177f0e4c10
- Parent:
- 11:c6f95a42d4d7
Troy a gain
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikapov | 0:a1a69d32f310 | 1 | /******************************************************************************* |
nikapov | 0:a1a69d32f310 | 2 | Copyright © 2016, STMicroelectronics International N.V. |
nikapov | 0:a1a69d32f310 | 3 | All rights reserved. |
nikapov | 0:a1a69d32f310 | 4 | |
nikapov | 0:a1a69d32f310 | 5 | Redistribution and use in source and binary forms, with or without |
nikapov | 0:a1a69d32f310 | 6 | modification, are permitted provided that the following conditions are met: |
nikapov | 0:a1a69d32f310 | 7 | * Redistributions of source code must retain the above copyright |
nikapov | 0:a1a69d32f310 | 8 | notice, this list of conditions and the following disclaimer. |
nikapov | 0:a1a69d32f310 | 9 | * Redistributions in binary form must reproduce the above copyright |
nikapov | 0:a1a69d32f310 | 10 | notice, this list of conditions and the following disclaimer in the |
nikapov | 0:a1a69d32f310 | 11 | documentation and/or other materials provided with the distribution. |
nikapov | 0:a1a69d32f310 | 12 | * Neither the name of STMicroelectronics nor the |
nikapov | 0:a1a69d32f310 | 13 | names of its contributors may be used to endorse or promote products |
nikapov | 0:a1a69d32f310 | 14 | derived from this software without specific prior written permission. |
nikapov | 0:a1a69d32f310 | 15 | |
nikapov | 0:a1a69d32f310 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
nikapov | 0:a1a69d32f310 | 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
nikapov | 0:a1a69d32f310 | 18 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND |
nikapov | 0:a1a69d32f310 | 19 | NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. |
nikapov | 0:a1a69d32f310 | 20 | IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY |
nikapov | 0:a1a69d32f310 | 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
nikapov | 0:a1a69d32f310 | 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
nikapov | 0:a1a69d32f310 | 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
nikapov | 0:a1a69d32f310 | 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
nikapov | 0:a1a69d32f310 | 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
nikapov | 0:a1a69d32f310 | 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
nikapov | 0:a1a69d32f310 | 27 | *******************************************************************************/ |
nikapov | 0:a1a69d32f310 | 28 | |
nikapov | 0:a1a69d32f310 | 29 | /** |
nikapov | 0:a1a69d32f310 | 30 | * @file VL53L0X_def.h |
nikapov | 0:a1a69d32f310 | 31 | * |
nikapov | 0:a1a69d32f310 | 32 | * @brief Type definitions for VL53L0X API. |
nikapov | 0:a1a69d32f310 | 33 | * |
nikapov | 0:a1a69d32f310 | 34 | */ |
nikapov | 0:a1a69d32f310 | 35 | |
nikapov | 0:a1a69d32f310 | 36 | |
nikapov | 0:a1a69d32f310 | 37 | #ifndef _VL53L0X_DEF_H_ |
nikapov | 0:a1a69d32f310 | 38 | #define _VL53L0X_DEF_H_ |
nikapov | 0:a1a69d32f310 | 39 | |
nikapov | 0:a1a69d32f310 | 40 | |
nikapov | 0:a1a69d32f310 | 41 | #ifdef __cplusplus |
nikapov | 0:a1a69d32f310 | 42 | extern "C" { |
nikapov | 0:a1a69d32f310 | 43 | #endif |
nikapov | 0:a1a69d32f310 | 44 | |
nikapov | 0:a1a69d32f310 | 45 | /** @defgroup VL53L0X_globaldefine_group VL53L0X Defines |
nikapov | 0:a1a69d32f310 | 46 | * @brief VL53L0X Defines |
nikapov | 0:a1a69d32f310 | 47 | * @{ |
nikapov | 0:a1a69d32f310 | 48 | */ |
nikapov | 0:a1a69d32f310 | 49 | |
sepp_nepp | 5:b95f6951f7d5 | 50 | /****************** define for i2c configuration *******************************/ |
sepp_nepp | 5:b95f6951f7d5 | 51 | /** Maximum buffer size to be used in i2c */ |
sepp_nepp | 5:b95f6951f7d5 | 52 | #define VL53L0X_MAX_I2C_XFER_SIZE 64 /* Maximum buffer size to be used in i2c */ |
sepp_nepp | 5:b95f6951f7d5 | 53 | #define VL53L0X_I2C_USER_VAR /* none but could be for a flag var to get/pass to mutex interruptible return flags and try again */ |
sepp_nepp | 5:b95f6951f7d5 | 54 | |
nikapov | 0:a1a69d32f310 | 55 | |
sepp_nepp | 11:c6f95a42d4d7 | 56 | /** Device SPECIFICATION major version */ |
nikapov | 0:a1a69d32f310 | 57 | #define VL53L0X10_SPECIFICATION_VER_MAJOR 1 |
sepp_nepp | 11:c6f95a42d4d7 | 58 | /** Device SPECIFICATION minor version */ |
nikapov | 0:a1a69d32f310 | 59 | #define VL53L0X10_SPECIFICATION_VER_MINOR 2 |
sepp_nepp | 11:c6f95a42d4d7 | 60 | /** Device SPECIFICATION sub version */ |
nikapov | 0:a1a69d32f310 | 61 | #define VL53L0X10_SPECIFICATION_VER_SUB 7 |
sepp_nepp | 11:c6f95a42d4d7 | 62 | /** Device SPECIFICATION sub version */ |
nikapov | 0:a1a69d32f310 | 63 | #define VL53L0X10_SPECIFICATION_VER_REVISION 1440 |
nikapov | 0:a1a69d32f310 | 64 | |
sepp_nepp | 11:c6f95a42d4d7 | 65 | /** VL53L0X Device IMPLEMENTATION major version */ |
nikapov | 0:a1a69d32f310 | 66 | #define VL53L0X10_IMPLEMENTATION_VER_MAJOR 1 |
sepp_nepp | 11:c6f95a42d4d7 | 67 | /** VL53L0X Device IMPLEMENTATION minor version */ |
nikapov | 0:a1a69d32f310 | 68 | #define VL53L0X10_IMPLEMENTATION_VER_MINOR 0 |
sepp_nepp | 11:c6f95a42d4d7 | 69 | /** VL53L0X Device IMPLEMENTATION sub version */ |
nikapov | 0:a1a69d32f310 | 70 | #define VL53L0X10_IMPLEMENTATION_VER_SUB 9 |
sepp_nepp | 11:c6f95a42d4d7 | 71 | /** VL53L0X Device IMPLEMENTATION sub version */ |
nikapov | 0:a1a69d32f310 | 72 | #define VL53L0X10_IMPLEMENTATION_VER_REVISION 3673 |
nikapov | 0:a1a69d32f310 | 73 | |
sepp_nepp | 11:c6f95a42d4d7 | 74 | /** Device SPECIFICATION major version */ |
nikapov | 0:a1a69d32f310 | 75 | #define VL53L0X_SPECIFICATION_VER_MAJOR 1 |
sepp_nepp | 11:c6f95a42d4d7 | 76 | /** Device SPECIFICATION minor version */ |
nikapov | 0:a1a69d32f310 | 77 | #define VL53L0X_SPECIFICATION_VER_MINOR 2 |
sepp_nepp | 11:c6f95a42d4d7 | 78 | /** Device SPECIFICATION sub version */ |
nikapov | 0:a1a69d32f310 | 79 | #define VL53L0X_SPECIFICATION_VER_SUB 7 |
sepp_nepp | 11:c6f95a42d4d7 | 80 | /** Device SPECIFICATION sub version */ |
nikapov | 0:a1a69d32f310 | 81 | #define VL53L0X_SPECIFICATION_VER_REVISION 1440 |
nikapov | 0:a1a69d32f310 | 82 | |
sepp_nepp | 11:c6f95a42d4d7 | 83 | /** VL53L0X Device IMPLEMENTATION major version */ |
nikapov | 0:a1a69d32f310 | 84 | #define VL53L0X_IMPLEMENTATION_VER_MAJOR 1 |
sepp_nepp | 11:c6f95a42d4d7 | 85 | /** VL53L0X Device IMPLEMENTATION minor version */ |
nikapov | 0:a1a69d32f310 | 86 | #define VL53L0X_IMPLEMENTATION_VER_MINOR 1 |
sepp_nepp | 11:c6f95a42d4d7 | 87 | /** VL53L0X Device IMPLEMENTATION sub version */ |
nikapov | 0:a1a69d32f310 | 88 | #define VL53L0X_IMPLEMENTATION_VER_SUB 21 |
sepp_nepp | 11:c6f95a42d4d7 | 89 | /** VL53L0X Device IMPLEMENTATION sub version */ |
nikapov | 0:a1a69d32f310 | 90 | #define VL53L0X_IMPLEMENTATION_VER_REVISION 4823 |
sepp_nepp | 5:b95f6951f7d5 | 91 | |
sepp_nepp | 5:b95f6951f7d5 | 92 | |
nikapov | 0:a1a69d32f310 | 93 | #define VL53L0X_DEFAULT_MAX_LOOP 2000 |
nikapov | 0:a1a69d32f310 | 94 | #define VL53L0X_MAX_STRING_LENGTH 32 |
nikapov | 0:a1a69d32f310 | 95 | |
sepp_nepp | 11:c6f95a42d4d7 | 96 | /** The device model ID */ |
sepp_nepp | 11:c6f95a42d4d7 | 97 | #define IDENTIFICATION_MODEL_ID 0x000 |
sepp_nepp | 11:c6f95a42d4d7 | 98 | #define STATUS_OK 0x00 |
sepp_nepp | 11:c6f95a42d4d7 | 99 | #define STATUS_FAIL 0x01 |
sepp_nepp | 11:c6f95a42d4d7 | 100 | |
sepp_nepp | 11:c6f95a42d4d7 | 101 | /** default device address */ |
sepp_nepp | 11:c6f95a42d4d7 | 102 | #define VL53L0X_DEFAULT_ADDRESS 0x52 /* (8-bit) */ |
sepp_nepp | 11:c6f95a42d4d7 | 103 | |
sepp_nepp | 11:c6f95a42d4d7 | 104 | #define VL53L0X_STRING_DEVICE_INFO_NAME_TS0 "VL53L0X TS0" |
sepp_nepp | 11:c6f95a42d4d7 | 105 | #define VL53L0X_STRING_DEVICE_INFO_NAME_TS1 "VL53L0X TS1" |
sepp_nepp | 11:c6f95a42d4d7 | 106 | #define VL53L0X_STRING_DEVICE_INFO_NAME_TS2 "VL53L0X TS2" |
sepp_nepp | 11:c6f95a42d4d7 | 107 | #define VL53L0X_STRING_DEVICE_INFO_NAME_ES1 "VL53L0X ES1 or later" |
sepp_nepp | 11:c6f95a42d4d7 | 108 | #define VL53L0X_STRING_DEVICE_INFO_TYPE "VL53L0X" |
sepp_nepp | 11:c6f95a42d4d7 | 109 | |
sepp_nepp | 11:c6f95a42d4d7 | 110 | #define REF_ARRAY_SPAD_0 0 |
sepp_nepp | 11:c6f95a42d4d7 | 111 | #define REF_ARRAY_SPAD_5 5 |
sepp_nepp | 11:c6f95a42d4d7 | 112 | #define REF_ARRAY_SPAD_10 10 |
sepp_nepp | 11:c6f95a42d4d7 | 113 | |
sepp_nepp | 11:c6f95a42d4d7 | 114 | |
sepp_nepp | 11:c6f95a42d4d7 | 115 | /* sensor operating modes */ |
sepp_nepp | 11:c6f95a42d4d7 | 116 | typedef enum { |
sepp_nepp | 11:c6f95a42d4d7 | 117 | op_single_shot_poll = 1, |
sepp_nepp | 11:c6f95a42d4d7 | 118 | op_poll, // was range_continuous_polling |
sepp_nepp | 11:c6f95a42d4d7 | 119 | op_INT, |
sepp_nepp | 11:c6f95a42d4d7 | 120 | op_poll_low_threshold, |
sepp_nepp | 11:c6f95a42d4d7 | 121 | op_poll_high_threshold, |
sepp_nepp | 11:c6f95a42d4d7 | 122 | op_poll_out_of_window, |
sepp_nepp | 11:c6f95a42d4d7 | 123 | op_INT_low_threshold, |
sepp_nepp | 11:c6f95a42d4d7 | 124 | op_INT_high_threshold, |
sepp_nepp | 11:c6f95a42d4d7 | 125 | op_INT_out_of_window, |
sepp_nepp | 11:c6f95a42d4d7 | 126 | } TOperatingMode; |
nikapov | 0:a1a69d32f310 | 127 | |
sepp_nepp | 7:41cbc431e1f4 | 128 | /** |
sepp_nepp | 7:41cbc431e1f4 | 129 | * Device specific defines. To be adapted by implementer for the targeted |
sepp_nepp | 7:41cbc431e1f4 | 130 | * device. |
sepp_nepp | 7:41cbc431e1f4 | 131 | */ |
sepp_nepp | 7:41cbc431e1f4 | 132 | |
sepp_nepp | 7:41cbc431e1f4 | 133 | /** use where fractional values are expected |
sepp_nepp | 7:41cbc431e1f4 | 134 | * |
sepp_nepp | 11:c6f95a42d4d7 | 135 | * Given a floating point value f it's 16.16 bit point is (int)(f*(1<<16))*/ |
sepp_nepp | 11:c6f95a42d4d7 | 136 | typedef uint32_t TFP1616; |
sepp_nepp | 7:41cbc431e1f4 | 137 | |
sepp_nepp | 7:41cbc431e1f4 | 138 | /** @defgroup VL53L0X_DevSpecDefines_group VL53L0X cut1.1 Device Specific Defines |
sepp_nepp | 7:41cbc431e1f4 | 139 | * @brief VL53L0X cut1.1 Device Specific Defines |
sepp_nepp | 7:41cbc431e1f4 | 140 | * @{ |
sepp_nepp | 7:41cbc431e1f4 | 141 | */ |
sepp_nepp | 7:41cbc431e1f4 | 142 | |
sepp_nepp | 7:41cbc431e1f4 | 143 | /** @defgroup VL53L0X_DeviceError_group Device Error |
sepp_nepp | 7:41cbc431e1f4 | 144 | * @brief Device Error code |
sepp_nepp | 7:41cbc431e1f4 | 145 | * |
sepp_nepp | 7:41cbc431e1f4 | 146 | * This enum is Device specific it should be updated in the implementation |
sepp_nepp | 7:41cbc431e1f4 | 147 | * Use @a VL53L0X_GetStatusErrorString() to get the string. |
sepp_nepp | 7:41cbc431e1f4 | 148 | * It is related to Status Register of the Device. |
sepp_nepp | 7:41cbc431e1f4 | 149 | * @{ |
sepp_nepp | 7:41cbc431e1f4 | 150 | */ |
sepp_nepp | 11:c6f95a42d4d7 | 151 | typedef uint8_t TDevError; |
sepp_nepp | 7:41cbc431e1f4 | 152 | |
sepp_nepp | 11:c6f95a42d4d7 | 153 | #define VL53L0X_DEVICEERROR_NONE ((TDevError) 0) |
sepp_nepp | 7:41cbc431e1f4 | 154 | /*!< 0 NoError */ |
sepp_nepp | 11:c6f95a42d4d7 | 155 | #define VL53L0X_DEVICEERROR_VCSELCONTINUITYTESTFAILURE ((TDevError) 1) |
sepp_nepp | 11:c6f95a42d4d7 | 156 | #define VL53L0X_DEVICEERROR_VCSELWATCHDOGTESTFAILURE ((TDevError) 2) |
sepp_nepp | 11:c6f95a42d4d7 | 157 | #define VL53L0X_DEVICEERROR_NOVHVVALUEFOUND ((TDevError) 3) |
sepp_nepp | 11:c6f95a42d4d7 | 158 | #define VL53L0X_DEVICEERROR_MSRCNOTARGET ((TDevError) 4) |
sepp_nepp | 11:c6f95a42d4d7 | 159 | #define VL53L0X_DEVICEERROR_SNRCHECK ((TDevError) 5) |
sepp_nepp | 11:c6f95a42d4d7 | 160 | #define VL53L0X_DEVICEERROR_RANGEPHASECHECK ((TDevError) 6) |
sepp_nepp | 11:c6f95a42d4d7 | 161 | #define VL53L0X_DEVICEERROR_SIGMATHRESHOLDCHECK ((TDevError) 7) |
sepp_nepp | 11:c6f95a42d4d7 | 162 | #define VL53L0X_DEVICEERROR_TCC ((TDevError) 8) |
sepp_nepp | 11:c6f95a42d4d7 | 163 | #define VL53L0X_DEVICEERROR_MINCLIP ((TDevError) 10) |
sepp_nepp | 11:c6f95a42d4d7 | 164 | #define VL53L0X_DEVICEERROR_RANGECOMPLETE ((TDevError) 11) |
sepp_nepp | 11:c6f95a42d4d7 | 165 | #define VL53L0X_DEVICEERROR_ALGOUNDERFLOW ((TDevError) 12) |
sepp_nepp | 11:c6f95a42d4d7 | 166 | #define VL53L0X_DEVICEERROR_ALGOOVERFLOW ((TDevError) 13) |
sepp_nepp | 11:c6f95a42d4d7 | 167 | #define VL53L0X_DEVICEERROR_RANGEIGNORETHRESHOLD ((TDevError) 14) |
sepp_nepp | 7:41cbc431e1f4 | 168 | |
sepp_nepp | 7:41cbc431e1f4 | 169 | /** @} end of VL53L0X_DeviceError_group */ |
sepp_nepp | 7:41cbc431e1f4 | 170 | |
sepp_nepp | 7:41cbc431e1f4 | 171 | |
sepp_nepp | 11:c6f95a42d4d7 | 172 | /** @defgroup VL53L0X_CHECKEN_group Check Enable list |
sepp_nepp | 7:41cbc431e1f4 | 173 | * @brief Check Enable code |
sepp_nepp | 7:41cbc431e1f4 | 174 | * |
sepp_nepp | 7:41cbc431e1f4 | 175 | * Define used to specify the LimitCheckId. |
sepp_nepp | 7:41cbc431e1f4 | 176 | * Use @a VL53L0X_GetLimitCheckInfo() to get the string. |
sepp_nepp | 7:41cbc431e1f4 | 177 | * @{ |
sepp_nepp | 7:41cbc431e1f4 | 178 | */ |
sepp_nepp | 11:c6f95a42d4d7 | 179 | #define VL53L0X_CHECKEN_SIGMA_FINAL_RANGE 0 |
sepp_nepp | 11:c6f95a42d4d7 | 180 | #define VL53L0X_CHECKEN_SIG_RATE_FINAL_RANGE 1 |
sepp_nepp | 11:c6f95a42d4d7 | 181 | #define VL53L0X_CHECKEN_SIG_REF_CLIP 2 |
sepp_nepp | 11:c6f95a42d4d7 | 182 | #define VL53L0X_CHECKEN_RANGE_IGNORE_THRESHOLD 3 |
sepp_nepp | 11:c6f95a42d4d7 | 183 | #define VL53L0X_CHECKEN_SIG_RATE_MSRC 4 |
sepp_nepp | 11:c6f95a42d4d7 | 184 | #define VL53L0X_CHECKEN_SIG_RATE_PRE_RANGE 5 |
sepp_nepp | 11:c6f95a42d4d7 | 185 | #define VL53L0X_CHECKEN_NUMBER_OF_CHECKS 6 |
sepp_nepp | 11:c6f95a42d4d7 | 186 | /** @} end of VL53L0X_CHECKEN_group */ |
sepp_nepp | 7:41cbc431e1f4 | 187 | |
sepp_nepp | 7:41cbc431e1f4 | 188 | |
sepp_nepp | 11:c6f95a42d4d7 | 189 | /** @defgroup GPIO_Func_group Gpio Functionality |
sepp_nepp | 7:41cbc431e1f4 | 190 | * @brief Defines the different functionalities for the device GPIO(s) |
sepp_nepp | 11:c6f95a42d4d7 | 191 | * @{ */ |
sepp_nepp | 11:c6f95a42d4d7 | 192 | typedef enum { |
sepp_nepp | 11:c6f95a42d4d7 | 193 | GPIO_FUNC_OFF = 0, /*!< NO Interrupt */ |
sepp_nepp | 11:c6f95a42d4d7 | 194 | GPIO_FUNC_THRESHOLD_CROSSED_LOW, /*!< Level Low (value < thresh_low) */ |
sepp_nepp | 11:c6f95a42d4d7 | 195 | GPIO_FUNC_THRESHOLD_CROSSED_HIGH, /*!< Level High (value > thresh_high) */ |
sepp_nepp | 11:c6f95a42d4d7 | 196 | GPIO_FUNC_THRESHOLD_CROSSED_OUT, /*!< Out Of Window (value < thresh_low OR value > thresh_high) */ |
sepp_nepp | 11:c6f95a42d4d7 | 197 | GPIO_FUNC_NEW_MEASURE_READY /*!< New Sample Ready */ |
sepp_nepp | 11:c6f95a42d4d7 | 198 | } TGPIO_Func; |
sepp_nepp | 11:c6f95a42d4d7 | 199 | /** @} end of GPIO_FUNC_group */ |
sepp_nepp | 7:41cbc431e1f4 | 200 | |
sepp_nepp | 7:41cbc431e1f4 | 201 | |
sepp_nepp | 7:41cbc431e1f4 | 202 | /* Device register map */ |
sepp_nepp | 7:41cbc431e1f4 | 203 | |
sepp_nepp | 7:41cbc431e1f4 | 204 | /** @defgroup VL53L0X_DefineRegisters_group Define Registers |
sepp_nepp | 7:41cbc431e1f4 | 205 | * @brief List of all the defined registers |
sepp_nepp | 7:41cbc431e1f4 | 206 | * @{ |
sepp_nepp | 7:41cbc431e1f4 | 207 | */ |
sepp_nepp | 11:c6f95a42d4d7 | 208 | #define REG_SYSRANGE_START 0x000 |
sepp_nepp | 11:c6f95a42d4d7 | 209 | /** mask existing bit in #REG_SYSRANGE_START*/ |
sepp_nepp | 11:c6f95a42d4d7 | 210 | #define REG_SYSRANGE_MODE_MASK 0x0F |
sepp_nepp | 11:c6f95a42d4d7 | 211 | /** bit 0 in #REG_SYSRANGE_START write 1 toggle state in |
sepp_nepp | 7:41cbc431e1f4 | 212 | * continuous mode and arm next shot in single shot mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 213 | #define REG_SYSRANGE_MODE_START_STOP 0x01 |
sepp_nepp | 11:c6f95a42d4d7 | 214 | /** bit 1 write 0 in #REG_SYSRANGE_START set single shot mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 215 | #define REG_SYSRANGE_MODE_SINGLESHOT 0x00 |
sepp_nepp | 11:c6f95a42d4d7 | 216 | /** bit 1 write 1 in #REG_SYSRANGE_START set back-to-back |
sepp_nepp | 7:41cbc431e1f4 | 217 | * operation mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 218 | #define REG_SYSRANGE_MODE_BACKTOBACK 0x02 |
sepp_nepp | 11:c6f95a42d4d7 | 219 | /** bit 2 write 1 in #REG_SYSRANGE_START set timed operation |
sepp_nepp | 7:41cbc431e1f4 | 220 | * mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 221 | #define REG_SYSRANGE_MODE_TIMED 0x04 |
sepp_nepp | 11:c6f95a42d4d7 | 222 | /** bit 3 write 1 in #REG_SYSRANGE_START set histogram operation |
sepp_nepp | 7:41cbc431e1f4 | 223 | * mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 224 | #define REG_SYSRANGE_MODE_HISTOGRAM 0x08 |
sepp_nepp | 7:41cbc431e1f4 | 225 | |
sepp_nepp | 11:c6f95a42d4d7 | 226 | #define REG_SYSTEM_THRESH_HIGH 0x0C |
sepp_nepp | 11:c6f95a42d4d7 | 227 | #define REG_SYSTEM_THRESH_LOW 0x0E |
sepp_nepp | 11:c6f95a42d4d7 | 228 | #define REG_SYSTEM_SEQUENCE_CONFIG 0x01 |
sepp_nepp | 11:c6f95a42d4d7 | 229 | #define REG_SYSTEM_RANGE_CONFIG 0x09 |
sepp_nepp | 11:c6f95a42d4d7 | 230 | #define REG_SYSTEM_MEASURE_PERIOD 0x04 |
sepp_nepp | 7:41cbc431e1f4 | 231 | |
sepp_nepp | 11:c6f95a42d4d7 | 232 | #define REG_SYSINT_CONFIG_GPIO 0x0A |
sepp_nepp | 11:c6f95a42d4d7 | 233 | #define REG_SYSINT_GPIO_DISABLED 0x00 |
sepp_nepp | 11:c6f95a42d4d7 | 234 | #define REG_SYSINT_GPIO_LEVEL_LOW 0x01 |
sepp_nepp | 11:c6f95a42d4d7 | 235 | #define REG_SYSINT_GPIO_LEVEL_HIGH 0x02 |
sepp_nepp | 11:c6f95a42d4d7 | 236 | #define REG_SYSINT_GPIO_OUT_OF_WINDOW 0x03 |
sepp_nepp | 11:c6f95a42d4d7 | 237 | #define REG_SYSINT_GPIO_NEW_SAMPLE_READY 0x04 |
sepp_nepp | 7:41cbc431e1f4 | 238 | |
sepp_nepp | 11:c6f95a42d4d7 | 239 | #define REG_GPIO_HV_MUX_ACTIVE_HIGH 0x84 |
sepp_nepp | 11:c6f95a42d4d7 | 240 | #define REG_SYSINT_CLEAR 0x0B |
sepp_nepp | 7:41cbc431e1f4 | 241 | |
sepp_nepp | 7:41cbc431e1f4 | 242 | /* Result registers */ |
sepp_nepp | 11:c6f95a42d4d7 | 243 | #define REG_RESULT_INTERRUPT_STATUS 0x13 |
sepp_nepp | 11:c6f95a42d4d7 | 244 | #define REG_RESULT_RANGE_STATUS 0x14 |
sepp_nepp | 7:41cbc431e1f4 | 245 | |
sepp_nepp | 11:c6f95a42d4d7 | 246 | #define REG_RESULT_CORE_PAGE 1 |
sepp_nepp | 11:c6f95a42d4d7 | 247 | #define REG_RESULT_CORE_AMBIENT_WINDOW_EVENTS_RTN 0xBC |
sepp_nepp | 11:c6f95a42d4d7 | 248 | #define REG_RESULT_CORE_RANGING_TOTAL_EVENTS_RTN 0xC0 |
sepp_nepp | 11:c6f95a42d4d7 | 249 | #define REG_RESULT_CORE_AMBIENT_WINDOW_EVENTS_REF 0xD0 |
sepp_nepp | 11:c6f95a42d4d7 | 250 | #define REG_RESULT_CORE_RANGING_TOTAL_EVENTS_REF 0xD4 |
sepp_nepp | 11:c6f95a42d4d7 | 251 | #define REG_RESULT_PEAK_SIG_RATE_REF 0xB6 |
sepp_nepp | 7:41cbc431e1f4 | 252 | |
sepp_nepp | 7:41cbc431e1f4 | 253 | /* Algo register */ |
sepp_nepp | 11:c6f95a42d4d7 | 254 | #define REG_ALGO_PART_TO_PART_RANGE_OFFSET_MM 0x28 |
sepp_nepp | 11:c6f95a42d4d7 | 255 | #define REG_I2C_SLAVE_DEVICE_ADDRESS 0x8a |
sepp_nepp | 7:41cbc431e1f4 | 256 | |
sepp_nepp | 7:41cbc431e1f4 | 257 | /* Check Limit registers */ |
sepp_nepp | 11:c6f95a42d4d7 | 258 | #define REG_MSRC_CONFIG_CONTROL 0x60 |
sepp_nepp | 7:41cbc431e1f4 | 259 | |
sepp_nepp | 11:c6f95a42d4d7 | 260 | #define REG_PRE_RANGE_CONFIG_MIN_SNR 0X27 |
sepp_nepp | 11:c6f95a42d4d7 | 261 | #define REG_PRE_RANGE_CONFIG_VALID_PHASE_LOW 0x56 |
sepp_nepp | 11:c6f95a42d4d7 | 262 | #define REG_PRE_RANGE_CONFIG_VALID_PHASE_HIGH 0x57 |
sepp_nepp | 11:c6f95a42d4d7 | 263 | #define REG_PRE_RANGE_MIN_COUNT_RATE_RTN_LIMIT 0x64 |
sepp_nepp | 7:41cbc431e1f4 | 264 | |
sepp_nepp | 11:c6f95a42d4d7 | 265 | #define REG_FINAL_RANGE_CONFIG_MIN_SNR 0X67 |
sepp_nepp | 11:c6f95a42d4d7 | 266 | #define REG_FINAL_RANGE_CONFIG_VALID_PHASE_LOW 0x47 |
sepp_nepp | 11:c6f95a42d4d7 | 267 | #define REG_FINAL_RANGE_CONFIG_VALID_PHASE_HIGH 0x48 |
sepp_nepp | 11:c6f95a42d4d7 | 268 | #define REG_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT 0x44 |
sepp_nepp | 7:41cbc431e1f4 | 269 | |
sepp_nepp | 11:c6f95a42d4d7 | 270 | #define REG_PRE_RANGE_CONFIG_SIGMA_THRESH_HI 0x61 |
sepp_nepp | 11:c6f95a42d4d7 | 271 | #define REG_PRE_RANGE_CONFIG_SIGMA_THRESH_LO 0x62 |
sepp_nepp | 7:41cbc431e1f4 | 272 | |
sepp_nepp | 7:41cbc431e1f4 | 273 | /* PRE RANGE registers */ |
sepp_nepp | 11:c6f95a42d4d7 | 274 | #define REG_PRE_RANGE_CONFIG_VCSEL_PERIOD 0x50 |
sepp_nepp | 11:c6f95a42d4d7 | 275 | #define REG_PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI 0x51 |
sepp_nepp | 11:c6f95a42d4d7 | 276 | #define REG_PRE_RANGE_CONFIG_TIMEOUT_MACROP_LO 0x52 |
sepp_nepp | 7:41cbc431e1f4 | 277 | |
sepp_nepp | 11:c6f95a42d4d7 | 278 | #define REG_SYSTEM_HISTOGRAM_BIN 0x81 |
sepp_nepp | 11:c6f95a42d4d7 | 279 | #define REG_HISTOGRAM_CONFIG_INITIAL_PHASE_SELECT 0x33 |
sepp_nepp | 11:c6f95a42d4d7 | 280 | #define REG_HISTOGRAM_CONFIG_READOUT_CTRL 0x55 |
sepp_nepp | 7:41cbc431e1f4 | 281 | |
sepp_nepp | 11:c6f95a42d4d7 | 282 | #define REG_FINAL_RANGE_CONFIG_VCSEL_PERIOD 0x70 |
sepp_nepp | 11:c6f95a42d4d7 | 283 | #define REG_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI 0x71 |
sepp_nepp | 11:c6f95a42d4d7 | 284 | #define REG_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_LO 0x72 |
sepp_nepp | 11:c6f95a42d4d7 | 285 | #define REG_XTALK_COMPENS_RATE_MHz 0x20 |
sepp_nepp | 7:41cbc431e1f4 | 286 | |
sepp_nepp | 11:c6f95a42d4d7 | 287 | #define REG_MSRC_CONFIG_TIMEOUT_MACROP 0x46 |
sepp_nepp | 7:41cbc431e1f4 | 288 | |
sepp_nepp | 11:c6f95a42d4d7 | 289 | #define REG_SOFT_RESET_GO2_SOFT_RESET_N 0xbf |
sepp_nepp | 11:c6f95a42d4d7 | 290 | #define REG_IDENTIFICATION_MODEL_ID 0xc0 |
sepp_nepp | 11:c6f95a42d4d7 | 291 | #define REG_IDENTIFICATION_REVISION_ID 0xc2 |
sepp_nepp | 7:41cbc431e1f4 | 292 | |
sepp_nepp | 11:c6f95a42d4d7 | 293 | #define REG_OSC_CALIBRATE_VAL 0xf8 |
sepp_nepp | 7:41cbc431e1f4 | 294 | |
sepp_nepp | 11:c6f95a42d4d7 | 295 | #define VL53L0X_SIGMA_ESTIMATE_MAX_VALUE 0xffff |
sepp_nepp | 7:41cbc431e1f4 | 296 | /* equivalent to a range sigma of 655.35mm */ |
sepp_nepp | 7:41cbc431e1f4 | 297 | |
sepp_nepp | 11:c6f95a42d4d7 | 298 | #define REG_GLOBAL_CONFIG_VCSEL_WIDTH 0x32 |
sepp_nepp | 11:c6f95a42d4d7 | 299 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_0 0xB0 |
sepp_nepp | 11:c6f95a42d4d7 | 300 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_1 0xB1 |
sepp_nepp | 11:c6f95a42d4d7 | 301 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_2 0xB2 |
sepp_nepp | 11:c6f95a42d4d7 | 302 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_3 0xB3 |
sepp_nepp | 11:c6f95a42d4d7 | 303 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_4 0xB4 |
sepp_nepp | 11:c6f95a42d4d7 | 304 | #define REG_GLOBAL_CONFIG_SPAD_ENABLES_REF_5 0xB5 |
sepp_nepp | 7:41cbc431e1f4 | 305 | |
sepp_nepp | 11:c6f95a42d4d7 | 306 | #define REG_GLOBAL_CONFIG_REF_EN_START_SELECT 0xB6 |
sepp_nepp | 11:c6f95a42d4d7 | 307 | #define REG_DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD 0x4E |
sepp_nepp | 11:c6f95a42d4d7 | 308 | #define REG_DYNAMIC_SPAD_REF_EN_START_OFFSET 0x4F |
sepp_nepp | 11:c6f95a42d4d7 | 309 | #define REG_POWER_MANAGEMENT_GO1_POWER_FORCE 0x80 |
sepp_nepp | 7:41cbc431e1f4 | 310 | |
sepp_nepp | 7:41cbc431e1f4 | 311 | /* Speed of light in um per 1E-10 Seconds */ |
sepp_nepp | 7:41cbc431e1f4 | 312 | #define VL53L0X_SPEED_OF_LIGHT_IN_AIR 2997 |
sepp_nepp | 7:41cbc431e1f4 | 313 | |
sepp_nepp | 11:c6f95a42d4d7 | 314 | #define REG_VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV 0x89 |
sepp_nepp | 7:41cbc431e1f4 | 315 | |
sepp_nepp | 11:c6f95a42d4d7 | 316 | #define REG_ALGO_PHASECAL_LIM 0x30 |
sepp_nepp | 11:c6f95a42d4d7 | 317 | #define REG_ALGO_PHASECAL_CONFIG_TIMEOUT 0x30 |
sepp_nepp | 7:41cbc431e1f4 | 318 | |
sepp_nepp | 7:41cbc431e1f4 | 319 | /** @} VL53L0X_DefineRegisters_group */ |
sepp_nepp | 7:41cbc431e1f4 | 320 | |
sepp_nepp | 7:41cbc431e1f4 | 321 | /** @} VL53L0X_DevSpecDefines_group */ |
sepp_nepp | 7:41cbc431e1f4 | 322 | |
nikapov | 0:a1a69d32f310 | 323 | |
nikapov | 0:a1a69d32f310 | 324 | /**************************************** |
nikapov | 0:a1a69d32f310 | 325 | * PRIVATE define do not edit |
nikapov | 0:a1a69d32f310 | 326 | ****************************************/ |
nikapov | 0:a1a69d32f310 | 327 | |
nikapov | 0:a1a69d32f310 | 328 | /** @brief Defines the parameters of the Get Version Functions |
nikapov | 0:a1a69d32f310 | 329 | */ |
nikapov | 0:a1a69d32f310 | 330 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 331 | uint32_t revision; /*!< revision number */ |
Davidroid | 2:d07edeaff6f1 | 332 | uint8_t major; /*!< major number */ |
Davidroid | 2:d07edeaff6f1 | 333 | uint8_t minor; /*!< minor number */ |
Davidroid | 2:d07edeaff6f1 | 334 | uint8_t build; /*!< build number */ |
nikapov | 0:a1a69d32f310 | 335 | } VL53L0X_Version_t; |
nikapov | 0:a1a69d32f310 | 336 | |
nikapov | 0:a1a69d32f310 | 337 | |
nikapov | 0:a1a69d32f310 | 338 | /** @brief Defines the parameters of the Get Device Info Functions |
nikapov | 0:a1a69d32f310 | 339 | */ |
nikapov | 0:a1a69d32f310 | 340 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 341 | char Name[VL53L0X_MAX_STRING_LENGTH]; |
Davidroid | 2:d07edeaff6f1 | 342 | /*!< Name of the Device e.g. Left_Distance */ |
Davidroid | 2:d07edeaff6f1 | 343 | char Type[VL53L0X_MAX_STRING_LENGTH]; |
Davidroid | 2:d07edeaff6f1 | 344 | /*!< Type of the Device e.g VL53L0X */ |
Davidroid | 2:d07edeaff6f1 | 345 | char ProductId[VL53L0X_MAX_STRING_LENGTH]; |
Davidroid | 2:d07edeaff6f1 | 346 | /*!< Product Identifier String */ |
Davidroid | 2:d07edeaff6f1 | 347 | uint8_t ProductType; |
Davidroid | 2:d07edeaff6f1 | 348 | /*!< Product Type, VL53L0X = 1, VL53L1 = 2 */ |
Davidroid | 2:d07edeaff6f1 | 349 | uint8_t ProductRevisionMajor; |
Davidroid | 2:d07edeaff6f1 | 350 | /*!< Product revision major */ |
Davidroid | 2:d07edeaff6f1 | 351 | uint8_t ProductRevisionMinor; |
Davidroid | 2:d07edeaff6f1 | 352 | /*!< Product revision minor */ |
sepp_nepp | 11:c6f95a42d4d7 | 353 | } TVL53L0X_DeviceInfo; |
nikapov | 0:a1a69d32f310 | 354 | |
nikapov | 0:a1a69d32f310 | 355 | |
sepp_nepp | 11:c6f95a42d4d7 | 356 | typedef TVL53L0X_DeviceInfo* PVL53L0X_DeviceInfo; |
sepp_nepp | 11:c6f95a42d4d7 | 357 | |
nikapov | 0:a1a69d32f310 | 358 | /** @defgroup VL53L0X_define_Error_group Error and Warning code returned by API |
sepp_nepp | 11:c6f95a42d4d7 | 359 | * The following DEFINE are used to identify the Device ERROR |
nikapov | 0:a1a69d32f310 | 360 | * @{ |
nikapov | 0:a1a69d32f310 | 361 | */ |
nikapov | 0:a1a69d32f310 | 362 | |
nikapov | 0:a1a69d32f310 | 363 | typedef int8_t VL53L0X_Error; |
nikapov | 0:a1a69d32f310 | 364 | |
sepp_nepp | 11:c6f95a42d4d7 | 365 | #define VL53L0X_OK ((VL53L0X_Error) 0) |
nikapov | 0:a1a69d32f310 | 366 | #define VL53L0X_ERROR_CALIBRATION_WARNING ((VL53L0X_Error) -1) |
Davidroid | 2:d07edeaff6f1 | 367 | /*!< Warning invalid calibration data may be in used |
Davidroid | 2:d07edeaff6f1 | 368 | \a VL53L0X_InitData() |
Davidroid | 2:d07edeaff6f1 | 369 | \a VL53L0X_GetOffsetCalibrationData |
Davidroid | 2:d07edeaff6f1 | 370 | \a VL53L0X_SetOffsetCalibrationData */ |
nikapov | 0:a1a69d32f310 | 371 | #define VL53L0X_ERROR_MIN_CLIPPED ((VL53L0X_Error) -2) |
Davidroid | 2:d07edeaff6f1 | 372 | /*!< Warning parameter passed was clipped to min before to be applied */ |
nikapov | 0:a1a69d32f310 | 373 | #define VL53L0X_ERROR_UNDEFINED ((VL53L0X_Error) -3) |
Davidroid | 2:d07edeaff6f1 | 374 | /*!< Unqualified error */ |
sepp_nepp | 11:c6f95a42d4d7 | 375 | #define VL53L0X_ERROR_INVALID_PARAMS ((VL53L0X_Error) -4) |
Davidroid | 2:d07edeaff6f1 | 376 | /*!< Parameter passed is invalid or out of range */ |
nikapov | 0:a1a69d32f310 | 377 | #define VL53L0X_ERROR_NOT_SUPPORTED ((VL53L0X_Error) -5) |
Davidroid | 2:d07edeaff6f1 | 378 | /*!< Function is not supported in current mode or configuration */ |
nikapov | 0:a1a69d32f310 | 379 | #define VL53L0X_ERROR_RANGE_ERROR ((VL53L0X_Error) -6) |
Davidroid | 2:d07edeaff6f1 | 380 | /*!< Device report a ranging error interrupt status */ |
nikapov | 0:a1a69d32f310 | 381 | #define VL53L0X_ERROR_TIME_OUT ((VL53L0X_Error) -7) |
Davidroid | 2:d07edeaff6f1 | 382 | /*!< Aborted due to time out */ |
sepp_nepp | 11:c6f95a42d4d7 | 383 | #define VL53L0X_ERROR_MODE_NOT_SUPPORTED ((VL53L0X_Error) -8) |
Davidroid | 2:d07edeaff6f1 | 384 | /*!< Asked mode is not supported by the device */ |
sepp_nepp | 11:c6f95a42d4d7 | 385 | #define VL53L0X_ERROR_BUFFER_TOO_SMALL ((VL53L0X_Error) -9) |
Davidroid | 2:d07edeaff6f1 | 386 | /*!< ... */ |
sepp_nepp | 11:c6f95a42d4d7 | 387 | #define VL53L0X_ERROR_GPIO_NOT_EXISTING ((VL53L0X_Error) -10) |
Davidroid | 2:d07edeaff6f1 | 388 | /*!< User tried to setup a non-existing GPIO pin */ |
sepp_nepp | 11:c6f95a42d4d7 | 389 | #define VL53L0X_ERROR_GPIO_FUNC_NOT_SUPPORTED ((VL53L0X_Error) -11) |
Davidroid | 2:d07edeaff6f1 | 390 | /*!< unsupported GPIO functionality */ |
sepp_nepp | 11:c6f95a42d4d7 | 391 | #define VL53L0X_ERROR_INTERRUPT_NOT_CLEARED ((VL53L0X_Error) -12) |
Davidroid | 2:d07edeaff6f1 | 392 | /*!< Error during interrupt clear */ |
sepp_nepp | 11:c6f95a42d4d7 | 393 | #define VL53L0X_ERROR_CONTROL_INTERFACE ((VL53L0X_Error) -20) |
sepp_nepp | 11:c6f95a42d4d7 | 394 | #define VL53L0X_ERROR_I2C_BUF_OVERFLOW ((VL53L0X_Error) -22) |
sepp_nepp | 11:c6f95a42d4d7 | 395 | #define VL53L0X_ERROR_I2C_WRONG_DEV_ID ((VL53L0X_Error) -23) |
Davidroid | 2:d07edeaff6f1 | 396 | /*!< error reported from IO functions */ |
sepp_nepp | 11:c6f95a42d4d7 | 397 | #define VL53L0X_ERROR_INVALID_COMMAND ((VL53L0X_Error) -30) |
sepp_nepp | 11:c6f95a42d4d7 | 398 | /*!< The command is not allowed in the current device state (power down) */ |
sepp_nepp | 11:c6f95a42d4d7 | 399 | #define VL53L0X_ERROR_DIVISION_BY_ZERO ((VL53L0X_Error) -40) |
Davidroid | 2:d07edeaff6f1 | 400 | /*!< In the function a division by zero occurs */ |
nikapov | 0:a1a69d32f310 | 401 | #define VL53L0X_ERROR_REF_SPAD_INIT ((VL53L0X_Error) -50) |
Davidroid | 2:d07edeaff6f1 | 402 | /*!< Error during reference SPAD initialization */ |
sepp_nepp | 11:c6f95a42d4d7 | 403 | #define VL53L0X_ERROR_NOT_IMPLEMENTED ((VL53L0X_Error) -99) |
Davidroid | 2:d07edeaff6f1 | 404 | /*!< Tells requested functionality has not been implemented yet or |
Davidroid | 2:d07edeaff6f1 | 405 | * not compatible with the device */ |
nikapov | 0:a1a69d32f310 | 406 | /** @} VL53L0X_define_Error_group */ |
nikapov | 0:a1a69d32f310 | 407 | |
nikapov | 0:a1a69d32f310 | 408 | |
nikapov | 0:a1a69d32f310 | 409 | /** @defgroup VL53L0X_define_DeviceModes_group Defines Device modes |
nikapov | 0:a1a69d32f310 | 410 | * Defines all possible modes for the device |
nikapov | 0:a1a69d32f310 | 411 | * @{ |
nikapov | 0:a1a69d32f310 | 412 | */ |
nikapov | 0:a1a69d32f310 | 413 | typedef uint8_t VL53L0X_DeviceModes; |
nikapov | 0:a1a69d32f310 | 414 | |
nikapov | 0:a1a69d32f310 | 415 | #define VL53L0X_DEVICEMODE_SINGLE_RANGING ((VL53L0X_DeviceModes) 0) |
nikapov | 0:a1a69d32f310 | 416 | #define VL53L0X_DEVICEMODE_CONTINUOUS_RANGING ((VL53L0X_DeviceModes) 1) |
nikapov | 0:a1a69d32f310 | 417 | #define VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM ((VL53L0X_DeviceModes) 2) |
nikapov | 0:a1a69d32f310 | 418 | #define VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING ((VL53L0X_DeviceModes) 3) |
nikapov | 0:a1a69d32f310 | 419 | #define VL53L0X_DEVICEMODE_SINGLE_ALS ((VL53L0X_DeviceModes) 10) |
nikapov | 0:a1a69d32f310 | 420 | #define VL53L0X_DEVICEMODE_GPIO_DRIVE ((VL53L0X_DeviceModes) 20) |
nikapov | 0:a1a69d32f310 | 421 | #define VL53L0X_DEVICEMODE_GPIO_OSC ((VL53L0X_DeviceModes) 21) |
Davidroid | 2:d07edeaff6f1 | 422 | /* ... Modes to be added depending on device */ |
nikapov | 0:a1a69d32f310 | 423 | /** @} VL53L0X_define_DeviceModes_group */ |
nikapov | 0:a1a69d32f310 | 424 | |
nikapov | 0:a1a69d32f310 | 425 | /** @defgroup VL53L0X_define_HistogramModes_group Defines Histogram modes |
nikapov | 0:a1a69d32f310 | 426 | * Defines all possible Histogram modes for the device |
nikapov | 0:a1a69d32f310 | 427 | * @{ |
nikapov | 0:a1a69d32f310 | 428 | */ |
nikapov | 0:a1a69d32f310 | 429 | typedef uint8_t VL53L0X_HistogramModes; |
nikapov | 0:a1a69d32f310 | 430 | |
nikapov | 0:a1a69d32f310 | 431 | #define VL53L0X_HISTOGRAMMODE_DISABLED ((VL53L0X_HistogramModes) 0) |
Davidroid | 2:d07edeaff6f1 | 432 | /*!< Histogram Disabled */ |
nikapov | 0:a1a69d32f310 | 433 | #define VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY ((VL53L0X_HistogramModes) 1) |
Davidroid | 2:d07edeaff6f1 | 434 | /*!< Histogram Reference array only */ |
nikapov | 0:a1a69d32f310 | 435 | #define VL53L0X_HISTOGRAMMODE_RETURN_ONLY ((VL53L0X_HistogramModes) 2) |
Davidroid | 2:d07edeaff6f1 | 436 | /*!< Histogram Return array only */ |
nikapov | 0:a1a69d32f310 | 437 | #define VL53L0X_HISTOGRAMMODE_BOTH ((VL53L0X_HistogramModes) 3) |
Davidroid | 2:d07edeaff6f1 | 438 | /*!< Histogram both Reference and Return Arrays */ |
Davidroid | 2:d07edeaff6f1 | 439 | /* ... Modes to be added depending on device */ |
nikapov | 0:a1a69d32f310 | 440 | /** @} VL53L0X_define_HistogramModes_group */ |
nikapov | 0:a1a69d32f310 | 441 | |
nikapov | 0:a1a69d32f310 | 442 | |
nikapov | 0:a1a69d32f310 | 443 | /** @defgroup VL53L0X_define_PowerModes_group List of available Power Modes |
nikapov | 0:a1a69d32f310 | 444 | * List of available Power Modes |
nikapov | 0:a1a69d32f310 | 445 | * @{ |
nikapov | 0:a1a69d32f310 | 446 | */ |
nikapov | 0:a1a69d32f310 | 447 | |
nikapov | 0:a1a69d32f310 | 448 | typedef uint8_t VL53L0X_PowerModes; |
nikapov | 0:a1a69d32f310 | 449 | |
nikapov | 0:a1a69d32f310 | 450 | #define VL53L0X_POWERMODE_STANDBY_LEVEL1 ((VL53L0X_PowerModes) 0) |
Davidroid | 2:d07edeaff6f1 | 451 | /*!< Standby level 1 */ |
nikapov | 0:a1a69d32f310 | 452 | #define VL53L0X_POWERMODE_STANDBY_LEVEL2 ((VL53L0X_PowerModes) 1) |
Davidroid | 2:d07edeaff6f1 | 453 | /*!< Standby level 2 */ |
nikapov | 0:a1a69d32f310 | 454 | #define VL53L0X_POWERMODE_IDLE_LEVEL1 ((VL53L0X_PowerModes) 2) |
Davidroid | 2:d07edeaff6f1 | 455 | /*!< Idle level 1 */ |
nikapov | 0:a1a69d32f310 | 456 | #define VL53L0X_POWERMODE_IDLE_LEVEL2 ((VL53L0X_PowerModes) 3) |
Davidroid | 2:d07edeaff6f1 | 457 | /*!< Idle level 2 */ |
nikapov | 0:a1a69d32f310 | 458 | |
nikapov | 0:a1a69d32f310 | 459 | /** @} VL53L0X_define_PowerModes_group */ |
nikapov | 0:a1a69d32f310 | 460 | |
nikapov | 0:a1a69d32f310 | 461 | /** @brief Defines all parameters for the device |
nikapov | 0:a1a69d32f310 | 462 | */ |
nikapov | 0:a1a69d32f310 | 463 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 464 | VL53L0X_DeviceModes DeviceMode; |
Davidroid | 2:d07edeaff6f1 | 465 | /*!< Defines type of measurement to be done for the next measure */ |
Davidroid | 2:d07edeaff6f1 | 466 | VL53L0X_HistogramModes HistogramMode; |
Davidroid | 2:d07edeaff6f1 | 467 | /*!< Defines type of histogram measurement to be done for the next |
Davidroid | 2:d07edeaff6f1 | 468 | * measure */ |
sepp_nepp | 11:c6f95a42d4d7 | 469 | uint32_t Measure_Time_Budget_us; // was MeasurementTimingBudget_us |
Davidroid | 2:d07edeaff6f1 | 470 | /*!< Defines the allowed total time for a single measurement */ |
sepp_nepp | 11:c6f95a42d4d7 | 471 | uint32_t Measure_Period_ms; |
Davidroid | 2:d07edeaff6f1 | 472 | /*!< Defines time between two consecutive measurements (between two |
Davidroid | 2:d07edeaff6f1 | 473 | * measurement starts). If set to 0 means back-to-back mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 474 | uint8_t XTalk_Compens_En; |
Davidroid | 2:d07edeaff6f1 | 475 | /*!< Tells if Crosstalk compensation shall be enable or not */ |
Davidroid | 2:d07edeaff6f1 | 476 | uint16_t XTalkCompensationRangeMilliMeter; |
Davidroid | 2:d07edeaff6f1 | 477 | /*!< CrossTalk compensation range in millimeter */ |
sepp_nepp | 11:c6f95a42d4d7 | 478 | TFP1616 Xtalk_CompRate_MHz; |
Davidroid | 2:d07edeaff6f1 | 479 | /*!< CrossTalk compensation rate in Mega counts per seconds. |
Davidroid | 2:d07edeaff6f1 | 480 | * Expressed in 16.16 fixed point format. */ |
sepp_nepp | 11:c6f95a42d4d7 | 481 | int32_t Offset_Cal_um; |
sepp_nepp | 11:c6f95a42d4d7 | 482 | /*!< Range offset adjustment (um) last programmed. */ |
nikapov | 0:a1a69d32f310 | 483 | |
sepp_nepp | 11:c6f95a42d4d7 | 484 | uint8_t Limit_Chk_En[VL53L0X_CHECKEN_NUMBER_OF_CHECKS]; |
Davidroid | 2:d07edeaff6f1 | 485 | /*!< This Array store all the Limit Check enable for this device. */ |
sepp_nepp | 11:c6f95a42d4d7 | 486 | uint8_t LimitChecksStatus[VL53L0X_CHECKEN_NUMBER_OF_CHECKS]; |
Davidroid | 2:d07edeaff6f1 | 487 | /*!< This Array store all the Status of the check linked to last |
Davidroid | 2:d07edeaff6f1 | 488 | * measurement. */ |
sepp_nepp | 11:c6f95a42d4d7 | 489 | TFP1616 Limit_Chk_Val[VL53L0X_CHECKEN_NUMBER_OF_CHECKS]; |
Davidroid | 2:d07edeaff6f1 | 490 | /*!< This Array store all the Limit Check value for this device */ |
sepp_nepp | 11:c6f95a42d4d7 | 491 | uint8_t Wrap_Around_Chk_En; |
Davidroid | 2:d07edeaff6f1 | 492 | /*!< Tells if Wrap Around Check shall be enable or not */ |
sepp_nepp | 11:c6f95a42d4d7 | 493 | } VL53L0X_DeviceParams_t; |
nikapov | 0:a1a69d32f310 | 494 | |
nikapov | 0:a1a69d32f310 | 495 | |
nikapov | 0:a1a69d32f310 | 496 | /** @defgroup VL53L0X_define_State_group Defines the current status of the device |
nikapov | 0:a1a69d32f310 | 497 | * Defines the current status of the device |
nikapov | 0:a1a69d32f310 | 498 | * @{ |
nikapov | 0:a1a69d32f310 | 499 | */ |
nikapov | 0:a1a69d32f310 | 500 | typedef uint8_t VL53L0X_State; |
nikapov | 0:a1a69d32f310 | 501 | |
sepp_nepp | 11:c6f95a42d4d7 | 502 | #define VL53L0X_STATE_POWERDOWN ((VL53L0X_State) 0) |
Davidroid | 2:d07edeaff6f1 | 503 | /*!< Device is in HW reset */ |
nikapov | 0:a1a69d32f310 | 504 | #define VL53L0X_STATE_WAIT_STATICINIT ((VL53L0X_State) 1) |
Davidroid | 2:d07edeaff6f1 | 505 | /*!< Device is initialized and wait for static initialization */ |
sepp_nepp | 11:c6f95a42d4d7 | 506 | #define VL53L0X_STATE_STANDBY ((VL53L0X_State) 2) |
Davidroid | 2:d07edeaff6f1 | 507 | /*!< Device is in Low power Standby mode */ |
sepp_nepp | 11:c6f95a42d4d7 | 508 | #define VL53L0X_STATE_IDLE ((VL53L0X_State) 3) |
Davidroid | 2:d07edeaff6f1 | 509 | /*!< Device has been initialized and ready to do measurements */ |
sepp_nepp | 11:c6f95a42d4d7 | 510 | #define VL53L0X_STATE_RUNNING ((VL53L0X_State) 4) |
Davidroid | 2:d07edeaff6f1 | 511 | /*!< Device is performing measurement */ |
sepp_nepp | 11:c6f95a42d4d7 | 512 | #define VL53L0X_STATE_UNKNOWN ((VL53L0X_State) 98) |
Davidroid | 2:d07edeaff6f1 | 513 | /*!< Device is in unknown state and need to be rebooted */ |
sepp_nepp | 11:c6f95a42d4d7 | 514 | #define VL53L0X_STATE_ERROR ((VL53L0X_State) 99) |
Davidroid | 2:d07edeaff6f1 | 515 | /*!< Device is in error state and need to be rebooted */ |
nikapov | 0:a1a69d32f310 | 516 | /** @} VL53L0X_define_State_group */ |
nikapov | 0:a1a69d32f310 | 517 | |
nikapov | 0:a1a69d32f310 | 518 | |
nikapov | 0:a1a69d32f310 | 519 | /** @brief Structure containing the Dmax computation parameters and data |
nikapov | 0:a1a69d32f310 | 520 | */ |
nikapov | 0:a1a69d32f310 | 521 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 522 | int32_t AmbTuningWindowFactor_K; |
Davidroid | 2:d07edeaff6f1 | 523 | /*!< internal algo tuning (*1000) */ |
Davidroid | 2:d07edeaff6f1 | 524 | int32_t RetSignalAt0mm; |
Davidroid | 2:d07edeaff6f1 | 525 | /*!< intermediate dmax computation value caching */ |
nikapov | 0:a1a69d32f310 | 526 | } VL53L0X_DMaxData_t; |
nikapov | 0:a1a69d32f310 | 527 | |
nikapov | 0:a1a69d32f310 | 528 | /** |
nikapov | 0:a1a69d32f310 | 529 | * @struct VL53L0X_RangeData_t |
nikapov | 0:a1a69d32f310 | 530 | * @brief Range measurement data. |
nikapov | 0:a1a69d32f310 | 531 | */ |
nikapov | 0:a1a69d32f310 | 532 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 533 | uint32_t TimeStamp; /*!< 32-bit time stamp. */ |
Davidroid | 2:d07edeaff6f1 | 534 | uint32_t MeasurementTimeUsec; |
sepp_nepp | 10:cd251e0fc2fd | 535 | /*!< Give the Measurement time needed by the device to do the measurement.*/ |
nikapov | 0:a1a69d32f310 | 536 | |
Davidroid | 2:d07edeaff6f1 | 537 | uint16_t RangeMilliMeter; /*!< range distance in millimeter. */ |
nikapov | 0:a1a69d32f310 | 538 | |
Davidroid | 2:d07edeaff6f1 | 539 | uint16_t RangeDMaxMilliMeter; |
Davidroid | 2:d07edeaff6f1 | 540 | /*!< Tells what is the maximum detection distance of the device |
Davidroid | 2:d07edeaff6f1 | 541 | * in current setup and environment conditions (Filled when |
Davidroid | 2:d07edeaff6f1 | 542 | * applicable) */ |
nikapov | 0:a1a69d32f310 | 543 | |
sepp_nepp | 11:c6f95a42d4d7 | 544 | TFP1616 SignalRateRtnMHz; |
sepp_nepp | 11:c6f95a42d4d7 | 545 | /*!< Return signal rate (MHz)\n these is a 16.16 fix point |
Davidroid | 2:d07edeaff6f1 | 546 | * value, which is effectively a measure of target |
Davidroid | 2:d07edeaff6f1 | 547 | * reflectance.*/ |
sepp_nepp | 11:c6f95a42d4d7 | 548 | TFP1616 AmbientRateRtnMHz; |
sepp_nepp | 11:c6f95a42d4d7 | 549 | /*!< Return ambient rate (MHz)\n these is a 16.16 fix point |
Davidroid | 2:d07edeaff6f1 | 550 | * value, which is effectively a measure of the ambien |
Davidroid | 2:d07edeaff6f1 | 551 | * t light.*/ |
nikapov | 0:a1a69d32f310 | 552 | |
sepp_nepp | 11:c6f95a42d4d7 | 553 | uint16_t EffectiveSPADRtnCount; |
Davidroid | 2:d07edeaff6f1 | 554 | /*!< Return the effective SPAD count for the return signal. |
Davidroid | 2:d07edeaff6f1 | 555 | * To obtain Real value it should be divided by 256 */ |
nikapov | 0:a1a69d32f310 | 556 | |
Davidroid | 2:d07edeaff6f1 | 557 | uint8_t ZoneId; |
Davidroid | 2:d07edeaff6f1 | 558 | /*!< Denotes which zone and range scheduler stage the range |
Davidroid | 2:d07edeaff6f1 | 559 | * data relates to. */ |
Davidroid | 2:d07edeaff6f1 | 560 | uint8_t RangeFractionalPart; |
Davidroid | 2:d07edeaff6f1 | 561 | /*!< Fractional part of range distance. Final value is a |
Davidroid | 2:d07edeaff6f1 | 562 | * FixPoint168 value. */ |
Davidroid | 2:d07edeaff6f1 | 563 | uint8_t RangeStatus; |
Davidroid | 2:d07edeaff6f1 | 564 | /*!< Range Status for the current measurement. This is device |
Davidroid | 2:d07edeaff6f1 | 565 | * dependent. Value = 0 means value is valid. |
Davidroid | 2:d07edeaff6f1 | 566 | * See \ref RangeStatusPage */ |
sepp_nepp | 11:c6f95a42d4d7 | 567 | } TRangeResults; // was VL53L0X_RangingMeasurementData_t |
nikapov | 0:a1a69d32f310 | 568 | |
nikapov | 0:a1a69d32f310 | 569 | |
nikapov | 0:a1a69d32f310 | 570 | #define VL53L0X_HISTOGRAM_BUFFER_SIZE 24 |
nikapov | 0:a1a69d32f310 | 571 | |
nikapov | 0:a1a69d32f310 | 572 | /** |
nikapov | 0:a1a69d32f310 | 573 | * @struct VL53L0X_HistogramData_t |
nikapov | 0:a1a69d32f310 | 574 | * @brief Histogram measurement data. |
nikapov | 0:a1a69d32f310 | 575 | */ |
sepp_nepp | 10:cd251e0fc2fd | 576 | typedef struct { /* Histogram Measurement data */ |
Davidroid | 2:d07edeaff6f1 | 577 | uint32_t HistogramData[VL53L0X_HISTOGRAM_BUFFER_SIZE]; |
Davidroid | 2:d07edeaff6f1 | 578 | /*!< Histogram data */ |
Davidroid | 2:d07edeaff6f1 | 579 | uint8_t HistogramType; /*!< Indicate the types of histogram data : |
nikapov | 0:a1a69d32f310 | 580 | Return only, Reference only, both Return and Reference */ |
Davidroid | 2:d07edeaff6f1 | 581 | uint8_t FirstBin; /*!< First Bin value */ |
Davidroid | 2:d07edeaff6f1 | 582 | uint8_t BufferSize; /*!< Buffer Size - Set by the user.*/ |
sepp_nepp | 10:cd251e0fc2fd | 583 | uint8_t NumberOfBins;/*!< Number of bins filled by the histogram measurement */ |
sepp_nepp | 11:c6f95a42d4d7 | 584 | TDevError ErrorStatus; |
Davidroid | 2:d07edeaff6f1 | 585 | /*!< Error status of the current measurement. \n |
sepp_nepp | 11:c6f95a42d4d7 | 586 | see @a ::TDevError @a VL53L0X_GetStatusErrorString() */ |
nikapov | 0:a1a69d32f310 | 587 | } VL53L0X_HistogramMeasurementData_t; |
nikapov | 0:a1a69d32f310 | 588 | |
sepp_nepp | 11:c6f95a42d4d7 | 589 | #define VL53L0X_PLL_PERIOD_PS = 1655; |
sepp_nepp | 11:c6f95a42d4d7 | 590 | #define VL53L0X_MACRO_PERIOD_VCLKS = 2304; |
nikapov | 0:a1a69d32f310 | 591 | |
nikapov | 0:a1a69d32f310 | 592 | /** |
sepp_nepp | 11:c6f95a42d4d7 | 593 | * @struct VL53L0X_SPADData_t |
sepp_nepp | 11:c6f95a42d4d7 | 594 | * @brief SPAD Configuration Data. |
nikapov | 0:a1a69d32f310 | 595 | */ |
sepp_nepp | 12:aa177f0e4c10 | 596 | #define REF_SPAD_ARRAY_SIZE 6 |
sepp_nepp | 12:aa177f0e4c10 | 597 | |
nikapov | 0:a1a69d32f310 | 598 | typedef struct { |
sepp_nepp | 12:aa177f0e4c10 | 599 | uint8_t RefSPADEnables[REF_SPAD_ARRAY_SIZE]; |
sepp_nepp | 11:c6f95a42d4d7 | 600 | /*!< Reference SPAD Enables */ |
sepp_nepp | 12:aa177f0e4c10 | 601 | uint8_t RefGoodSPADMap[REF_SPAD_ARRAY_SIZE]; |
sepp_nepp | 11:c6f95a42d4d7 | 602 | /*!< Reference SPAD Good SPAD Map */ |
sepp_nepp | 11:c6f95a42d4d7 | 603 | } VL53L0X_SPADData_t; |
nikapov | 0:a1a69d32f310 | 604 | |
nikapov | 0:a1a69d32f310 | 605 | |
nikapov | 0:a1a69d32f310 | 606 | /** @defgroup VL53L0X_define_InterruptPolarity_group Defines the Polarity |
nikapov | 0:a1a69d32f310 | 607 | * of the Interrupt |
nikapov | 0:a1a69d32f310 | 608 | * Defines the Polarity of the Interrupt |
nikapov | 0:a1a69d32f310 | 609 | * @{ |
nikapov | 0:a1a69d32f310 | 610 | */ |
nikapov | 0:a1a69d32f310 | 611 | typedef uint8_t VL53L0X_InterruptPolarity; |
nikapov | 0:a1a69d32f310 | 612 | #define VL53L0X_INTERRUPTPOLARITY_LOW ((VL53L0X_InterruptPolarity) 0) |
nikapov | 0:a1a69d32f310 | 613 | /*!< Set active low polarity best setup for falling edge. */ |
nikapov | 0:a1a69d32f310 | 614 | #define VL53L0X_INTERRUPTPOLARITY_HIGH ((VL53L0X_InterruptPolarity) 1) |
nikapov | 0:a1a69d32f310 | 615 | /*!< Set active high polarity best setup for rising edge. */ |
nikapov | 0:a1a69d32f310 | 616 | |
nikapov | 0:a1a69d32f310 | 617 | /** @} VL53L0X_define_InterruptPolarity_group */ |
nikapov | 0:a1a69d32f310 | 618 | |
nikapov | 0:a1a69d32f310 | 619 | |
nikapov | 0:a1a69d32f310 | 620 | /** @defgroup VL53L0X_define_VcselPeriod_group Vcsel Period Defines |
sepp_nepp | 11:c6f95a42d4d7 | 621 | * Defines the range measurement for which to access the vcsel Phase. |
nikapov | 0:a1a69d32f310 | 622 | * @{ |
nikapov | 0:a1a69d32f310 | 623 | */ |
sepp_nepp | 11:c6f95a42d4d7 | 624 | typedef uint8_t VL53L0X_Range_Phase; |
nikapov | 0:a1a69d32f310 | 625 | |
sepp_nepp | 11:c6f95a42d4d7 | 626 | #define VL53L0X_VCSEL_PRE_RANGE ((VL53L0X_Range_Phase) 0) |
sepp_nepp | 11:c6f95a42d4d7 | 627 | /*!<Identifies the pre-range vcsel Phase. */ |
sepp_nepp | 11:c6f95a42d4d7 | 628 | #define VL53L0X_VCSEL_FINAL_RANGE ((VL53L0X_Range_Phase) 1) |
sepp_nepp | 11:c6f95a42d4d7 | 629 | /*!<Identifies the final range vcsel Phase . */ |
nikapov | 0:a1a69d32f310 | 630 | |
nikapov | 0:a1a69d32f310 | 631 | /** @} VL53L0X_define_VcselPeriod_group */ |
nikapov | 0:a1a69d32f310 | 632 | |
nikapov | 0:a1a69d32f310 | 633 | /** @defgroup VL53L0X_define_SchedulerSequence_group Defines the steps |
nikapov | 0:a1a69d32f310 | 634 | * carried out by the scheduler during a range measurement. |
nikapov | 0:a1a69d32f310 | 635 | * @{ |
nikapov | 0:a1a69d32f310 | 636 | * Defines the states of all the steps in the scheduler |
nikapov | 0:a1a69d32f310 | 637 | * i.e. enabled/disabled. |
nikapov | 0:a1a69d32f310 | 638 | */ |
nikapov | 0:a1a69d32f310 | 639 | typedef struct { |
Davidroid | 2:d07edeaff6f1 | 640 | uint8_t TccOn; /*!<Reports if Target Centre Check On */ |
Davidroid | 2:d07edeaff6f1 | 641 | uint8_t MsrcOn; /*!<Reports if MSRC On */ |
Davidroid | 2:d07edeaff6f1 | 642 | uint8_t DssOn; /*!<Reports if DSS On */ |
Davidroid | 2:d07edeaff6f1 | 643 | uint8_t PreRangeOn; /*!<Reports if Pre-Range On */ |
Davidroid | 2:d07edeaff6f1 | 644 | uint8_t FinalRangeOn; /*!<Reports if Final-Range On */ |
sepp_nepp | 11:c6f95a42d4d7 | 645 | } VL53L0X_Sequence_Steps_t; |
nikapov | 0:a1a69d32f310 | 646 | |
nikapov | 0:a1a69d32f310 | 647 | /** @} VL53L0X_define_SchedulerSequence_group */ |
nikapov | 0:a1a69d32f310 | 648 | |
nikapov | 0:a1a69d32f310 | 649 | /** @defgroup VL53L0X_define_SequenceStepId_group Defines the Polarity |
nikapov | 0:a1a69d32f310 | 650 | * of the Interrupt |
nikapov | 0:a1a69d32f310 | 651 | * Defines the the sequence steps performed during ranging.. |
nikapov | 0:a1a69d32f310 | 652 | * @{ |
nikapov | 0:a1a69d32f310 | 653 | */ |
nikapov | 0:a1a69d32f310 | 654 | typedef uint8_t VL53L0X_SequenceStepId; |
nikapov | 0:a1a69d32f310 | 655 | |
sepp_nepp | 11:c6f95a42d4d7 | 656 | #define VL53L0X_SEQUENCESTEP_TCC ((VL53L0X_SequenceStepId) 0) |
nikapov | 0:a1a69d32f310 | 657 | /*!<Target CentreCheck identifier. */ |
sepp_nepp | 11:c6f95a42d4d7 | 658 | #define VL53L0X_SEQUENCESTEP_DSS ((VL53L0X_SequenceStepId) 1) |
sepp_nepp | 11:c6f95a42d4d7 | 659 | /*!<Dynamic SPAD Selection function Identifier. */ |
sepp_nepp | 11:c6f95a42d4d7 | 660 | #define VL53L0X_SEQUENCESTEP_MSRC ((VL53L0X_SequenceStepId) 2) |
nikapov | 0:a1a69d32f310 | 661 | /*!<Minimum Signal Rate Check function Identifier. */ |
sepp_nepp | 11:c6f95a42d4d7 | 662 | #define VL53L0X_SEQUENCESTEP_PRE_RANGE ((VL53L0X_SequenceStepId) 3) |
nikapov | 0:a1a69d32f310 | 663 | /*!<Pre-Range check Identifier. */ |
sepp_nepp | 11:c6f95a42d4d7 | 664 | #define VL53L0X_SEQUENCESTEP_FINAL_RANGE ((VL53L0X_SequenceStepId) 4) |
nikapov | 0:a1a69d32f310 | 665 | /*!<Final Range Check Identifier. */ |
nikapov | 0:a1a69d32f310 | 666 | |
nikapov | 0:a1a69d32f310 | 667 | #define VL53L0X_SEQUENCESTEP_NUMBER_OF_CHECKS 5 |
nikapov | 0:a1a69d32f310 | 668 | /*!<Number of Sequence Step Managed by the API. */ |
nikapov | 0:a1a69d32f310 | 669 | |
nikapov | 0:a1a69d32f310 | 670 | /** @} VL53L0X_define_SequenceStepId_group */ |
nikapov | 0:a1a69d32f310 | 671 | |
nikapov | 0:a1a69d32f310 | 672 | /* MACRO Definitions */ |
nikapov | 0:a1a69d32f310 | 673 | /** @defgroup VL53L0X_define_GeneralMacro_group General Macro Defines |
nikapov | 0:a1a69d32f310 | 674 | * General Macro Defines |
nikapov | 0:a1a69d32f310 | 675 | * @{ |
nikapov | 0:a1a69d32f310 | 676 | */ |
nikapov | 0:a1a69d32f310 | 677 | |
nikapov | 0:a1a69d32f310 | 678 | /* Defines */ |
sepp_nepp | 11:c6f95a42d4d7 | 679 | #define FP1616_TO_FP97(Value) (uint16_t)((Value>>9)&0xFFFF) |
sepp_nepp | 11:c6f95a42d4d7 | 680 | #define FP97_TO_FP1616(Value) (TFP1616)(Value<<9) |
nikapov | 0:a1a69d32f310 | 681 | |
sepp_nepp | 11:c6f95a42d4d7 | 682 | #define FP1616_TO_FP88(Value) (uint16_t)((Value>>8)&0xFFFF) |
sepp_nepp | 11:c6f95a42d4d7 | 683 | #define FP88_TO_FP1616(Value) (TFP1616)(Value<<8) |
nikapov | 0:a1a69d32f310 | 684 | |
sepp_nepp | 11:c6f95a42d4d7 | 685 | #define FP1616_TO_FP412(Value) (uint16_t)((Value>>4)&0xFFFF) |
sepp_nepp | 11:c6f95a42d4d7 | 686 | #define FP412_TO_FP1616(Value) (TFP1616)(Value<<4) |
nikapov | 0:a1a69d32f310 | 687 | |
sepp_nepp | 11:c6f95a42d4d7 | 688 | #define FP1616_TO_FP313(Value) (uint16_t)((Value>>3)&0xFFFF) |
sepp_nepp | 11:c6f95a42d4d7 | 689 | #define FP313_TO_FP1616(Value) (TFP1616)(Value<<3) |
nikapov | 0:a1a69d32f310 | 690 | |
sepp_nepp | 11:c6f95a42d4d7 | 691 | #define FP1616_TO_FP08(Value) (uint8_t)((Value>>8)&0x00FF) |
sepp_nepp | 11:c6f95a42d4d7 | 692 | #define FP08_TO_FP1616(Value) (TFP1616)(Value<<8) |
nikapov | 0:a1a69d32f310 | 693 | |
sepp_nepp | 11:c6f95a42d4d7 | 694 | #define FP1616_TO_FP53(Value) (uint8_t)((Value>>13)&0x00FF) |
sepp_nepp | 11:c6f95a42d4d7 | 695 | #define FP53_TO_FP1616(Value) (TFP1616)(Value<<13) |
nikapov | 0:a1a69d32f310 | 696 | |
sepp_nepp | 11:c6f95a42d4d7 | 697 | #define FP1616_TO_FP102(Value) (uint16_t)((Value>>14)&0x0FFF) |
sepp_nepp | 11:c6f95a42d4d7 | 698 | #define FP102_TO_FP1616(Value) (TFP1616)(Value<<12) |
nikapov | 0:a1a69d32f310 | 699 | |
sepp_nepp | 10:cd251e0fc2fd | 700 | #define VL53L0X_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + (uint16_t)lsb) |
nikapov | 0:a1a69d32f310 | 701 | |
nikapov | 0:a1a69d32f310 | 702 | /** @} VL53L0X_define_GeneralMacro_group */ |
nikapov | 0:a1a69d32f310 | 703 | |
nikapov | 0:a1a69d32f310 | 704 | /** @} VL53L0X_globaldefine_group */ |
nikapov | 0:a1a69d32f310 | 705 | |
nikapov | 0:a1a69d32f310 | 706 | #ifdef __cplusplus |
nikapov | 0:a1a69d32f310 | 707 | } |
nikapov | 0:a1a69d32f310 | 708 | #endif |
nikapov | 0:a1a69d32f310 | 709 | |
nikapov | 0:a1a69d32f310 | 710 | #endif /* _VL53L0X_DEF_H_ */ |