hh
Dependencies: VL6180x X_NUCLEO_COMMON X_NUCLEO_IHM01A1 mbed
Fork of 1-DoorCloser_jor by
VL6180X/vl6180x_def.h@0:1cb50d31c3b5, 2016-03-25 (annotated)
- Committer:
- julientiron
- Date:
- Fri Mar 25 21:27:03 2016 +0000
- Revision:
- 0:1cb50d31c3b5
Code petit robot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
julientiron | 0:1cb50d31c3b5 | 1 | /******************************************************************************* |
julientiron | 0:1cb50d31c3b5 | 2 | Copyright © 2014, STMicroelectronics International N.V. |
julientiron | 0:1cb50d31c3b5 | 3 | All rights reserved. |
julientiron | 0:1cb50d31c3b5 | 4 | |
julientiron | 0:1cb50d31c3b5 | 5 | Redistribution and use in source and binary forms, with or without |
julientiron | 0:1cb50d31c3b5 | 6 | modification, are permitted provided that the following conditions are met: |
julientiron | 0:1cb50d31c3b5 | 7 | * Redistributions of source code must retain the above copyright |
julientiron | 0:1cb50d31c3b5 | 8 | notice, this list of conditions and the following disclaimer. |
julientiron | 0:1cb50d31c3b5 | 9 | * Redistributions in binary form must reproduce the above copyright |
julientiron | 0:1cb50d31c3b5 | 10 | notice, this list of conditions and the following disclaimer in the |
julientiron | 0:1cb50d31c3b5 | 11 | documentation and/or other materials provided with the distribution. |
julientiron | 0:1cb50d31c3b5 | 12 | * Neither the name of STMicroelectronics nor the |
julientiron | 0:1cb50d31c3b5 | 13 | names of its contributors may be used to endorse or promote products |
julientiron | 0:1cb50d31c3b5 | 14 | derived from this software without specific prior written permission. |
julientiron | 0:1cb50d31c3b5 | 15 | |
julientiron | 0:1cb50d31c3b5 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
julientiron | 0:1cb50d31c3b5 | 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
julientiron | 0:1cb50d31c3b5 | 18 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND |
julientiron | 0:1cb50d31c3b5 | 19 | NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. |
julientiron | 0:1cb50d31c3b5 | 20 | IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY |
julientiron | 0:1cb50d31c3b5 | 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
julientiron | 0:1cb50d31c3b5 | 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
julientiron | 0:1cb50d31c3b5 | 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
julientiron | 0:1cb50d31c3b5 | 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
julientiron | 0:1cb50d31c3b5 | 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
julientiron | 0:1cb50d31c3b5 | 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
julientiron | 0:1cb50d31c3b5 | 27 | ********************************************************************************/ |
julientiron | 0:1cb50d31c3b5 | 28 | |
julientiron | 0:1cb50d31c3b5 | 29 | /* |
julientiron | 0:1cb50d31c3b5 | 30 | * $Date: 2015-05-13 14:12:05 +0200 (Wed, 13 May 2015) $ |
julientiron | 0:1cb50d31c3b5 | 31 | * $Revision: 2290 $ |
julientiron | 0:1cb50d31c3b5 | 32 | */ |
julientiron | 0:1cb50d31c3b5 | 33 | |
julientiron | 0:1cb50d31c3b5 | 34 | /** |
julientiron | 0:1cb50d31c3b5 | 35 | * @file VL6180x_def.h |
julientiron | 0:1cb50d31c3b5 | 36 | * |
julientiron | 0:1cb50d31c3b5 | 37 | * @brief Type definitions for vl6180x api. |
julientiron | 0:1cb50d31c3b5 | 38 | * |
julientiron | 0:1cb50d31c3b5 | 39 | */ |
julientiron | 0:1cb50d31c3b5 | 40 | |
julientiron | 0:1cb50d31c3b5 | 41 | |
julientiron | 0:1cb50d31c3b5 | 42 | #ifndef _VL6180x_DEF |
julientiron | 0:1cb50d31c3b5 | 43 | #define _VL6180x_DEF |
julientiron | 0:1cb50d31c3b5 | 44 | |
julientiron | 0:1cb50d31c3b5 | 45 | /** API major version */ |
julientiron | 0:1cb50d31c3b5 | 46 | #define VL6180x_API_REV_MAJOR 3 |
julientiron | 0:1cb50d31c3b5 | 47 | /** API minor version */ |
julientiron | 0:1cb50d31c3b5 | 48 | #define VL6180x_API_REV_MINOR 0 |
julientiron | 0:1cb50d31c3b5 | 49 | /** API sub version */ |
julientiron | 0:1cb50d31c3b5 | 50 | #define VL6180x_API_REV_SUB 1 |
julientiron | 0:1cb50d31c3b5 | 51 | |
julientiron | 0:1cb50d31c3b5 | 52 | #define VL6180X_STR_HELPER(x) #x |
julientiron | 0:1cb50d31c3b5 | 53 | #define VL6180X_STR(x) VL6180X_STR_HELPER(x) |
julientiron | 0:1cb50d31c3b5 | 54 | |
julientiron | 0:1cb50d31c3b5 | 55 | #include "vl6180x_cfg.h" |
julientiron | 0:1cb50d31c3b5 | 56 | #include "vl6180x_types.h" |
julientiron | 0:1cb50d31c3b5 | 57 | |
julientiron | 0:1cb50d31c3b5 | 58 | /* |
julientiron | 0:1cb50d31c3b5 | 59 | * check configuration macro raise error or warning and suggest a default value |
julientiron | 0:1cb50d31c3b5 | 60 | */ |
julientiron | 0:1cb50d31c3b5 | 61 | |
julientiron | 0:1cb50d31c3b5 | 62 | #ifndef VL6180x_UPSCALE_SUPPORT |
julientiron | 0:1cb50d31c3b5 | 63 | #error "VL6180x_UPSCALE_SUPPORT not defined" |
julientiron | 0:1cb50d31c3b5 | 64 | /* TODO you must define value for upscale support in your vl6180x_cfg.h */ |
julientiron | 0:1cb50d31c3b5 | 65 | #endif |
julientiron | 0:1cb50d31c3b5 | 66 | |
julientiron | 0:1cb50d31c3b5 | 67 | #ifndef VL6180x_ALS_SUPPORT |
julientiron | 0:1cb50d31c3b5 | 68 | #error "VL6180x_ALS_SUPPORT not defined" |
julientiron | 0:1cb50d31c3b5 | 69 | /* TODO you must define VL6180x_ALS_SUPPORT with a value in your vl6180x_cfg.h set to 0 do disable*/ |
julientiron | 0:1cb50d31c3b5 | 70 | #endif |
julientiron | 0:1cb50d31c3b5 | 71 | |
julientiron | 0:1cb50d31c3b5 | 72 | #ifndef VL6180x_HAVE_DMAX_RANGING |
julientiron | 0:1cb50d31c3b5 | 73 | #error "VL6180x_HAVE_DMAX_RANGING not defined" |
julientiron | 0:1cb50d31c3b5 | 74 | /* TODO you may remove or comment these #error and keep the default below or update your vl6180x_cfg.h .h file */ |
julientiron | 0:1cb50d31c3b5 | 75 | /** |
julientiron | 0:1cb50d31c3b5 | 76 | * force VL6180x_HAVE_DMAX_RANGING to not supported when not part of cfg file |
julientiron | 0:1cb50d31c3b5 | 77 | */ |
julientiron | 0:1cb50d31c3b5 | 78 | #define VL6180x_HAVE_DMAX_RANGING 0 |
julientiron | 0:1cb50d31c3b5 | 79 | #endif |
julientiron | 0:1cb50d31c3b5 | 80 | |
julientiron | 0:1cb50d31c3b5 | 81 | #ifndef VL6180x_EXTENDED_RANGE |
julientiron | 0:1cb50d31c3b5 | 82 | #define VL6180x_EXTENDED_RANGE 0 |
julientiron | 0:1cb50d31c3b5 | 83 | #endif |
julientiron | 0:1cb50d31c3b5 | 84 | |
julientiron | 0:1cb50d31c3b5 | 85 | #ifndef VL6180x_WRAP_AROUND_FILTER_SUPPORT |
julientiron | 0:1cb50d31c3b5 | 86 | #error "VL6180x_WRAP_AROUND_FILTER_SUPPORT not defined ?" |
julientiron | 0:1cb50d31c3b5 | 87 | /* TODO you may remove or comment these #error and keep the default below or update vl6180x_cfg.h file */ |
julientiron | 0:1cb50d31c3b5 | 88 | /** |
julientiron | 0:1cb50d31c3b5 | 89 | * force VL6180x_WRAP_AROUND_FILTER_SUPPORT to not supported when not part of cfg file |
julientiron | 0:1cb50d31c3b5 | 90 | */ |
julientiron | 0:1cb50d31c3b5 | 91 | #define VL6180x_WRAP_AROUND_FILTER_SUPPORT 0 |
julientiron | 0:1cb50d31c3b5 | 92 | #endif |
julientiron | 0:1cb50d31c3b5 | 93 | |
julientiron | 0:1cb50d31c3b5 | 94 | |
julientiron | 0:1cb50d31c3b5 | 95 | |
julientiron | 0:1cb50d31c3b5 | 96 | |
julientiron | 0:1cb50d31c3b5 | 97 | /**************************************** |
julientiron | 0:1cb50d31c3b5 | 98 | * PRIVATE define do not edit |
julientiron | 0:1cb50d31c3b5 | 99 | ****************************************/ |
julientiron | 0:1cb50d31c3b5 | 100 | |
julientiron | 0:1cb50d31c3b5 | 101 | /** Maximal buffer size ever use in i2c */ |
julientiron | 0:1cb50d31c3b5 | 102 | #define VL6180x_MAX_I2C_XFER_SIZE 8 /* At present time it 6 byte max but that can change */ |
julientiron | 0:1cb50d31c3b5 | 103 | |
julientiron | 0:1cb50d31c3b5 | 104 | #if VL6180x_UPSCALE_SUPPORT < 0 |
julientiron | 0:1cb50d31c3b5 | 105 | /** |
julientiron | 0:1cb50d31c3b5 | 106 | * @def VL6180x_HAVE_UPSCALE_DATA |
julientiron | 0:1cb50d31c3b5 | 107 | * @brief is defined if device data structure has data so when user configurable up-scale is active |
julientiron | 0:1cb50d31c3b5 | 108 | */ |
julientiron | 0:1cb50d31c3b5 | 109 | #define VL6180x_HAVE_UPSCALE_DATA /* have data only for user configurable up-scale config */ |
julientiron | 0:1cb50d31c3b5 | 110 | #endif |
julientiron | 0:1cb50d31c3b5 | 111 | |
julientiron | 0:1cb50d31c3b5 | 112 | #if VL6180x_WRAP_AROUND_FILTER_SUPPORT |
julientiron | 0:1cb50d31c3b5 | 113 | /** |
julientiron | 0:1cb50d31c3b5 | 114 | * @def VL6180x_HAVE_WRAP_AROUND_DATA |
julientiron | 0:1cb50d31c3b5 | 115 | * @brief is defined if device data structure has filter data so when active in cfg file |
julientiron | 0:1cb50d31c3b5 | 116 | */ |
julientiron | 0:1cb50d31c3b5 | 117 | #define VL6180x_HAVE_WRAP_AROUND_DATA |
julientiron | 0:1cb50d31c3b5 | 118 | #endif |
julientiron | 0:1cb50d31c3b5 | 119 | |
julientiron | 0:1cb50d31c3b5 | 120 | #if VL6180x_ALS_SUPPORT != 0 |
julientiron | 0:1cb50d31c3b5 | 121 | /** |
julientiron | 0:1cb50d31c3b5 | 122 | * @def VL6180x_HAVE_ALS_DATA |
julientiron | 0:1cb50d31c3b5 | 123 | * @brief is defined when als data are include in device data structure so when als suport if configured |
julientiron | 0:1cb50d31c3b5 | 124 | */ |
julientiron | 0:1cb50d31c3b5 | 125 | #define VL6180x_HAVE_ALS_DATA |
julientiron | 0:1cb50d31c3b5 | 126 | #endif |
julientiron | 0:1cb50d31c3b5 | 127 | |
julientiron | 0:1cb50d31c3b5 | 128 | |
julientiron | 0:1cb50d31c3b5 | 129 | #if VL6180x_WRAP_AROUND_FILTER_SUPPORT || VL6180x_HAVE_DMAX_RANGING |
julientiron | 0:1cb50d31c3b5 | 130 | #define VL6180x_HAVE_RATE_DATA |
julientiron | 0:1cb50d31c3b5 | 131 | #endif |
julientiron | 0:1cb50d31c3b5 | 132 | |
julientiron | 0:1cb50d31c3b5 | 133 | /** Error and warning code returned by API |
julientiron | 0:1cb50d31c3b5 | 134 | * |
julientiron | 0:1cb50d31c3b5 | 135 | * negative value are true error mostly fatal\n |
julientiron | 0:1cb50d31c3b5 | 136 | * positive value are warning most of time it's ok to continue\n |
julientiron | 0:1cb50d31c3b5 | 137 | */ |
julientiron | 0:1cb50d31c3b5 | 138 | enum VL6180x_ErrCode_t{ |
julientiron | 0:1cb50d31c3b5 | 139 | API_NO_ERROR = 0, |
julientiron | 0:1cb50d31c3b5 | 140 | CALIBRATION_WARNING = 1, /*!< warning invalid calibration data may be in used \a VL6180x_InitData() \a VL6180x_GetOffsetCalibrationData \a VL6180x_SetOffsetCalibrationData*/ |
julientiron | 0:1cb50d31c3b5 | 141 | MIN_CLIPED = 2, /*!< warning parameter passed was clipped to min before to be applied */ |
julientiron | 0:1cb50d31c3b5 | 142 | NOT_GUARANTEED = 3, /*!< Correct operation is not guaranteed typically using extended ranging on vl6180x */ |
julientiron | 0:1cb50d31c3b5 | 143 | NOT_READY = 4, /*!< the data is not ready retry */ |
julientiron | 0:1cb50d31c3b5 | 144 | |
julientiron | 0:1cb50d31c3b5 | 145 | API_ERROR = -1, /*!< Unqualified error */ |
julientiron | 0:1cb50d31c3b5 | 146 | INVALID_PARAMS = -2, /*!< parameter passed is invalid or out of range */ |
julientiron | 0:1cb50d31c3b5 | 147 | NOT_SUPPORTED = -3, /*!< function is not supported in current mode or configuration */ |
julientiron | 0:1cb50d31c3b5 | 148 | RANGE_ERROR = -4, /*!< device report a ranging error interrupt status */ |
julientiron | 0:1cb50d31c3b5 | 149 | TIME_OUT = -5, /*!< aborted due to time out */ |
julientiron | 0:1cb50d31c3b5 | 150 | }; |
julientiron | 0:1cb50d31c3b5 | 151 | |
julientiron | 0:1cb50d31c3b5 | 152 | /** |
julientiron | 0:1cb50d31c3b5 | 153 | * Filtered result data structure range data is to be used |
julientiron | 0:1cb50d31c3b5 | 154 | */ |
julientiron | 0:1cb50d31c3b5 | 155 | typedef struct RangeFilterResult_tag { |
julientiron | 0:1cb50d31c3b5 | 156 | uint16_t range_mm; /*!< Filtered ranging value */ |
julientiron | 0:1cb50d31c3b5 | 157 | uint16_t rawRange_mm; /*!< raw range value (scaled) */ |
julientiron | 0:1cb50d31c3b5 | 158 | } RangeFilterResult_t; |
julientiron | 0:1cb50d31c3b5 | 159 | |
julientiron | 0:1cb50d31c3b5 | 160 | /** |
julientiron | 0:1cb50d31c3b5 | 161 | * "small" unsigned data type used in filter |
julientiron | 0:1cb50d31c3b5 | 162 | * |
julientiron | 0:1cb50d31c3b5 | 163 | * if data space saving is not a concern it can be change to platform native unsigned int |
julientiron | 0:1cb50d31c3b5 | 164 | */ |
julientiron | 0:1cb50d31c3b5 | 165 | typedef uint8_t FilterType1_t; |
julientiron | 0:1cb50d31c3b5 | 166 | |
julientiron | 0:1cb50d31c3b5 | 167 | /** |
julientiron | 0:1cb50d31c3b5 | 168 | * @def FILTER_NBOF_SAMPLES |
julientiron | 0:1cb50d31c3b5 | 169 | * @brief sample history len used for wrap around filtering |
julientiron | 0:1cb50d31c3b5 | 170 | */ |
julientiron | 0:1cb50d31c3b5 | 171 | #define FILTER_NBOF_SAMPLES 10 |
julientiron | 0:1cb50d31c3b5 | 172 | /** |
julientiron | 0:1cb50d31c3b5 | 173 | * Wrap around filter internal data |
julientiron | 0:1cb50d31c3b5 | 174 | */ |
julientiron | 0:1cb50d31c3b5 | 175 | struct FilterData_t { |
julientiron | 0:1cb50d31c3b5 | 176 | uint32_t MeasurementIndex; /*!< current measurement index */ |
julientiron | 0:1cb50d31c3b5 | 177 | uint16_t LastTrueRange[FILTER_NBOF_SAMPLES]; /*!< filtered/corrected distance history */ |
julientiron | 0:1cb50d31c3b5 | 178 | uint32_t LastReturnRates[FILTER_NBOF_SAMPLES]; /*!< Return rate history */ |
julientiron | 0:1cb50d31c3b5 | 179 | uint16_t StdFilteredReads; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 180 | FilterType1_t Default_ZeroVal; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 181 | FilterType1_t Default_VAVGVal; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 182 | FilterType1_t NoDelay_ZeroVal; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 183 | FilterType1_t NoDelay_VAVGVal; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 184 | FilterType1_t Previous_VAVGDiff; /*!< internal use */ |
julientiron | 0:1cb50d31c3b5 | 185 | }; |
julientiron | 0:1cb50d31c3b5 | 186 | |
julientiron | 0:1cb50d31c3b5 | 187 | #if VL6180x_HAVE_DMAX_RANGING |
julientiron | 0:1cb50d31c3b5 | 188 | typedef int32_t DMaxFix_t; |
julientiron | 0:1cb50d31c3b5 | 189 | struct DMaxData_t { |
julientiron | 0:1cb50d31c3b5 | 190 | uint32_t ambTuningWindowFactor_K; /*!< internal algo tuning (*1000) */ |
julientiron | 0:1cb50d31c3b5 | 191 | |
julientiron | 0:1cb50d31c3b5 | 192 | DMaxFix_t retSignalAt400mm; /*!< intermediate dmax computation value caching @a #SYSRANGE_CROSSTALK_COMPENSATION_RATE and private reg 0x02A */ |
julientiron | 0:1cb50d31c3b5 | 193 | //int32_t RegB8; /*!< register 0xB8 cached to speed reduce i2c traffic for dmax computation */ |
julientiron | 0:1cb50d31c3b5 | 194 | /* place all word data below to optimize struct packing */ |
julientiron | 0:1cb50d31c3b5 | 195 | //int32_t minSignalNeeded; /*!< optimized computation intermediate base on register cached value */ |
julientiron | 0:1cb50d31c3b5 | 196 | int32_t snrLimit_K; /*!< cached and optimized computation intermediate from @a #SYSRANGE_MAX_AMBIENT_LEVEL_MULT */ |
julientiron | 0:1cb50d31c3b5 | 197 | uint16_t ClipSnrLimit; /*!< Max value for snr limit */ |
julientiron | 0:1cb50d31c3b5 | 198 | /* place all byte data below to optimize packing */ |
julientiron | 0:1cb50d31c3b5 | 199 | //uint8_t MaxConvTime; /*!< cached max convergence time @a #SYSRANGE_MAX_CONVERGENCE_TIME*/ |
julientiron | 0:1cb50d31c3b5 | 200 | }; |
julientiron | 0:1cb50d31c3b5 | 201 | #endif |
julientiron | 0:1cb50d31c3b5 | 202 | |
julientiron | 0:1cb50d31c3b5 | 203 | /** |
julientiron | 0:1cb50d31c3b5 | 204 | * @struct VL6180xDevData_t |
julientiron | 0:1cb50d31c3b5 | 205 | * |
julientiron | 0:1cb50d31c3b5 | 206 | * @brief Per VL6180x device St private data structure \n |
julientiron | 0:1cb50d31c3b5 | 207 | * End user should never access any of these field directly |
julientiron | 0:1cb50d31c3b5 | 208 | * |
julientiron | 0:1cb50d31c3b5 | 209 | * These must never access directly but only via VL6180xDev/SetData(dev, field) macro |
julientiron | 0:1cb50d31c3b5 | 210 | */ |
julientiron | 0:1cb50d31c3b5 | 211 | struct VL6180xDevData_t { |
julientiron | 0:1cb50d31c3b5 | 212 | |
julientiron | 0:1cb50d31c3b5 | 213 | uint32_t Part2PartAmbNVM; /*!< backed up NVM value */ |
julientiron | 0:1cb50d31c3b5 | 214 | uint32_t XTalkCompRate_KCps; /*! Cached XTlak Compensation Rate */ |
julientiron | 0:1cb50d31c3b5 | 215 | |
julientiron | 0:1cb50d31c3b5 | 216 | uint16_t EceFactorM; /*!< Ece Factor M numerator */ |
julientiron | 0:1cb50d31c3b5 | 217 | uint16_t EceFactorD; /*!< Ece Factor D denominator*/ |
julientiron | 0:1cb50d31c3b5 | 218 | |
julientiron | 0:1cb50d31c3b5 | 219 | #ifdef VL6180x_HAVE_ALS_DATA |
julientiron | 0:1cb50d31c3b5 | 220 | uint16_t IntegrationPeriod; /*!< cached als Integration period avoid slow read from device at each measure */ |
julientiron | 0:1cb50d31c3b5 | 221 | uint16_t AlsGainCode; /*!< cached Als gain avoid slow read from device at each measure */ |
julientiron | 0:1cb50d31c3b5 | 222 | uint16_t AlsScaler; /*!< cached Als scaler avoid slow read from device at each measure */ |
julientiron | 0:1cb50d31c3b5 | 223 | #endif |
julientiron | 0:1cb50d31c3b5 | 224 | |
julientiron | 0:1cb50d31c3b5 | 225 | #ifdef VL6180x_HAVE_UPSCALE_DATA |
julientiron | 0:1cb50d31c3b5 | 226 | uint8_t UpscaleFactor; /*!< up-scaling factor*/ |
julientiron | 0:1cb50d31c3b5 | 227 | #endif |
julientiron | 0:1cb50d31c3b5 | 228 | |
julientiron | 0:1cb50d31c3b5 | 229 | #ifdef VL6180x_HAVE_WRAP_AROUND_DATA |
julientiron | 0:1cb50d31c3b5 | 230 | uint8_t WrapAroundFilterActive; /*!< Filter on/off */ |
julientiron | 0:1cb50d31c3b5 | 231 | struct FilterData_t FilterData; /*!< Filter internal data state history ... */ |
julientiron | 0:1cb50d31c3b5 | 232 | #endif |
julientiron | 0:1cb50d31c3b5 | 233 | |
julientiron | 0:1cb50d31c3b5 | 234 | #if VL6180x_HAVE_DMAX_RANGING |
julientiron | 0:1cb50d31c3b5 | 235 | struct DMaxData_t DMaxData; |
julientiron | 0:1cb50d31c3b5 | 236 | uint8_t DMaxEnable; |
julientiron | 0:1cb50d31c3b5 | 237 | #endif |
julientiron | 0:1cb50d31c3b5 | 238 | int8_t Part2PartOffsetNVM; /*!< backed up NVM value */ |
julientiron | 0:1cb50d31c3b5 | 239 | }; |
julientiron | 0:1cb50d31c3b5 | 240 | |
julientiron | 0:1cb50d31c3b5 | 241 | #if VL6180x_SINGLE_DEVICE_DRIVER |
julientiron | 0:1cb50d31c3b5 | 242 | extern struct VL6180xDevData_t SingleVL6180xDevData; |
julientiron | 0:1cb50d31c3b5 | 243 | #define VL6180xDevDataGet(dev, field) (SingleVL6180xDevData.field) |
julientiron | 0:1cb50d31c3b5 | 244 | /* is also used as direct accessor like VL6180xDevDataGet(dev, x)++*/ |
julientiron | 0:1cb50d31c3b5 | 245 | #define VL6180xDevDataSet(dev, field, data) (SingleVL6180xDevData.field)=(data) |
julientiron | 0:1cb50d31c3b5 | 246 | #endif |
julientiron | 0:1cb50d31c3b5 | 247 | |
julientiron | 0:1cb50d31c3b5 | 248 | |
julientiron | 0:1cb50d31c3b5 | 249 | /** |
julientiron | 0:1cb50d31c3b5 | 250 | * @struct VL6180x_RangeData_t |
julientiron | 0:1cb50d31c3b5 | 251 | * @brief Range and any optional measurement data. |
julientiron | 0:1cb50d31c3b5 | 252 | */ |
julientiron | 0:1cb50d31c3b5 | 253 | typedef struct { |
julientiron | 0:1cb50d31c3b5 | 254 | int32_t range_mm; /*!< range distance in mm. */ |
julientiron | 0:1cb50d31c3b5 | 255 | int32_t signalRate_mcps; /*!< signal rate (MCPS)\n these is a 9.7 fix point value, which is effectively a measure of target reflectance.*/ |
julientiron | 0:1cb50d31c3b5 | 256 | uint32_t errorStatus; /*!< Error status of the current measurement. \n |
julientiron | 0:1cb50d31c3b5 | 257 | see @a ::RangeError_u @a VL6180x_GetRangeStatusErrString() */ |
julientiron | 0:1cb50d31c3b5 | 258 | |
julientiron | 0:1cb50d31c3b5 | 259 | |
julientiron | 0:1cb50d31c3b5 | 260 | #ifdef VL6180x_HAVE_RATE_DATA |
julientiron | 0:1cb50d31c3b5 | 261 | uint32_t rtnAmbRate; /*!< Return Ambient rate in KCount per sec related to \a RESULT_RANGE_RETURN_AMB_COUNT */ |
julientiron | 0:1cb50d31c3b5 | 262 | uint32_t rtnRate; /*!< Return rate in KCount per sec related to \a RESULT_RANGE_RETURN_SIGNAL_COUNT */ |
julientiron | 0:1cb50d31c3b5 | 263 | uint32_t rtnConvTime; /*!< Return Convergence time \a RESULT_RANGE_RETURN_CONV_TIME */ |
julientiron | 0:1cb50d31c3b5 | 264 | uint32_t refConvTime; /*!< Reference convergence time \a RESULT_RANGE_REFERENCE_CONV_TIME */ |
julientiron | 0:1cb50d31c3b5 | 265 | #endif |
julientiron | 0:1cb50d31c3b5 | 266 | |
julientiron | 0:1cb50d31c3b5 | 267 | |
julientiron | 0:1cb50d31c3b5 | 268 | #if VL6180x_HAVE_DMAX_RANGING |
julientiron | 0:1cb50d31c3b5 | 269 | uint32_t DMax; /*!< DMax when applicable */ |
julientiron | 0:1cb50d31c3b5 | 270 | #endif |
julientiron | 0:1cb50d31c3b5 | 271 | |
julientiron | 0:1cb50d31c3b5 | 272 | #ifdef VL6180x_HAVE_WRAP_AROUND_DATA |
julientiron | 0:1cb50d31c3b5 | 273 | RangeFilterResult_t FilteredData; /*!< Filter result main range_mm is updated */ |
julientiron | 0:1cb50d31c3b5 | 274 | #endif |
julientiron | 0:1cb50d31c3b5 | 275 | }VL6180x_RangeData_t; |
julientiron | 0:1cb50d31c3b5 | 276 | |
julientiron | 0:1cb50d31c3b5 | 277 | |
julientiron | 0:1cb50d31c3b5 | 278 | /** use where fix point 9.7 bit values are expected |
julientiron | 0:1cb50d31c3b5 | 279 | * |
julientiron | 0:1cb50d31c3b5 | 280 | * given a floating point value f it's .7 bit point is (int)(f*(1<<7))*/ |
julientiron | 0:1cb50d31c3b5 | 281 | typedef uint16_t FixPoint97_t; |
julientiron | 0:1cb50d31c3b5 | 282 | |
julientiron | 0:1cb50d31c3b5 | 283 | /** lux data type */ |
julientiron | 0:1cb50d31c3b5 | 284 | typedef uint32_t lux_t; |
julientiron | 0:1cb50d31c3b5 | 285 | |
julientiron | 0:1cb50d31c3b5 | 286 | /** |
julientiron | 0:1cb50d31c3b5 | 287 | * @brief This data type defines als measurement data. |
julientiron | 0:1cb50d31c3b5 | 288 | */ |
julientiron | 0:1cb50d31c3b5 | 289 | typedef struct VL6180x_AlsData_st{ |
julientiron | 0:1cb50d31c3b5 | 290 | lux_t lux; /**< Light measurement (Lux) */ |
julientiron | 0:1cb50d31c3b5 | 291 | uint32_t errorStatus; /**< Error status of the current measurement. \n |
julientiron | 0:1cb50d31c3b5 | 292 | * No Error := 0. \n |
julientiron | 0:1cb50d31c3b5 | 293 | * Refer to product sheets for other error codes. */ |
julientiron | 0:1cb50d31c3b5 | 294 | }VL6180x_AlsData_t; |
julientiron | 0:1cb50d31c3b5 | 295 | |
julientiron | 0:1cb50d31c3b5 | 296 | /** |
julientiron | 0:1cb50d31c3b5 | 297 | * @brief Range status Error code |
julientiron | 0:1cb50d31c3b5 | 298 | * |
julientiron | 0:1cb50d31c3b5 | 299 | * @a VL6180x_GetRangeStatusErrString() if configured ( @a #VL6180x_RANGE_STATUS_ERRSTRING ) |
julientiron | 0:1cb50d31c3b5 | 300 | * related to register @a #RESULT_RANGE_STATUS and additional post processing |
julientiron | 0:1cb50d31c3b5 | 301 | */ |
julientiron | 0:1cb50d31c3b5 | 302 | typedef enum { |
julientiron | 0:1cb50d31c3b5 | 303 | NoError_=0, /*!< 0 0b0000 NoError */ |
julientiron | 0:1cb50d31c3b5 | 304 | VCSEL_Continuity_Test, /*!< 1 0b0001 VCSEL_Continuity_Test */ |
julientiron | 0:1cb50d31c3b5 | 305 | VCSEL_Watchdog_Test, /*!< 2 0b0010 VCSEL_Watchdog_Test */ |
julientiron | 0:1cb50d31c3b5 | 306 | VCSEL_Watchdog, /*!< 3 0b0011 VCSEL_Watchdog */ |
julientiron | 0:1cb50d31c3b5 | 307 | PLL1_Lock, /*!< 4 0b0100 PLL1_Lock */ |
julientiron | 0:1cb50d31c3b5 | 308 | PLL2_Lock, /*!< 5 0b0101 PLL2_Lock */ |
julientiron | 0:1cb50d31c3b5 | 309 | Early_Convergence_Estimate,/*!< 6 0b0110 Early_Convergence_Estimate */ |
julientiron | 0:1cb50d31c3b5 | 310 | Max_Convergence, /*!< 7 0b0111 Max_Convergence */ |
julientiron | 0:1cb50d31c3b5 | 311 | No_Target_Ignore, /*!< 8 0b1000 No_Target_Ignore */ |
julientiron | 0:1cb50d31c3b5 | 312 | Not_used_9, /*!< 9 0b1001 Not_used */ |
julientiron | 0:1cb50d31c3b5 | 313 | Not_used_10, /*!< 10 0b1010 Not_used_ */ |
julientiron | 0:1cb50d31c3b5 | 314 | Max_Signal_To_Noise_Ratio, /*!< 11 0b1011 Max_Signal_To_Noise_Ratio*/ |
julientiron | 0:1cb50d31c3b5 | 315 | Raw_Ranging_Algo_Underflow,/*!< 12 0b1100 Raw_Ranging_Algo_Underflow*/ |
julientiron | 0:1cb50d31c3b5 | 316 | Raw_Ranging_Algo_Overflow, /*!< 13 0b1101 Raw_Ranging_Algo_Overflow */ |
julientiron | 0:1cb50d31c3b5 | 317 | Ranging_Algo_Underflow, /*!< 14 0b1110 Ranging_Algo_Underflow */ |
julientiron | 0:1cb50d31c3b5 | 318 | Ranging_Algo_Overflow, /*!< 15 0b1111 Ranging_Algo_Overflow */ |
julientiron | 0:1cb50d31c3b5 | 319 | |
julientiron | 0:1cb50d31c3b5 | 320 | /* code below are addition for API/software side they are not hardware*/ |
julientiron | 0:1cb50d31c3b5 | 321 | RangingFiltered =0x10, /*!< 16 0b10000 filtered by post processing*/ |
julientiron | 0:1cb50d31c3b5 | 322 | |
julientiron | 0:1cb50d31c3b5 | 323 | } RangeError_u; |
julientiron | 0:1cb50d31c3b5 | 324 | |
julientiron | 0:1cb50d31c3b5 | 325 | |
julientiron | 0:1cb50d31c3b5 | 326 | /** @defgroup device_regdef Device registers & masks definitions |
julientiron | 0:1cb50d31c3b5 | 327 | * @brief Device registers and masks definitions |
julientiron | 0:1cb50d31c3b5 | 328 | */ |
julientiron | 0:1cb50d31c3b5 | 329 | |
julientiron | 0:1cb50d31c3b5 | 330 | |
julientiron | 0:1cb50d31c3b5 | 331 | /** @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 332 | * @{*/ |
julientiron | 0:1cb50d31c3b5 | 333 | |
julientiron | 0:1cb50d31c3b5 | 334 | /** |
julientiron | 0:1cb50d31c3b5 | 335 | * The device model ID |
julientiron | 0:1cb50d31c3b5 | 336 | */ |
julientiron | 0:1cb50d31c3b5 | 337 | #define IDENTIFICATION_MODEL_ID 0x000 |
julientiron | 0:1cb50d31c3b5 | 338 | /** |
julientiron | 0:1cb50d31c3b5 | 339 | * Revision identifier of the Device for major change. |
julientiron | 0:1cb50d31c3b5 | 340 | */ |
julientiron | 0:1cb50d31c3b5 | 341 | #define IDENTIFICATION_MODULE_REV_MAJOR 0x003 |
julientiron | 0:1cb50d31c3b5 | 342 | /** |
julientiron | 0:1cb50d31c3b5 | 343 | * Revision identifier of the Device for minor change. |
julientiron | 0:1cb50d31c3b5 | 344 | */ |
julientiron | 0:1cb50d31c3b5 | 345 | #define IDENTIFICATION_MODULE_REV_MINOR 0x004 |
julientiron | 0:1cb50d31c3b5 | 346 | |
julientiron | 0:1cb50d31c3b5 | 347 | |
julientiron | 0:1cb50d31c3b5 | 348 | /** |
julientiron | 0:1cb50d31c3b5 | 349 | * @def SYSTEM_MODE_GPIO0 |
julientiron | 0:1cb50d31c3b5 | 350 | * @brief Configures polarity and select which function gpio 0 serves. |
julientiron | 0:1cb50d31c3b5 | 351 | * Gpio0 is chip enable at power up ! Be aware of all h/w implication of turning it to output. |
julientiron | 0:1cb50d31c3b5 | 352 | * Same definition as #SYSTEM_MODE_GPIO1 |
julientiron | 0:1cb50d31c3b5 | 353 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 354 | */ |
julientiron | 0:1cb50d31c3b5 | 355 | #define SYSTEM_MODE_GPIO0 0x010 |
julientiron | 0:1cb50d31c3b5 | 356 | /** |
julientiron | 0:1cb50d31c3b5 | 357 | * @def SYSTEM_MODE_GPIO1 |
julientiron | 0:1cb50d31c3b5 | 358 | * @brief Configures polarity and select what als or ranging functionality gpio pin serves. |
julientiron | 0:1cb50d31c3b5 | 359 | * |
julientiron | 0:1cb50d31c3b5 | 360 | * Function can be #GPIOx_SELECT_OFF #GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT.\n |
julientiron | 0:1cb50d31c3b5 | 361 | * Same definition apply to register GPIO0 that is used as chip enable at power up. |
julientiron | 0:1cb50d31c3b5 | 362 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 363 | */ |
julientiron | 0:1cb50d31c3b5 | 364 | #define SYSTEM_MODE_GPIO1 0x011 |
julientiron | 0:1cb50d31c3b5 | 365 | /** gpio pad POLARITY mask in #SYSTEM_MODE_GPIO1 (and/or 0) write 1 to set active high polarity (positive edge) */ |
julientiron | 0:1cb50d31c3b5 | 366 | #define GPIOx_POLARITY_SELECT_MASK 0x20 |
julientiron | 0:1cb50d31c3b5 | 367 | /** gpio pad Function select shift in #SYSTEM_MODE_GPIO1 or 0 */ |
julientiron | 0:1cb50d31c3b5 | 368 | #define GPIOx_FUNCTIONALITY_SELECT_SHIFT 1 |
julientiron | 0:1cb50d31c3b5 | 369 | /** gpio pad Function select mask in #SYSTEM_MODE_GPIO1 or 0 */ |
julientiron | 0:1cb50d31c3b5 | 370 | #define GPIOx_FUNCTIONALITY_SELECT_MASK (0xF<<GPIOx_FUNCTIONALITY_SELECT_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 371 | /** select no interrupt in #SYSTEM_MODE_GPIO1 pad is put in Hi-Z*/ |
julientiron | 0:1cb50d31c3b5 | 372 | #define GPIOx_SELECT_OFF 0x00 |
julientiron | 0:1cb50d31c3b5 | 373 | /** select gpiox as interrupt output in #SYSTEM_MODE_GPIO1 */ |
julientiron | 0:1cb50d31c3b5 | 374 | #define GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT 0x08 |
julientiron | 0:1cb50d31c3b5 | 375 | /** select range as source for interrupt on in #SYSTEM_MODE_GPIO1 */ |
julientiron | 0:1cb50d31c3b5 | 376 | #define GPIOx_MODE_SELECT_RANGING 0x00 |
julientiron | 0:1cb50d31c3b5 | 377 | /** select als as source for interrupt on in #SYSTEM_MODE_GPIO1 */ |
julientiron | 0:1cb50d31c3b5 | 378 | #define GPIOx_MODE_SELECT_ALS 0x01 |
julientiron | 0:1cb50d31c3b5 | 379 | |
julientiron | 0:1cb50d31c3b5 | 380 | |
julientiron | 0:1cb50d31c3b5 | 381 | /** |
julientiron | 0:1cb50d31c3b5 | 382 | * @def SYSTEM_INTERRUPT_CONFIG_GPIO |
julientiron | 0:1cb50d31c3b5 | 383 | * |
julientiron | 0:1cb50d31c3b5 | 384 | * @brief Configure Als and Ranging interrupt reporting |
julientiron | 0:1cb50d31c3b5 | 385 | * |
julientiron | 0:1cb50d31c3b5 | 386 | * Possible values for Range and ALS are\n |
julientiron | 0:1cb50d31c3b5 | 387 | * |
julientiron | 0:1cb50d31c3b5 | 388 | * #CONFIG_GPIO_INTERRUPT_DISABLED\n |
julientiron | 0:1cb50d31c3b5 | 389 | * #CONFIG_GPIO_INTERRUPT_LEVEL_LOW\n |
julientiron | 0:1cb50d31c3b5 | 390 | * #CONFIG_GPIO_INTERRUPT_LEVEL_HIGH\n |
julientiron | 0:1cb50d31c3b5 | 391 | * #CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW\n |
julientiron | 0:1cb50d31c3b5 | 392 | * #CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY\n |
julientiron | 0:1cb50d31c3b5 | 393 | * Apply respective rang/als shift and mask \n |
julientiron | 0:1cb50d31c3b5 | 394 | * #CONFIG_GPIO_RANGE_SHIFT and full reg mask #CONFIG_GPIO_RANGE_MASK\n |
julientiron | 0:1cb50d31c3b5 | 395 | * #CONFIG_GPIO_ALS_SHIFT and full reg mask #CONFIG_GPIO_ALS_MASK\n |
julientiron | 0:1cb50d31c3b5 | 396 | * |
julientiron | 0:1cb50d31c3b5 | 397 | * \sa GPIO use for interrupt #SYSTEM_MODE_GPIO0 or #SYSTEM_MODE_GPIO1\n |
julientiron | 0:1cb50d31c3b5 | 398 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 399 | */ |
julientiron | 0:1cb50d31c3b5 | 400 | #define SYSTEM_INTERRUPT_CONFIG_GPIO 0x014 |
julientiron | 0:1cb50d31c3b5 | 401 | /** RANGE bits shift in #SYSTEM_INTERRUPT_CONFIG_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 402 | #define CONFIG_GPIO_RANGE_SHIFT 0 |
julientiron | 0:1cb50d31c3b5 | 403 | /** RANGE bits mask in #SYSTEM_INTERRUPT_CONFIG_GPIO (unshifted)*/ |
julientiron | 0:1cb50d31c3b5 | 404 | #define CONFIG_GPIO_RANGE_MASK (0x7<<CONFIG_GPIO_RANGE_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 405 | /** ALS bits shift in #SYSTEM_INTERRUPT_CONFIG_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 406 | #define CONFIG_GPIO_ALS_SHIFT 3 |
julientiron | 0:1cb50d31c3b5 | 407 | /** ALS bits mask in #SYSTEM_INTERRUPT_CONFIG_GPIO (unshifted)*/ |
julientiron | 0:1cb50d31c3b5 | 408 | #define CONFIG_GPIO_ALS_MASK (0x7<<CONFIG_GPIO_ALS_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 409 | /** interrupt is disabled */ |
julientiron | 0:1cb50d31c3b5 | 410 | #define CONFIG_GPIO_INTERRUPT_DISABLED 0x00 |
julientiron | 0:1cb50d31c3b5 | 411 | /** trigger when value < low threshold */ |
julientiron | 0:1cb50d31c3b5 | 412 | #define CONFIG_GPIO_INTERRUPT_LEVEL_LOW 0x01 |
julientiron | 0:1cb50d31c3b5 | 413 | /** trigger when value < low threshold */ |
julientiron | 0:1cb50d31c3b5 | 414 | #define CONFIG_GPIO_INTERRUPT_LEVEL_HIGH 0x02 |
julientiron | 0:1cb50d31c3b5 | 415 | /** trigger when outside range defined by high low threshold */ |
julientiron | 0:1cb50d31c3b5 | 416 | #define CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW 0x03 |
julientiron | 0:1cb50d31c3b5 | 417 | /** trigger when new sample are ready */ |
julientiron | 0:1cb50d31c3b5 | 418 | #define CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY 0x04 |
julientiron | 0:1cb50d31c3b5 | 419 | |
julientiron | 0:1cb50d31c3b5 | 420 | /** |
julientiron | 0:1cb50d31c3b5 | 421 | * @def SYSTEM_INTERRUPT_CLEAR |
julientiron | 0:1cb50d31c3b5 | 422 | * @brief Writing to this register will clear interrupt source |
julientiron | 0:1cb50d31c3b5 | 423 | * |
julientiron | 0:1cb50d31c3b5 | 424 | * Use or combination of any #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR |
julientiron | 0:1cb50d31c3b5 | 425 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 426 | */ |
julientiron | 0:1cb50d31c3b5 | 427 | #define SYSTEM_INTERRUPT_CLEAR 0x015 |
julientiron | 0:1cb50d31c3b5 | 428 | /** clear ranging interrupt in write to #SYSTEM_INTERRUPT_CLEAR */ |
julientiron | 0:1cb50d31c3b5 | 429 | #define INTERRUPT_CLEAR_RANGING 0x01 |
julientiron | 0:1cb50d31c3b5 | 430 | /** clear als interrupt in write to #SYSTEM_INTERRUPT_CLEAR */ |
julientiron | 0:1cb50d31c3b5 | 431 | #define INTERRUPT_CLEAR_ALS 0x02 |
julientiron | 0:1cb50d31c3b5 | 432 | /** clear error interrupt in write to #SYSTEM_INTERRUPT_CLEAR */ |
julientiron | 0:1cb50d31c3b5 | 433 | #define INTERRUPT_CLEAR_ERROR 0x04 |
julientiron | 0:1cb50d31c3b5 | 434 | |
julientiron | 0:1cb50d31c3b5 | 435 | /** After power up or reset this register will start reading 1 when device is ready */ |
julientiron | 0:1cb50d31c3b5 | 436 | #define SYSTEM_FRESH_OUT_OF_RESET 0x016 |
julientiron | 0:1cb50d31c3b5 | 437 | |
julientiron | 0:1cb50d31c3b5 | 438 | /** |
julientiron | 0:1cb50d31c3b5 | 439 | * @def SYSTEM_GROUPED_PARAMETER_HOLD |
julientiron | 0:1cb50d31c3b5 | 440 | * @brief Writing 1/0 activate/deactivate safe host update of multiple register in critical group \n |
julientiron | 0:1cb50d31c3b5 | 441 | * rather use \a VL6180x_SetGroupParamHold() |
julientiron | 0:1cb50d31c3b5 | 442 | * |
julientiron | 0:1cb50d31c3b5 | 443 | * The critical register group is made of: \n |
julientiron | 0:1cb50d31c3b5 | 444 | * #SYSTEM_INTERRUPT_CONFIG_GPIO \n |
julientiron | 0:1cb50d31c3b5 | 445 | * #SYSRANGE_THRESH_HIGH \n |
julientiron | 0:1cb50d31c3b5 | 446 | * #SYSRANGE_THRESH_LOW \n |
julientiron | 0:1cb50d31c3b5 | 447 | * #SYSALS_INTEGRATION_PERIOD \n |
julientiron | 0:1cb50d31c3b5 | 448 | * #SYSALS_ANALOGUE_GAIN \n |
julientiron | 0:1cb50d31c3b5 | 449 | * #SYSALS_THRESH_HIGH \n |
julientiron | 0:1cb50d31c3b5 | 450 | * #SYSALS_THRESH_LOW |
julientiron | 0:1cb50d31c3b5 | 451 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 452 | */ |
julientiron | 0:1cb50d31c3b5 | 453 | #define SYSTEM_GROUPED_PARAMETER_HOLD 0x017 |
julientiron | 0:1cb50d31c3b5 | 454 | |
julientiron | 0:1cb50d31c3b5 | 455 | |
julientiron | 0:1cb50d31c3b5 | 456 | /** |
julientiron | 0:1cb50d31c3b5 | 457 | * @def SYSRANGE_START |
julientiron | 0:1cb50d31c3b5 | 458 | * @brief Start/stop and set operating range mode |
julientiron | 0:1cb50d31c3b5 | 459 | * |
julientiron | 0:1cb50d31c3b5 | 460 | * Write Combination of #MODE_START_STOP and #MODE_CONTINUOUS to select and start desired operation. |
julientiron | 0:1cb50d31c3b5 | 461 | * |
julientiron | 0:1cb50d31c3b5 | 462 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 463 | */ |
julientiron | 0:1cb50d31c3b5 | 464 | #define SYSRANGE_START 0x018 |
julientiron | 0:1cb50d31c3b5 | 465 | /** mask existing bit in #SYSRANGE_START*/ |
julientiron | 0:1cb50d31c3b5 | 466 | #define MODE_MASK 0x03 |
julientiron | 0:1cb50d31c3b5 | 467 | /** bit 0 in #SYSRANGE_START write 1 toggle state in continuous mode and arm next shot in single shot mode */ |
julientiron | 0:1cb50d31c3b5 | 468 | #define MODE_START_STOP 0x01 |
julientiron | 0:1cb50d31c3b5 | 469 | /** bit 1 write 1 in #SYSRANGE_START set continuous operation mode */ |
julientiron | 0:1cb50d31c3b5 | 470 | #define MODE_CONTINUOUS 0x02 |
julientiron | 0:1cb50d31c3b5 | 471 | /** bit 1 write 0 in #SYSRANGE_START set single shot mode */ |
julientiron | 0:1cb50d31c3b5 | 472 | #define MODE_SINGLESHOT 0x00 |
julientiron | 0:1cb50d31c3b5 | 473 | |
julientiron | 0:1cb50d31c3b5 | 474 | /** |
julientiron | 0:1cb50d31c3b5 | 475 | * @def SYSRANGE_THRESH_HIGH |
julientiron | 0:1cb50d31c3b5 | 476 | * High level range threshold (must be scaled) |
julientiron | 0:1cb50d31c3b5 | 477 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 478 | */ |
julientiron | 0:1cb50d31c3b5 | 479 | #define SYSRANGE_THRESH_HIGH 0x019 |
julientiron | 0:1cb50d31c3b5 | 480 | |
julientiron | 0:1cb50d31c3b5 | 481 | /** |
julientiron | 0:1cb50d31c3b5 | 482 | * @def SYSRANGE_THRESH_LOW |
julientiron | 0:1cb50d31c3b5 | 483 | * Low level range threshold (must be scaled) |
julientiron | 0:1cb50d31c3b5 | 484 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 485 | */ |
julientiron | 0:1cb50d31c3b5 | 486 | #define SYSRANGE_THRESH_LOW 0x01A |
julientiron | 0:1cb50d31c3b5 | 487 | |
julientiron | 0:1cb50d31c3b5 | 488 | /** |
julientiron | 0:1cb50d31c3b5 | 489 | * @def SYSRANGE_INTERMEASUREMENT_PERIOD |
julientiron | 0:1cb50d31c3b5 | 490 | * @brief Continuous mode intermeasurement delay \a VL6180x_RangeSetInterMeasPeriod() |
julientiron | 0:1cb50d31c3b5 | 491 | * |
julientiron | 0:1cb50d31c3b5 | 492 | * Time delay between measurements in Ranging continuous mode.\n |
julientiron | 0:1cb50d31c3b5 | 493 | * Range 0-254 (0 = 10ms).\n Step size = 10ms. |
julientiron | 0:1cb50d31c3b5 | 494 | * |
julientiron | 0:1cb50d31c3b5 | 495 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 496 | */ |
julientiron | 0:1cb50d31c3b5 | 497 | #define SYSRANGE_INTERMEASUREMENT_PERIOD 0x01B |
julientiron | 0:1cb50d31c3b5 | 498 | |
julientiron | 0:1cb50d31c3b5 | 499 | /** |
julientiron | 0:1cb50d31c3b5 | 500 | * @brief Maximum time to run measurement in Ranging modes. |
julientiron | 0:1cb50d31c3b5 | 501 | * Range 1 - 63 ms (1 code = 1 ms); |
julientiron | 0:1cb50d31c3b5 | 502 | * |
julientiron | 0:1cb50d31c3b5 | 503 | * Measurement aborted when limit reached to aid power reduction.\ |
julientiron | 0:1cb50d31c3b5 | 504 | * For example, 0x01 = 1ms, 0x0a = 10ms.\ |
julientiron | 0:1cb50d31c3b5 | 505 | * Note: Effective max_convergence_time depends on readout_averaging_sample_period setting. |
julientiron | 0:1cb50d31c3b5 | 506 | * |
julientiron | 0:1cb50d31c3b5 | 507 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 508 | */ |
julientiron | 0:1cb50d31c3b5 | 509 | #define SYSRANGE_MAX_CONVERGENCE_TIME 0x01C |
julientiron | 0:1cb50d31c3b5 | 510 | /**@brief Cross talk compensation rate |
julientiron | 0:1cb50d31c3b5 | 511 | * @warning never write register directly use @a VL6180x_SetXTalkCompensationRate() |
julientiron | 0:1cb50d31c3b5 | 512 | * refer to manual for calibration procedure and computation |
julientiron | 0:1cb50d31c3b5 | 513 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 514 | */ |
julientiron | 0:1cb50d31c3b5 | 515 | #define SYSRANGE_CROSSTALK_COMPENSATION_RATE 0x01E |
julientiron | 0:1cb50d31c3b5 | 516 | /** |
julientiron | 0:1cb50d31c3b5 | 517 | * @brief Minimum range value in mm to qualify for crosstalk compensation |
julientiron | 0:1cb50d31c3b5 | 518 | */ |
julientiron | 0:1cb50d31c3b5 | 519 | #define SYSRANGE_CROSSTALK_VALID_HEIGHT 0x021 |
julientiron | 0:1cb50d31c3b5 | 520 | #define SYSRANGE_EARLY_CONVERGENCE_ESTIMATE 0x022 |
julientiron | 0:1cb50d31c3b5 | 521 | #define SYSRANGE_PART_TO_PART_RANGE_OFFSET 0x024 |
julientiron | 0:1cb50d31c3b5 | 522 | #define SYSRANGE_RANGE_IGNORE_VALID_HEIGHT 0x025 |
julientiron | 0:1cb50d31c3b5 | 523 | #define SYSRANGE_RANGE_IGNORE_THRESHOLD 0x026 |
julientiron | 0:1cb50d31c3b5 | 524 | #define SYSRANGE_EMITTER_BLOCK_THRESHOLD 0x028 |
julientiron | 0:1cb50d31c3b5 | 525 | #define SYSRANGE_MAX_AMBIENT_LEVEL_THRESH 0x02A |
julientiron | 0:1cb50d31c3b5 | 526 | #define SYSRANGE_MAX_AMBIENT_LEVEL_MULT 0x02C |
julientiron | 0:1cb50d31c3b5 | 527 | /** @brief various Enable check enabel register |
julientiron | 0:1cb50d31c3b5 | 528 | * @a VL6180x_RangeSetEceState() |
julientiron | 0:1cb50d31c3b5 | 529 | */ |
julientiron | 0:1cb50d31c3b5 | 530 | #define SYSRANGE_RANGE_CHECK_ENABLES 0x02D |
julientiron | 0:1cb50d31c3b5 | 531 | #define RANGE_CHECK_ECE_ENABLE_MASK 0x01 |
julientiron | 0:1cb50d31c3b5 | 532 | #define RANGE_CHECK_RANGE_ENABLE_MASK 0x02 |
julientiron | 0:1cb50d31c3b5 | 533 | #define RANGE_CHECK_SNR_ENABLKE 0x10 |
julientiron | 0:1cb50d31c3b5 | 534 | |
julientiron | 0:1cb50d31c3b5 | 535 | #define SYSRANGE_VHV_RECALIBRATE 0x02E |
julientiron | 0:1cb50d31c3b5 | 536 | #define SYSRANGE_VHV_REPEAT_RATE 0x031 |
julientiron | 0:1cb50d31c3b5 | 537 | |
julientiron | 0:1cb50d31c3b5 | 538 | /** |
julientiron | 0:1cb50d31c3b5 | 539 | * @def SYSALS_START |
julientiron | 0:1cb50d31c3b5 | 540 | * @brief Start/stop and set operating als mode |
julientiron | 0:1cb50d31c3b5 | 541 | * |
julientiron | 0:1cb50d31c3b5 | 542 | * same bit definition as range \a #SYSRANGE_START \n |
julientiron | 0:1cb50d31c3b5 | 543 | */ |
julientiron | 0:1cb50d31c3b5 | 544 | #define SYSALS_START 0x038 |
julientiron | 0:1cb50d31c3b5 | 545 | |
julientiron | 0:1cb50d31c3b5 | 546 | /** ALS low Threshold high */ |
julientiron | 0:1cb50d31c3b5 | 547 | #define SYSALS_THRESH_HIGH 0x03A |
julientiron | 0:1cb50d31c3b5 | 548 | /** ALS low Threshold low */ |
julientiron | 0:1cb50d31c3b5 | 549 | #define SYSALS_THRESH_LOW 0x03C |
julientiron | 0:1cb50d31c3b5 | 550 | /** ALS intermeasurement period */ |
julientiron | 0:1cb50d31c3b5 | 551 | #define SYSALS_INTERMEASUREMENT_PERIOD 0x03E |
julientiron | 0:1cb50d31c3b5 | 552 | /** |
julientiron | 0:1cb50d31c3b5 | 553 | * @warning or value with 0x40 when writing to these register*/ |
julientiron | 0:1cb50d31c3b5 | 554 | #define SYSALS_ANALOGUE_GAIN 0x03F |
julientiron | 0:1cb50d31c3b5 | 555 | /** ALS integration period */ |
julientiron | 0:1cb50d31c3b5 | 556 | #define SYSALS_INTEGRATION_PERIOD 0x040 |
julientiron | 0:1cb50d31c3b5 | 557 | |
julientiron | 0:1cb50d31c3b5 | 558 | /** |
julientiron | 0:1cb50d31c3b5 | 559 | * @brief Result range status |
julientiron | 0:1cb50d31c3b5 | 560 | * |
julientiron | 0:1cb50d31c3b5 | 561 | * Hold the various range interrupt flags and error Specific error codes |
julientiron | 0:1cb50d31c3b5 | 562 | */ |
julientiron | 0:1cb50d31c3b5 | 563 | #define RESULT_RANGE_STATUS 0x04D |
julientiron | 0:1cb50d31c3b5 | 564 | /** Device ready for new command bit 0*/ |
julientiron | 0:1cb50d31c3b5 | 565 | #define RANGE_DEVICE_READY_MASK 0x01 |
julientiron | 0:1cb50d31c3b5 | 566 | /** mask for error status covers bits [7:4] in #RESULT_RANGE_STATUS @a ::RangeError_u */ |
julientiron | 0:1cb50d31c3b5 | 567 | #define RANGE_ERROR_CODE_MASK 0xF0 /* */ |
julientiron | 0:1cb50d31c3b5 | 568 | /** range error bit position in #RESULT_RANGE_STATUS */ |
julientiron | 0:1cb50d31c3b5 | 569 | #define RANGE_ERROR_CODE_SHIFT 4 |
julientiron | 0:1cb50d31c3b5 | 570 | |
julientiron | 0:1cb50d31c3b5 | 571 | /** |
julientiron | 0:1cb50d31c3b5 | 572 | * @def RESULT_ALS_STATUS |
julientiron | 0:1cb50d31c3b5 | 573 | * @brief Result als status \n |
julientiron | 0:1cb50d31c3b5 | 574 | * Hold the various als interrupt flags and Specific error codes |
julientiron | 0:1cb50d31c3b5 | 575 | */ |
julientiron | 0:1cb50d31c3b5 | 576 | #define RESULT_ALS_STATUS 0x4E |
julientiron | 0:1cb50d31c3b5 | 577 | /** Device ready for new command bit 0*/ |
julientiron | 0:1cb50d31c3b5 | 578 | #define ALS_DEVICE_READY_MASK 0x01 |
julientiron | 0:1cb50d31c3b5 | 579 | |
julientiron | 0:1cb50d31c3b5 | 580 | /** |
julientiron | 0:1cb50d31c3b5 | 581 | * @def RESULT_ALS_VAL |
julientiron | 0:1cb50d31c3b5 | 582 | * @brief 16 Bit ALS count output value. |
julientiron | 0:1cb50d31c3b5 | 583 | * |
julientiron | 0:1cb50d31c3b5 | 584 | * Lux value depends on Gain and integration settings and calibrated lux/count setting |
julientiron | 0:1cb50d31c3b5 | 585 | * \a VL6180x_AlsGetLux() \a VL6180x_AlsGetMeasurement() |
julientiron | 0:1cb50d31c3b5 | 586 | */ |
julientiron | 0:1cb50d31c3b5 | 587 | #define RESULT_ALS_VAL 0x50 |
julientiron | 0:1cb50d31c3b5 | 588 | |
julientiron | 0:1cb50d31c3b5 | 589 | /** |
julientiron | 0:1cb50d31c3b5 | 590 | * @def FW_ALS_RESULT_SCALER |
julientiron | 0:1cb50d31c3b5 | 591 | * @brief Als scaler register Bits [3:0] analogue gain 1 to 16x |
julientiron | 0:1cb50d31c3b5 | 592 | * these register content is cached by API in \a VL6180xDevData_t::AlsScaler |
julientiron | 0:1cb50d31c3b5 | 593 | * for lux computation acceleration |
julientiron | 0:1cb50d31c3b5 | 594 | */ |
julientiron | 0:1cb50d31c3b5 | 595 | #define FW_ALS_RESULT_SCALER 0x120 |
julientiron | 0:1cb50d31c3b5 | 596 | |
julientiron | 0:1cb50d31c3b5 | 597 | |
julientiron | 0:1cb50d31c3b5 | 598 | /** |
julientiron | 0:1cb50d31c3b5 | 599 | * these union can be use as a generic bit field type for map #RESULT_INTERRUPT_STATUS_GPIO register |
julientiron | 0:1cb50d31c3b5 | 600 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 601 | */ |
julientiron | 0:1cb50d31c3b5 | 602 | typedef union IntrStatus_u{ |
julientiron | 0:1cb50d31c3b5 | 603 | uint8_t val; /*!< raw 8 bit register value*/ |
julientiron | 0:1cb50d31c3b5 | 604 | struct { |
julientiron | 0:1cb50d31c3b5 | 605 | unsigned Range :3; /*!< Range status one of :\n \a #RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD \n \a #RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD \n \a #RES_INT_STAT_GPIO_OUT_OF_WINDOW \n \a #RES_INT_STAT_GPIO_NEW_SAMPLE_READY */ |
julientiron | 0:1cb50d31c3b5 | 606 | unsigned Als :3; /*!< Als status one of: \n \a #RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD \n \a #RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD \n \a #RES_INT_STAT_GPIO_OUT_OF_WINDOW \n \a #RES_INT_STAT_GPIO_NEW_SAMPLE_READY */ |
julientiron | 0:1cb50d31c3b5 | 607 | unsigned Error :2; /*!< Error status of: \n \a #RES_INT_ERROR_LASER_SAFETY \n \a #RES_INT_ERROR_PLL */ |
julientiron | 0:1cb50d31c3b5 | 608 | } status; /*!< interrupt status as bit field */ |
julientiron | 0:1cb50d31c3b5 | 609 | } IntrStatus_t; |
julientiron | 0:1cb50d31c3b5 | 610 | |
julientiron | 0:1cb50d31c3b5 | 611 | /** |
julientiron | 0:1cb50d31c3b5 | 612 | * @def RESULT_INTERRUPT_STATUS_GPIO |
julientiron | 0:1cb50d31c3b5 | 613 | * @brief System interrupt status report selected interrupt for als and ranging |
julientiron | 0:1cb50d31c3b5 | 614 | * |
julientiron | 0:1cb50d31c3b5 | 615 | * These register can be polled even if no gpio pins is active\n |
julientiron | 0:1cb50d31c3b5 | 616 | * What reported is selected by \a #SYSTEM_INTERRUPT_CONFIG_GPIO \n |
julientiron | 0:1cb50d31c3b5 | 617 | * Range mask with \a #RES_INT_RANGE_MASK and shit by \a #RES_INT_RANGE_SHIFT |
julientiron | 0:1cb50d31c3b5 | 618 | * Als mask with \a #RES_INT_ALS_MASK and shit by \a #RES_INT_ALS_SHIFT |
julientiron | 0:1cb50d31c3b5 | 619 | * Result value express condition (or combination?) |
julientiron | 0:1cb50d31c3b5 | 620 | * \a #RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD \n |
julientiron | 0:1cb50d31c3b5 | 621 | * \a #RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD \n |
julientiron | 0:1cb50d31c3b5 | 622 | * \a #RES_INT_STAT_GPIO_OUT_OF_WINDOW \n |
julientiron | 0:1cb50d31c3b5 | 623 | * \a #RES_INT_STAT_GPIO_NEW_SAMPLE_READY |
julientiron | 0:1cb50d31c3b5 | 624 | * |
julientiron | 0:1cb50d31c3b5 | 625 | * @ingroup device_regdef |
julientiron | 0:1cb50d31c3b5 | 626 | */ |
julientiron | 0:1cb50d31c3b5 | 627 | #define RESULT_INTERRUPT_STATUS_GPIO 0x4F |
julientiron | 0:1cb50d31c3b5 | 628 | /** ranging interrupt 1st bit position in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 629 | #define RES_INT_RANGE_SHIFT 0 |
julientiron | 0:1cb50d31c3b5 | 630 | /** ALS interrupt 1st bit position in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 631 | #define RES_INT_ALS_SHIFT 3 |
julientiron | 0:1cb50d31c3b5 | 632 | /** interrupt bit position in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 633 | #define RES_INT_ERROR_SHIFT 6 |
julientiron | 0:1cb50d31c3b5 | 634 | /** Ranging interrupt mask in #RESULT_INTERRUPT_STATUS_GPIO (prior to shift) \sa IntrStatus_t */ |
julientiron | 0:1cb50d31c3b5 | 635 | #define RES_INT_RANGE_MASK (0x7<<RES_INT_RANGE_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 636 | /** als interrupt mask in #RESULT_INTERRUPT_STATUS_GPIO (prior to shift) \sa IntrStatus_t */ |
julientiron | 0:1cb50d31c3b5 | 637 | #define RES_INT_ALS_MASK (0x7<<RES_INT_ALS_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 638 | |
julientiron | 0:1cb50d31c3b5 | 639 | /** low threshold condition in #RESULT_INTERRUPT_STATUS_GPIO for */ |
julientiron | 0:1cb50d31c3b5 | 640 | #define RES_INT_STAT_GPIO_LOW_LEVEL_THRESHOLD 0x01 |
julientiron | 0:1cb50d31c3b5 | 641 | /** high threshold condition in #RESULT_INTERRUPT_STATUS_GPIO for ALs or Rage*/ |
julientiron | 0:1cb50d31c3b5 | 642 | #define RES_INT_STAT_GPIO_HIGH_LEVEL_THRESHOLD 0x02 |
julientiron | 0:1cb50d31c3b5 | 643 | /** out of window condition in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 644 | #define RES_INT_STAT_GPIO_OUT_OF_WINDOW 0x03 |
julientiron | 0:1cb50d31c3b5 | 645 | /** new sample ready in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 646 | #define RES_INT_STAT_GPIO_NEW_SAMPLE_READY 0x04 |
julientiron | 0:1cb50d31c3b5 | 647 | /** error in #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 648 | #define RES_INT_ERROR_MASK (0x3<<RES_INT_ERROR_SHIFT) |
julientiron | 0:1cb50d31c3b5 | 649 | /** laser safety error on #RES_INT_ERROR_MASK of #RESULT_INTERRUPT_STATUS_GPIO */ |
julientiron | 0:1cb50d31c3b5 | 650 | #define RES_INT_ERROR_LASER_SAFETY 1 |
julientiron | 0:1cb50d31c3b5 | 651 | /** pll 1 or 2 error on #RES_INT_ERROR_MASK of #RESULT_INTERRUPT_STATUS_GPIO*/ |
julientiron | 0:1cb50d31c3b5 | 652 | #define RES_INT_ERROR_PLL 2 |
julientiron | 0:1cb50d31c3b5 | 653 | |
julientiron | 0:1cb50d31c3b5 | 654 | /** |
julientiron | 0:1cb50d31c3b5 | 655 | * Final range result value presented to the user for use. Unit is in mm. |
julientiron | 0:1cb50d31c3b5 | 656 | */ |
julientiron | 0:1cb50d31c3b5 | 657 | #define RESULT_RANGE_VAL 0x062 |
julientiron | 0:1cb50d31c3b5 | 658 | |
julientiron | 0:1cb50d31c3b5 | 659 | /** |
julientiron | 0:1cb50d31c3b5 | 660 | * Raw Range result value with offset applied (no cross talk compensation applied). Unit is in mm. |
julientiron | 0:1cb50d31c3b5 | 661 | */ |
julientiron | 0:1cb50d31c3b5 | 662 | #define RESULT_RANGE_RAW 0x064 |
julientiron | 0:1cb50d31c3b5 | 663 | |
julientiron | 0:1cb50d31c3b5 | 664 | /** |
julientiron | 0:1cb50d31c3b5 | 665 | * @brief Sensor count rate of signal returns correlated to IR emitter. |
julientiron | 0:1cb50d31c3b5 | 666 | * |
julientiron | 0:1cb50d31c3b5 | 667 | * Computed from RETURN_SIGNAL_COUNT / RETURN_CONV_TIME. Mcps 9.7 format |
julientiron | 0:1cb50d31c3b5 | 668 | */ |
julientiron | 0:1cb50d31c3b5 | 669 | #define RESULT_RANGE_SIGNAL_RATE 0x066 |
julientiron | 0:1cb50d31c3b5 | 670 | |
julientiron | 0:1cb50d31c3b5 | 671 | /** |
julientiron | 0:1cb50d31c3b5 | 672 | * @brief Return signal count |
julientiron | 0:1cb50d31c3b5 | 673 | * |
julientiron | 0:1cb50d31c3b5 | 674 | * Sensor count output value attributed to signal correlated to IR emitter on the Return array. |
julientiron | 0:1cb50d31c3b5 | 675 | */ |
julientiron | 0:1cb50d31c3b5 | 676 | #define RESULT_RANGE_RETURN_SIGNAL_COUNT 0x06C |
julientiron | 0:1cb50d31c3b5 | 677 | |
julientiron | 0:1cb50d31c3b5 | 678 | /** |
julientiron | 0:1cb50d31c3b5 | 679 | * @brief Reference signal count |
julientiron | 0:1cb50d31c3b5 | 680 | * |
julientiron | 0:1cb50d31c3b5 | 681 | * sensor count output value attributed to signal correlated to IR emitter on the Reference array. |
julientiron | 0:1cb50d31c3b5 | 682 | */ |
julientiron | 0:1cb50d31c3b5 | 683 | #define RESULT_RANGE_REFERENCE_SIGNAL_COUNT 0x070 |
julientiron | 0:1cb50d31c3b5 | 684 | |
julientiron | 0:1cb50d31c3b5 | 685 | /** |
julientiron | 0:1cb50d31c3b5 | 686 | * @brief Return ambient count |
julientiron | 0:1cb50d31c3b5 | 687 | * |
julientiron | 0:1cb50d31c3b5 | 688 | * sensor count output value attributed to uncorrelated ambient signal on the Return array. |
julientiron | 0:1cb50d31c3b5 | 689 | * Must be multiplied by 6 if used to calculate the ambient to signal threshold |
julientiron | 0:1cb50d31c3b5 | 690 | */ |
julientiron | 0:1cb50d31c3b5 | 691 | #define RESULT_RANGE_RETURN_AMB_COUNT 0x074 |
julientiron | 0:1cb50d31c3b5 | 692 | |
julientiron | 0:1cb50d31c3b5 | 693 | /** |
julientiron | 0:1cb50d31c3b5 | 694 | * @brief Reference ambient count |
julientiron | 0:1cb50d31c3b5 | 695 | * |
julientiron | 0:1cb50d31c3b5 | 696 | * Sensor count output value attributed to uncorrelated ambient signal on the Reference array. |
julientiron | 0:1cb50d31c3b5 | 697 | */ |
julientiron | 0:1cb50d31c3b5 | 698 | #define RESULT_RANGE_REFERENCE_AMB_COUNT 0x078 |
julientiron | 0:1cb50d31c3b5 | 699 | |
julientiron | 0:1cb50d31c3b5 | 700 | /** |
julientiron | 0:1cb50d31c3b5 | 701 | * sensor count output value attributed to signal on the Return array. |
julientiron | 0:1cb50d31c3b5 | 702 | */ |
julientiron | 0:1cb50d31c3b5 | 703 | #define RESULT_RANGE_RETURN_CONV_TIME 0x07C |
julientiron | 0:1cb50d31c3b5 | 704 | |
julientiron | 0:1cb50d31c3b5 | 705 | /** |
julientiron | 0:1cb50d31c3b5 | 706 | * sensor count output value attributed to signal on the Reference array. |
julientiron | 0:1cb50d31c3b5 | 707 | */ |
julientiron | 0:1cb50d31c3b5 | 708 | #define RESULT_RANGE_REFERENCE_CONV_TIME 0x080 |
julientiron | 0:1cb50d31c3b5 | 709 | |
julientiron | 0:1cb50d31c3b5 | 710 | |
julientiron | 0:1cb50d31c3b5 | 711 | /** |
julientiron | 0:1cb50d31c3b5 | 712 | * @def RANGE_SCALER |
julientiron | 0:1cb50d31c3b5 | 713 | * @brief RANGE scaling register |
julientiron | 0:1cb50d31c3b5 | 714 | * |
julientiron | 0:1cb50d31c3b5 | 715 | * Never should user write directly onto that register directly \a VL6180x_UpscaleSetScaling() |
julientiron | 0:1cb50d31c3b5 | 716 | */ |
julientiron | 0:1cb50d31c3b5 | 717 | #define RANGE_SCALER 0x096 |
julientiron | 0:1cb50d31c3b5 | 718 | |
julientiron | 0:1cb50d31c3b5 | 719 | /** |
julientiron | 0:1cb50d31c3b5 | 720 | * @def READOUT_AVERAGING_SAMPLE_PERIOD |
julientiron | 0:1cb50d31c3b5 | 721 | * @brief Readout averaging sample period register |
julientiron | 0:1cb50d31c3b5 | 722 | * |
julientiron | 0:1cb50d31c3b5 | 723 | * |
julientiron | 0:1cb50d31c3b5 | 724 | * The internal readout averaging sample period can be adjusted from 0 to 255. |
julientiron | 0:1cb50d31c3b5 | 725 | * Increasing the sampling period decreases noise but also reduces the effective |
julientiron | 0:1cb50d31c3b5 | 726 | * max convergence time and increases power consumption |
julientiron | 0:1cb50d31c3b5 | 727 | * Each unit sample period corresponds to around 64.5 μs additional processing time. |
julientiron | 0:1cb50d31c3b5 | 728 | * The recommended setting is 48 which equates to around 4.3 ms. |
julientiron | 0:1cb50d31c3b5 | 729 | * |
julientiron | 0:1cb50d31c3b5 | 730 | * see datasheet for more detail |
julientiron | 0:1cb50d31c3b5 | 731 | */ |
julientiron | 0:1cb50d31c3b5 | 732 | #define READOUT_AVERAGING_SAMPLE_PERIOD 0x10A |
julientiron | 0:1cb50d31c3b5 | 733 | |
julientiron | 0:1cb50d31c3b5 | 734 | /** |
julientiron | 0:1cb50d31c3b5 | 735 | * @def I2C_SLAVE_DEVICE_ADDRESS |
julientiron | 0:1cb50d31c3b5 | 736 | * User programmable I2C address (7-bit). Device address can be re-designated after power-up. |
julientiron | 0:1cb50d31c3b5 | 737 | * @warning What programmed in the register 7-0 are bit 8-1 of i2c address on bus (bit 0 is rd/wr) |
julientiron | 0:1cb50d31c3b5 | 738 | * so what prohamd is commonly whar ergfer as adrerss /2 |
julientiron | 0:1cb50d31c3b5 | 739 | * @sa VL6180x_SetI2CAddress() |
julientiron | 0:1cb50d31c3b5 | 740 | */ |
julientiron | 0:1cb50d31c3b5 | 741 | #define I2C_SLAVE_DEVICE_ADDRESS 0x212 |
julientiron | 0:1cb50d31c3b5 | 742 | |
julientiron | 0:1cb50d31c3b5 | 743 | #endif /* _VL6180x_DEF */ |