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_def.h@7:1add29d51e72, 2021-06-08 (annotated)
- Committer:
- Charles MacNeill
- Date:
- Tue Jun 08 10:34:47 2021 +0100
- Revision:
- 7:1add29d51e72
- Parent:
- 0:3ac96e360672
- Child:
- 18:0696efe39d08
Update to v6.6.5 of bare_driver
Who changed what in which revision?
User | Revision | Line number | New 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_def.h |
charlesmn | 0:3ac96e360672 | 14 | * |
charlesmn | 0:3ac96e360672 | 15 | * @brief Type definitions for VL53L1 API. |
charlesmn | 0:3ac96e360672 | 16 | * |
charlesmn | 0:3ac96e360672 | 17 | */ |
charlesmn | 0:3ac96e360672 | 18 | |
charlesmn | 0:3ac96e360672 | 19 | |
charlesmn | 0:3ac96e360672 | 20 | #ifndef _VL53L1_DEF_H_ |
charlesmn | 0:3ac96e360672 | 21 | #define _VL53L1_DEF_H_ |
charlesmn | 0:3ac96e360672 | 22 | |
charlesmn | 0:3ac96e360672 | 23 | #include "vl53l1_ll_def.h" |
charlesmn | 0:3ac96e360672 | 24 | |
charlesmn | 0:3ac96e360672 | 25 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 26 | extern "C" { |
charlesmn | 0:3ac96e360672 | 27 | #endif |
charlesmn | 0:3ac96e360672 | 28 | |
charlesmn | 0:3ac96e360672 | 29 | /** @defgroup VL53L1_globaldefine_group VL53L1 Defines |
charlesmn | 0:3ac96e360672 | 30 | * @brief VL53L1 Defines |
charlesmn | 0:3ac96e360672 | 31 | * @{ |
charlesmn | 0:3ac96e360672 | 32 | */ |
charlesmn | 0:3ac96e360672 | 33 | |
charlesmn | 0:3ac96e360672 | 34 | |
charlesmn | 0:3ac96e360672 | 35 | /** VL53L1 IMPLEMENTATION major version */ |
charlesmn | 0:3ac96e360672 | 36 | #define VL53L1_IMPLEMENTATION_VER_MAJOR 6 |
charlesmn | 0:3ac96e360672 | 37 | /** VL53L1 IMPLEMENTATION minor version */ |
charlesmn | 0:3ac96e360672 | 38 | #define VL53L1_IMPLEMENTATION_VER_MINOR 6 |
charlesmn | 0:3ac96e360672 | 39 | /** VL53L1 IMPLEMENTATION sub version */ |
Charles MacNeill |
7:1add29d51e72 | 40 | #define VL53L1_IMPLEMENTATION_VER_SUB 5 |
charlesmn | 0:3ac96e360672 | 41 | /** VL53L1 IMPLEMENTATION sub version */ |
Charles MacNeill |
7:1add29d51e72 | 42 | #define VL53L1_IMPLEMENTATION_VER_REVISION 2496 |
charlesmn | 0:3ac96e360672 | 43 | |
charlesmn | 0:3ac96e360672 | 44 | /**************************************** |
charlesmn | 0:3ac96e360672 | 45 | * PRIVATE define do not edit |
charlesmn | 0:3ac96e360672 | 46 | ****************************************/ |
charlesmn | 0:3ac96e360672 | 47 | |
charlesmn | 0:3ac96e360672 | 48 | /** @brief Defines the parameters of the Get Version Functions |
charlesmn | 0:3ac96e360672 | 49 | */ |
charlesmn | 0:3ac96e360672 | 50 | typedef struct { |
charlesmn | 0:3ac96e360672 | 51 | uint32_t revision; /*!< revision number */ |
charlesmn | 0:3ac96e360672 | 52 | uint8_t major; /*!< major number */ |
charlesmn | 0:3ac96e360672 | 53 | uint8_t minor; /*!< minor number */ |
charlesmn | 0:3ac96e360672 | 54 | uint8_t build; /*!< build number */ |
charlesmn | 0:3ac96e360672 | 55 | } VL53L1_Version_t; |
charlesmn | 0:3ac96e360672 | 56 | |
charlesmn | 0:3ac96e360672 | 57 | |
charlesmn | 0:3ac96e360672 | 58 | #define VL53L1_DEVINFO_STRLEN 32 |
charlesmn | 0:3ac96e360672 | 59 | |
charlesmn | 0:3ac96e360672 | 60 | /** @brief Defines the parameters of the Get Device Info Functions |
charlesmn | 0:3ac96e360672 | 61 | */ |
charlesmn | 0:3ac96e360672 | 62 | typedef struct { |
charlesmn | 0:3ac96e360672 | 63 | char Name[VL53L1_DEVINFO_STRLEN]; |
charlesmn | 0:3ac96e360672 | 64 | /*!< Full Name of the Device e.g. VL53L1 cut1.1 */ |
charlesmn | 0:3ac96e360672 | 65 | char Type[VL53L1_DEVINFO_STRLEN]; |
charlesmn | 0:3ac96e360672 | 66 | /*!< Type of the Device e.g VL53L1 */ |
charlesmn | 0:3ac96e360672 | 67 | char ProductId[VL53L1_DEVINFO_STRLEN]; |
charlesmn | 0:3ac96e360672 | 68 | /*!< Product Identifier String |
charlesmn | 0:3ac96e360672 | 69 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 70 | */ |
charlesmn | 0:3ac96e360672 | 71 | uint8_t ProductType; |
charlesmn | 0:3ac96e360672 | 72 | /*!< Product Type, VL53L1 = 0xCC, VL53L3 = 0xAA |
charlesmn | 0:3ac96e360672 | 73 | * Stands as module_type in the datasheet |
charlesmn | 0:3ac96e360672 | 74 | */ |
charlesmn | 0:3ac96e360672 | 75 | uint8_t ProductRevisionMajor; |
charlesmn | 0:3ac96e360672 | 76 | /*!< Product revision major */ |
charlesmn | 0:3ac96e360672 | 77 | uint8_t ProductRevisionMinor; |
charlesmn | 0:3ac96e360672 | 78 | /*!< Product revision minor */ |
charlesmn | 0:3ac96e360672 | 79 | } VL53L1_DeviceInfo_t; |
charlesmn | 0:3ac96e360672 | 80 | |
charlesmn | 0:3ac96e360672 | 81 | |
charlesmn | 0:3ac96e360672 | 82 | |
charlesmn | 0:3ac96e360672 | 83 | /** @defgroup VL53L1_define_PresetModes_group Defines Preset modes |
charlesmn | 0:3ac96e360672 | 84 | * Defines all possible preset modes for the device |
charlesmn | 0:3ac96e360672 | 85 | * @{ |
charlesmn | 0:3ac96e360672 | 86 | */ |
charlesmn | 0:3ac96e360672 | 87 | typedef uint8_t VL53L1_PresetModes; |
charlesmn | 0:3ac96e360672 | 88 | |
charlesmn | 0:3ac96e360672 | 89 | #define VL53L1_PRESETMODE_RANGING ((VL53L1_PresetModes) 1) |
charlesmn | 0:3ac96e360672 | 90 | #define VL53L1_PRESETMODE_MULTIZONES_SCANNING ((VL53L1_PresetModes) 2) |
charlesmn | 0:3ac96e360672 | 91 | #define VL53L1_PRESETMODE_AUTONOMOUS ((VL53L1_PresetModes) 3) |
charlesmn | 0:3ac96e360672 | 92 | #define VL53L1_PRESETMODE_LITE_RANGING ((VL53L1_PresetModes) 4) |
charlesmn | 0:3ac96e360672 | 93 | #define VL53L1_PRESETMODE_OLT ((VL53L1_PresetModes) 7) |
charlesmn | 0:3ac96e360672 | 94 | #define VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS ((VL53L1_PresetModes) 8) |
charlesmn | 0:3ac96e360672 | 95 | #define VL53L1_PRESETMODE_PROXY_RANGING_MODE ((VL53L1_PresetModes) 9) |
charlesmn | 0:3ac96e360672 | 96 | |
charlesmn | 0:3ac96e360672 | 97 | /* ... Modes to be added depending on device */ |
charlesmn | 0:3ac96e360672 | 98 | /** @} VL53L1_define_PresetModes_group */ |
charlesmn | 0:3ac96e360672 | 99 | |
charlesmn | 0:3ac96e360672 | 100 | |
charlesmn | 0:3ac96e360672 | 101 | /** @defgroup VL53L1_define_DistanceModes_group Defines Distance modes |
charlesmn | 0:3ac96e360672 | 102 | * Defines all possible Distance modes for the device |
charlesmn | 0:3ac96e360672 | 103 | * @{ |
charlesmn | 0:3ac96e360672 | 104 | */ |
charlesmn | 0:3ac96e360672 | 105 | typedef uint8_t VL53L1_DistanceModes; |
charlesmn | 0:3ac96e360672 | 106 | |
charlesmn | 0:3ac96e360672 | 107 | #define VL53L1_DISTANCEMODE_SHORT ((VL53L1_DistanceModes) 1) |
charlesmn | 0:3ac96e360672 | 108 | #define VL53L1_DISTANCEMODE_MEDIUM ((VL53L1_DistanceModes) 2) |
charlesmn | 0:3ac96e360672 | 109 | #define VL53L1_DISTANCEMODE_LONG ((VL53L1_DistanceModes) 3) |
charlesmn | 0:3ac96e360672 | 110 | /** @} VL53L1_define_DistanceModes_group */ |
charlesmn | 0:3ac96e360672 | 111 | |
charlesmn | 0:3ac96e360672 | 112 | /** @defgroup VL53L1_define_OutputModes_group Defines Output modes |
charlesmn | 0:3ac96e360672 | 113 | * Defines all possible Output modes for the device |
charlesmn | 0:3ac96e360672 | 114 | * @{ |
charlesmn | 0:3ac96e360672 | 115 | */ |
charlesmn | 0:3ac96e360672 | 116 | typedef uint8_t VL53L1_OutputModes; |
charlesmn | 0:3ac96e360672 | 117 | |
charlesmn | 0:3ac96e360672 | 118 | #define VL53L1_OUTPUTMODE_NEAREST ((VL53L1_OutputModes) 1) |
charlesmn | 0:3ac96e360672 | 119 | #define VL53L1_OUTPUTMODE_STRONGEST ((VL53L1_OutputModes) 2) |
charlesmn | 0:3ac96e360672 | 120 | |
charlesmn | 0:3ac96e360672 | 121 | /** @} VL53L1_define_OutputModes_group */ |
charlesmn | 0:3ac96e360672 | 122 | |
charlesmn | 0:3ac96e360672 | 123 | /** @defgroup VL53L1_define_XtalkCal_group Defines Xtalk Calibration modes |
charlesmn | 0:3ac96e360672 | 124 | * Defines all possible Offset Calibration modes for the device |
charlesmn | 0:3ac96e360672 | 125 | * @{ |
charlesmn | 0:3ac96e360672 | 126 | */ |
charlesmn | 0:3ac96e360672 | 127 | typedef uint8_t VL53L1_XtalkCalibrationModes; |
charlesmn | 0:3ac96e360672 | 128 | |
charlesmn | 0:3ac96e360672 | 129 | #define VL53L1_XTALKCALIBRATIONMODE_NO_TARGET \ |
charlesmn | 0:3ac96e360672 | 130 | ((VL53L1_OffsetCalibrationModes) 0) |
charlesmn | 0:3ac96e360672 | 131 | /*!< To perform Xtalk calibration with no target below 80 cm */ |
charlesmn | 0:3ac96e360672 | 132 | #define VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET \ |
charlesmn | 0:3ac96e360672 | 133 | ((VL53L1_OffsetCalibrationModes) 1) |
charlesmn | 0:3ac96e360672 | 134 | /*!< To perform Xtalk calibration with one target */ |
charlesmn | 0:3ac96e360672 | 135 | #define VL53L1_XTALKCALIBRATIONMODE_FULL_ROI \ |
charlesmn | 0:3ac96e360672 | 136 | ((VL53L1_OffsetCalibrationModes) 2) |
charlesmn | 0:3ac96e360672 | 137 | /*!< To perform Xtalk calibration based on histogram with full ROI */ |
charlesmn | 0:3ac96e360672 | 138 | |
charlesmn | 0:3ac96e360672 | 139 | /** @} VL53L1_define_XtalkCal_group */ |
charlesmn | 0:3ac96e360672 | 140 | |
charlesmn | 0:3ac96e360672 | 141 | /** @defgroup VL53L1_define_OffsetCal_group Defines Offset Calibration modes |
charlesmn | 0:3ac96e360672 | 142 | * Defines all possible Offset Calibration modes for the device |
charlesmn | 0:3ac96e360672 | 143 | * @{ |
charlesmn | 0:3ac96e360672 | 144 | */ |
charlesmn | 0:3ac96e360672 | 145 | typedef uint8_t VL53L1_OffsetCalibrationModes; |
charlesmn | 0:3ac96e360672 | 146 | |
charlesmn | 0:3ac96e360672 | 147 | #define VL53L1_OFFSETCALIBRATIONMODE_STANDARD \ |
charlesmn | 0:3ac96e360672 | 148 | ((VL53L1_OffsetCalibrationModes) 1) |
charlesmn | 0:3ac96e360672 | 149 | #define VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY \ |
charlesmn | 0:3ac96e360672 | 150 | ((VL53L1_OffsetCalibrationModes) 2) |
charlesmn | 0:3ac96e360672 | 151 | #define VL53L1_OFFSETCALIBRATIONMODE_MULTI_ZONE \ |
charlesmn | 0:3ac96e360672 | 152 | ((VL53L1_OffsetCalibrationModes) 3) |
charlesmn | 0:3ac96e360672 | 153 | |
charlesmn | 0:3ac96e360672 | 154 | /** @} VL53L1_define_OffsetCal_group */ |
charlesmn | 0:3ac96e360672 | 155 | |
charlesmn | 0:3ac96e360672 | 156 | /** @defgroup VL53L1_define_DeviceDmaxModes_group Defines Dmax source modes |
charlesmn | 0:3ac96e360672 | 157 | * Defines all possible sources for Dmax calibration for the device |
charlesmn | 0:3ac96e360672 | 158 | * @{ |
charlesmn | 0:3ac96e360672 | 159 | */ |
charlesmn | 0:3ac96e360672 | 160 | typedef uint8_t VL53L1_DeviceDmaxModes; |
charlesmn | 0:3ac96e360672 | 161 | |
charlesmn | 0:3ac96e360672 | 162 | #define VL53L1_DMAXMODE_FMT_CAL_DATA ((VL53L1_DeviceDmaxModes) 1) |
charlesmn | 0:3ac96e360672 | 163 | #define VL53L1_DMAXMODE_CUSTCAL_DATA ((VL53L1_DeviceDmaxModes) 2) |
charlesmn | 0:3ac96e360672 | 164 | #define VL53L1_DMAXMODE_PER_ZONE_CAL_DATA ((VL53L1_DeviceDmaxModes) 3) |
charlesmn | 0:3ac96e360672 | 165 | |
charlesmn | 0:3ac96e360672 | 166 | /** @} VL53L1_define_DeviceDmaxModes_group */ |
charlesmn | 0:3ac96e360672 | 167 | |
charlesmn | 0:3ac96e360672 | 168 | /** @defgroup VL53L1_define_OffsetCorrectionModesBD_group |
charlesmn | 0:3ac96e360672 | 169 | * Device Offset Correction Mode |
charlesmn | 0:3ac96e360672 | 170 | * |
charlesmn | 0:3ac96e360672 | 171 | * @brief Defines all possible offset correction modes for the device |
charlesmn | 0:3ac96e360672 | 172 | * @{ |
charlesmn | 0:3ac96e360672 | 173 | */ |
charlesmn | 0:3ac96e360672 | 174 | typedef uint8_t VL53L1_OffsetCorrectionModes; |
charlesmn | 0:3ac96e360672 | 175 | |
charlesmn | 0:3ac96e360672 | 176 | #define VL53L1_OFFSETCORRECTIONMODE_STANDARD ((VL53L1_OffsetCorrectionMode) 1) |
charlesmn | 0:3ac96e360672 | 177 | #define VL53L1_OFFSETCORRECTIONMODE_PERZONE ((VL53L1_OffsetCorrectionMode) 2) |
charlesmn | 0:3ac96e360672 | 178 | #define VL53L1_OFFSETCORRECTIONMODE_PERVCSEL ((VL53L1_OffsetCorrectionMode) 3) |
charlesmn | 0:3ac96e360672 | 179 | |
charlesmn | 0:3ac96e360672 | 180 | /** @} VL53L1_define_OffsetCorrectionModesBD_group */ |
charlesmn | 0:3ac96e360672 | 181 | |
charlesmn | 0:3ac96e360672 | 182 | /** @defgroup VL53L1_define_RoiStatus_group Defines Roi Status |
charlesmn | 0:3ac96e360672 | 183 | * Defines the read status mode |
charlesmn | 0:3ac96e360672 | 184 | * @{ |
charlesmn | 0:3ac96e360672 | 185 | */ |
charlesmn | 0:3ac96e360672 | 186 | typedef uint8_t VL53L1_RoiStatus; |
charlesmn | 0:3ac96e360672 | 187 | |
charlesmn | 0:3ac96e360672 | 188 | #define VL53L1_ROISTATUS_NOT_VALID ((VL53L1_RoiStatus) 0) |
charlesmn | 0:3ac96e360672 | 189 | #define VL53L1_ROISTATUS_VALID_NOT_LAST ((VL53L1_RoiStatus) 1) |
charlesmn | 0:3ac96e360672 | 190 | #define VL53L1_ROISTATUS_VALID_LAST ((VL53L1_RoiStatus) 2) |
charlesmn | 0:3ac96e360672 | 191 | /** @} VL53L1_define_RoiStatus_group */ |
charlesmn | 0:3ac96e360672 | 192 | |
charlesmn | 0:3ac96e360672 | 193 | |
charlesmn | 0:3ac96e360672 | 194 | /** @defgroup VL53L1_CheckEnable_group Check Enable list |
charlesmn | 0:3ac96e360672 | 195 | * @brief Check Enable code |
charlesmn | 0:3ac96e360672 | 196 | * |
charlesmn | 0:3ac96e360672 | 197 | * Define used to specify the LimitCheckId. |
charlesmn | 0:3ac96e360672 | 198 | * Use @a VL53L1_GetLimitCheckInfo() to get the string. |
charlesmn | 0:3ac96e360672 | 199 | * @{ |
charlesmn | 0:3ac96e360672 | 200 | */ |
charlesmn | 0:3ac96e360672 | 201 | |
charlesmn | 0:3ac96e360672 | 202 | #define VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE 0 |
charlesmn | 0:3ac96e360672 | 203 | #define VL53L1_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE 1 |
charlesmn | 0:3ac96e360672 | 204 | |
charlesmn | 0:3ac96e360672 | 205 | #define VL53L1_CHECKENABLE_NUMBER_OF_CHECKS 2 |
charlesmn | 0:3ac96e360672 | 206 | |
charlesmn | 0:3ac96e360672 | 207 | /** @} end of VL53L1_CheckEnable_group */ |
charlesmn | 0:3ac96e360672 | 208 | |
charlesmn | 0:3ac96e360672 | 209 | |
charlesmn | 0:3ac96e360672 | 210 | /** @defgroup VL53L1_ThresholdMode_gropup Detection Functionality |
charlesmn | 0:3ac96e360672 | 211 | * @brief Defines the different functionalities for the detection feature |
charlesmn | 0:3ac96e360672 | 212 | * @{ |
charlesmn | 0:3ac96e360672 | 213 | */ |
charlesmn | 0:3ac96e360672 | 214 | typedef uint8_t VL53L1_ThresholdMode; |
charlesmn | 0:3ac96e360672 | 215 | |
charlesmn | 0:3ac96e360672 | 216 | #define VL53L1_THRESHOLD_CROSSED_LOW \ |
charlesmn | 0:3ac96e360672 | 217 | ((VL53L1_ThresholdMode) 0) |
charlesmn | 0:3ac96e360672 | 218 | /*!< Trigger interrupt if value < thresh_low */ |
charlesmn | 0:3ac96e360672 | 219 | #define VL53L1_THRESHOLD_CROSSED_HIGH \ |
charlesmn | 0:3ac96e360672 | 220 | ((VL53L1_ThresholdMode) 1) |
charlesmn | 0:3ac96e360672 | 221 | /*!< Trigger interrupt if value > thresh_high */ |
charlesmn | 0:3ac96e360672 | 222 | #define VL53L1_THRESHOLD_OUT_OF_WINDOW \ |
charlesmn | 0:3ac96e360672 | 223 | ((VL53L1_ThresholdMode) 2) |
charlesmn | 0:3ac96e360672 | 224 | /*!< Trigger interrupt if value < thresh_low OR value > thresh_high */ |
charlesmn | 0:3ac96e360672 | 225 | #define VL53L1_THRESHOLD_IN_WINDOW \ |
charlesmn | 0:3ac96e360672 | 226 | ((VL53L1_ThresholdMode) 3) |
charlesmn | 0:3ac96e360672 | 227 | /*!< Trigger interrupt if value > thresh_low AND value < thresh_high */ |
charlesmn | 0:3ac96e360672 | 228 | |
charlesmn | 0:3ac96e360672 | 229 | /** @} end of VL53L1_ThresholdMode_gropup */ |
charlesmn | 0:3ac96e360672 | 230 | |
charlesmn | 0:3ac96e360672 | 231 | /** @brief Defines parameters for Distance detection Thresholds configuration |
charlesmn | 0:3ac96e360672 | 232 | */ |
charlesmn | 0:3ac96e360672 | 233 | typedef struct { |
charlesmn | 0:3ac96e360672 | 234 | VL53L1_ThresholdMode CrossMode; |
charlesmn | 0:3ac96e360672 | 235 | uint16_t High; /*!< Distance threshold high limit in mm */ |
charlesmn | 0:3ac96e360672 | 236 | uint16_t Low; /*!< Distance threshold low limit in mm */ |
charlesmn | 0:3ac96e360672 | 237 | } VL53L1_DistanceThreshold_t; |
charlesmn | 0:3ac96e360672 | 238 | |
charlesmn | 0:3ac96e360672 | 239 | /** @brief Defines parameters for Signal rate detection Thresholds configuration |
charlesmn | 0:3ac96e360672 | 240 | */ |
charlesmn | 0:3ac96e360672 | 241 | typedef struct { |
charlesmn | 0:3ac96e360672 | 242 | VL53L1_ThresholdMode CrossMode; |
charlesmn | 0:3ac96e360672 | 243 | FixPoint1616_t High; /*!< Signal rate threshold high limit */ |
charlesmn | 0:3ac96e360672 | 244 | FixPoint1616_t Low; /*!< Signal rate threshold low limit */ |
charlesmn | 0:3ac96e360672 | 245 | } VL53L1_RateThreshold_t; |
charlesmn | 0:3ac96e360672 | 246 | |
charlesmn | 0:3ac96e360672 | 247 | /** @defgroup VL53L1_DetectionMode_group Gpio Functionality |
charlesmn | 0:3ac96e360672 | 248 | * @brief Defines conditions leading to device's IT on GPIO |
charlesmn | 0:3ac96e360672 | 249 | * @{ |
charlesmn | 0:3ac96e360672 | 250 | */ |
charlesmn | 0:3ac96e360672 | 251 | typedef uint8_t VL53L1_DetectionMode; |
charlesmn | 0:3ac96e360672 | 252 | |
charlesmn | 0:3ac96e360672 | 253 | #define VL53L1_DETECTION_NORMAL_RUN \ |
charlesmn | 0:3ac96e360672 | 254 | ((VL53L1_DetectionMode) 0) |
charlesmn | 0:3ac96e360672 | 255 | /*!< Trigger interrupt on new measurement regardless of threshold |
charlesmn | 0:3ac96e360672 | 256 | * just like after a VL53L1_SetPresetMode() call |
charlesmn | 0:3ac96e360672 | 257 | */ |
charlesmn | 0:3ac96e360672 | 258 | #define VL53L1_DETECTION_DISTANCE_ONLY \ |
charlesmn | 0:3ac96e360672 | 259 | ((VL53L1_DetectionMode) 1) |
charlesmn | 0:3ac96e360672 | 260 | /*!< Trigger interrupt if "threshold event" occurs on distance */ |
charlesmn | 0:3ac96e360672 | 261 | #define VL53L1_DETECTION_RATE_ONLY \ |
charlesmn | 0:3ac96e360672 | 262 | ((VL53L1_DetectionMode) 2) |
charlesmn | 0:3ac96e360672 | 263 | /*!< Trigger interrupt if "threshold event" occurs on signal rate */ |
charlesmn | 0:3ac96e360672 | 264 | #define VL53L1_DETECTION_DISTANCE_AND_RATE \ |
charlesmn | 0:3ac96e360672 | 265 | ((VL53L1_DetectionMode) 3) |
charlesmn | 0:3ac96e360672 | 266 | /*!< Trigger interrupt if "threshold event" occurs on distance AND rate |
charlesmn | 0:3ac96e360672 | 267 | */ |
charlesmn | 0:3ac96e360672 | 268 | #define VL53L1_DETECTION_DISTANCE_OR_RATE \ |
charlesmn | 0:3ac96e360672 | 269 | ((VL53L1_DetectionMode) 4) |
charlesmn | 0:3ac96e360672 | 270 | /*!< Trigger interrupt if "threshold event" occurs on distance OR rate |
charlesmn | 0:3ac96e360672 | 271 | */ |
charlesmn | 0:3ac96e360672 | 272 | |
charlesmn | 0:3ac96e360672 | 273 | /** @} end of VL53L1_DetectionMode_group */ |
charlesmn | 0:3ac96e360672 | 274 | |
charlesmn | 0:3ac96e360672 | 275 | /** @brief Defines parameters for User/object Detection configuration |
charlesmn | 0:3ac96e360672 | 276 | */ |
charlesmn | 0:3ac96e360672 | 277 | typedef struct { |
charlesmn | 0:3ac96e360672 | 278 | VL53L1_DetectionMode DetectionMode; /*!< See #VL53L1_DetectionMode*/ |
charlesmn | 0:3ac96e360672 | 279 | uint8_t IntrNoTarget; /*!< 1 to trigger IT in case of no target found */ |
charlesmn | 0:3ac96e360672 | 280 | VL53L1_DistanceThreshold_t Distance; /*!< limits in mm */ |
charlesmn | 0:3ac96e360672 | 281 | VL53L1_RateThreshold_t Rate;/*!< limits in FixPoint1616_t */ |
charlesmn | 0:3ac96e360672 | 282 | } VL53L1_DetectionConfig_t; |
charlesmn | 0:3ac96e360672 | 283 | |
charlesmn | 0:3ac96e360672 | 284 | |
charlesmn | 0:3ac96e360672 | 285 | /** @brief Defines all parameters for the device |
charlesmn | 0:3ac96e360672 | 286 | */ |
charlesmn | 0:3ac96e360672 | 287 | typedef struct { |
charlesmn | 0:3ac96e360672 | 288 | VL53L1_PresetModes PresetMode; |
charlesmn | 0:3ac96e360672 | 289 | /*!< Defines the operating mode to be used for the next measure */ |
charlesmn | 0:3ac96e360672 | 290 | VL53L1_OutputModes OutputMode; |
charlesmn | 0:3ac96e360672 | 291 | /*!< Defines the Output mode to be used for the next measure */ |
charlesmn | 0:3ac96e360672 | 292 | VL53L1_DistanceModes DistanceMode; |
charlesmn | 0:3ac96e360672 | 293 | /*!< Defines the operating mode to be used for the next measure */ |
charlesmn | 0:3ac96e360672 | 294 | uint32_t MeasurementTimingBudgetMicroSeconds; |
charlesmn | 0:3ac96e360672 | 295 | /*!< Defines the allowed total time for a single measurement */ |
charlesmn | 0:3ac96e360672 | 296 | uint8_t LimitChecksEnable[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; |
charlesmn | 0:3ac96e360672 | 297 | /*!< This Array store all the Limit Check enable for this device. */ |
charlesmn | 0:3ac96e360672 | 298 | uint8_t LimitChecksStatus[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; |
charlesmn | 0:3ac96e360672 | 299 | /*!< This Array stores all the Status of the check linked to last |
charlesmn | 0:3ac96e360672 | 300 | * measurement. |
charlesmn | 0:3ac96e360672 | 301 | */ |
charlesmn | 0:3ac96e360672 | 302 | FixPoint1616_t LimitChecksValue[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; |
charlesmn | 0:3ac96e360672 | 303 | /*!< This Array stores all the Limit Check value for this device */ |
charlesmn | 0:3ac96e360672 | 304 | FixPoint1616_t LimitChecksCurrent[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS]; |
charlesmn | 0:3ac96e360672 | 305 | /*!< This Array stores all the Limit Check current value from latest |
charlesmn | 0:3ac96e360672 | 306 | * ranging |
charlesmn | 0:3ac96e360672 | 307 | */ |
charlesmn | 0:3ac96e360672 | 308 | } VL53L1_DeviceParameters_t; |
charlesmn | 0:3ac96e360672 | 309 | |
charlesmn | 0:3ac96e360672 | 310 | |
charlesmn | 0:3ac96e360672 | 311 | /** @defgroup VL53L1_define_State_group Defines the current status of the device |
charlesmn | 0:3ac96e360672 | 312 | * Defines the current status of the device |
charlesmn | 0:3ac96e360672 | 313 | * @{ |
charlesmn | 0:3ac96e360672 | 314 | */ |
charlesmn | 0:3ac96e360672 | 315 | |
charlesmn | 0:3ac96e360672 | 316 | typedef uint8_t VL53L1_State; |
charlesmn | 0:3ac96e360672 | 317 | |
charlesmn | 0:3ac96e360672 | 318 | #define VL53L1_STATE_POWERDOWN ((VL53L1_State) 0) |
charlesmn | 0:3ac96e360672 | 319 | /*!< Device is in HW reset */ |
charlesmn | 0:3ac96e360672 | 320 | #define VL53L1_STATE_WAIT_STATICINIT ((VL53L1_State) 1) |
charlesmn | 0:3ac96e360672 | 321 | /*!< Device is initialized and wait for static initialization */ |
charlesmn | 0:3ac96e360672 | 322 | #define VL53L1_STATE_STANDBY ((VL53L1_State) 2) |
charlesmn | 0:3ac96e360672 | 323 | /*!< Device is in Low power Standby mode */ |
charlesmn | 0:3ac96e360672 | 324 | #define VL53L1_STATE_IDLE ((VL53L1_State) 3) |
charlesmn | 0:3ac96e360672 | 325 | /*!< Device has been initialized and ready to do measurements */ |
charlesmn | 0:3ac96e360672 | 326 | #define VL53L1_STATE_RUNNING ((VL53L1_State) 4) |
charlesmn | 0:3ac96e360672 | 327 | /*!< Device is performing measurement */ |
charlesmn | 0:3ac96e360672 | 328 | #define VL53L1_STATE_RESET ((VL53L1_State) 5) |
charlesmn | 0:3ac96e360672 | 329 | /*!< Soft reset has been run on Device */ |
charlesmn | 0:3ac96e360672 | 330 | #define VL53L1_STATE_UNKNOWN ((VL53L1_State) 98) |
charlesmn | 0:3ac96e360672 | 331 | /*!< Device is in unknown state and need to be rebooted */ |
charlesmn | 0:3ac96e360672 | 332 | #define VL53L1_STATE_ERROR ((VL53L1_State) 99) |
charlesmn | 0:3ac96e360672 | 333 | /*!< Device is in error state and need to be rebooted */ |
charlesmn | 0:3ac96e360672 | 334 | |
charlesmn | 0:3ac96e360672 | 335 | /** @} VL53L1_define_State_group */ |
charlesmn | 0:3ac96e360672 | 336 | |
charlesmn | 0:3ac96e360672 | 337 | /** @defgroup VL53L1_define_Smudge_Mode_group Defines smudge correction modes |
charlesmn | 0:3ac96e360672 | 338 | * Defines the smudge correction modes |
charlesmn | 0:3ac96e360672 | 339 | * @{ |
charlesmn | 0:3ac96e360672 | 340 | */ |
charlesmn | 0:3ac96e360672 | 341 | |
charlesmn | 0:3ac96e360672 | 342 | typedef uint8_t VL53L1_SmudgeCorrectionModes; |
charlesmn | 0:3ac96e360672 | 343 | |
charlesmn | 0:3ac96e360672 | 344 | #define VL53L1_SMUDGE_CORRECTION_NONE ((VL53L1_SmudgeCorrectionModes) 0) |
charlesmn | 0:3ac96e360672 | 345 | /*!< Smudge correction is applied continously accross the rangings */ |
charlesmn | 0:3ac96e360672 | 346 | #define VL53L1_SMUDGE_CORRECTION_CONTINUOUS ((VL53L1_SmudgeCorrectionModes) 1) |
charlesmn | 0:3ac96e360672 | 347 | /*!< Smudge correction is applied continously accross the rangings */ |
charlesmn | 0:3ac96e360672 | 348 | #define VL53L1_SMUDGE_CORRECTION_SINGLE ((VL53L1_SmudgeCorrectionModes) 2) |
charlesmn | 0:3ac96e360672 | 349 | /*!< Smudge correction is applied only once accross the rangings */ |
charlesmn | 0:3ac96e360672 | 350 | #define VL53L1_SMUDGE_CORRECTION_DEBUG ((VL53L1_SmudgeCorrectionModes) 3) |
charlesmn | 0:3ac96e360672 | 351 | /*!< Smudge detection is applied continously but Xtalk values are not |
charlesmn | 0:3ac96e360672 | 352 | * updated automatically within the driver |
charlesmn | 0:3ac96e360672 | 353 | */ |
charlesmn | 0:3ac96e360672 | 354 | |
charlesmn | 0:3ac96e360672 | 355 | /** @} VL53L1_define_Smudge_Correction_Mode_group */ |
charlesmn | 0:3ac96e360672 | 356 | |
charlesmn | 0:3ac96e360672 | 357 | |
charlesmn | 0:3ac96e360672 | 358 | /** |
charlesmn | 0:3ac96e360672 | 359 | * @struct VL53L1_RangingMeasurementData_t |
charlesmn | 0:3ac96e360672 | 360 | * @brief Single Range measurement data. |
charlesmn | 0:3ac96e360672 | 361 | */ |
charlesmn | 0:3ac96e360672 | 362 | typedef struct { |
charlesmn | 0:3ac96e360672 | 363 | uint32_t TimeStamp; |
charlesmn | 0:3ac96e360672 | 364 | /*!< 32-bit time stamp. |
charlesmn | 0:3ac96e360672 | 365 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 366 | */ |
charlesmn | 0:3ac96e360672 | 367 | |
charlesmn | 0:3ac96e360672 | 368 | uint8_t StreamCount; |
charlesmn | 0:3ac96e360672 | 369 | /*!< 8-bit Stream Count. */ |
charlesmn | 0:3ac96e360672 | 370 | |
charlesmn | 0:3ac96e360672 | 371 | uint8_t RangeQualityLevel; |
charlesmn | 0:3ac96e360672 | 372 | /*!< indicate a quality level in percentage from 0 to 100 |
charlesmn | 0:3ac96e360672 | 373 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 374 | */ |
charlesmn | 0:3ac96e360672 | 375 | |
charlesmn | 0:3ac96e360672 | 376 | FixPoint1616_t SignalRateRtnMegaCps; |
charlesmn | 0:3ac96e360672 | 377 | /*!< Return signal rate (MCPS)\n these is a 16.16 fix point |
charlesmn | 0:3ac96e360672 | 378 | * value, which is effectively a measure of target |
charlesmn | 0:3ac96e360672 | 379 | * reflectance. |
charlesmn | 0:3ac96e360672 | 380 | */ |
charlesmn | 0:3ac96e360672 | 381 | |
charlesmn | 0:3ac96e360672 | 382 | FixPoint1616_t AmbientRateRtnMegaCps; |
charlesmn | 0:3ac96e360672 | 383 | /*!< Return ambient rate (MCPS)\n these is a 16.16 fix point |
charlesmn | 0:3ac96e360672 | 384 | * value, which is effectively a measure of the ambien |
charlesmn | 0:3ac96e360672 | 385 | * t light. |
charlesmn | 0:3ac96e360672 | 386 | */ |
charlesmn | 0:3ac96e360672 | 387 | |
charlesmn | 0:3ac96e360672 | 388 | uint16_t EffectiveSpadRtnCount; |
charlesmn | 0:3ac96e360672 | 389 | /*!< Return the effective SPAD count for the return signal. |
charlesmn | 0:3ac96e360672 | 390 | * To obtain Real value it should be divided by 256 |
charlesmn | 0:3ac96e360672 | 391 | */ |
charlesmn | 0:3ac96e360672 | 392 | |
charlesmn | 0:3ac96e360672 | 393 | FixPoint1616_t SigmaMilliMeter; |
charlesmn | 0:3ac96e360672 | 394 | /*!< Return the Sigma value in millimeter */ |
charlesmn | 0:3ac96e360672 | 395 | |
charlesmn | 0:3ac96e360672 | 396 | int16_t RangeMilliMeter; |
charlesmn | 0:3ac96e360672 | 397 | /*!< range distance in millimeter. This should be between |
charlesmn | 0:3ac96e360672 | 398 | * RangeMinMilliMeter and RangeMaxMilliMeter |
charlesmn | 0:3ac96e360672 | 399 | */ |
charlesmn | 0:3ac96e360672 | 400 | |
charlesmn | 0:3ac96e360672 | 401 | uint8_t RangeFractionalPart; |
charlesmn | 0:3ac96e360672 | 402 | /*!< Fractional part of range distance. Final value is a |
charlesmn | 0:3ac96e360672 | 403 | * RangeMilliMeter + RangeFractionalPart/256. |
charlesmn | 0:3ac96e360672 | 404 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 405 | */ |
charlesmn | 0:3ac96e360672 | 406 | |
charlesmn | 0:3ac96e360672 | 407 | uint8_t RangeStatus; |
charlesmn | 0:3ac96e360672 | 408 | /*!< Range Status for the current measurement. This is device |
charlesmn | 0:3ac96e360672 | 409 | * dependent. Value = 0 means value is valid. |
charlesmn | 0:3ac96e360672 | 410 | */ |
charlesmn | 0:3ac96e360672 | 411 | } VL53L1_RangingMeasurementData_t; |
charlesmn | 0:3ac96e360672 | 412 | |
charlesmn | 0:3ac96e360672 | 413 | /** |
charlesmn | 0:3ac96e360672 | 414 | * @struct VL53L1_TargetRangeData_t |
charlesmn | 0:3ac96e360672 | 415 | * @brief One Range measurement data for each target. |
charlesmn | 0:3ac96e360672 | 416 | */ |
charlesmn | 0:3ac96e360672 | 417 | typedef struct { |
charlesmn | 0:3ac96e360672 | 418 | uint8_t RangeQualityLevel; |
charlesmn | 0:3ac96e360672 | 419 | /*!< indicate a quality level in percentage from 0 to 100 |
charlesmn | 0:3ac96e360672 | 420 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 421 | */ |
charlesmn | 0:3ac96e360672 | 422 | |
charlesmn | 0:3ac96e360672 | 423 | int16_t RangeMaxMilliMeter; |
charlesmn | 0:3ac96e360672 | 424 | /*!< Tells what is the maximum detection distance of the object |
charlesmn | 0:3ac96e360672 | 425 | * in current setup and environment conditions (Filled when |
charlesmn | 0:3ac96e360672 | 426 | * applicable) |
charlesmn | 0:3ac96e360672 | 427 | */ |
charlesmn | 0:3ac96e360672 | 428 | |
charlesmn | 0:3ac96e360672 | 429 | int16_t RangeMinMilliMeter; |
charlesmn | 0:3ac96e360672 | 430 | /*!< Tells what is the minimum detection distance of the object |
charlesmn | 0:3ac96e360672 | 431 | * in current setup and environment conditions (Filled when |
charlesmn | 0:3ac96e360672 | 432 | * applicable) |
charlesmn | 0:3ac96e360672 | 433 | */ |
charlesmn | 0:3ac96e360672 | 434 | |
charlesmn | 0:3ac96e360672 | 435 | FixPoint1616_t SignalRateRtnMegaCps; |
charlesmn | 0:3ac96e360672 | 436 | /*!< Return signal rate (MCPS)\n these is a 16.16 fix point |
charlesmn | 0:3ac96e360672 | 437 | * value, which is effectively a measure of target |
charlesmn | 0:3ac96e360672 | 438 | * reflectance. |
charlesmn | 0:3ac96e360672 | 439 | */ |
charlesmn | 0:3ac96e360672 | 440 | |
charlesmn | 0:3ac96e360672 | 441 | FixPoint1616_t AmbientRateRtnMegaCps; |
charlesmn | 0:3ac96e360672 | 442 | /*!< Return ambient rate (MCPS)\n these is a 16.16 fix point |
charlesmn | 0:3ac96e360672 | 443 | * value, which is effectively a measure of the ambien |
charlesmn | 0:3ac96e360672 | 444 | * t light. |
charlesmn | 0:3ac96e360672 | 445 | */ |
charlesmn | 0:3ac96e360672 | 446 | |
charlesmn | 0:3ac96e360672 | 447 | FixPoint1616_t SigmaMilliMeter; |
charlesmn | 0:3ac96e360672 | 448 | /*!< Return the Sigma value in millimeter */ |
charlesmn | 0:3ac96e360672 | 449 | |
charlesmn | 0:3ac96e360672 | 450 | int16_t RangeMilliMeter; |
charlesmn | 0:3ac96e360672 | 451 | /*!< range distance in millimeter. This should be between |
charlesmn | 0:3ac96e360672 | 452 | * RangeMinMilliMeter and RangeMaxMilliMeter |
charlesmn | 0:3ac96e360672 | 453 | */ |
charlesmn | 0:3ac96e360672 | 454 | |
charlesmn | 0:3ac96e360672 | 455 | uint8_t RangeFractionalPart; |
charlesmn | 0:3ac96e360672 | 456 | /*!< Fractional part of range distance. Final value is a |
charlesmn | 0:3ac96e360672 | 457 | * RangeMilliMeter + RangeFractionalPart/256. |
charlesmn | 0:3ac96e360672 | 458 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 459 | */ |
charlesmn | 0:3ac96e360672 | 460 | |
charlesmn | 0:3ac96e360672 | 461 | uint8_t RangeStatus; |
charlesmn | 0:3ac96e360672 | 462 | /*!< Range Status for the current measurement. This is device |
charlesmn | 0:3ac96e360672 | 463 | * dependent. Value = 0 means value is valid. |
charlesmn | 0:3ac96e360672 | 464 | */ |
charlesmn | 0:3ac96e360672 | 465 | |
charlesmn | 0:3ac96e360672 | 466 | uint8_t ExtendedRange; |
charlesmn | 0:3ac96e360672 | 467 | /*!< Extended range flag for the current measurement. |
charlesmn | 0:3ac96e360672 | 468 | * Value = 1 means timings A&B are combined to increase the |
charlesmn | 0:3ac96e360672 | 469 | * maximum distance range. |
charlesmn | 0:3ac96e360672 | 470 | */ |
charlesmn | 0:3ac96e360672 | 471 | } VL53L1_TargetRangeData_t; |
charlesmn | 0:3ac96e360672 | 472 | /** |
charlesmn | 0:3ac96e360672 | 473 | * @struct VL53L1_MultiRangingData_t |
charlesmn | 0:3ac96e360672 | 474 | * @brief Structure for storing the set of range results for a single ROI |
charlesmn | 0:3ac96e360672 | 475 | * |
charlesmn | 0:3ac96e360672 | 476 | */ |
charlesmn | 0:3ac96e360672 | 477 | typedef struct { |
charlesmn | 0:3ac96e360672 | 478 | uint32_t TimeStamp; |
charlesmn | 0:3ac96e360672 | 479 | /*!< 32-bit time stamp. |
charlesmn | 0:3ac96e360672 | 480 | * @warning Not yet implemented |
charlesmn | 0:3ac96e360672 | 481 | */ |
charlesmn | 0:3ac96e360672 | 482 | |
charlesmn | 0:3ac96e360672 | 483 | uint8_t StreamCount; |
charlesmn | 0:3ac96e360672 | 484 | /*!< 8-bit Stream Count. */ |
charlesmn | 0:3ac96e360672 | 485 | |
charlesmn | 0:3ac96e360672 | 486 | uint8_t RoiNumber; |
charlesmn | 0:3ac96e360672 | 487 | /*!< Denotes on which ROI the range data is related to. */ |
charlesmn | 0:3ac96e360672 | 488 | uint8_t NumberOfObjectsFound; |
charlesmn | 0:3ac96e360672 | 489 | /*!< Indicate the number of objects found in the current ROI. |
charlesmn | 0:3ac96e360672 | 490 | * This is used to know how many ranging data should be get. |
charlesmn | 0:3ac96e360672 | 491 | * NumberOfObjectsFound is in the range 0 to |
charlesmn | 0:3ac96e360672 | 492 | * VL53L1_MAX_RANGE_RESULTS. |
charlesmn | 0:3ac96e360672 | 493 | */ |
charlesmn | 0:3ac96e360672 | 494 | VL53L1_RoiStatus RoiStatus; |
charlesmn | 0:3ac96e360672 | 495 | /*!< Indicate if the data read is valid or not or if this is |
charlesmn | 0:3ac96e360672 | 496 | * the last valid data in the ROI. |
charlesmn | 0:3ac96e360672 | 497 | */ |
charlesmn | 0:3ac96e360672 | 498 | VL53L1_TargetRangeData_t RangeData[VL53L1_MAX_RANGE_RESULTS]; |
charlesmn | 0:3ac96e360672 | 499 | /*!< Range data each target distance */ |
charlesmn | 0:3ac96e360672 | 500 | uint8_t HasXtalkValueChanged; |
charlesmn | 0:3ac96e360672 | 501 | /*!< set to 1 if a new Xtalk value has been computed whilst |
charlesmn | 0:3ac96e360672 | 502 | * smudge correction mode enable by with |
charlesmn | 0:3ac96e360672 | 503 | * VL53L1_SmudgeCorrectionEnable() function is either |
charlesmn | 0:3ac96e360672 | 504 | * VL53L1_SMUDGE_CORRECTION_CONTINUOUS or |
charlesmn | 0:3ac96e360672 | 505 | * VL53L1_SMUDGE_CORRECTION_SINGLE. |
charlesmn | 0:3ac96e360672 | 506 | */ |
charlesmn | 0:3ac96e360672 | 507 | uint16_t EffectiveSpadRtnCount; |
charlesmn | 0:3ac96e360672 | 508 | /*!< Return the effective SPAD count for the return signal. |
charlesmn | 0:3ac96e360672 | 509 | * To obtain Real value it should be divided by 256 |
charlesmn | 0:3ac96e360672 | 510 | */ |
charlesmn | 0:3ac96e360672 | 511 | int16_t DmaxMilliMeter; |
charlesmn | 0:3ac96e360672 | 512 | /*!< range Dmax distance in millimeter. |
charlesmn | 0:3ac96e360672 | 513 | */ |
charlesmn | 0:3ac96e360672 | 514 | VL53L1_DistanceModes RecommendedDistanceMode; |
charlesmn | 0:3ac96e360672 | 515 | /*!< suggestion for a better distance mode choice to improve |
charlesmn | 0:3ac96e360672 | 516 | * range accuracy. |
charlesmn | 0:3ac96e360672 | 517 | */ |
charlesmn | 0:3ac96e360672 | 518 | } VL53L1_MultiRangingData_t; |
charlesmn | 0:3ac96e360672 | 519 | |
charlesmn | 0:3ac96e360672 | 520 | |
charlesmn | 0:3ac96e360672 | 521 | /** @brief Defines User Zone(ROI) parameters |
charlesmn | 0:3ac96e360672 | 522 | * |
charlesmn | 0:3ac96e360672 | 523 | */ |
charlesmn | 0:3ac96e360672 | 524 | typedef struct { |
charlesmn | 0:3ac96e360672 | 525 | |
charlesmn | 0:3ac96e360672 | 526 | uint8_t TopLeftX; /*!< Top Left x coordinate: 0-15 range */ |
charlesmn | 0:3ac96e360672 | 527 | uint8_t TopLeftY; /*!< Top Left y coordinate: 0-15 range */ |
charlesmn | 0:3ac96e360672 | 528 | uint8_t BotRightX; /*!< Bot Right x coordinate: 0-15 range */ |
charlesmn | 0:3ac96e360672 | 529 | uint8_t BotRightY; /*!< Bot Right y coordinate: 0-15 range */ |
charlesmn | 0:3ac96e360672 | 530 | |
charlesmn | 0:3ac96e360672 | 531 | } VL53L1_UserRoi_t; |
charlesmn | 0:3ac96e360672 | 532 | |
charlesmn | 0:3ac96e360672 | 533 | |
charlesmn | 0:3ac96e360672 | 534 | /** @brief Defines ROI configuration parameters |
charlesmn | 0:3ac96e360672 | 535 | * |
charlesmn | 0:3ac96e360672 | 536 | * Support up a max of 16 zones, Each Zone has the same size |
charlesmn | 0:3ac96e360672 | 537 | * |
charlesmn | 0:3ac96e360672 | 538 | */ |
charlesmn | 0:3ac96e360672 | 539 | typedef struct { |
charlesmn | 0:3ac96e360672 | 540 | |
charlesmn | 0:3ac96e360672 | 541 | uint8_t NumberOfRoi; /*!< Number of Rois defined*/ |
charlesmn | 0:3ac96e360672 | 542 | |
charlesmn | 0:3ac96e360672 | 543 | VL53L1_UserRoi_t UserRois[VL53L1_MAX_USER_ZONES]; |
charlesmn | 0:3ac96e360672 | 544 | /*!< List of Rois */ |
charlesmn | 0:3ac96e360672 | 545 | |
charlesmn | 0:3ac96e360672 | 546 | } VL53L1_RoiConfig_t; |
charlesmn | 0:3ac96e360672 | 547 | |
charlesmn | 0:3ac96e360672 | 548 | /** |
charlesmn | 0:3ac96e360672 | 549 | * @struct VL53L1_CustomerNvmManaged_t |
charlesmn | 0:3ac96e360672 | 550 | * |
charlesmn | 0:3ac96e360672 | 551 | */ |
charlesmn | 0:3ac96e360672 | 552 | |
charlesmn | 0:3ac96e360672 | 553 | typedef struct { |
charlesmn | 0:3ac96e360672 | 554 | uint8_t global_config__spad_enables_ref_0; |
charlesmn | 0:3ac96e360672 | 555 | uint8_t global_config__spad_enables_ref_1; |
charlesmn | 0:3ac96e360672 | 556 | uint8_t global_config__spad_enables_ref_2; |
charlesmn | 0:3ac96e360672 | 557 | uint8_t global_config__spad_enables_ref_3; |
charlesmn | 0:3ac96e360672 | 558 | uint8_t global_config__spad_enables_ref_4; |
charlesmn | 0:3ac96e360672 | 559 | uint8_t global_config__spad_enables_ref_5; |
charlesmn | 0:3ac96e360672 | 560 | uint8_t global_config__ref_en_start_select; |
charlesmn | 0:3ac96e360672 | 561 | uint8_t ref_spad_man__num_requested_ref_spads; |
charlesmn | 0:3ac96e360672 | 562 | uint8_t ref_spad_man__ref_location; |
charlesmn | 0:3ac96e360672 | 563 | uint32_t algo__crosstalk_compensation_plane_offset_kcps; |
charlesmn | 0:3ac96e360672 | 564 | int16_t algo__crosstalk_compensation_x_plane_gradient_kcps; |
charlesmn | 0:3ac96e360672 | 565 | int16_t algo__crosstalk_compensation_y_plane_gradient_kcps; |
charlesmn | 0:3ac96e360672 | 566 | uint16_t ref_spad_char__total_rate_target_mcps; |
charlesmn | 0:3ac96e360672 | 567 | int16_t algo__part_to_part_range_offset_mm; |
charlesmn | 0:3ac96e360672 | 568 | int16_t mm_config__inner_offset_mm; |
charlesmn | 0:3ac96e360672 | 569 | int16_t mm_config__outer_offset_mm; |
charlesmn | 0:3ac96e360672 | 570 | } VL53L1_CustomerNvmManaged_t; |
charlesmn | 0:3ac96e360672 | 571 | |
charlesmn | 0:3ac96e360672 | 572 | /** |
charlesmn | 0:3ac96e360672 | 573 | * @struct VL53L1_CalibrationData_t |
charlesmn | 0:3ac96e360672 | 574 | * @brief Structure for storing the Calibration Data |
charlesmn | 0:3ac96e360672 | 575 | * |
charlesmn | 0:3ac96e360672 | 576 | */ |
charlesmn | 0:3ac96e360672 | 577 | |
charlesmn | 0:3ac96e360672 | 578 | typedef struct { |
charlesmn | 0:3ac96e360672 | 579 | |
charlesmn | 0:3ac96e360672 | 580 | uint32_t struct_version; |
charlesmn | 0:3ac96e360672 | 581 | VL53L1_CustomerNvmManaged_t customer; |
charlesmn | 0:3ac96e360672 | 582 | VL53L1_dmax_calibration_data_t fmt_dmax_cal; |
charlesmn | 0:3ac96e360672 | 583 | VL53L1_dmax_calibration_data_t cust_dmax_cal; |
charlesmn | 0:3ac96e360672 | 584 | VL53L1_additional_offset_cal_data_t add_off_cal_data; |
charlesmn | 0:3ac96e360672 | 585 | VL53L1_optical_centre_t optical_centre; |
charlesmn | 0:3ac96e360672 | 586 | VL53L1_xtalk_histogram_data_t xtalkhisto; |
charlesmn | 0:3ac96e360672 | 587 | VL53L1_gain_calibration_data_t gain_cal; |
charlesmn | 0:3ac96e360672 | 588 | VL53L1_cal_peak_rate_map_t cal_peak_rate_map; |
charlesmn | 0:3ac96e360672 | 589 | VL53L1_per_vcsel_period_offset_cal_data_t per_vcsel_cal_data; |
charlesmn | 0:3ac96e360672 | 590 | uint32_t algo__xtalk_cpo_HistoMerge_kcps[VL53L1_BIN_REC_SIZE]; |
charlesmn | 0:3ac96e360672 | 591 | } VL53L1_CalibrationData_t; |
charlesmn | 0:3ac96e360672 | 592 | |
charlesmn | 0:3ac96e360672 | 593 | #define VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION 0x20 |
charlesmn | 0:3ac96e360672 | 594 | /** VL53L1 additional Calibration Data struct version final struct version |
charlesmn | 0:3ac96e360672 | 595 | * is given by adding it to VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION |
charlesmn | 0:3ac96e360672 | 596 | */ |
charlesmn | 0:3ac96e360672 | 597 | |
charlesmn | 0:3ac96e360672 | 598 | #define VL53L1_CALIBRATION_DATA_STRUCT_VERSION \ |
charlesmn | 0:3ac96e360672 | 599 | (VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION + \ |
charlesmn | 0:3ac96e360672 | 600 | VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION) |
charlesmn | 0:3ac96e360672 | 601 | /* VL53L1 Calibration Data struct version */ |
charlesmn | 0:3ac96e360672 | 602 | |
charlesmn | 0:3ac96e360672 | 603 | /** |
charlesmn | 0:3ac96e360672 | 604 | * @struct VL53L1_AdditionalData_t |
charlesmn | 0:3ac96e360672 | 605 | * @brief Structure for storing the Additional Data |
charlesmn | 0:3ac96e360672 | 606 | * |
charlesmn | 0:3ac96e360672 | 607 | */ |
charlesmn | 0:3ac96e360672 | 608 | typedef VL53L1_additional_data_t VL53L1_AdditionalData_t; |
charlesmn | 0:3ac96e360672 | 609 | |
charlesmn | 0:3ac96e360672 | 610 | /** |
charlesmn | 0:3ac96e360672 | 611 | * @struct VL53L1_ZoneCalibrationData_t |
charlesmn | 0:3ac96e360672 | 612 | * @brief Structure for storing the Zone Calibration Data |
charlesmn | 0:3ac96e360672 | 613 | * |
charlesmn | 0:3ac96e360672 | 614 | */ |
charlesmn | 0:3ac96e360672 | 615 | typedef VL53L1_zone_calibration_results_t VL53L1_ZoneCalibrationData_t; |
charlesmn | 0:3ac96e360672 | 616 | |
charlesmn | 0:3ac96e360672 | 617 | /** @defgroup VL53L1_define_SequenceStepId_group Defines the SequenceStep |
charlesmn | 0:3ac96e360672 | 618 | * Defines the the sequence steps performed during ranging.. |
charlesmn | 0:3ac96e360672 | 619 | * @{ |
charlesmn | 0:3ac96e360672 | 620 | */ |
charlesmn | 0:3ac96e360672 | 621 | typedef uint8_t VL53L1_SequenceStepId; |
charlesmn | 0:3ac96e360672 | 622 | |
charlesmn | 0:3ac96e360672 | 623 | #define VL53L1_SEQUENCESTEP_VHV ((VL53L1_SequenceStepId) 0) |
charlesmn | 0:3ac96e360672 | 624 | /*!<VHV. */ |
charlesmn | 0:3ac96e360672 | 625 | #define VL53L1_SEQUENCESTEP_PHASECAL ((VL53L1_SequenceStepId) 1) |
charlesmn | 0:3ac96e360672 | 626 | /*!<Phase Calibration. */ |
charlesmn | 0:3ac96e360672 | 627 | #define VL53L1_SEQUENCESTEP_REFPHASE ((VL53L1_SequenceStepId) 2) |
charlesmn | 0:3ac96e360672 | 628 | /*!<Reference Phase. */ |
charlesmn | 0:3ac96e360672 | 629 | #define VL53L1_SEQUENCESTEP_DSS1 ((VL53L1_SequenceStepId) 3) |
charlesmn | 0:3ac96e360672 | 630 | /*!<DSS1. */ |
charlesmn | 0:3ac96e360672 | 631 | #define VL53L1_SEQUENCESTEP_DSS2 ((VL53L1_SequenceStepId) 4) |
charlesmn | 0:3ac96e360672 | 632 | /*!<DSS2. */ |
charlesmn | 0:3ac96e360672 | 633 | #define VL53L1_SEQUENCESTEP_MM1 ((VL53L1_SequenceStepId) 5) |
charlesmn | 0:3ac96e360672 | 634 | /*!<Mode Mitigation 1. */ |
charlesmn | 0:3ac96e360672 | 635 | #define VL53L1_SEQUENCESTEP_MM2 ((VL53L1_SequenceStepId) 6) |
charlesmn | 0:3ac96e360672 | 636 | /*!<Mode Mitigation 2. */ |
charlesmn | 0:3ac96e360672 | 637 | #define VL53L1_SEQUENCESTEP_RANGE ((VL53L1_SequenceStepId) 7) |
charlesmn | 0:3ac96e360672 | 638 | /*!<Final Range step. */ |
charlesmn | 0:3ac96e360672 | 639 | |
charlesmn | 0:3ac96e360672 | 640 | #define VL53L1_SEQUENCESTEP_NUMBER_OF_ITEMS 8 |
charlesmn | 0:3ac96e360672 | 641 | /*!<Number of Sequence Step Managed by the API. */ |
charlesmn | 0:3ac96e360672 | 642 | |
charlesmn | 0:3ac96e360672 | 643 | /** @} VL53L1_define_SequenceStepId_group */ |
charlesmn | 0:3ac96e360672 | 644 | |
charlesmn | 0:3ac96e360672 | 645 | /** @defgroup VL53L1_define_RangeStatus_group Defines the Range Status |
charlesmn | 0:3ac96e360672 | 646 | * @{ |
charlesmn | 0:3ac96e360672 | 647 | */ |
charlesmn | 0:3ac96e360672 | 648 | #define VL53L1_RANGESTATUS_RANGE_VALID 0 |
charlesmn | 0:3ac96e360672 | 649 | /*!<The Range is valid. */ |
charlesmn | 0:3ac96e360672 | 650 | #define VL53L1_RANGESTATUS_SIGMA_FAIL 1 |
charlesmn | 0:3ac96e360672 | 651 | /*!<Sigma Fail. */ |
charlesmn | 0:3ac96e360672 | 652 | #define VL53L1_RANGESTATUS_SIGNAL_FAIL 2 |
charlesmn | 0:3ac96e360672 | 653 | /*!<Signal fail. */ |
charlesmn | 0:3ac96e360672 | 654 | #define VL53L1_RANGESTATUS_RANGE_VALID_MIN_RANGE_CLIPPED 3 |
charlesmn | 0:3ac96e360672 | 655 | /*!<Target is below minimum detection threshold. */ |
charlesmn | 0:3ac96e360672 | 656 | #define VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL 4 |
charlesmn | 0:3ac96e360672 | 657 | /*!<Phase out of valid limits - different to a wrap exit. */ |
charlesmn | 0:3ac96e360672 | 658 | #define VL53L1_RANGESTATUS_HARDWARE_FAIL 5 |
charlesmn | 0:3ac96e360672 | 659 | /*!<Hardware fail. */ |
charlesmn | 0:3ac96e360672 | 660 | #define VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL 6 |
charlesmn | 0:3ac96e360672 | 661 | /*!<The Range is valid but the wraparound check has not been done. */ |
charlesmn | 0:3ac96e360672 | 662 | #define VL53L1_RANGESTATUS_WRAP_TARGET_FAIL 7 |
charlesmn | 0:3ac96e360672 | 663 | /*!<Wrapped target - no matching phase in other VCSEL period timing. */ |
charlesmn | 0:3ac96e360672 | 664 | #define VL53L1_RANGESTATUS_PROCESSING_FAIL 8 |
charlesmn | 0:3ac96e360672 | 665 | /*!<Internal algo underflow or overflow in lite ranging. */ |
charlesmn | 0:3ac96e360672 | 666 | #define VL53L1_RANGESTATUS_XTALK_SIGNAL_FAIL 9 |
charlesmn | 0:3ac96e360672 | 667 | /*!<Specific to lite ranging. */ |
charlesmn | 0:3ac96e360672 | 668 | #define VL53L1_RANGESTATUS_SYNCRONISATION_INT 10 |
charlesmn | 0:3ac96e360672 | 669 | /*!<1st interrupt when starting ranging in back to back mode. Ignore data. */ |
charlesmn | 0:3ac96e360672 | 670 | #define VL53L1_RANGESTATUS_RANGE_VALID_MERGED_PULSE 11 |
charlesmn | 0:3ac96e360672 | 671 | /*!<All Range ok but object is result of multiple pulses merging together. |
charlesmn | 0:3ac96e360672 | 672 | * Used by RQL for merged pulse detection |
charlesmn | 0:3ac96e360672 | 673 | */ |
charlesmn | 0:3ac96e360672 | 674 | #define VL53L1_RANGESTATUS_TARGET_PRESENT_LACK_OF_SIGNAL 12 |
charlesmn | 0:3ac96e360672 | 675 | /*!<Used by RQL as different to phase fail. */ |
charlesmn | 0:3ac96e360672 | 676 | #define VL53L1_RANGESTATUS_MIN_RANGE_FAIL 13 |
charlesmn | 0:3ac96e360672 | 677 | /*!<User ROI input is not valid e.g. beyond SPAD Array.*/ |
charlesmn | 0:3ac96e360672 | 678 | #define VL53L1_RANGESTATUS_RANGE_INVALID 14 |
charlesmn | 0:3ac96e360672 | 679 | /*!<lld returned valid range but negative value ! */ |
charlesmn | 0:3ac96e360672 | 680 | #define VL53L1_RANGESTATUS_NONE 255 |
charlesmn | 0:3ac96e360672 | 681 | /*!<No Update. */ |
charlesmn | 0:3ac96e360672 | 682 | |
charlesmn | 0:3ac96e360672 | 683 | /** @} VL53L1_define_RangeStatus_group */ |
charlesmn | 0:3ac96e360672 | 684 | |
charlesmn | 0:3ac96e360672 | 685 | |
charlesmn | 0:3ac96e360672 | 686 | /** @brief Contains the Internal data of the Bare Driver |
charlesmn | 0:3ac96e360672 | 687 | */ |
charlesmn | 0:3ac96e360672 | 688 | |
charlesmn | 0:3ac96e360672 | 689 | typedef struct { |
charlesmn | 0:3ac96e360672 | 690 | VL53L1_LLDriverData_t LLData; |
charlesmn | 0:3ac96e360672 | 691 | /*!< Low Level Driver data structure */ |
charlesmn | 0:3ac96e360672 | 692 | |
charlesmn | 0:3ac96e360672 | 693 | VL53L1_LLDriverResults_t llresults; |
charlesmn | 0:3ac96e360672 | 694 | /*!< Low Level Driver data structure */ |
charlesmn | 0:3ac96e360672 | 695 | |
charlesmn | 0:3ac96e360672 | 696 | VL53L1_State PalState; /* Store the pal state */ |
charlesmn | 0:3ac96e360672 | 697 | VL53L1_DeviceParameters_t CurrentParameters; |
charlesmn | 0:3ac96e360672 | 698 | /*!< Current Device Parameter */ |
charlesmn | 0:3ac96e360672 | 699 | |
charlesmn | 0:3ac96e360672 | 700 | } VL53L1_DevData_t; |
charlesmn | 0:3ac96e360672 | 701 | |
charlesmn | 0:3ac96e360672 | 702 | |
charlesmn | 0:3ac96e360672 | 703 | /* MACRO Definitions */ |
charlesmn | 0:3ac96e360672 | 704 | /** @defgroup VL53L1_define_GeneralMacro_group General Macro Defines |
charlesmn | 0:3ac96e360672 | 705 | * General Macro Defines |
charlesmn | 0:3ac96e360672 | 706 | * @{ |
charlesmn | 0:3ac96e360672 | 707 | */ |
charlesmn | 0:3ac96e360672 | 708 | |
charlesmn | 0:3ac96e360672 | 709 | /* Defines */ |
charlesmn | 0:3ac96e360672 | 710 | #define VL53L1_SETPARAMETERFIELD(Dev, field, value) \ |
charlesmn | 0:3ac96e360672 | 711 | (VL53L1DevDataSet(Dev, CurrentParameters.field, value)) |
charlesmn | 0:3ac96e360672 | 712 | |
charlesmn | 0:3ac96e360672 | 713 | #define VL53L1_GETPARAMETERFIELD(Dev, field, variable) \ |
charlesmn | 0:3ac96e360672 | 714 | (variable = VL53L1DevDataGet(Dev, CurrentParameters).field) |
charlesmn | 0:3ac96e360672 | 715 | |
charlesmn | 0:3ac96e360672 | 716 | |
charlesmn | 0:3ac96e360672 | 717 | #define VL53L1_SETARRAYPARAMETERFIELD(Dev, field, index, value) \ |
charlesmn | 0:3ac96e360672 | 718 | (VL53L1DevDataSet(Dev, CurrentParameters.field[index], value)) |
charlesmn | 0:3ac96e360672 | 719 | |
charlesmn | 0:3ac96e360672 | 720 | #define VL53L1_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \ |
charlesmn | 0:3ac96e360672 | 721 | (variable = VL53L1DevDataGet(Dev, CurrentParameters).field[index]) |
charlesmn | 0:3ac96e360672 | 722 | |
charlesmn | 0:3ac96e360672 | 723 | |
charlesmn | 0:3ac96e360672 | 724 | #define VL53L1_SETDEVICESPECIFICPARAMETER(Dev, field, value) \ |
charlesmn | 0:3ac96e360672 | 725 | (VL53L1DevDataSet(Dev, DeviceSpecificParameters.field, value)) |
charlesmn | 0:3ac96e360672 | 726 | |
charlesmn | 0:3ac96e360672 | 727 | #define VL53L1_GETDEVICESPECIFICPARAMETER(Dev, field) \ |
charlesmn | 0:3ac96e360672 | 728 | (VL53L1DevDataGet(Dev, DeviceSpecificParameters).field) |
charlesmn | 0:3ac96e360672 | 729 | |
charlesmn | 0:3ac96e360672 | 730 | |
charlesmn | 0:3ac96e360672 | 731 | #define VL53L1_FIXPOINT1616TOFIXPOINT44(Value) \ |
charlesmn | 0:3ac96e360672 | 732 | (uint16_t)((Value>>12)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 733 | #define VL53L1_FIXPOINT44TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 734 | (FixPoint1616_t)((uint32_t)Value<<12) |
charlesmn | 0:3ac96e360672 | 735 | |
charlesmn | 0:3ac96e360672 | 736 | #define VL53L1_FIXPOINT1616TOFIXPOINT72(Value) \ |
charlesmn | 0:3ac96e360672 | 737 | (uint16_t)((Value>>14)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 738 | #define VL53L1_FIXPOINT72TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 739 | (FixPoint1616_t)((uint32_t)Value<<14) |
charlesmn | 0:3ac96e360672 | 740 | |
charlesmn | 0:3ac96e360672 | 741 | #define VL53L1_FIXPOINT1616TOFIXPOINT97(Value) \ |
charlesmn | 0:3ac96e360672 | 742 | (uint16_t)((Value>>9)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 743 | #define VL53L1_FIXPOINT97TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 744 | (FixPoint1616_t)((uint32_t)Value<<9) |
charlesmn | 0:3ac96e360672 | 745 | |
charlesmn | 0:3ac96e360672 | 746 | #define VL53L1_FIXPOINT1616TOFIXPOINT88(Value) \ |
charlesmn | 0:3ac96e360672 | 747 | (uint16_t)((Value>>8)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 748 | #define VL53L1_FIXPOINT88TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 749 | (FixPoint1616_t)((uint32_t)Value<<8) |
charlesmn | 0:3ac96e360672 | 750 | |
charlesmn | 0:3ac96e360672 | 751 | #define VL53L1_FIXPOINT1616TOFIXPOINT412(Value) \ |
charlesmn | 0:3ac96e360672 | 752 | (uint16_t)((Value>>4)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 753 | #define VL53L1_FIXPOINT412TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 754 | (FixPoint1616_t)((uint32_t)Value<<4) |
charlesmn | 0:3ac96e360672 | 755 | |
charlesmn | 0:3ac96e360672 | 756 | #define VL53L1_FIXPOINT1616TOFIXPOINT313(Value) \ |
charlesmn | 0:3ac96e360672 | 757 | (uint16_t)((Value>>3)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 758 | #define VL53L1_FIXPOINT313TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 759 | (FixPoint1616_t)((uint32_t)Value<<3) |
charlesmn | 0:3ac96e360672 | 760 | |
charlesmn | 0:3ac96e360672 | 761 | #define VL53L1_FIXPOINT1616TOFIXPOINT08(Value) \ |
charlesmn | 0:3ac96e360672 | 762 | (uint8_t)((Value>>8)&0x00FF) |
charlesmn | 0:3ac96e360672 | 763 | #define VL53L1_FIXPOINT08TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 764 | (FixPoint1616_t)((uint32_t)Value<<8) |
charlesmn | 0:3ac96e360672 | 765 | |
charlesmn | 0:3ac96e360672 | 766 | #define VL53L1_FIXPOINT1616TOFIXPOINT53(Value) \ |
charlesmn | 0:3ac96e360672 | 767 | (uint8_t)((Value>>13)&0x00FF) |
charlesmn | 0:3ac96e360672 | 768 | #define VL53L1_FIXPOINT53TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 769 | (FixPoint1616_t)((uint32_t)Value<<13) |
charlesmn | 0:3ac96e360672 | 770 | |
charlesmn | 0:3ac96e360672 | 771 | #define VL53L1_FIXPOINT1616TOFIXPOINT102(Value) \ |
charlesmn | 0:3ac96e360672 | 772 | (uint16_t)((Value>>14)&0x0FFF) |
charlesmn | 0:3ac96e360672 | 773 | #define VL53L1_FIXPOINT102TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 774 | (FixPoint1616_t)((uint32_t)Value<<14) |
charlesmn | 0:3ac96e360672 | 775 | |
charlesmn | 0:3ac96e360672 | 776 | #define VL53L1_FIXPOINT1616TOFIXPOINT142(Value) \ |
charlesmn | 0:3ac96e360672 | 777 | (uint16_t)((Value>>14)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 778 | #define VL53L1_FIXPOINT142TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 779 | (FixPoint1616_t)((uint32_t)Value<<14) |
charlesmn | 0:3ac96e360672 | 780 | |
charlesmn | 0:3ac96e360672 | 781 | #define VL53L1_FIXPOINT1616TOFIXPOINT160(Value) \ |
charlesmn | 0:3ac96e360672 | 782 | (uint16_t)((Value>>16)&0xFFFF) |
charlesmn | 0:3ac96e360672 | 783 | #define VL53L1_FIXPOINT160TOFIXPOINT1616(Value) \ |
charlesmn | 0:3ac96e360672 | 784 | (FixPoint1616_t)((uint32_t)Value<<16) |
charlesmn | 0:3ac96e360672 | 785 | |
charlesmn | 0:3ac96e360672 | 786 | #define VL53L1_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \ |
charlesmn | 0:3ac96e360672 | 787 | (uint16_t)lsb) |
charlesmn | 0:3ac96e360672 | 788 | |
charlesmn | 0:3ac96e360672 | 789 | #ifndef SUPPRESS_UNUSED_WARNING |
charlesmn | 0:3ac96e360672 | 790 | #define SUPPRESS_UNUSED_WARNING(x) ((void) (x)) |
charlesmn | 0:3ac96e360672 | 791 | #endif |
charlesmn | 0:3ac96e360672 | 792 | |
charlesmn | 0:3ac96e360672 | 793 | /** @} VL53L1_define_GeneralMacro_group */ |
charlesmn | 0:3ac96e360672 | 794 | |
charlesmn | 0:3ac96e360672 | 795 | /** @} VL53L1_globaldefine_group */ |
charlesmn | 0:3ac96e360672 | 796 | |
charlesmn | 0:3ac96e360672 | 797 | |
charlesmn | 0:3ac96e360672 | 798 | |
charlesmn | 0:3ac96e360672 | 799 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 800 | } |
charlesmn | 0:3ac96e360672 | 801 | #endif |
charlesmn | 0:3ac96e360672 | 802 | |
charlesmn | 0:3ac96e360672 | 803 | |
charlesmn | 0:3ac96e360672 | 804 | #endif /* _VL53L1_DEF_H_ */ |