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