VL53L0X World smallest Time-of-Flight (ToF) ranging sensor

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   HelloWorld_ST_Sensors mbed-os-mqtt-client Multi_VL53L0X DISCO-IOT01_HomeEnv ... more

Fork of VL53L0X by Nicola Capovilla

Committer:
johnAlexander
Date:
Thu Jun 06 09:21:39 2019 +0000
Revision:
6:8ac15bf6d635
Publish mbed-certified sensor class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
johnAlexander 6:8ac15bf6d635 1 /*******************************************************************************
johnAlexander 6:8ac15bf6d635 2 Copyright © 2016, STMicroelectronics International N.V.
johnAlexander 6:8ac15bf6d635 3 All rights reserved.
johnAlexander 6:8ac15bf6d635 4
johnAlexander 6:8ac15bf6d635 5 Redistribution and use in source and binary forms, with or without
johnAlexander 6:8ac15bf6d635 6 modification, are permitted provided that the following conditions are met:
johnAlexander 6:8ac15bf6d635 7 * Redistributions of source code must retain the above copyright
johnAlexander 6:8ac15bf6d635 8 notice, this list of conditions and the following disclaimer.
johnAlexander 6:8ac15bf6d635 9 * Redistributions in binary form must reproduce the above copyright
johnAlexander 6:8ac15bf6d635 10 notice, this list of conditions and the following disclaimer in the
johnAlexander 6:8ac15bf6d635 11 documentation and/or other materials provided with the distribution.
johnAlexander 6:8ac15bf6d635 12 * Neither the name of STMicroelectronics nor the
johnAlexander 6:8ac15bf6d635 13 names of its contributors may be used to endorse or promote products
johnAlexander 6:8ac15bf6d635 14 derived from this software without specific prior written permission.
johnAlexander 6:8ac15bf6d635 15
johnAlexander 6:8ac15bf6d635 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
johnAlexander 6:8ac15bf6d635 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
johnAlexander 6:8ac15bf6d635 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
johnAlexander 6:8ac15bf6d635 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
johnAlexander 6:8ac15bf6d635 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
johnAlexander 6:8ac15bf6d635 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
johnAlexander 6:8ac15bf6d635 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
johnAlexander 6:8ac15bf6d635 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
johnAlexander 6:8ac15bf6d635 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
johnAlexander 6:8ac15bf6d635 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
johnAlexander 6:8ac15bf6d635 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
johnAlexander 6:8ac15bf6d635 27 *****************************************************************************/
johnAlexander 6:8ac15bf6d635 28
johnAlexander 6:8ac15bf6d635 29 #ifndef __VL53L0X_CLASS_H
johnAlexander 6:8ac15bf6d635 30 #define __VL53L0X_CLASS_H
johnAlexander 6:8ac15bf6d635 31
johnAlexander 6:8ac15bf6d635 32
johnAlexander 6:8ac15bf6d635 33 #ifdef _MSC_VER
johnAlexander 6:8ac15bf6d635 34 # ifdef VL53L0X_API_EXPORTS
johnAlexander 6:8ac15bf6d635 35 # define VL53L0X_API __declspec(dllexport)
johnAlexander 6:8ac15bf6d635 36 # else
johnAlexander 6:8ac15bf6d635 37 # define VL53L0X_API
johnAlexander 6:8ac15bf6d635 38 # endif
johnAlexander 6:8ac15bf6d635 39 #else
johnAlexander 6:8ac15bf6d635 40 # define VL53L0X_API
johnAlexander 6:8ac15bf6d635 41 #endif
johnAlexander 6:8ac15bf6d635 42
johnAlexander 6:8ac15bf6d635 43
johnAlexander 6:8ac15bf6d635 44 /* Includes ------------------------------------------------------------------*/
johnAlexander 6:8ac15bf6d635 45 #include "mbed.h"
johnAlexander 6:8ac15bf6d635 46 #include "RangeSensor.h"
johnAlexander 6:8ac15bf6d635 47 #include "DevI2C.h"
johnAlexander 6:8ac15bf6d635 48 #include "PinNames.h"
johnAlexander 6:8ac15bf6d635 49 #include "VL53L0X_def.h"
johnAlexander 6:8ac15bf6d635 50 #include "VL53L0X_platform.h"
johnAlexander 6:8ac15bf6d635 51 #include "Stmpe1600.h"
johnAlexander 6:8ac15bf6d635 52
johnAlexander 6:8ac15bf6d635 53
johnAlexander 6:8ac15bf6d635 54 /**
johnAlexander 6:8ac15bf6d635 55 * The device model ID
johnAlexander 6:8ac15bf6d635 56 */
johnAlexander 6:8ac15bf6d635 57 #define IDENTIFICATION_MODEL_ID 0x000
johnAlexander 6:8ac15bf6d635 58
johnAlexander 6:8ac15bf6d635 59
johnAlexander 6:8ac15bf6d635 60 #define STATUS_OK 0x00
johnAlexander 6:8ac15bf6d635 61 #define STATUS_FAIL 0x01
johnAlexander 6:8ac15bf6d635 62
johnAlexander 6:8ac15bf6d635 63 #define VL53L0X_OsDelay(...) wait_ms(2) // 2 msec delay. can also use wait(float secs)/wait_us(int)
johnAlexander 6:8ac15bf6d635 64
johnAlexander 6:8ac15bf6d635 65 #ifdef USE_EMPTY_STRING
johnAlexander 6:8ac15bf6d635 66 #define VL53L0X_STRING_DEVICE_INFO_NAME ""
johnAlexander 6:8ac15bf6d635 67 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS0 ""
johnAlexander 6:8ac15bf6d635 68 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS1 ""
johnAlexander 6:8ac15bf6d635 69 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS2 ""
johnAlexander 6:8ac15bf6d635 70 #define VL53L0X_STRING_DEVICE_INFO_NAME_ES1 ""
johnAlexander 6:8ac15bf6d635 71 #define VL53L0X_STRING_DEVICE_INFO_TYPE ""
johnAlexander 6:8ac15bf6d635 72
johnAlexander 6:8ac15bf6d635 73 /* PAL ERROR strings */
johnAlexander 6:8ac15bf6d635 74 #define VL53L0X_STRING_ERROR_NONE ""
johnAlexander 6:8ac15bf6d635 75 #define VL53L0X_STRING_ERROR_CALIBRATION_WARNING ""
johnAlexander 6:8ac15bf6d635 76 #define VL53L0X_STRING_ERROR_MIN_CLIPPED ""
johnAlexander 6:8ac15bf6d635 77 #define VL53L0X_STRING_ERROR_UNDEFINED ""
johnAlexander 6:8ac15bf6d635 78 #define VL53L0X_STRING_ERROR_INVALID_PARAMS ""
johnAlexander 6:8ac15bf6d635 79 #define VL53L0X_STRING_ERROR_NOT_SUPPORTED ""
johnAlexander 6:8ac15bf6d635 80 #define VL53L0X_STRING_ERROR_RANGE_ERROR ""
johnAlexander 6:8ac15bf6d635 81 #define VL53L0X_STRING_ERROR_TIME_OUT ""
johnAlexander 6:8ac15bf6d635 82 #define VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED ""
johnAlexander 6:8ac15bf6d635 83 #define VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL ""
johnAlexander 6:8ac15bf6d635 84 #define VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING ""
johnAlexander 6:8ac15bf6d635 85 #define VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ""
johnAlexander 6:8ac15bf6d635 86 #define VL53L0X_STRING_ERROR_CONTROL_INTERFACE ""
johnAlexander 6:8ac15bf6d635 87 #define VL53L0X_STRING_ERROR_INVALID_COMMAND ""
johnAlexander 6:8ac15bf6d635 88 #define VL53L0X_STRING_ERROR_DIVISION_BY_ZERO ""
johnAlexander 6:8ac15bf6d635 89 #define VL53L0X_STRING_ERROR_REF_SPAD_INIT ""
johnAlexander 6:8ac15bf6d635 90 #define VL53L0X_STRING_ERROR_NOT_IMPLEMENTED ""
johnAlexander 6:8ac15bf6d635 91
johnAlexander 6:8ac15bf6d635 92 #define VL53L0X_STRING_UNKNOW_ERROR_CODE ""
johnAlexander 6:8ac15bf6d635 93
johnAlexander 6:8ac15bf6d635 94
johnAlexander 6:8ac15bf6d635 95
johnAlexander 6:8ac15bf6d635 96 /* Range Status */
johnAlexander 6:8ac15bf6d635 97 #define VL53L0X_STRING_RANGESTATUS_NONE ""
johnAlexander 6:8ac15bf6d635 98 #define VL53L0X_STRING_RANGESTATUS_RANGEVALID ""
johnAlexander 6:8ac15bf6d635 99 #define VL53L0X_STRING_RANGESTATUS_SIGMA ""
johnAlexander 6:8ac15bf6d635 100 #define VL53L0X_STRING_RANGESTATUS_SIGNAL ""
johnAlexander 6:8ac15bf6d635 101 #define VL53L0X_STRING_RANGESTATUS_MINRANGE ""
johnAlexander 6:8ac15bf6d635 102 #define VL53L0X_STRING_RANGESTATUS_PHASE ""
johnAlexander 6:8ac15bf6d635 103 #define VL53L0X_STRING_RANGESTATUS_HW ""
johnAlexander 6:8ac15bf6d635 104
johnAlexander 6:8ac15bf6d635 105
johnAlexander 6:8ac15bf6d635 106 /* Range Status */
johnAlexander 6:8ac15bf6d635 107 #define VL53L0X_STRING_STATE_POWERDOWN ""
johnAlexander 6:8ac15bf6d635 108 #define VL53L0X_STRING_STATE_WAIT_STATICINIT ""
johnAlexander 6:8ac15bf6d635 109 #define VL53L0X_STRING_STATE_STANDBY ""
johnAlexander 6:8ac15bf6d635 110 #define VL53L0X_STRING_STATE_IDLE ""
johnAlexander 6:8ac15bf6d635 111 #define VL53L0X_STRING_STATE_RUNNING ""
johnAlexander 6:8ac15bf6d635 112 #define VL53L0X_STRING_STATE_UNKNOWN ""
johnAlexander 6:8ac15bf6d635 113 #define VL53L0X_STRING_STATE_ERROR ""
johnAlexander 6:8ac15bf6d635 114
johnAlexander 6:8ac15bf6d635 115
johnAlexander 6:8ac15bf6d635 116 /* Device Specific */
johnAlexander 6:8ac15bf6d635 117 #define VL53L0X_STRING_DEVICEERROR_NONE ""
johnAlexander 6:8ac15bf6d635 118 #define VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE ""
johnAlexander 6:8ac15bf6d635 119 #define VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE ""
johnAlexander 6:8ac15bf6d635 120 #define VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND ""
johnAlexander 6:8ac15bf6d635 121 #define VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET ""
johnAlexander 6:8ac15bf6d635 122 #define VL53L0X_STRING_DEVICEERROR_SNRCHECK ""
johnAlexander 6:8ac15bf6d635 123 #define VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK ""
johnAlexander 6:8ac15bf6d635 124 #define VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK ""
johnAlexander 6:8ac15bf6d635 125 #define VL53L0X_STRING_DEVICEERROR_TCC ""
johnAlexander 6:8ac15bf6d635 126 #define VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY ""
johnAlexander 6:8ac15bf6d635 127 #define VL53L0X_STRING_DEVICEERROR_MINCLIP ""
johnAlexander 6:8ac15bf6d635 128 #define VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE ""
johnAlexander 6:8ac15bf6d635 129 #define VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW ""
johnAlexander 6:8ac15bf6d635 130 #define VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW ""
johnAlexander 6:8ac15bf6d635 131 #define VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD ""
johnAlexander 6:8ac15bf6d635 132 #define VL53L0X_STRING_DEVICEERROR_UNKNOWN ""
johnAlexander 6:8ac15bf6d635 133
johnAlexander 6:8ac15bf6d635 134 /* Check Enable */
johnAlexander 6:8ac15bf6d635 135 #define VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE ""
johnAlexander 6:8ac15bf6d635 136 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE ""
johnAlexander 6:8ac15bf6d635 137 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP ""
johnAlexander 6:8ac15bf6d635 138 #define VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD ""
johnAlexander 6:8ac15bf6d635 139
johnAlexander 6:8ac15bf6d635 140 /* Sequence Step */
johnAlexander 6:8ac15bf6d635 141 #define VL53L0X_STRING_SEQUENCESTEP_TCC ""
johnAlexander 6:8ac15bf6d635 142 #define VL53L0X_STRING_SEQUENCESTEP_DSS ""
johnAlexander 6:8ac15bf6d635 143 #define VL53L0X_STRING_SEQUENCESTEP_MSRC ""
johnAlexander 6:8ac15bf6d635 144 #define VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE ""
johnAlexander 6:8ac15bf6d635 145 #define VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE ""
johnAlexander 6:8ac15bf6d635 146 #else
johnAlexander 6:8ac15bf6d635 147 #define VL53L0X_STRING_DEVICE_INFO_NAME "VL53L0X cut1.0"
johnAlexander 6:8ac15bf6d635 148 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS0 "VL53L0X TS0"
johnAlexander 6:8ac15bf6d635 149 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS1 "VL53L0X TS1"
johnAlexander 6:8ac15bf6d635 150 #define VL53L0X_STRING_DEVICE_INFO_NAME_TS2 "VL53L0X TS2"
johnAlexander 6:8ac15bf6d635 151 #define VL53L0X_STRING_DEVICE_INFO_NAME_ES1 "VL53L0X ES1 or later"
johnAlexander 6:8ac15bf6d635 152 #define VL53L0X_STRING_DEVICE_INFO_TYPE "VL53L0X"
johnAlexander 6:8ac15bf6d635 153
johnAlexander 6:8ac15bf6d635 154 /* PAL ERROR strings */
johnAlexander 6:8ac15bf6d635 155 #define VL53L0X_STRING_ERROR_NONE \
johnAlexander 6:8ac15bf6d635 156 "No Error"
johnAlexander 6:8ac15bf6d635 157 #define VL53L0X_STRING_ERROR_CALIBRATION_WARNING \
johnAlexander 6:8ac15bf6d635 158 "Calibration Warning Error"
johnAlexander 6:8ac15bf6d635 159 #define VL53L0X_STRING_ERROR_MIN_CLIPPED \
johnAlexander 6:8ac15bf6d635 160 "Min clipped error"
johnAlexander 6:8ac15bf6d635 161 #define VL53L0X_STRING_ERROR_UNDEFINED \
johnAlexander 6:8ac15bf6d635 162 "Undefined error"
johnAlexander 6:8ac15bf6d635 163 #define VL53L0X_STRING_ERROR_INVALID_PARAMS \
johnAlexander 6:8ac15bf6d635 164 "Invalid parameters error"
johnAlexander 6:8ac15bf6d635 165 #define VL53L0X_STRING_ERROR_NOT_SUPPORTED \
johnAlexander 6:8ac15bf6d635 166 "Not supported error"
johnAlexander 6:8ac15bf6d635 167 #define VL53L0X_STRING_ERROR_RANGE_ERROR \
johnAlexander 6:8ac15bf6d635 168 "Range error"
johnAlexander 6:8ac15bf6d635 169 #define VL53L0X_STRING_ERROR_TIME_OUT \
johnAlexander 6:8ac15bf6d635 170 "Time out error"
johnAlexander 6:8ac15bf6d635 171 #define VL53L0X_STRING_ERROR_MODE_NOT_SUPPORTED \
johnAlexander 6:8ac15bf6d635 172 "Mode not supported error"
johnAlexander 6:8ac15bf6d635 173 #define VL53L0X_STRING_ERROR_BUFFER_TOO_SMALL \
johnAlexander 6:8ac15bf6d635 174 "Buffer too small"
johnAlexander 6:8ac15bf6d635 175 #define VL53L0X_STRING_ERROR_GPIO_NOT_EXISTING \
johnAlexander 6:8ac15bf6d635 176 "GPIO not existing"
johnAlexander 6:8ac15bf6d635 177 #define VL53L0X_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \
johnAlexander 6:8ac15bf6d635 178 "GPIO funct not supported"
johnAlexander 6:8ac15bf6d635 179 #define VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED \
johnAlexander 6:8ac15bf6d635 180 "Interrupt not Cleared"
johnAlexander 6:8ac15bf6d635 181 #define VL53L0X_STRING_ERROR_CONTROL_INTERFACE \
johnAlexander 6:8ac15bf6d635 182 "Control Interface Error"
johnAlexander 6:8ac15bf6d635 183 #define VL53L0X_STRING_ERROR_INVALID_COMMAND \
johnAlexander 6:8ac15bf6d635 184 "Invalid Command Error"
johnAlexander 6:8ac15bf6d635 185 #define VL53L0X_STRING_ERROR_DIVISION_BY_ZERO \
johnAlexander 6:8ac15bf6d635 186 "Division by zero Error"
johnAlexander 6:8ac15bf6d635 187 #define VL53L0X_STRING_ERROR_REF_SPAD_INIT \
johnAlexander 6:8ac15bf6d635 188 "Reference Spad Init Error"
johnAlexander 6:8ac15bf6d635 189 #define VL53L0X_STRING_ERROR_NOT_IMPLEMENTED \
johnAlexander 6:8ac15bf6d635 190 "Not implemented error"
johnAlexander 6:8ac15bf6d635 191
johnAlexander 6:8ac15bf6d635 192 #define VL53L0X_STRING_UNKNOW_ERROR_CODE \
johnAlexander 6:8ac15bf6d635 193 "Unknown Error Code"
johnAlexander 6:8ac15bf6d635 194
johnAlexander 6:8ac15bf6d635 195
johnAlexander 6:8ac15bf6d635 196
johnAlexander 6:8ac15bf6d635 197 /* Range Status */
johnAlexander 6:8ac15bf6d635 198 #define VL53L0X_STRING_RANGESTATUS_NONE "No Update"
johnAlexander 6:8ac15bf6d635 199 #define VL53L0X_STRING_RANGESTATUS_RANGEVALID "Range Valid"
johnAlexander 6:8ac15bf6d635 200 #define VL53L0X_STRING_RANGESTATUS_SIGMA "Sigma Fail"
johnAlexander 6:8ac15bf6d635 201 #define VL53L0X_STRING_RANGESTATUS_SIGNAL "Signal Fail"
johnAlexander 6:8ac15bf6d635 202 #define VL53L0X_STRING_RANGESTATUS_MINRANGE "Min Range Fail"
johnAlexander 6:8ac15bf6d635 203 #define VL53L0X_STRING_RANGESTATUS_PHASE "Phase Fail"
johnAlexander 6:8ac15bf6d635 204 #define VL53L0X_STRING_RANGESTATUS_HW "Hardware Fail"
johnAlexander 6:8ac15bf6d635 205
johnAlexander 6:8ac15bf6d635 206
johnAlexander 6:8ac15bf6d635 207 /* Range Status */
johnAlexander 6:8ac15bf6d635 208 #define VL53L0X_STRING_STATE_POWERDOWN "POWERDOWN State"
johnAlexander 6:8ac15bf6d635 209 #define VL53L0X_STRING_STATE_WAIT_STATICINIT \
johnAlexander 6:8ac15bf6d635 210 "Wait for staticinit State"
johnAlexander 6:8ac15bf6d635 211 #define VL53L0X_STRING_STATE_STANDBY "STANDBY State"
johnAlexander 6:8ac15bf6d635 212 #define VL53L0X_STRING_STATE_IDLE "IDLE State"
johnAlexander 6:8ac15bf6d635 213 #define VL53L0X_STRING_STATE_RUNNING "RUNNING State"
johnAlexander 6:8ac15bf6d635 214 #define VL53L0X_STRING_STATE_UNKNOWN "UNKNOWN State"
johnAlexander 6:8ac15bf6d635 215 #define VL53L0X_STRING_STATE_ERROR "ERROR State"
johnAlexander 6:8ac15bf6d635 216
johnAlexander 6:8ac15bf6d635 217
johnAlexander 6:8ac15bf6d635 218 /* Device Specific */
johnAlexander 6:8ac15bf6d635 219 #define VL53L0X_STRING_DEVICEERROR_NONE "No Update"
johnAlexander 6:8ac15bf6d635 220 #define VL53L0X_STRING_DEVICEERROR_VCSELCONTINUITYTESTFAILURE \
johnAlexander 6:8ac15bf6d635 221 "VCSEL Continuity Test Failure"
johnAlexander 6:8ac15bf6d635 222 #define VL53L0X_STRING_DEVICEERROR_VCSELWATCHDOGTESTFAILURE \
johnAlexander 6:8ac15bf6d635 223 "VCSEL Watchdog Test Failure"
johnAlexander 6:8ac15bf6d635 224 #define VL53L0X_STRING_DEVICEERROR_NOVHVVALUEFOUND \
johnAlexander 6:8ac15bf6d635 225 "No VHV Value found"
johnAlexander 6:8ac15bf6d635 226 #define VL53L0X_STRING_DEVICEERROR_MSRCNOTARGET \
johnAlexander 6:8ac15bf6d635 227 "MSRC No Target Error"
johnAlexander 6:8ac15bf6d635 228 #define VL53L0X_STRING_DEVICEERROR_SNRCHECK \
johnAlexander 6:8ac15bf6d635 229 "SNR Check Exit"
johnAlexander 6:8ac15bf6d635 230 #define VL53L0X_STRING_DEVICEERROR_RANGEPHASECHECK \
johnAlexander 6:8ac15bf6d635 231 "Range Phase Check Error"
johnAlexander 6:8ac15bf6d635 232 #define VL53L0X_STRING_DEVICEERROR_SIGMATHRESHOLDCHECK \
johnAlexander 6:8ac15bf6d635 233 "Sigma Threshold Check Error"
johnAlexander 6:8ac15bf6d635 234 #define VL53L0X_STRING_DEVICEERROR_TCC \
johnAlexander 6:8ac15bf6d635 235 "TCC Error"
johnAlexander 6:8ac15bf6d635 236 #define VL53L0X_STRING_DEVICEERROR_PHASECONSISTENCY \
johnAlexander 6:8ac15bf6d635 237 "Phase Consistency Error"
johnAlexander 6:8ac15bf6d635 238 #define VL53L0X_STRING_DEVICEERROR_MINCLIP \
johnAlexander 6:8ac15bf6d635 239 "Min Clip Error"
johnAlexander 6:8ac15bf6d635 240 #define VL53L0X_STRING_DEVICEERROR_RANGECOMPLETE \
johnAlexander 6:8ac15bf6d635 241 "Range Complete"
johnAlexander 6:8ac15bf6d635 242 #define VL53L0X_STRING_DEVICEERROR_ALGOUNDERFLOW \
johnAlexander 6:8ac15bf6d635 243 "Range Algo Underflow Error"
johnAlexander 6:8ac15bf6d635 244 #define VL53L0X_STRING_DEVICEERROR_ALGOOVERFLOW \
johnAlexander 6:8ac15bf6d635 245 "Range Algo Overlow Error"
johnAlexander 6:8ac15bf6d635 246 #define VL53L0X_STRING_DEVICEERROR_RANGEIGNORETHRESHOLD \
johnAlexander 6:8ac15bf6d635 247 "Range Ignore Threshold Error"
johnAlexander 6:8ac15bf6d635 248 #define VL53L0X_STRING_DEVICEERROR_UNKNOWN \
johnAlexander 6:8ac15bf6d635 249 "Unknown error code"
johnAlexander 6:8ac15bf6d635 250
johnAlexander 6:8ac15bf6d635 251 /* Check Enable */
johnAlexander 6:8ac15bf6d635 252 #define VL53L0X_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
johnAlexander 6:8ac15bf6d635 253 "SIGMA FINAL RANGE"
johnAlexander 6:8ac15bf6d635 254 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
johnAlexander 6:8ac15bf6d635 255 "SIGNAL RATE FINAL RANGE"
johnAlexander 6:8ac15bf6d635 256 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_REF_CLIP \
johnAlexander 6:8ac15bf6d635 257 "SIGNAL REF CLIP"
johnAlexander 6:8ac15bf6d635 258 #define VL53L0X_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
johnAlexander 6:8ac15bf6d635 259 "RANGE IGNORE THRESHOLD"
johnAlexander 6:8ac15bf6d635 260 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_MSRC \
johnAlexander 6:8ac15bf6d635 261 "SIGNAL RATE MSRC"
johnAlexander 6:8ac15bf6d635 262 #define VL53L0X_STRING_CHECKENABLE_SIGNAL_RATE_PRE_RANGE \
johnAlexander 6:8ac15bf6d635 263 "SIGNAL RATE PRE RANGE"
johnAlexander 6:8ac15bf6d635 264
johnAlexander 6:8ac15bf6d635 265 /* Sequence Step */
johnAlexander 6:8ac15bf6d635 266 #define VL53L0X_STRING_SEQUENCESTEP_TCC "TCC"
johnAlexander 6:8ac15bf6d635 267 #define VL53L0X_STRING_SEQUENCESTEP_DSS "DSS"
johnAlexander 6:8ac15bf6d635 268 #define VL53L0X_STRING_SEQUENCESTEP_MSRC "MSRC"
johnAlexander 6:8ac15bf6d635 269 #define VL53L0X_STRING_SEQUENCESTEP_PRE_RANGE "PRE RANGE"
johnAlexander 6:8ac15bf6d635 270 #define VL53L0X_STRING_SEQUENCESTEP_FINAL_RANGE "FINAL RANGE"
johnAlexander 6:8ac15bf6d635 271 #endif /* USE_EMPTY_STRING */
johnAlexander 6:8ac15bf6d635 272
johnAlexander 6:8ac15bf6d635 273 /* sensor operating modes */
johnAlexander 6:8ac15bf6d635 274 typedef enum {
johnAlexander 6:8ac15bf6d635 275 range_single_shot_polling = 1,
johnAlexander 6:8ac15bf6d635 276 range_continuous_polling,
johnAlexander 6:8ac15bf6d635 277 range_continuous_interrupt,
johnAlexander 6:8ac15bf6d635 278 range_continuous_polling_low_threshold,
johnAlexander 6:8ac15bf6d635 279 range_continuous_polling_high_threshold,
johnAlexander 6:8ac15bf6d635 280 range_continuous_polling_out_of_window,
johnAlexander 6:8ac15bf6d635 281 range_continuous_interrupt_low_threshold,
johnAlexander 6:8ac15bf6d635 282 range_continuous_interrupt_high_threshold,
johnAlexander 6:8ac15bf6d635 283 range_continuous_interrupt_out_of_window,
johnAlexander 6:8ac15bf6d635 284 } OperatingMode;
johnAlexander 6:8ac15bf6d635 285
johnAlexander 6:8ac15bf6d635 286 /** default device address */
johnAlexander 6:8ac15bf6d635 287 #define VL53L0X_DEFAULT_ADDRESS 0x52 /* (8-bit) */
johnAlexander 6:8ac15bf6d635 288
johnAlexander 6:8ac15bf6d635 289 /* Classes -------------------------------------------------------------------*/
johnAlexander 6:8ac15bf6d635 290 /** Class representing a VL53L0 sensor component
johnAlexander 6:8ac15bf6d635 291 */
johnAlexander 6:8ac15bf6d635 292 class VL53L0X : public RangeSensor
johnAlexander 6:8ac15bf6d635 293 {
johnAlexander 6:8ac15bf6d635 294 public:
johnAlexander 6:8ac15bf6d635 295 /** Constructor
johnAlexander 6:8ac15bf6d635 296 * @param[in] &i2c device I2C to be used for communication
johnAlexander 6:8ac15bf6d635 297 * @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
johnAlexander 6:8ac15bf6d635 298 * @param[in] dev_addr device address, 0x29 by default
johnAlexander 6:8ac15bf6d635 299 */
johnAlexander 6:8ac15bf6d635 300 VL53L0X(DevI2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c),
johnAlexander 6:8ac15bf6d635 301 _gpio0(pin)
johnAlexander 6:8ac15bf6d635 302 {
johnAlexander 6:8ac15bf6d635 303 _my_device.I2cDevAddr = dev_addr;
johnAlexander 6:8ac15bf6d635 304 _my_device.comms_type = 1; // VL53L0X_COMMS_I2C
johnAlexander 6:8ac15bf6d635 305 _my_device.comms_speed_khz = 400;
johnAlexander 6:8ac15bf6d635 306 _device = &_my_device;
johnAlexander 6:8ac15bf6d635 307 _expgpio0 = NULL;
johnAlexander 6:8ac15bf6d635 308 if (pin_gpio1 != NC) {
johnAlexander 6:8ac15bf6d635 309 _gpio1Int = new InterruptIn(pin_gpio1);
johnAlexander 6:8ac15bf6d635 310 } else {
johnAlexander 6:8ac15bf6d635 311 _gpio1Int = NULL;
johnAlexander 6:8ac15bf6d635 312 }
johnAlexander 6:8ac15bf6d635 313 }
johnAlexander 6:8ac15bf6d635 314
johnAlexander 6:8ac15bf6d635 315 /** Constructor 2 (STMPE1600DigiOut)
johnAlexander 6:8ac15bf6d635 316 * @param[in] i2c device I2C to be used for communication
johnAlexander 6:8ac15bf6d635 317 * @param[in] &pin Gpio Expander STMPE1600DigiOut pin to be used as component GPIO_0 CE
johnAlexander 6:8ac15bf6d635 318 * @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
johnAlexander 6:8ac15bf6d635 319 * @param[in] device address, 0x29 by default
johnAlexander 6:8ac15bf6d635 320 */
johnAlexander 6:8ac15bf6d635 321 VL53L0X(DevI2C *i2c, Stmpe1600DigiOut *pin, PinName pin_gpio1,
johnAlexander 6:8ac15bf6d635 322 uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c), _expgpio0(pin)
johnAlexander 6:8ac15bf6d635 323 {
johnAlexander 6:8ac15bf6d635 324 _my_device.I2cDevAddr = dev_addr;
johnAlexander 6:8ac15bf6d635 325 _my_device.comms_type = 1; // VL53L0X_COMMS_I2C
johnAlexander 6:8ac15bf6d635 326 _my_device.comms_speed_khz = 400;
johnAlexander 6:8ac15bf6d635 327 _device = &_my_device;
johnAlexander 6:8ac15bf6d635 328 _gpio0 = NULL;
johnAlexander 6:8ac15bf6d635 329 if (pin_gpio1 != NC) {
johnAlexander 6:8ac15bf6d635 330 _gpio1Int = new InterruptIn(pin_gpio1);
johnAlexander 6:8ac15bf6d635 331 } else {
johnAlexander 6:8ac15bf6d635 332 _gpio1Int = NULL;
johnAlexander 6:8ac15bf6d635 333 }
johnAlexander 6:8ac15bf6d635 334 }
johnAlexander 6:8ac15bf6d635 335
johnAlexander 6:8ac15bf6d635 336 /** Destructor
johnAlexander 6:8ac15bf6d635 337 */
johnAlexander 6:8ac15bf6d635 338 virtual ~VL53L0X()
johnAlexander 6:8ac15bf6d635 339 {
johnAlexander 6:8ac15bf6d635 340 if (_gpio1Int != NULL) {
johnAlexander 6:8ac15bf6d635 341 delete _gpio1Int;
johnAlexander 6:8ac15bf6d635 342 }
johnAlexander 6:8ac15bf6d635 343 }
johnAlexander 6:8ac15bf6d635 344
johnAlexander 6:8ac15bf6d635 345 /*** Interface Methods ***/
johnAlexander 6:8ac15bf6d635 346 /*** High level API ***/
johnAlexander 6:8ac15bf6d635 347 /**
johnAlexander 6:8ac15bf6d635 348 * @brief PowerOn the sensor
johnAlexander 6:8ac15bf6d635 349 * @return void
johnAlexander 6:8ac15bf6d635 350 */
johnAlexander 6:8ac15bf6d635 351 /* turns on the sensor */
johnAlexander 6:8ac15bf6d635 352 void VL53L0X_on(void)
johnAlexander 6:8ac15bf6d635 353 {
johnAlexander 6:8ac15bf6d635 354 if (_gpio0) {
johnAlexander 6:8ac15bf6d635 355 *_gpio0 = 1;
johnAlexander 6:8ac15bf6d635 356 } else {
johnAlexander 6:8ac15bf6d635 357 if (_expgpio0) {
johnAlexander 6:8ac15bf6d635 358 *_expgpio0 = 1;
johnAlexander 6:8ac15bf6d635 359 }
johnAlexander 6:8ac15bf6d635 360 }
johnAlexander 6:8ac15bf6d635 361 wait_ms(10);
johnAlexander 6:8ac15bf6d635 362 }
johnAlexander 6:8ac15bf6d635 363
johnAlexander 6:8ac15bf6d635 364 /**
johnAlexander 6:8ac15bf6d635 365 * @brief PowerOff the sensor
johnAlexander 6:8ac15bf6d635 366 * @return void
johnAlexander 6:8ac15bf6d635 367 */
johnAlexander 6:8ac15bf6d635 368 /* turns off the sensor */
johnAlexander 6:8ac15bf6d635 369 void VL53L0X_off(void)
johnAlexander 6:8ac15bf6d635 370 {
johnAlexander 6:8ac15bf6d635 371 if (_gpio0) {
johnAlexander 6:8ac15bf6d635 372 *_gpio0 = 0;
johnAlexander 6:8ac15bf6d635 373 } else {
johnAlexander 6:8ac15bf6d635 374 if (_expgpio0) {
johnAlexander 6:8ac15bf6d635 375 *_expgpio0 = 0;
johnAlexander 6:8ac15bf6d635 376 }
johnAlexander 6:8ac15bf6d635 377 }
johnAlexander 6:8ac15bf6d635 378 wait_ms(10);
johnAlexander 6:8ac15bf6d635 379 }
johnAlexander 6:8ac15bf6d635 380
johnAlexander 6:8ac15bf6d635 381
johnAlexander 6:8ac15bf6d635 382 /**
johnAlexander 6:8ac15bf6d635 383 * @brief Initialize the sensor with default values
johnAlexander 6:8ac15bf6d635 384 * @return "0" on success
johnAlexander 6:8ac15bf6d635 385 */
johnAlexander 6:8ac15bf6d635 386 int init_sensor(uint8_t new_addr);
johnAlexander 6:8ac15bf6d635 387
johnAlexander 6:8ac15bf6d635 388 /**
johnAlexander 6:8ac15bf6d635 389 * @brief Start the measure indicated by operating mode
johnAlexander 6:8ac15bf6d635 390 * @param[in] operating_mode specifies requested measure
johnAlexander 6:8ac15bf6d635 391 * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure
johnAlexander 6:8ac15bf6d635 392 * @return "0" on success
johnAlexander 6:8ac15bf6d635 393 */
johnAlexander 6:8ac15bf6d635 394 int start_measurement(OperatingMode operating_mode, void (*fptr)(void));
johnAlexander 6:8ac15bf6d635 395
johnAlexander 6:8ac15bf6d635 396 /**
johnAlexander 6:8ac15bf6d635 397 * @brief Get results for the measure indicated by operating mode
johnAlexander 6:8ac15bf6d635 398 * @param[in] operating_mode specifies requested measure results
johnAlexander 6:8ac15bf6d635 399 * @param[out] p_data pointer to the MeasureData_t structure to read data in to
johnAlexander 6:8ac15bf6d635 400 * @return "0" on success
johnAlexander 6:8ac15bf6d635 401 */
johnAlexander 6:8ac15bf6d635 402 int get_measurement(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *p_data);
johnAlexander 6:8ac15bf6d635 403
johnAlexander 6:8ac15bf6d635 404 /**
johnAlexander 6:8ac15bf6d635 405 * @brief Stop the currently running measure indicate by operating_mode
johnAlexander 6:8ac15bf6d635 406 * @param[in] operating_mode specifies requested measure to stop
johnAlexander 6:8ac15bf6d635 407 * @return "0" on success
johnAlexander 6:8ac15bf6d635 408 */
johnAlexander 6:8ac15bf6d635 409 int stop_measurement(OperatingMode operating_mode);
johnAlexander 6:8ac15bf6d635 410
johnAlexander 6:8ac15bf6d635 411 /**
johnAlexander 6:8ac15bf6d635 412 * @brief Interrupt handling func to be called by user after an INT is occourred
johnAlexander 6:8ac15bf6d635 413 * @param[in] opeating_mode indicating the in progress measure
johnAlexander 6:8ac15bf6d635 414 * @param[out] Data pointer to the MeasureData_t structure to read data in to
johnAlexander 6:8ac15bf6d635 415 * @return "0" on success
johnAlexander 6:8ac15bf6d635 416 */
johnAlexander 6:8ac15bf6d635 417 int handle_irq(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *data);
johnAlexander 6:8ac15bf6d635 418
johnAlexander 6:8ac15bf6d635 419 /**
johnAlexander 6:8ac15bf6d635 420 * @brief Enable interrupt measure IRQ
johnAlexander 6:8ac15bf6d635 421 * @return "0" on success
johnAlexander 6:8ac15bf6d635 422 */
johnAlexander 6:8ac15bf6d635 423 void enable_interrupt_measure_detection_irq(void)
johnAlexander 6:8ac15bf6d635 424 {
johnAlexander 6:8ac15bf6d635 425 if (_gpio1Int != NULL) {
johnAlexander 6:8ac15bf6d635 426 _gpio1Int->enable_irq();
johnAlexander 6:8ac15bf6d635 427 }
johnAlexander 6:8ac15bf6d635 428 }
johnAlexander 6:8ac15bf6d635 429
johnAlexander 6:8ac15bf6d635 430 /**
johnAlexander 6:8ac15bf6d635 431 * @brief Disable interrupt measure IRQ
johnAlexander 6:8ac15bf6d635 432 * @return "0" on success
johnAlexander 6:8ac15bf6d635 433 */
johnAlexander 6:8ac15bf6d635 434 void disable_interrupt_measure_detection_irq(void)
johnAlexander 6:8ac15bf6d635 435 {
johnAlexander 6:8ac15bf6d635 436 if (_gpio1Int != NULL) {
johnAlexander 6:8ac15bf6d635 437 _gpio1Int->disable_irq();
johnAlexander 6:8ac15bf6d635 438 }
johnAlexander 6:8ac15bf6d635 439 }
johnAlexander 6:8ac15bf6d635 440
johnAlexander 6:8ac15bf6d635 441 /**
johnAlexander 6:8ac15bf6d635 442 * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
johnAlexander 6:8ac15bf6d635 443 * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
johnAlexander 6:8ac15bf6d635 444 * @return "0" on success
johnAlexander 6:8ac15bf6d635 445 */
johnAlexander 6:8ac15bf6d635 446 void attach_interrupt_measure_detection_irq(void (*fptr)(void))
johnAlexander 6:8ac15bf6d635 447 {
johnAlexander 6:8ac15bf6d635 448 if (_gpio1Int != NULL) {
johnAlexander 6:8ac15bf6d635 449 _gpio1Int->rise(fptr);
johnAlexander 6:8ac15bf6d635 450 }
johnAlexander 6:8ac15bf6d635 451 }
johnAlexander 6:8ac15bf6d635 452
johnAlexander 6:8ac15bf6d635 453 /** Wrapper functions */
johnAlexander 6:8ac15bf6d635 454 /** @defgroup api_init Init functions
johnAlexander 6:8ac15bf6d635 455 * @brief API init functions
johnAlexander 6:8ac15bf6d635 456 * @ingroup api_hl
johnAlexander 6:8ac15bf6d635 457 * @{
johnAlexander 6:8ac15bf6d635 458 */
johnAlexander 6:8ac15bf6d635 459
johnAlexander 6:8ac15bf6d635 460 /**
johnAlexander 6:8ac15bf6d635 461 *
johnAlexander 6:8ac15bf6d635 462 * @brief One time device initialization
johnAlexander 6:8ac15bf6d635 463 *
johnAlexander 6:8ac15bf6d635 464 * To be called once and only once after device is brought out of reset (Chip enable) and booted.
johnAlexander 6:8ac15bf6d635 465 *
johnAlexander 6:8ac15bf6d635 466 * @par Function Description
johnAlexander 6:8ac15bf6d635 467 * When not used after a fresh device "power up" or reset, it may return @a #CALIBRATION_WARNING
johnAlexander 6:8ac15bf6d635 468 * meaning wrong calibration data may have been fetched from device that can result in ranging offset error\n
johnAlexander 6:8ac15bf6d635 469 * If application cannot execute device reset or need to run VL53L0X_data_init multiple time
johnAlexander 6:8ac15bf6d635 470 * then it must ensure proper offset calibration saving and restore on its own
johnAlexander 6:8ac15bf6d635 471 * by using @a VL53L0X_get_offset_calibration_data_micro_meter() on first power up and then @a VL53L0X_set_offset_calibration_data_micro_meter() all all subsequent init
johnAlexander 6:8ac15bf6d635 472 *
johnAlexander 6:8ac15bf6d635 473 * @param void
johnAlexander 6:8ac15bf6d635 474 * @return "0" on success, @a #CALIBRATION_WARNING if failed
johnAlexander 6:8ac15bf6d635 475 */
johnAlexander 6:8ac15bf6d635 476 virtual int init(void *init)
johnAlexander 6:8ac15bf6d635 477 {
johnAlexander 6:8ac15bf6d635 478 return VL53L0X_data_init(_device);
johnAlexander 6:8ac15bf6d635 479 }
johnAlexander 6:8ac15bf6d635 480
johnAlexander 6:8ac15bf6d635 481 /**
johnAlexander 6:8ac15bf6d635 482 * @brief Prepare device for operation
johnAlexander 6:8ac15bf6d635 483 * @par Function Description
johnAlexander 6:8ac15bf6d635 484 * Does static initialization and reprogram common default settings \n
johnAlexander 6:8ac15bf6d635 485 * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n
johnAlexander 6:8ac15bf6d635 486 * After prepare user can : \n
johnAlexander 6:8ac15bf6d635 487 * @li Call other API function to set other settings\n
johnAlexander 6:8ac15bf6d635 488 * @li Configure the interrupt pins, etc... \n
johnAlexander 6:8ac15bf6d635 489 * @li Then start ranging or ALS operations in single shot or continuous mode
johnAlexander 6:8ac15bf6d635 490 *
johnAlexander 6:8ac15bf6d635 491 * @param void
johnAlexander 6:8ac15bf6d635 492 * @return "0" on success
johnAlexander 6:8ac15bf6d635 493 */
johnAlexander 6:8ac15bf6d635 494 int prepare()
johnAlexander 6:8ac15bf6d635 495 {
johnAlexander 6:8ac15bf6d635 496 VL53L0X_Error status = VL53L0X_ERROR_NONE;
johnAlexander 6:8ac15bf6d635 497 uint32_t ref_spad_count;
johnAlexander 6:8ac15bf6d635 498 uint8_t is_aperture_spads;
johnAlexander 6:8ac15bf6d635 499 uint8_t vhv_settings;
johnAlexander 6:8ac15bf6d635 500 uint8_t phase_cal;
johnAlexander 6:8ac15bf6d635 501
johnAlexander 6:8ac15bf6d635 502 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 6:8ac15bf6d635 503 //printf("Call of VL53L0X_StaticInit\r\n");
johnAlexander 6:8ac15bf6d635 504 status = VL53L0X_static_init(_device); // Device Initialization
johnAlexander 6:8ac15bf6d635 505 }
johnAlexander 6:8ac15bf6d635 506
johnAlexander 6:8ac15bf6d635 507 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 6:8ac15bf6d635 508 //printf("Call of VL53L0X_PerformRefCalibration\r\n");
johnAlexander 6:8ac15bf6d635 509 status = VL53L0X_perform_ref_calibration(_device,
johnAlexander 6:8ac15bf6d635 510 &vhv_settings, &phase_cal); // Device Initialization
johnAlexander 6:8ac15bf6d635 511 }
johnAlexander 6:8ac15bf6d635 512
johnAlexander 6:8ac15bf6d635 513 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 6:8ac15bf6d635 514 //printf("Call of VL53L0X_PerformRefSpadManagement\r\n");
johnAlexander 6:8ac15bf6d635 515 status = VL53L0X_perform_ref_spad_management(_device,
johnAlexander 6:8ac15bf6d635 516 &ref_spad_count, &is_aperture_spads); // Device Initialization
johnAlexander 6:8ac15bf6d635 517 // printf ("refSpadCount = %d, isApertureSpads = %d\r\n", refSpadCount, isApertureSpads);
johnAlexander 6:8ac15bf6d635 518 }
johnAlexander 6:8ac15bf6d635 519
johnAlexander 6:8ac15bf6d635 520 return status;
johnAlexander 6:8ac15bf6d635 521 }
johnAlexander 6:8ac15bf6d635 522
johnAlexander 6:8ac15bf6d635 523 /**
johnAlexander 6:8ac15bf6d635 524 * @brief Start continuous ranging mode
johnAlexander 6:8ac15bf6d635 525 *
johnAlexander 6:8ac15bf6d635 526 * @details End user should ensure device is in idle state and not already running
johnAlexander 6:8ac15bf6d635 527 * @return "0" on success
johnAlexander 6:8ac15bf6d635 528 */
johnAlexander 6:8ac15bf6d635 529 int range_start_continuous_mode()
johnAlexander 6:8ac15bf6d635 530 {
johnAlexander 6:8ac15bf6d635 531 int status;
johnAlexander 6:8ac15bf6d635 532 status = VL53L0X_set_device_mode(_device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
johnAlexander 6:8ac15bf6d635 533
johnAlexander 6:8ac15bf6d635 534 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 6:8ac15bf6d635 535 //printf ("Call of VL53L0X_StartMeasurement\r\n");
johnAlexander 6:8ac15bf6d635 536 status = VL53L0X_start_measurement(_device);
johnAlexander 6:8ac15bf6d635 537 }
johnAlexander 6:8ac15bf6d635 538
johnAlexander 6:8ac15bf6d635 539 return status;
johnAlexander 6:8ac15bf6d635 540 }
johnAlexander 6:8ac15bf6d635 541
johnAlexander 6:8ac15bf6d635 542 /**
johnAlexander 6:8ac15bf6d635 543 * @brief Get ranging result and only that
johnAlexander 6:8ac15bf6d635 544 *
johnAlexander 6:8ac15bf6d635 545 * @par Function Description
johnAlexander 6:8ac15bf6d635 546 * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in millimeter \n
johnAlexander 6:8ac15bf6d635 547 * It does any required up-scale translation\n
johnAlexander 6:8ac15bf6d635 548 * It can be called after success status polling or in interrupt mode \n
johnAlexander 6:8ac15bf6d635 549 * @warning these function is not doing wrap around filtering \n
johnAlexander 6:8ac15bf6d635 550 * This function doesn't perform any data ready check!
johnAlexander 6:8ac15bf6d635 551 *
johnAlexander 6:8ac15bf6d635 552 * @param p_data Pointer to range distance
johnAlexander 6:8ac15bf6d635 553 * @return "0" on success
johnAlexander 6:8ac15bf6d635 554 */
johnAlexander 6:8ac15bf6d635 555 virtual int get_distance(uint32_t *p_data)
johnAlexander 6:8ac15bf6d635 556 {
johnAlexander 6:8ac15bf6d635 557 int status = 0;
johnAlexander 6:8ac15bf6d635 558 VL53L0X_RangingMeasurementData_t p_ranging_measurement_data;
johnAlexander 6:8ac15bf6d635 559
johnAlexander 6:8ac15bf6d635 560 status = start_measurement(range_single_shot_polling, NULL);
johnAlexander 6:8ac15bf6d635 561 if (!status) {
johnAlexander 6:8ac15bf6d635 562 status = get_measurement(range_single_shot_polling, &p_ranging_measurement_data);
johnAlexander 6:8ac15bf6d635 563 }
johnAlexander 6:8ac15bf6d635 564 if (p_ranging_measurement_data.RangeStatus == 0) {
johnAlexander 6:8ac15bf6d635 565 // we have a valid range.
johnAlexander 6:8ac15bf6d635 566 *p_data = p_ranging_measurement_data.RangeMilliMeter;
johnAlexander 6:8ac15bf6d635 567 } else {
johnAlexander 6:8ac15bf6d635 568 *p_data = 0;
johnAlexander 6:8ac15bf6d635 569 status = VL53L0X_ERROR_RANGE_ERROR;
johnAlexander 6:8ac15bf6d635 570 }
johnAlexander 6:8ac15bf6d635 571 stop_measurement(range_single_shot_polling);
johnAlexander 6:8ac15bf6d635 572 return status;
johnAlexander 6:8ac15bf6d635 573 }
johnAlexander 6:8ac15bf6d635 574
johnAlexander 6:8ac15bf6d635 575 /** @} */
johnAlexander 6:8ac15bf6d635 576
johnAlexander 6:8ac15bf6d635 577 /**
johnAlexander 6:8ac15bf6d635 578 * @brief Set new device i2c address
johnAlexander 6:8ac15bf6d635 579 *
johnAlexander 6:8ac15bf6d635 580 * After completion the device will answer to the new address programmed.
johnAlexander 6:8ac15bf6d635 581 *
johnAlexander 6:8ac15bf6d635 582 * @param new_addr The new i2c address (7bit)
johnAlexander 6:8ac15bf6d635 583 * @return "0" on success
johnAlexander 6:8ac15bf6d635 584 */
johnAlexander 6:8ac15bf6d635 585 int set_device_address(int new_addr)
johnAlexander 6:8ac15bf6d635 586 {
johnAlexander 6:8ac15bf6d635 587 int status;
johnAlexander 6:8ac15bf6d635 588
johnAlexander 6:8ac15bf6d635 589 status = VL53L0X_set_device_address(_device, new_addr);
johnAlexander 6:8ac15bf6d635 590 if (!status) {
johnAlexander 6:8ac15bf6d635 591 _device->I2cDevAddr = new_addr;
johnAlexander 6:8ac15bf6d635 592 }
johnAlexander 6:8ac15bf6d635 593 return status;
johnAlexander 6:8ac15bf6d635 594
johnAlexander 6:8ac15bf6d635 595 }
johnAlexander 6:8ac15bf6d635 596
johnAlexander 6:8ac15bf6d635 597 /**
johnAlexander 6:8ac15bf6d635 598 * @brief Clear given system interrupt condition
johnAlexander 6:8ac15bf6d635 599 *
johnAlexander 6:8ac15bf6d635 600 * @par Function Description
johnAlexander 6:8ac15bf6d635 601 * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register.
johnAlexander 6:8ac15bf6d635 602 * @param dev The device
johnAlexander 6:8ac15bf6d635 603 * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR.
johnAlexander 6:8ac15bf6d635 604 * @return "0" on success
johnAlexander 6:8ac15bf6d635 605 */
johnAlexander 6:8ac15bf6d635 606 int clear_interrupt(uint8_t int_clear)
johnAlexander 6:8ac15bf6d635 607 {
johnAlexander 6:8ac15bf6d635 608 return VL53L0X_clear_interrupt_mask(_device, int_clear);
johnAlexander 6:8ac15bf6d635 609 }
johnAlexander 6:8ac15bf6d635 610
johnAlexander 6:8ac15bf6d635 611 /**
johnAlexander 6:8ac15bf6d635 612 *
johnAlexander 6:8ac15bf6d635 613 * @brief Get the 53L0 device
johnAlexander 6:8ac15bf6d635 614 *
johnAlexander 6:8ac15bf6d635 615 * To be called to retrive the internal device descriptor to allow usage of
johnAlexander 6:8ac15bf6d635 616 * low level API having device as parameter. To be called after set_device_address()
johnAlexander 6:8ac15bf6d635 617 * (if any).
johnAlexander 6:8ac15bf6d635 618 *
johnAlexander 6:8ac15bf6d635 619 * @par Function Description
johnAlexander 6:8ac15bf6d635 620 * To be called if low level API usage is needed as those functions requires
johnAlexander 6:8ac15bf6d635 621 * device as a parameter.TICINIT.
johnAlexander 6:8ac15bf6d635 622 *
johnAlexander 6:8ac15bf6d635 623 * @note This function return a pointer to an object internal structure
johnAlexander 6:8ac15bf6d635 624 *
johnAlexander 6:8ac15bf6d635 625 * @param dev ptr to ptr to Device Handle
johnAlexander 6:8ac15bf6d635 626 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 627 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 628 */
johnAlexander 6:8ac15bf6d635 629 VL53L0X_Error vl53l0x_get_device(VL53L0X_DEV *dev)
johnAlexander 6:8ac15bf6d635 630 {
johnAlexander 6:8ac15bf6d635 631 *dev = _device;
johnAlexander 6:8ac15bf6d635 632 return VL53L0X_ERROR_NONE;
johnAlexander 6:8ac15bf6d635 633 }
johnAlexander 6:8ac15bf6d635 634
johnAlexander 6:8ac15bf6d635 635 /**
johnAlexander 6:8ac15bf6d635 636 *
johnAlexander 6:8ac15bf6d635 637 * @brief One time device initialization
johnAlexander 6:8ac15bf6d635 638 *
johnAlexander 6:8ac15bf6d635 639 * To be called once and only once after device is brought out of reset
johnAlexander 6:8ac15bf6d635 640 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted()
johnAlexander 6:8ac15bf6d635 641 *
johnAlexander 6:8ac15bf6d635 642 * @par Function Description
johnAlexander 6:8ac15bf6d635 643 * When not used after a fresh device "power up" or reset, it may return
johnAlexander 6:8ac15bf6d635 644 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data
johnAlexander 6:8ac15bf6d635 645 * may have been fetched from device that can result in ranging offset error\n
johnAlexander 6:8ac15bf6d635 646 * If application cannot execute device reset or need to run VL53L0X_DataInit
johnAlexander 6:8ac15bf6d635 647 * multiple time then it must ensure proper offset calibration saving and
johnAlexander 6:8ac15bf6d635 648 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first
johnAlexander 6:8ac15bf6d635 649 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init
johnAlexander 6:8ac15bf6d635 650 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to
johnAlexander 6:8ac15bf6d635 651 * VL53L0X_STATE_WAIT_STATICINIT.
johnAlexander 6:8ac15bf6d635 652 *
johnAlexander 6:8ac15bf6d635 653 * @note This function accesses to the device
johnAlexander 6:8ac15bf6d635 654 *
johnAlexander 6:8ac15bf6d635 655 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 656 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 657 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 658 */
johnAlexander 6:8ac15bf6d635 659 VL53L0X_Error VL53L0X_data_init(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 660
johnAlexander 6:8ac15bf6d635 661 /**
johnAlexander 6:8ac15bf6d635 662 * @brief Do basic device init (and eventually patch loading)
johnAlexander 6:8ac15bf6d635 663 * This function will change the VL53L0X_State from
johnAlexander 6:8ac15bf6d635 664 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
johnAlexander 6:8ac15bf6d635 665 * In this stage all default setting will be applied.
johnAlexander 6:8ac15bf6d635 666 *
johnAlexander 6:8ac15bf6d635 667 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 668 *
johnAlexander 6:8ac15bf6d635 669 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 670 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 671 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 672 */
johnAlexander 6:8ac15bf6d635 673 VL53L0X_Error VL53L0X_static_init(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 674
johnAlexander 6:8ac15bf6d635 675 /**
johnAlexander 6:8ac15bf6d635 676 * @brief Perform Reference Calibration
johnAlexander 6:8ac15bf6d635 677 *
johnAlexander 6:8ac15bf6d635 678 * @details Perform a reference calibration of the Device.
johnAlexander 6:8ac15bf6d635 679 * This function should be run from time to time before doing
johnAlexander 6:8ac15bf6d635 680 * a ranging measurement.
johnAlexander 6:8ac15bf6d635 681 * This function will launch a special ranging measurement, so
johnAlexander 6:8ac15bf6d635 682 * if interrupt are enable an interrupt will be done.
johnAlexander 6:8ac15bf6d635 683 * This function will clear the interrupt generated automatically.
johnAlexander 6:8ac15bf6d635 684 *
johnAlexander 6:8ac15bf6d635 685 * @warning This function is a blocking function
johnAlexander 6:8ac15bf6d635 686 *
johnAlexander 6:8ac15bf6d635 687 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 688 *
johnAlexander 6:8ac15bf6d635 689 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 690 * @param p_vhv_settings Pointer to vhv settings parameter.
johnAlexander 6:8ac15bf6d635 691 * @param p_phase_cal Pointer to PhaseCal parameter.
johnAlexander 6:8ac15bf6d635 692 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 693 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 694 */
johnAlexander 6:8ac15bf6d635 695 VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev, uint8_t *p_vhv_settings,
johnAlexander 6:8ac15bf6d635 696 uint8_t *p_phase_cal);
johnAlexander 6:8ac15bf6d635 697
johnAlexander 6:8ac15bf6d635 698 /**
johnAlexander 6:8ac15bf6d635 699 * @brief Get Reference Calibration Parameters
johnAlexander 6:8ac15bf6d635 700 *
johnAlexander 6:8ac15bf6d635 701 * @par Function Description
johnAlexander 6:8ac15bf6d635 702 * Get Reference Calibration Parameters.
johnAlexander 6:8ac15bf6d635 703 *
johnAlexander 6:8ac15bf6d635 704 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 705 *
johnAlexander 6:8ac15bf6d635 706 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 707 * @param p_vhv_settings Pointer to VHV parameter
johnAlexander 6:8ac15bf6d635 708 * @param p_phase_cal Pointer to PhaseCal Parameter
johnAlexander 6:8ac15bf6d635 709 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 710 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 711 */
johnAlexander 6:8ac15bf6d635 712 VL53L0X_Error VL53L0X_get_ref_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 713 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
johnAlexander 6:8ac15bf6d635 714
johnAlexander 6:8ac15bf6d635 715 VL53L0X_Error VL53L0X_set_ref_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 716 uint8_t vhv_settings, uint8_t phase_cal);
johnAlexander 6:8ac15bf6d635 717
johnAlexander 6:8ac15bf6d635 718 /**
johnAlexander 6:8ac15bf6d635 719 * @brief Performs Reference Spad Management
johnAlexander 6:8ac15bf6d635 720 *
johnAlexander 6:8ac15bf6d635 721 * @par Function Description
johnAlexander 6:8ac15bf6d635 722 * The reference SPAD initialization procedure determines the minimum amount
johnAlexander 6:8ac15bf6d635 723 * of reference spads to be enables to achieve a target reference signal rate
johnAlexander 6:8ac15bf6d635 724 * and should be performed once during initialization.
johnAlexander 6:8ac15bf6d635 725 *
johnAlexander 6:8ac15bf6d635 726 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 727 *
johnAlexander 6:8ac15bf6d635 728 * @note This function change the device mode to
johnAlexander 6:8ac15bf6d635 729 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 6:8ac15bf6d635 730 *
johnAlexander 6:8ac15bf6d635 731 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 732 * @param ref_spad_count Reports ref Spad Count
johnAlexander 6:8ac15bf6d635 733 * @param is_aperture_spads Reports if spads are of type
johnAlexander 6:8ac15bf6d635 734 * aperture or non-aperture.
johnAlexander 6:8ac15bf6d635 735 * 1:=aperture, 0:=Non-Aperture
johnAlexander 6:8ac15bf6d635 736 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 737 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure.
johnAlexander 6:8ac15bf6d635 738 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 739 */
johnAlexander 6:8ac15bf6d635 740 VL53L0X_Error VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 741 uint32_t *ref_spad_count, uint8_t *is_aperture_spads);
johnAlexander 6:8ac15bf6d635 742
johnAlexander 6:8ac15bf6d635 743 /**
johnAlexander 6:8ac15bf6d635 744 * @brief Applies Reference SPAD configuration
johnAlexander 6:8ac15bf6d635 745 *
johnAlexander 6:8ac15bf6d635 746 * @par Function Description
johnAlexander 6:8ac15bf6d635 747 * This function applies a given number of reference spads, identified as
johnAlexander 6:8ac15bf6d635 748 * either Aperture or Non-Aperture.
johnAlexander 6:8ac15bf6d635 749 * The requested spad count and type are stored within the device specific
johnAlexander 6:8ac15bf6d635 750 * parameters data for access by the host.
johnAlexander 6:8ac15bf6d635 751 *
johnAlexander 6:8ac15bf6d635 752 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 753 *
johnAlexander 6:8ac15bf6d635 754 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 755 * @param refSpadCount Number of ref spads.
johnAlexander 6:8ac15bf6d635 756 * @param is_aperture_spads Defines if spads are of type
johnAlexander 6:8ac15bf6d635 757 * aperture or non-aperture.
johnAlexander 6:8ac15bf6d635 758 * 1:=aperture, 0:=Non-Aperture
johnAlexander 6:8ac15bf6d635 759 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 760 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 6:8ac15bf6d635 761 * spad configuration.
johnAlexander 6:8ac15bf6d635 762 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 763 */
johnAlexander 6:8ac15bf6d635 764 VL53L0X_Error VL53L0X_set_reference_spads(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 765 uint32_t refSpadCount, uint8_t is_aperture_spads);
johnAlexander 6:8ac15bf6d635 766
johnAlexander 6:8ac15bf6d635 767 /**
johnAlexander 6:8ac15bf6d635 768 * @brief Retrieves SPAD configuration
johnAlexander 6:8ac15bf6d635 769 *
johnAlexander 6:8ac15bf6d635 770 * @par Function Description
johnAlexander 6:8ac15bf6d635 771 * This function retrieves the current number of applied reference spads
johnAlexander 6:8ac15bf6d635 772 * and also their type : Aperture or Non-Aperture.
johnAlexander 6:8ac15bf6d635 773 *
johnAlexander 6:8ac15bf6d635 774 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 775 *
johnAlexander 6:8ac15bf6d635 776 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 777 * @param p_spad_count Number ref Spad Count
johnAlexander 6:8ac15bf6d635 778 * @param p_is_aperture_spads Reports if spads are of type
johnAlexander 6:8ac15bf6d635 779 * aperture or non-aperture.
johnAlexander 6:8ac15bf6d635 780 * 1:=aperture, 0:=Non-Aperture
johnAlexander 6:8ac15bf6d635 781 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 782 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 6:8ac15bf6d635 783 * spad configuration.
johnAlexander 6:8ac15bf6d635 784 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 785 */
johnAlexander 6:8ac15bf6d635 786 VL53L0X_Error VL53L0X_get_reference_spads(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 787 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
johnAlexander 6:8ac15bf6d635 788
johnAlexander 6:8ac15bf6d635 789 /**
johnAlexander 6:8ac15bf6d635 790 * @brief Get part to part calibration offset
johnAlexander 6:8ac15bf6d635 791 *
johnAlexander 6:8ac15bf6d635 792 * @par Function Description
johnAlexander 6:8ac15bf6d635 793 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
johnAlexander 6:8ac15bf6d635 794 * device NVM value
johnAlexander 6:8ac15bf6d635 795 *
johnAlexander 6:8ac15bf6d635 796 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 797 *
johnAlexander 6:8ac15bf6d635 798 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 799 * @param p_offset_calibration_data_micro_meter Return part to part
johnAlexander 6:8ac15bf6d635 800 * calibration offset from device (microns)
johnAlexander 6:8ac15bf6d635 801 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 802 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 803 */
johnAlexander 6:8ac15bf6d635 804 VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 805 int32_t *p_offset_calibration_data_micro_meter);
johnAlexander 6:8ac15bf6d635 806 /**
johnAlexander 6:8ac15bf6d635 807 * Set or over-hide part to part calibration offset
johnAlexander 6:8ac15bf6d635 808 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter()
johnAlexander 6:8ac15bf6d635 809 *
johnAlexander 6:8ac15bf6d635 810 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 811 *
johnAlexander 6:8ac15bf6d635 812 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 813 * @param p_offset_calibration_data_micro_meter Offset (microns)
johnAlexander 6:8ac15bf6d635 814 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 815 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 816 */
johnAlexander 6:8ac15bf6d635 817 VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 818 int32_t offset_calibration_data_micro_meter);
johnAlexander 6:8ac15bf6d635 819
johnAlexander 6:8ac15bf6d635 820 VL53L0X_Error VL53L0X_perform_offset_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 821 FixPoint1616_t cal_distance_milli_meter,
johnAlexander 6:8ac15bf6d635 822 int32_t *p_offset_micro_meter);
johnAlexander 6:8ac15bf6d635 823
johnAlexander 6:8ac15bf6d635 824 VL53L0X_Error VL53L0X_perform_xtalk_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 825 FixPoint1616_t xtalk_cal_distance,
johnAlexander 6:8ac15bf6d635 826 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
johnAlexander 6:8ac15bf6d635 827
johnAlexander 6:8ac15bf6d635 828 /**
johnAlexander 6:8ac15bf6d635 829 * @brief Perform XTalk Measurement
johnAlexander 6:8ac15bf6d635 830 *
johnAlexander 6:8ac15bf6d635 831 * @details Measures the current cross talk from glass in front
johnAlexander 6:8ac15bf6d635 832 * of the sensor.
johnAlexander 6:8ac15bf6d635 833 * This functions performs a histogram measurement and uses the results
johnAlexander 6:8ac15bf6d635 834 * to measure the crosstalk. For the function to be successful, there
johnAlexander 6:8ac15bf6d635 835 * must be no target in front of the sensor.
johnAlexander 6:8ac15bf6d635 836 *
johnAlexander 6:8ac15bf6d635 837 * @warning This function is a blocking function
johnAlexander 6:8ac15bf6d635 838 *
johnAlexander 6:8ac15bf6d635 839 * @warning This function is not supported when the final range
johnAlexander 6:8ac15bf6d635 840 * vcsel clock period is set below 10 PCLKS.
johnAlexander 6:8ac15bf6d635 841 *
johnAlexander 6:8ac15bf6d635 842 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 843 *
johnAlexander 6:8ac15bf6d635 844 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 845 * @param timeout_ms Histogram measurement duration.
johnAlexander 6:8ac15bf6d635 846 * @param p_xtalk_per_spad Output parameter containing the crosstalk
johnAlexander 6:8ac15bf6d635 847 * measurement result, in MCPS/Spad.
johnAlexander 6:8ac15bf6d635 848 * Format fixpoint 16:16.
johnAlexander 6:8ac15bf6d635 849 * @param p_ambient_too_high Output parameter which indicate that
johnAlexander 6:8ac15bf6d635 850 * pXtalkPerSpad is not good if the Ambient
johnAlexander 6:8ac15bf6d635 851 * is too high.
johnAlexander 6:8ac15bf6d635 852 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 853 * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported
johnAlexander 6:8ac15bf6d635 854 * for this operation.
johnAlexander 6:8ac15bf6d635 855 * Must not be less than 10PCLKS.
johnAlexander 6:8ac15bf6d635 856 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 857 */
johnAlexander 6:8ac15bf6d635 858 VL53L0X_Error VL53L0X_perform_xtalk_measurement(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 859 uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad,
johnAlexander 6:8ac15bf6d635 860 uint8_t *p_ambient_too_high);
johnAlexander 6:8ac15bf6d635 861
johnAlexander 6:8ac15bf6d635 862 /**
johnAlexander 6:8ac15bf6d635 863 * @brief Enable/Disable Cross talk compensation feature
johnAlexander 6:8ac15bf6d635 864 *
johnAlexander 6:8ac15bf6d635 865 * @note This function is not Implemented.
johnAlexander 6:8ac15bf6d635 866 * Enable/Disable Cross Talk by set to zero the Cross Talk value
johnAlexander 6:8ac15bf6d635 867 * by using @a VL53L0X_SetXTalkCompensationRateMegaCps().
johnAlexander 6:8ac15bf6d635 868 *
johnAlexander 6:8ac15bf6d635 869 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 870 * @param x_talk_compensation_enable Cross talk compensation
johnAlexander 6:8ac15bf6d635 871 * to be set 0=disabled else = enabled
johnAlexander 6:8ac15bf6d635 872 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 873 */
johnAlexander 6:8ac15bf6d635 874 VL53L0X_Error VL53L0X_set_x_talk_compensation_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 875 uint8_t x_talk_compensation_enable);
johnAlexander 6:8ac15bf6d635 876
johnAlexander 6:8ac15bf6d635 877 /**
johnAlexander 6:8ac15bf6d635 878 * @brief Get Cross talk compensation rate
johnAlexander 6:8ac15bf6d635 879 *
johnAlexander 6:8ac15bf6d635 880 * @note This function is not Implemented.
johnAlexander 6:8ac15bf6d635 881 * Enable/Disable Cross Talk by set to zero the Cross Talk value by
johnAlexander 6:8ac15bf6d635 882 * using @a VL53L0X_SetXTalkCompensationRateMegaCps().
johnAlexander 6:8ac15bf6d635 883 *
johnAlexander 6:8ac15bf6d635 884 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 885 * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation
johnAlexander 6:8ac15bf6d635 886 * state 0=disabled or 1 = enabled
johnAlexander 6:8ac15bf6d635 887 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 888 */
johnAlexander 6:8ac15bf6d635 889 VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 890 uint8_t *p_x_talk_compensation_enable);
johnAlexander 6:8ac15bf6d635 891 /**
johnAlexander 6:8ac15bf6d635 892 * @brief Set Cross talk compensation rate
johnAlexander 6:8ac15bf6d635 893 *
johnAlexander 6:8ac15bf6d635 894 * @par Function Description
johnAlexander 6:8ac15bf6d635 895 * Set Cross talk compensation rate.
johnAlexander 6:8ac15bf6d635 896 *
johnAlexander 6:8ac15bf6d635 897 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 898 *
johnAlexander 6:8ac15bf6d635 899 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 900 * @param x_talk_compensation_rate_mega_cps Compensation rate in
johnAlexander 6:8ac15bf6d635 901 * Mega counts per second
johnAlexander 6:8ac15bf6d635 902 * (16.16 fix point) see
johnAlexander 6:8ac15bf6d635 903 * datasheet for details
johnAlexander 6:8ac15bf6d635 904 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 905 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 906 */
johnAlexander 6:8ac15bf6d635 907 VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 908 FixPoint1616_t x_talk_compensation_rate_mega_cps);
johnAlexander 6:8ac15bf6d635 909
johnAlexander 6:8ac15bf6d635 910 /**
johnAlexander 6:8ac15bf6d635 911 * @brief Get Cross talk compensation rate
johnAlexander 6:8ac15bf6d635 912 *
johnAlexander 6:8ac15bf6d635 913 * @par Function Description
johnAlexander 6:8ac15bf6d635 914 * Get Cross talk compensation rate.
johnAlexander 6:8ac15bf6d635 915 *
johnAlexander 6:8ac15bf6d635 916 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 917 *
johnAlexander 6:8ac15bf6d635 918 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 919 * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate
johnAlexander 6:8ac15bf6d635 920 * in Mega counts per second
johnAlexander 6:8ac15bf6d635 921 * (16.16 fix point) see
johnAlexander 6:8ac15bf6d635 922 * datasheet for details
johnAlexander 6:8ac15bf6d635 923 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 924 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 925 */
johnAlexander 6:8ac15bf6d635 926 VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 927 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
johnAlexander 6:8ac15bf6d635 928
johnAlexander 6:8ac15bf6d635 929 /**
johnAlexander 6:8ac15bf6d635 930 * @brief Set a new device mode
johnAlexander 6:8ac15bf6d635 931 * @par Function Description
johnAlexander 6:8ac15bf6d635 932 * Set device to a new mode (ranging, histogram ...)
johnAlexander 6:8ac15bf6d635 933 *
johnAlexander 6:8ac15bf6d635 934 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 935 *
johnAlexander 6:8ac15bf6d635 936 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 937 * @param device_mode New device mode to apply
johnAlexander 6:8ac15bf6d635 938 * Valid values are:
johnAlexander 6:8ac15bf6d635 939 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 6:8ac15bf6d635 940 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
johnAlexander 6:8ac15bf6d635 941 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 6:8ac15bf6d635 942 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 6:8ac15bf6d635 943 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 6:8ac15bf6d635 944 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 6:8ac15bf6d635 945 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 6:8ac15bf6d635 946 *
johnAlexander 6:8ac15bf6d635 947 *
johnAlexander 6:8ac15bf6d635 948 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 949 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 6:8ac15bf6d635 950 * DeviceMode is not in the
johnAlexander 6:8ac15bf6d635 951 * supported list
johnAlexander 6:8ac15bf6d635 952 */
johnAlexander 6:8ac15bf6d635 953 VL53L0X_Error VL53L0X_set_device_mode(VL53L0X_DEV dev, VL53L0X_DeviceModes device_mode);
johnAlexander 6:8ac15bf6d635 954
johnAlexander 6:8ac15bf6d635 955 /**
johnAlexander 6:8ac15bf6d635 956 * @brief Get current new device mode
johnAlexander 6:8ac15bf6d635 957 * @par Function Description
johnAlexander 6:8ac15bf6d635 958 * Get actual mode of the device(ranging, histogram ...)
johnAlexander 6:8ac15bf6d635 959 *
johnAlexander 6:8ac15bf6d635 960 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 961 *
johnAlexander 6:8ac15bf6d635 962 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 963 * @param p_device_mode Pointer to current apply mode value
johnAlexander 6:8ac15bf6d635 964 * Valid values are:
johnAlexander 6:8ac15bf6d635 965 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 6:8ac15bf6d635 966 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
johnAlexander 6:8ac15bf6d635 967 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 6:8ac15bf6d635 968 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 6:8ac15bf6d635 969 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 6:8ac15bf6d635 970 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 6:8ac15bf6d635 971 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 6:8ac15bf6d635 972 *
johnAlexander 6:8ac15bf6d635 973 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 974 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 6:8ac15bf6d635 975 * DeviceMode is not in the
johnAlexander 6:8ac15bf6d635 976 * supported list
johnAlexander 6:8ac15bf6d635 977 */
johnAlexander 6:8ac15bf6d635 978 VL53L0X_Error VL53L0X_get_device_mode(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 979 VL53L0X_DeviceModes *p_device_mode);
johnAlexander 6:8ac15bf6d635 980
johnAlexander 6:8ac15bf6d635 981 /**
johnAlexander 6:8ac15bf6d635 982 * @brief Get current configuration for GPIO pin for a given device
johnAlexander 6:8ac15bf6d635 983 *
johnAlexander 6:8ac15bf6d635 984 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 985 *
johnAlexander 6:8ac15bf6d635 986 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 987 * @param pin ID of the GPIO Pin
johnAlexander 6:8ac15bf6d635 988 * @param p_device_mode Pointer to Device Mode associated to the Gpio.
johnAlexander 6:8ac15bf6d635 989 * @param p_functionality Pointer to Pin functionality.
johnAlexander 6:8ac15bf6d635 990 * Refer to ::VL53L0X_GpioFunctionality
johnAlexander 6:8ac15bf6d635 991 * @param p_polarity Pointer to interrupt polarity.
johnAlexander 6:8ac15bf6d635 992 * Active high or active low see
johnAlexander 6:8ac15bf6d635 993 * ::VL53L0X_InterruptPolarity
johnAlexander 6:8ac15bf6d635 994 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 995 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
johnAlexander 6:8ac15bf6d635 996 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED
johnAlexander 6:8ac15bf6d635 997 * This error occurs
johnAlexander 6:8ac15bf6d635 998 * when Funcionality programmed is not in the supported list:
johnAlexander 6:8ac15bf6d635 999 * Supported value are:
johnAlexander 6:8ac15bf6d635 1000 * VL53L0X_GPIOFUNCTIONALITY_OFF,
johnAlexander 6:8ac15bf6d635 1001 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
johnAlexander 6:8ac15bf6d635 1002 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
johnAlexander 6:8ac15bf6d635 1003 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
johnAlexander 6:8ac15bf6d635 1004 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
johnAlexander 6:8ac15bf6d635 1005 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1006 */
johnAlexander 6:8ac15bf6d635 1007 VL53L0X_Error VL53L0X_get_gpio_config(VL53L0X_DEV dev, uint8_t pin,
johnAlexander 6:8ac15bf6d635 1008 VL53L0X_DeviceModes *p_device_mode,
johnAlexander 6:8ac15bf6d635 1009 VL53L0X_GpioFunctionality *p_functionality,
johnAlexander 6:8ac15bf6d635 1010 VL53L0X_InterruptPolarity *p_polarity);
johnAlexander 6:8ac15bf6d635 1011
johnAlexander 6:8ac15bf6d635 1012 /**
johnAlexander 6:8ac15bf6d635 1013 * @brief Set the configuration of GPIO pin for a given device
johnAlexander 6:8ac15bf6d635 1014 *
johnAlexander 6:8ac15bf6d635 1015 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1016 *
johnAlexander 6:8ac15bf6d635 1017 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1018 * @param pin ID of the GPIO Pin
johnAlexander 6:8ac15bf6d635 1019 * @param functionality Select Pin functionality.
johnAlexander 6:8ac15bf6d635 1020 * Refer to ::VL53L0X_GpioFunctionality
johnAlexander 6:8ac15bf6d635 1021 * @param device_mode Device Mode associated to the Gpio.
johnAlexander 6:8ac15bf6d635 1022 * @param polarity Set interrupt polarity. Active high
johnAlexander 6:8ac15bf6d635 1023 * or active low see ::VL53L0X_InterruptPolarity
johnAlexander 6:8ac15bf6d635 1024 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1025 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
johnAlexander 6:8ac15bf6d635 1026 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs
johnAlexander 6:8ac15bf6d635 1027 * when Functionality programmed is not in the supported list:
johnAlexander 6:8ac15bf6d635 1028 * Supported value are:
johnAlexander 6:8ac15bf6d635 1029 * VL53L0X_GPIOFUNCTIONALITY_OFF,
johnAlexander 6:8ac15bf6d635 1030 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
johnAlexander 6:8ac15bf6d635 1031 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
johnAlexander 6:8ac15bf6d635 1032 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
johnAlexander 6:8ac15bf6d635 1033 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
johnAlexander 6:8ac15bf6d635 1034 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1035 */
johnAlexander 6:8ac15bf6d635 1036 VL53L0X_Error VL53L0X_set_gpio_config(VL53L0X_DEV dev, uint8_t pin,
johnAlexander 6:8ac15bf6d635 1037 VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality,
johnAlexander 6:8ac15bf6d635 1038 VL53L0X_InterruptPolarity polarity);
johnAlexander 6:8ac15bf6d635 1039
johnAlexander 6:8ac15bf6d635 1040 /**
johnAlexander 6:8ac15bf6d635 1041 * @brief Start device measurement
johnAlexander 6:8ac15bf6d635 1042 *
johnAlexander 6:8ac15bf6d635 1043 * @details Started measurement will depend on device parameters set through
johnAlexander 6:8ac15bf6d635 1044 * @a VL53L0X_SetParameters()
johnAlexander 6:8ac15bf6d635 1045 * This is a non-blocking function.
johnAlexander 6:8ac15bf6d635 1046 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to
johnAlexander 6:8ac15bf6d635 1047 * VL53L0X_STATE_RUNNING.
johnAlexander 6:8ac15bf6d635 1048 *
johnAlexander 6:8ac15bf6d635 1049 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1050 *
johnAlexander 6:8ac15bf6d635 1051
johnAlexander 6:8ac15bf6d635 1052 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1053 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1054 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 6:8ac15bf6d635 1055 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported
johnAlexander 6:8ac15bf6d635 1056 * list:
johnAlexander 6:8ac15bf6d635 1057 * Supported mode are:
johnAlexander 6:8ac15bf6d635 1058 * VL53L0X_DEVICEMODE_SINGLE_RANGING,
johnAlexander 6:8ac15bf6d635 1059 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING,
johnAlexander 6:8ac15bf6d635 1060 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 6:8ac15bf6d635 1061 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement
johnAlexander 6:8ac15bf6d635 1062 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1063 */
johnAlexander 6:8ac15bf6d635 1064 VL53L0X_Error VL53L0X_start_measurement(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1065
johnAlexander 6:8ac15bf6d635 1066 /**
johnAlexander 6:8ac15bf6d635 1067 * @brief Stop device measurement
johnAlexander 6:8ac15bf6d635 1068 *
johnAlexander 6:8ac15bf6d635 1069 * @details Will set the device in standby mode at end of current measurement\n
johnAlexander 6:8ac15bf6d635 1070 * Not necessary in single mode as device shall return automatically
johnAlexander 6:8ac15bf6d635 1071 * in standby mode at end of measurement.
johnAlexander 6:8ac15bf6d635 1072 * This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING
johnAlexander 6:8ac15bf6d635 1073 * to VL53L0X_STATE_IDLE.
johnAlexander 6:8ac15bf6d635 1074 *
johnAlexander 6:8ac15bf6d635 1075 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1076 *
johnAlexander 6:8ac15bf6d635 1077 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1078 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1079 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1080 */
johnAlexander 6:8ac15bf6d635 1081 VL53L0X_Error VL53L0X_stop_measurement(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1082
johnAlexander 6:8ac15bf6d635 1083 /**
johnAlexander 6:8ac15bf6d635 1084 * @brief Return device stop completion status
johnAlexander 6:8ac15bf6d635 1085 *
johnAlexander 6:8ac15bf6d635 1086 * @par Function Description
johnAlexander 6:8ac15bf6d635 1087 * Returns stop completiob status.
johnAlexander 6:8ac15bf6d635 1088 * User shall call this function after a stop command
johnAlexander 6:8ac15bf6d635 1089 *
johnAlexander 6:8ac15bf6d635 1090 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1091 *
johnAlexander 6:8ac15bf6d635 1092 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1093 * @param p_stop_status Pointer to status variable to update
johnAlexander 6:8ac15bf6d635 1094 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1095 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1096 */
johnAlexander 6:8ac15bf6d635 1097 VL53L0X_Error VL53L0X_get_stop_completed_status(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1098 uint32_t *p_stop_status);
johnAlexander 6:8ac15bf6d635 1099
johnAlexander 6:8ac15bf6d635 1100 /**
johnAlexander 6:8ac15bf6d635 1101 * @brief Return Measurement Data Ready
johnAlexander 6:8ac15bf6d635 1102 *
johnAlexander 6:8ac15bf6d635 1103 * @par Function Description
johnAlexander 6:8ac15bf6d635 1104 * This function indicate that a measurement data is ready.
johnAlexander 6:8ac15bf6d635 1105 * This function check if interrupt mode is used then check is done accordingly.
johnAlexander 6:8ac15bf6d635 1106 * If perform function clear the interrupt, this function will not work,
johnAlexander 6:8ac15bf6d635 1107 * like in case of @a VL53L0X_PerformSingleRangingMeasurement().
johnAlexander 6:8ac15bf6d635 1108 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady
johnAlexander 6:8ac15bf6d635 1109 * is used for non-blocking capture.
johnAlexander 6:8ac15bf6d635 1110 *
johnAlexander 6:8ac15bf6d635 1111 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1112 *
johnAlexander 6:8ac15bf6d635 1113 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1114 * @param p_measurement_data_ready Pointer to Measurement Data Ready.
johnAlexander 6:8ac15bf6d635 1115 * 0=data not ready, 1 = data ready
johnAlexander 6:8ac15bf6d635 1116 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1117 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1118 */
johnAlexander 6:8ac15bf6d635 1119 VL53L0X_Error VL53L0X_get_measurement_data_ready(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1120 uint8_t *p_measurement_data_ready);
johnAlexander 6:8ac15bf6d635 1121
johnAlexander 6:8ac15bf6d635 1122 /**
johnAlexander 6:8ac15bf6d635 1123 * @brief Retrieve the measurements from device for a given setup
johnAlexander 6:8ac15bf6d635 1124 *
johnAlexander 6:8ac15bf6d635 1125 * @par Function Description
johnAlexander 6:8ac15bf6d635 1126 * Get data from last successful Ranging measurement
johnAlexander 6:8ac15bf6d635 1127 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 6:8ac15bf6d635 1128 * before get data.
johnAlexander 6:8ac15bf6d635 1129 * PAL will fill a NumberOfROIZones times the corresponding data
johnAlexander 6:8ac15bf6d635 1130 * structure used in the measurement function.
johnAlexander 6:8ac15bf6d635 1131 *
johnAlexander 6:8ac15bf6d635 1132 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1133 *
johnAlexander 6:8ac15bf6d635 1134 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1135 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
johnAlexander 6:8ac15bf6d635 1136 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1137 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1138 */
johnAlexander 6:8ac15bf6d635 1139 VL53L0X_Error VL53L0X_get_ranging_measurement_data(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1140 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
johnAlexander 6:8ac15bf6d635 1141
johnAlexander 6:8ac15bf6d635 1142 /**
johnAlexander 6:8ac15bf6d635 1143 * @brief Clear given system interrupt condition
johnAlexander 6:8ac15bf6d635 1144 *
johnAlexander 6:8ac15bf6d635 1145 * @par Function Description
johnAlexander 6:8ac15bf6d635 1146 * Clear given interrupt(s).
johnAlexander 6:8ac15bf6d635 1147 *
johnAlexander 6:8ac15bf6d635 1148 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1149 *
johnAlexander 6:8ac15bf6d635 1150 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1151 * @param interrupt_mask Mask of interrupts to clear
johnAlexander 6:8ac15bf6d635 1152 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1153 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts
johnAlexander 6:8ac15bf6d635 1154 *
johnAlexander 6:8ac15bf6d635 1155 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1156 */
johnAlexander 6:8ac15bf6d635 1157 VL53L0X_Error VL53L0X_clear_interrupt_mask(VL53L0X_DEV dev, uint32_t interrupt_mask);
johnAlexander 6:8ac15bf6d635 1158
johnAlexander 6:8ac15bf6d635 1159 /**
johnAlexander 6:8ac15bf6d635 1160 * @brief Return device interrupt status
johnAlexander 6:8ac15bf6d635 1161 *
johnAlexander 6:8ac15bf6d635 1162 * @par Function Description
johnAlexander 6:8ac15bf6d635 1163 * Returns currently raised interrupts by the device.
johnAlexander 6:8ac15bf6d635 1164 * User shall be able to activate/deactivate interrupts through
johnAlexander 6:8ac15bf6d635 1165 * @a VL53L0X_SetGpioConfig()
johnAlexander 6:8ac15bf6d635 1166 *
johnAlexander 6:8ac15bf6d635 1167 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1168 *
johnAlexander 6:8ac15bf6d635 1169 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1170 * @param p_interrupt_mask_status Pointer to status variable to update
johnAlexander 6:8ac15bf6d635 1171 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1172 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1173 */
johnAlexander 6:8ac15bf6d635 1174 VL53L0X_Error VL53L0X_get_interrupt_mask_status(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1175 uint32_t *p_interrupt_mask_status);
johnAlexander 6:8ac15bf6d635 1176
johnAlexander 6:8ac15bf6d635 1177 /**
johnAlexander 6:8ac15bf6d635 1178 * @brief Performs a single ranging measurement and retrieve the ranging
johnAlexander 6:8ac15bf6d635 1179 * measurement data
johnAlexander 6:8ac15bf6d635 1180 *
johnAlexander 6:8ac15bf6d635 1181 * @par Function Description
johnAlexander 6:8ac15bf6d635 1182 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 6:8ac15bf6d635 1183 * with @a VL53L0X_SetDeviceMode(),
johnAlexander 6:8ac15bf6d635 1184 * It performs measurement with @a VL53L0X_PerformSingleMeasurement()
johnAlexander 6:8ac15bf6d635 1185 * It get data from last successful Ranging measurement with
johnAlexander 6:8ac15bf6d635 1186 * @a VL53L0X_GetRangingMeasurementData.
johnAlexander 6:8ac15bf6d635 1187 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask().
johnAlexander 6:8ac15bf6d635 1188 *
johnAlexander 6:8ac15bf6d635 1189 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1190 *
johnAlexander 6:8ac15bf6d635 1191 * @note This function change the device mode to
johnAlexander 6:8ac15bf6d635 1192 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 6:8ac15bf6d635 1193 *
johnAlexander 6:8ac15bf6d635 1194 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1195 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
johnAlexander 6:8ac15bf6d635 1196 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1197 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1198 */
johnAlexander 6:8ac15bf6d635 1199 VL53L0X_Error VL53L0X_perform_single_ranging_measurement(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1200 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
johnAlexander 6:8ac15bf6d635 1201
johnAlexander 6:8ac15bf6d635 1202 /**
johnAlexander 6:8ac15bf6d635 1203 * @brief Single shot measurement.
johnAlexander 6:8ac15bf6d635 1204 *
johnAlexander 6:8ac15bf6d635 1205 * @par Function Description
johnAlexander 6:8ac15bf6d635 1206 * Perform simple measurement sequence (Start measure, Wait measure to end,
johnAlexander 6:8ac15bf6d635 1207 * and returns when measurement is done).
johnAlexander 6:8ac15bf6d635 1208 * Once function returns, user can get valid data by calling
johnAlexander 6:8ac15bf6d635 1209 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement
johnAlexander 6:8ac15bf6d635 1210 * depending on defined measurement mode
johnAlexander 6:8ac15bf6d635 1211 * User should Clear the interrupt in case this are enabled by using the
johnAlexander 6:8ac15bf6d635 1212 * function VL53L0X_ClearInterruptMask().
johnAlexander 6:8ac15bf6d635 1213 *
johnAlexander 6:8ac15bf6d635 1214 * @warning This function is a blocking function
johnAlexander 6:8ac15bf6d635 1215 *
johnAlexander 6:8ac15bf6d635 1216 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1217 *
johnAlexander 6:8ac15bf6d635 1218 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1219 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1220 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1221 */
johnAlexander 6:8ac15bf6d635 1222 VL53L0X_Error VL53L0X_perform_single_measurement(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1223
johnAlexander 6:8ac15bf6d635 1224 /**
johnAlexander 6:8ac15bf6d635 1225 * @brief Read current status of the error register for the selected device
johnAlexander 6:8ac15bf6d635 1226 *
johnAlexander 6:8ac15bf6d635 1227 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1228 *
johnAlexander 6:8ac15bf6d635 1229 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1230 * @param p_device_error_status Pointer to current error code of the device
johnAlexander 6:8ac15bf6d635 1231 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1232 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1233 */
johnAlexander 6:8ac15bf6d635 1234 VL53L0X_Error VL53L0X_get_device_error_status(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1235 VL53L0X_DeviceError *p_device_error_status);
johnAlexander 6:8ac15bf6d635 1236
johnAlexander 6:8ac15bf6d635 1237 /**
johnAlexander 6:8ac15bf6d635 1238 * @brief Human readable error string for a given Error Code
johnAlexander 6:8ac15bf6d635 1239 *
johnAlexander 6:8ac15bf6d635 1240 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1241 *
johnAlexander 6:8ac15bf6d635 1242 * @param error_code The error code as stored on ::VL53L0X_DeviceError
johnAlexander 6:8ac15bf6d635 1243 * @param p_device_error_string The error string corresponding to the ErrorCode
johnAlexander 6:8ac15bf6d635 1244 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1245 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1246 */
johnAlexander 6:8ac15bf6d635 1247 VL53L0X_Error VL53L0X_get_device_error_string(
johnAlexander 6:8ac15bf6d635 1248 VL53L0X_DeviceError error_code, char *p_device_error_string);
johnAlexander 6:8ac15bf6d635 1249
johnAlexander 6:8ac15bf6d635 1250 /**
johnAlexander 6:8ac15bf6d635 1251 * @brief Human readable Range Status string for a given RangeStatus
johnAlexander 6:8ac15bf6d635 1252 *
johnAlexander 6:8ac15bf6d635 1253 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1254 *
johnAlexander 6:8ac15bf6d635 1255 * @param range_status The RangeStatus code as stored on
johnAlexander 6:8ac15bf6d635 1256 * @a VL53L0X_RangingMeasurementData_t
johnAlexander 6:8ac15bf6d635 1257 * @param p_range_status_string The returned RangeStatus string.
johnAlexander 6:8ac15bf6d635 1258 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1259 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1260 */
johnAlexander 6:8ac15bf6d635 1261 VL53L0X_Error VL53L0X_get_range_status_string(uint8_t range_status,
johnAlexander 6:8ac15bf6d635 1262 char *p_range_status_string);
johnAlexander 6:8ac15bf6d635 1263
johnAlexander 6:8ac15bf6d635 1264 VL53L0X_Error VL53L0X_get_total_signal_rate(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1265 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 6:8ac15bf6d635 1266 FixPoint1616_t *p_total_signal_rate_mcps);
johnAlexander 6:8ac15bf6d635 1267
johnAlexander 6:8ac15bf6d635 1268 VL53L0X_Error VL53L0X_get_total_xtalk_rate(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1269 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 6:8ac15bf6d635 1270 FixPoint1616_t *p_total_xtalk_rate_mcps);
johnAlexander 6:8ac15bf6d635 1271
johnAlexander 6:8ac15bf6d635 1272 /**
johnAlexander 6:8ac15bf6d635 1273 * @brief Get Ranging Timing Budget in microseconds
johnAlexander 6:8ac15bf6d635 1274 *
johnAlexander 6:8ac15bf6d635 1275 * @par Function Description
johnAlexander 6:8ac15bf6d635 1276 * Returns the programmed the maximum time allowed by the user to the
johnAlexander 6:8ac15bf6d635 1277 * device to run a full ranging sequence for the current mode
johnAlexander 6:8ac15bf6d635 1278 * (ranging, histogram, ASL ...)
johnAlexander 6:8ac15bf6d635 1279 *
johnAlexander 6:8ac15bf6d635 1280 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1281 *
johnAlexander 6:8ac15bf6d635 1282 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1283 * @param p_measurement_timing_budget_micro_seconds Max measurement time in
johnAlexander 6:8ac15bf6d635 1284 * microseconds.
johnAlexander 6:8ac15bf6d635 1285 * Valid values are:
johnAlexander 6:8ac15bf6d635 1286 * >= 17000 microsecs when wraparound enabled
johnAlexander 6:8ac15bf6d635 1287 * >= 12000 microsecs when wraparound disabled
johnAlexander 6:8ac15bf6d635 1288 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1289 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1290 */
johnAlexander 6:8ac15bf6d635 1291 VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1292 uint32_t *p_measurement_timing_budget_micro_seconds);
johnAlexander 6:8ac15bf6d635 1293
johnAlexander 6:8ac15bf6d635 1294 /**
johnAlexander 6:8ac15bf6d635 1295 * @brief Set Ranging Timing Budget in microseconds
johnAlexander 6:8ac15bf6d635 1296 *
johnAlexander 6:8ac15bf6d635 1297 * @par Function Description
johnAlexander 6:8ac15bf6d635 1298 * Defines the maximum time allowed by the user to the device to run a
johnAlexander 6:8ac15bf6d635 1299 * full ranging sequence for the current mode (ranging, histogram, ASL ...)
johnAlexander 6:8ac15bf6d635 1300 *
johnAlexander 6:8ac15bf6d635 1301 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1302 *
johnAlexander 6:8ac15bf6d635 1303 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1304 * @param measurement_timing_budget_micro_seconds Max measurement time in
johnAlexander 6:8ac15bf6d635 1305 * microseconds.
johnAlexander 6:8ac15bf6d635 1306 * Valid values are:
johnAlexander 6:8ac15bf6d635 1307 * >= 17000 microsecs when wraparound enabled
johnAlexander 6:8ac15bf6d635 1308 * >= 12000 microsecs when wraparound disabled
johnAlexander 6:8ac15bf6d635 1309 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1310 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
johnAlexander 6:8ac15bf6d635 1311 MeasurementTimingBudgetMicroSeconds out of range
johnAlexander 6:8ac15bf6d635 1312 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1313 */
johnAlexander 6:8ac15bf6d635 1314 VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1315 uint32_t measurement_timing_budget_micro_seconds);
johnAlexander 6:8ac15bf6d635 1316
johnAlexander 6:8ac15bf6d635 1317 /**
johnAlexander 6:8ac15bf6d635 1318 * @brief Get specific limit check enable state
johnAlexander 6:8ac15bf6d635 1319 *
johnAlexander 6:8ac15bf6d635 1320 * @par Function Description
johnAlexander 6:8ac15bf6d635 1321 * This function get the enable state of a specific limit check.
johnAlexander 6:8ac15bf6d635 1322 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 1323 *
johnAlexander 6:8ac15bf6d635 1324 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1325 *
johnAlexander 6:8ac15bf6d635 1326 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1327 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1328 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1329 * @param p_limit_check_enable Pointer to the check limit enable
johnAlexander 6:8ac15bf6d635 1330 * value.
johnAlexander 6:8ac15bf6d635 1331 * if 1 the check limit
johnAlexander 6:8ac15bf6d635 1332 * corresponding to LimitCheckId is Enabled
johnAlexander 6:8ac15bf6d635 1333 * if 0 the check limit
johnAlexander 6:8ac15bf6d635 1334 * corresponding to LimitCheckId is disabled
johnAlexander 6:8ac15bf6d635 1335 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1336 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 6:8ac15bf6d635 1337 * when LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 1338 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1339 */
johnAlexander 6:8ac15bf6d635 1340 VL53L0X_Error VL53L0X_get_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 1341 uint8_t *p_limit_check_enable);
johnAlexander 6:8ac15bf6d635 1342
johnAlexander 6:8ac15bf6d635 1343 /**
johnAlexander 6:8ac15bf6d635 1344 * @brief Enable/Disable a specific limit check
johnAlexander 6:8ac15bf6d635 1345 *
johnAlexander 6:8ac15bf6d635 1346 * @par Function Description
johnAlexander 6:8ac15bf6d635 1347 * This function Enable/Disable a specific limit check.
johnAlexander 6:8ac15bf6d635 1348 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 1349 *
johnAlexander 6:8ac15bf6d635 1350 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 1351 *
johnAlexander 6:8ac15bf6d635 1352 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1353 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1354 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1355 * @param limit_check_enable if 1 the check limit
johnAlexander 6:8ac15bf6d635 1356 * corresponding to LimitCheckId is Enabled
johnAlexander 6:8ac15bf6d635 1357 * if 0 the check limit
johnAlexander 6:8ac15bf6d635 1358 * corresponding to LimitCheckId is disabled
johnAlexander 6:8ac15bf6d635 1359 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1360 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 6:8ac15bf6d635 1361 * when LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 1362 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1363 */
johnAlexander 6:8ac15bf6d635 1364 VL53L0X_Error VL53L0X_set_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 1365 uint8_t limit_check_enable);
johnAlexander 6:8ac15bf6d635 1366
johnAlexander 6:8ac15bf6d635 1367 /**
johnAlexander 6:8ac15bf6d635 1368 * @brief Get a specific limit check value
johnAlexander 6:8ac15bf6d635 1369 *
johnAlexander 6:8ac15bf6d635 1370 * @par Function Description
johnAlexander 6:8ac15bf6d635 1371 * This function get a specific limit check value from device then it updates
johnAlexander 6:8ac15bf6d635 1372 * internal values and check enables.
johnAlexander 6:8ac15bf6d635 1373 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 1374 *
johnAlexander 6:8ac15bf6d635 1375 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1376 *
johnAlexander 6:8ac15bf6d635 1377 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1378 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1379 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1380 * @param p_limit_check_value Pointer to Limit
johnAlexander 6:8ac15bf6d635 1381 * check Value for a given LimitCheckId.
johnAlexander 6:8ac15bf6d635 1382 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1383 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 6:8ac15bf6d635 1384 * when LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 1385 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1386 */
johnAlexander 6:8ac15bf6d635 1387 VL53L0X_Error VL53L0X_get_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 1388 FixPoint1616_t *p_limit_check_value);
johnAlexander 6:8ac15bf6d635 1389
johnAlexander 6:8ac15bf6d635 1390 /**
johnAlexander 6:8ac15bf6d635 1391 * @brief Set a specific limit check value
johnAlexander 6:8ac15bf6d635 1392 *
johnAlexander 6:8ac15bf6d635 1393 * @par Function Description
johnAlexander 6:8ac15bf6d635 1394 * This function set a specific limit check value.
johnAlexander 6:8ac15bf6d635 1395 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 1396 *
johnAlexander 6:8ac15bf6d635 1397 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1398 *
johnAlexander 6:8ac15bf6d635 1399 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1400 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1401 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1402 * @param limit_check_value Limit check Value for a given
johnAlexander 6:8ac15bf6d635 1403 * LimitCheckId
johnAlexander 6:8ac15bf6d635 1404 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1405 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when either
johnAlexander 6:8ac15bf6d635 1406 * LimitCheckId or LimitCheckValue value is out of range.
johnAlexander 6:8ac15bf6d635 1407 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1408 */
johnAlexander 6:8ac15bf6d635 1409 VL53L0X_Error VL53L0X_set_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 1410 FixPoint1616_t limit_check_value);
johnAlexander 6:8ac15bf6d635 1411
johnAlexander 6:8ac15bf6d635 1412 /**
johnAlexander 6:8ac15bf6d635 1413 * @brief Get the current value of the signal used for the limit check
johnAlexander 6:8ac15bf6d635 1414 *
johnAlexander 6:8ac15bf6d635 1415 * @par Function Description
johnAlexander 6:8ac15bf6d635 1416 * This function get a the current value of the signal used for the limit check.
johnAlexander 6:8ac15bf6d635 1417 * To obtain the latest value you should run a ranging before.
johnAlexander 6:8ac15bf6d635 1418 * The value reported is linked to the limit check identified with the
johnAlexander 6:8ac15bf6d635 1419 * LimitCheckId.
johnAlexander 6:8ac15bf6d635 1420 *
johnAlexander 6:8ac15bf6d635 1421 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1422 *
johnAlexander 6:8ac15bf6d635 1423 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1424 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1425 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1426 * @param p_limit_check_current Pointer to current Value for a
johnAlexander 6:8ac15bf6d635 1427 * given LimitCheckId.
johnAlexander 6:8ac15bf6d635 1428 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1429 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when
johnAlexander 6:8ac15bf6d635 1430 * LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 1431 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1432 */
johnAlexander 6:8ac15bf6d635 1433 VL53L0X_Error VL53L0X_get_limit_check_current(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 1434 FixPoint1616_t *p_limit_check_current);
johnAlexander 6:8ac15bf6d635 1435
johnAlexander 6:8ac15bf6d635 1436 /**
johnAlexander 6:8ac15bf6d635 1437 * @brief Return a the Status of the specified check limit
johnAlexander 6:8ac15bf6d635 1438 *
johnAlexander 6:8ac15bf6d635 1439 * @par Function Description
johnAlexander 6:8ac15bf6d635 1440 * This function returns the Status of the specified check limit.
johnAlexander 6:8ac15bf6d635 1441 * The value indicate if the check is fail or not.
johnAlexander 6:8ac15bf6d635 1442 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 1443 *
johnAlexander 6:8ac15bf6d635 1444 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 1445 *
johnAlexander 6:8ac15bf6d635 1446 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1447 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 1448 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 1449 * @param p_limit_check_status Pointer to the
johnAlexander 6:8ac15bf6d635 1450 Limit Check Status of the given check limit.
johnAlexander 6:8ac15bf6d635 1451 * LimitCheckStatus :
johnAlexander 6:8ac15bf6d635 1452 * 0 the check is not fail
johnAlexander 6:8ac15bf6d635 1453 * 1 the check if fail or not enabled
johnAlexander 6:8ac15bf6d635 1454 *
johnAlexander 6:8ac15bf6d635 1455 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1456 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
johnAlexander 6:8ac15bf6d635 1457 returned when LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 1458 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1459 */
johnAlexander 6:8ac15bf6d635 1460 VL53L0X_Error VL53L0X_get_limit_check_status(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1461 uint16_t limit_check_id, uint8_t *p_limit_check_status);
johnAlexander 6:8ac15bf6d635 1462
johnAlexander 6:8ac15bf6d635 1463 /**
johnAlexander 6:8ac15bf6d635 1464 * Get continuous mode Inter-Measurement period in milliseconds
johnAlexander 6:8ac15bf6d635 1465 *
johnAlexander 6:8ac15bf6d635 1466 * @par Function Description
johnAlexander 6:8ac15bf6d635 1467 * When trying to set too short time return INVALID_PARAMS minimal value
johnAlexander 6:8ac15bf6d635 1468 *
johnAlexander 6:8ac15bf6d635 1469 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1470 *
johnAlexander 6:8ac15bf6d635 1471 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1472 * @param p_inter_measurement_period_milli_seconds Pointer to programmed
johnAlexander 6:8ac15bf6d635 1473 * Inter-Measurement Period in milliseconds.
johnAlexander 6:8ac15bf6d635 1474 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1475 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1476 */
johnAlexander 6:8ac15bf6d635 1477 VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1478 uint32_t *p_inter_measurement_period_milli_seconds);
johnAlexander 6:8ac15bf6d635 1479
johnAlexander 6:8ac15bf6d635 1480 /**
johnAlexander 6:8ac15bf6d635 1481 * Program continuous mode Inter-Measurement period in milliseconds
johnAlexander 6:8ac15bf6d635 1482 *
johnAlexander 6:8ac15bf6d635 1483 * @par Function Description
johnAlexander 6:8ac15bf6d635 1484 * When trying to set too short time return INVALID_PARAMS minimal value
johnAlexander 6:8ac15bf6d635 1485 *
johnAlexander 6:8ac15bf6d635 1486 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1487 *
johnAlexander 6:8ac15bf6d635 1488 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1489 * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms.
johnAlexander 6:8ac15bf6d635 1490 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1491 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1492 */
johnAlexander 6:8ac15bf6d635 1493 VL53L0X_Error VL53L0X_set_inter_measurement_period_milli_seconds(
johnAlexander 6:8ac15bf6d635 1494 VL53L0X_DEV dev, uint32_t inter_measurement_period_milli_seconds);
johnAlexander 6:8ac15bf6d635 1495
johnAlexander 6:8ac15bf6d635 1496 /**
johnAlexander 6:8ac15bf6d635 1497 * @brief Set new device address
johnAlexander 6:8ac15bf6d635 1498 *
johnAlexander 6:8ac15bf6d635 1499 * After completion the device will answer to the new address programmed.
johnAlexander 6:8ac15bf6d635 1500 * This function should be called when several devices are used in parallel
johnAlexander 6:8ac15bf6d635 1501 * before start programming the sensor.
johnAlexander 6:8ac15bf6d635 1502 * When a single device us used, there is no need to call this function.
johnAlexander 6:8ac15bf6d635 1503 *
johnAlexander 6:8ac15bf6d635 1504 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1505 *
johnAlexander 6:8ac15bf6d635 1506 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1507 * @param device_address The new Device address
johnAlexander 6:8ac15bf6d635 1508 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1509 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1510 */
johnAlexander 6:8ac15bf6d635 1511 VL53L0X_Error VL53L0X_set_device_address(VL53L0X_DEV dev, uint8_t device_address);
johnAlexander 6:8ac15bf6d635 1512
johnAlexander 6:8ac15bf6d635 1513 /**
johnAlexander 6:8ac15bf6d635 1514 * @brief Do an hard reset or soft reset (depending on implementation) of the
johnAlexander 6:8ac15bf6d635 1515 * device \nAfter call of this function, device must be in same state as right
johnAlexander 6:8ac15bf6d635 1516 * after a power-up sequence.This function will change the VL53L0X_State to
johnAlexander 6:8ac15bf6d635 1517 * VL53L0X_STATE_POWERDOWN.
johnAlexander 6:8ac15bf6d635 1518 *
johnAlexander 6:8ac15bf6d635 1519 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1520 *
johnAlexander 6:8ac15bf6d635 1521 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1522 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1523 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1524 */
johnAlexander 6:8ac15bf6d635 1525 VL53L0X_Error VL53L0X_reset_device(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1526
johnAlexander 6:8ac15bf6d635 1527 /**
johnAlexander 6:8ac15bf6d635 1528 * @brief Get setup of Wrap around Check
johnAlexander 6:8ac15bf6d635 1529 *
johnAlexander 6:8ac15bf6d635 1530 * @par Function Description
johnAlexander 6:8ac15bf6d635 1531 * This function get the wrapAround check enable parameters
johnAlexander 6:8ac15bf6d635 1532 *
johnAlexander 6:8ac15bf6d635 1533 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1534 *
johnAlexander 6:8ac15bf6d635 1535 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1536 * @param p_wrap_around_check_enable Pointer to the Wrap around Check state
johnAlexander 6:8ac15bf6d635 1537 * 0=disabled or 1 = enabled
johnAlexander 6:8ac15bf6d635 1538 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1539 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1540 */
johnAlexander 6:8ac15bf6d635 1541 VL53L0X_Error VL53L0X_get_wrap_around_check_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1542 uint8_t *p_wrap_around_check_enable);
johnAlexander 6:8ac15bf6d635 1543
johnAlexander 6:8ac15bf6d635 1544 /**
johnAlexander 6:8ac15bf6d635 1545 * @brief Enable (or disable) Wrap around Check
johnAlexander 6:8ac15bf6d635 1546 *
johnAlexander 6:8ac15bf6d635 1547 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1548 *
johnAlexander 6:8ac15bf6d635 1549 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1550 * @param wrap_around_check_enable Wrap around Check to be set
johnAlexander 6:8ac15bf6d635 1551 * 0=disabled, other = enabled
johnAlexander 6:8ac15bf6d635 1552 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1553 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1554 */
johnAlexander 6:8ac15bf6d635 1555 VL53L0X_Error VL53L0X_set_wrap_around_check_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1556 uint8_t wrap_around_check_enable);
johnAlexander 6:8ac15bf6d635 1557
johnAlexander 6:8ac15bf6d635 1558 /**
johnAlexander 6:8ac15bf6d635 1559 * @brief Gets the VCSEL pulse period.
johnAlexander 6:8ac15bf6d635 1560 *
johnAlexander 6:8ac15bf6d635 1561 * @par Function Description
johnAlexander 6:8ac15bf6d635 1562 * This function retrieves the VCSEL pulse period for the given period type.
johnAlexander 6:8ac15bf6d635 1563 *
johnAlexander 6:8ac15bf6d635 1564 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1565 *
johnAlexander 6:8ac15bf6d635 1566 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1567 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
johnAlexander 6:8ac15bf6d635 1568 * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value.
johnAlexander 6:8ac15bf6d635 1569 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1570 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
johnAlexander 6:8ac15bf6d635 1571 * supported.
johnAlexander 6:8ac15bf6d635 1572 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1573 */
johnAlexander 6:8ac15bf6d635 1574 VL53L0X_Error VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1575 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
johnAlexander 6:8ac15bf6d635 1576
johnAlexander 6:8ac15bf6d635 1577 /**
johnAlexander 6:8ac15bf6d635 1578 * @brief Sets the VCSEL pulse period.
johnAlexander 6:8ac15bf6d635 1579 *
johnAlexander 6:8ac15bf6d635 1580 * @par Function Description
johnAlexander 6:8ac15bf6d635 1581 * This function retrieves the VCSEL pulse period for the given period type.
johnAlexander 6:8ac15bf6d635 1582 *
johnAlexander 6:8ac15bf6d635 1583 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1584 *
johnAlexander 6:8ac15bf6d635 1585 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1586 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
johnAlexander 6:8ac15bf6d635 1587 * @param vcsel_pulse_period VCSEL period value
johnAlexander 6:8ac15bf6d635 1588 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1589 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
johnAlexander 6:8ac15bf6d635 1590 * supported.
johnAlexander 6:8ac15bf6d635 1591 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1592 */
johnAlexander 6:8ac15bf6d635 1593 VL53L0X_Error VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1594 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period);
johnAlexander 6:8ac15bf6d635 1595
johnAlexander 6:8ac15bf6d635 1596 /**
johnAlexander 6:8ac15bf6d635 1597 * @brief Set low and high Interrupt thresholds for a given mode
johnAlexander 6:8ac15bf6d635 1598 * (ranging, ALS, ...) for a given device
johnAlexander 6:8ac15bf6d635 1599 *
johnAlexander 6:8ac15bf6d635 1600 * @par Function Description
johnAlexander 6:8ac15bf6d635 1601 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...)
johnAlexander 6:8ac15bf6d635 1602 * for a given device
johnAlexander 6:8ac15bf6d635 1603 *
johnAlexander 6:8ac15bf6d635 1604 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1605 *
johnAlexander 6:8ac15bf6d635 1606 * @note DeviceMode is ignored for the current device
johnAlexander 6:8ac15bf6d635 1607 *
johnAlexander 6:8ac15bf6d635 1608 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1609 * @param device_mode Device Mode for which change thresholds
johnAlexander 6:8ac15bf6d635 1610 * @param threshold_low Low threshold (mm, lux ..., depending on the mode)
johnAlexander 6:8ac15bf6d635 1611 * @param threshold_high High threshold (mm, lux ..., depending on the mode)
johnAlexander 6:8ac15bf6d635 1612 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1613 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1614 */
johnAlexander 6:8ac15bf6d635 1615 VL53L0X_Error VL53L0X_set_interrupt_thresholds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1616 VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low,
johnAlexander 6:8ac15bf6d635 1617 FixPoint1616_t threshold_high);
johnAlexander 6:8ac15bf6d635 1618
johnAlexander 6:8ac15bf6d635 1619 /**
johnAlexander 6:8ac15bf6d635 1620 * @brief Get high and low Interrupt thresholds for a given mode
johnAlexander 6:8ac15bf6d635 1621 * (ranging, ALS, ...) for a given device
johnAlexander 6:8ac15bf6d635 1622 *
johnAlexander 6:8ac15bf6d635 1623 * @par Function Description
johnAlexander 6:8ac15bf6d635 1624 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...)
johnAlexander 6:8ac15bf6d635 1625 * for a given device
johnAlexander 6:8ac15bf6d635 1626 *
johnAlexander 6:8ac15bf6d635 1627 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1628 *
johnAlexander 6:8ac15bf6d635 1629 * @note DeviceMode is ignored for the current device
johnAlexander 6:8ac15bf6d635 1630 *
johnAlexander 6:8ac15bf6d635 1631 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1632 * @param device_mode Device Mode from which read thresholds
johnAlexander 6:8ac15bf6d635 1633 * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode)
johnAlexander 6:8ac15bf6d635 1634 * @param p_threshold_high High threshold (mm, lux ..., depending on the mode)
johnAlexander 6:8ac15bf6d635 1635 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1636 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1637 */
johnAlexander 6:8ac15bf6d635 1638 VL53L0X_Error VL53L0X_get_interrupt_thresholds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1639 VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low,
johnAlexander 6:8ac15bf6d635 1640 FixPoint1616_t *p_threshold_high);
johnAlexander 6:8ac15bf6d635 1641
johnAlexander 6:8ac15bf6d635 1642 /**
johnAlexander 6:8ac15bf6d635 1643 * @brief Reads the Device information for given Device
johnAlexander 6:8ac15bf6d635 1644 *
johnAlexander 6:8ac15bf6d635 1645 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1646 *
johnAlexander 6:8ac15bf6d635 1647 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1648 * @param p_VL53L0X_device_info Pointer to current device info for a given
johnAlexander 6:8ac15bf6d635 1649 * Device
johnAlexander 6:8ac15bf6d635 1650 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1651 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1652 */
johnAlexander 6:8ac15bf6d635 1653 VL53L0X_Error VL53L0X_get_device_info(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1654 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
johnAlexander 6:8ac15bf6d635 1655
johnAlexander 6:8ac15bf6d635 1656 /**
johnAlexander 6:8ac15bf6d635 1657 * @brief Gets the (on/off) state of all sequence steps.
johnAlexander 6:8ac15bf6d635 1658 *
johnAlexander 6:8ac15bf6d635 1659 * @par Function Description
johnAlexander 6:8ac15bf6d635 1660 * This function retrieves the state of all sequence step in the scheduler.
johnAlexander 6:8ac15bf6d635 1661 *
johnAlexander 6:8ac15bf6d635 1662 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1663 *
johnAlexander 6:8ac15bf6d635 1664 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1665 * @param p_scheduler_sequence_steps Pointer to struct containing result.
johnAlexander 6:8ac15bf6d635 1666 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1667 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1668 */
johnAlexander 6:8ac15bf6d635 1669 VL53L0X_Error VL53L0X_get_sequence_step_enables(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1670 VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps);
johnAlexander 6:8ac15bf6d635 1671
johnAlexander 6:8ac15bf6d635 1672 /**
johnAlexander 6:8ac15bf6d635 1673 * @brief Sets the (on/off) state of a requested sequence step.
johnAlexander 6:8ac15bf6d635 1674 *
johnAlexander 6:8ac15bf6d635 1675 * @par Function Description
johnAlexander 6:8ac15bf6d635 1676 * This function enables/disables a requested sequence step.
johnAlexander 6:8ac15bf6d635 1677 *
johnAlexander 6:8ac15bf6d635 1678 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1679 *
johnAlexander 6:8ac15bf6d635 1680 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1681 * @param sequence_step_id Sequence step identifier.
johnAlexander 6:8ac15bf6d635 1682 * @param sequence_step_enabled Demanded state {0=Off,1=On}
johnAlexander 6:8ac15bf6d635 1683 * is enabled.
johnAlexander 6:8ac15bf6d635 1684 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1685 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 6:8ac15bf6d635 1686 * supported.
johnAlexander 6:8ac15bf6d635 1687 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1688 */
johnAlexander 6:8ac15bf6d635 1689 VL53L0X_Error VL53L0X_set_sequence_step_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1690 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled);
johnAlexander 6:8ac15bf6d635 1691
johnAlexander 6:8ac15bf6d635 1692 /**
johnAlexander 6:8ac15bf6d635 1693 * @brief Gets the fraction enable parameter indicating the resolution of
johnAlexander 6:8ac15bf6d635 1694 * range measurements.
johnAlexander 6:8ac15bf6d635 1695 *
johnAlexander 6:8ac15bf6d635 1696 * @par Function Description
johnAlexander 6:8ac15bf6d635 1697 * Gets the fraction enable state, which translates to the resolution of
johnAlexander 6:8ac15bf6d635 1698 * range measurements as follows :Enabled:=0.25mm resolution,
johnAlexander 6:8ac15bf6d635 1699 * Not Enabled:=1mm resolution.
johnAlexander 6:8ac15bf6d635 1700 *
johnAlexander 6:8ac15bf6d635 1701 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1702 *
johnAlexander 6:8ac15bf6d635 1703 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1704 * @param p_enabled Output Parameter reporting the fraction enable state.
johnAlexander 6:8ac15bf6d635 1705 *
johnAlexander 6:8ac15bf6d635 1706 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1707 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1708 */
johnAlexander 6:8ac15bf6d635 1709 VL53L0X_Error VL53L0X_get_fraction_enable(VL53L0X_DEV dev, uint8_t *p_enabled);
johnAlexander 6:8ac15bf6d635 1710
johnAlexander 6:8ac15bf6d635 1711 /**
johnAlexander 6:8ac15bf6d635 1712 * @brief Sets the resolution of range measurements.
johnAlexander 6:8ac15bf6d635 1713 * @par Function Description
johnAlexander 6:8ac15bf6d635 1714 * Set resolution of range measurements to either 0.25mm if
johnAlexander 6:8ac15bf6d635 1715 * fraction enabled or 1mm if not enabled.
johnAlexander 6:8ac15bf6d635 1716 *
johnAlexander 6:8ac15bf6d635 1717 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 1718 *
johnAlexander 6:8ac15bf6d635 1719 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1720 * @param enable Enable high resolution
johnAlexander 6:8ac15bf6d635 1721 *
johnAlexander 6:8ac15bf6d635 1722 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1723 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1724 */
johnAlexander 6:8ac15bf6d635 1725 VL53L0X_Error VL53L0X_set_range_fraction_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1726 uint8_t enable);
johnAlexander 6:8ac15bf6d635 1727
johnAlexander 6:8ac15bf6d635 1728 /**
johnAlexander 6:8ac15bf6d635 1729 * @brief Return the VL53L0X PAL Implementation Version
johnAlexander 6:8ac15bf6d635 1730 *
johnAlexander 6:8ac15bf6d635 1731 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1732 *
johnAlexander 6:8ac15bf6d635 1733 * @param p_version Pointer to current PAL Implementation Version
johnAlexander 6:8ac15bf6d635 1734 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1735 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1736 */
johnAlexander 6:8ac15bf6d635 1737 VL53L0X_Error VL53L0X_get_version(VL53L0X_Version_t *p_version);
johnAlexander 6:8ac15bf6d635 1738
johnAlexander 6:8ac15bf6d635 1739 /**
johnAlexander 6:8ac15bf6d635 1740 * @brief Reads the Product Revision for a for given Device
johnAlexander 6:8ac15bf6d635 1741 * This function can be used to distinguish cut1.0 from cut1.1.
johnAlexander 6:8ac15bf6d635 1742 *
johnAlexander 6:8ac15bf6d635 1743 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1744 *
johnAlexander 6:8ac15bf6d635 1745 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1746 * @param p_product_revision_major Pointer to Product Revision Major
johnAlexander 6:8ac15bf6d635 1747 * for a given Device
johnAlexander 6:8ac15bf6d635 1748 * @param p_product_revision_minor Pointer to Product Revision Minor
johnAlexander 6:8ac15bf6d635 1749 * for a given Device
johnAlexander 6:8ac15bf6d635 1750 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1751 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1752 */
johnAlexander 6:8ac15bf6d635 1753 VL53L0X_Error VL53L0X_get_product_revision(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1754 uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor);
johnAlexander 6:8ac15bf6d635 1755
johnAlexander 6:8ac15bf6d635 1756 /**
johnAlexander 6:8ac15bf6d635 1757 * @brief Retrieve current device parameters
johnAlexander 6:8ac15bf6d635 1758 * @par Function Description
johnAlexander 6:8ac15bf6d635 1759 * Get actual parameters of the device
johnAlexander 6:8ac15bf6d635 1760 * @li Then start ranging operation.
johnAlexander 6:8ac15bf6d635 1761 *
johnAlexander 6:8ac15bf6d635 1762 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 1763 *
johnAlexander 6:8ac15bf6d635 1764 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1765 * @param p_device_parameters Pointer to store current device parameters.
johnAlexander 6:8ac15bf6d635 1766 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1767 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1768 */
johnAlexander 6:8ac15bf6d635 1769 VL53L0X_Error VL53L0X_get_device_parameters(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1770 VL53L0X_DeviceParameters_t *p_device_parameters);
johnAlexander 6:8ac15bf6d635 1771
johnAlexander 6:8ac15bf6d635 1772 /**
johnAlexander 6:8ac15bf6d635 1773 * @brief Human readable error string for current PAL error status
johnAlexander 6:8ac15bf6d635 1774 *
johnAlexander 6:8ac15bf6d635 1775 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1776 *
johnAlexander 6:8ac15bf6d635 1777 * @param pal_error_code The error code as stored on @a VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1778 * @param p_pal_error_string The error string corresponding to the
johnAlexander 6:8ac15bf6d635 1779 * PalErrorCode
johnAlexander 6:8ac15bf6d635 1780 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1781 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1782 */
johnAlexander 6:8ac15bf6d635 1783 VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code,
johnAlexander 6:8ac15bf6d635 1784 char *p_pal_error_string);
johnAlexander 6:8ac15bf6d635 1785
johnAlexander 6:8ac15bf6d635 1786 /**
johnAlexander 6:8ac15bf6d635 1787 * @brief Return the PAL Specification Version used for the current
johnAlexander 6:8ac15bf6d635 1788 * implementation.
johnAlexander 6:8ac15bf6d635 1789 *
johnAlexander 6:8ac15bf6d635 1790 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1791 *
johnAlexander 6:8ac15bf6d635 1792 * @param p_pal_spec_version Pointer to current PAL Specification Version
johnAlexander 6:8ac15bf6d635 1793 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1794 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1795 */
johnAlexander 6:8ac15bf6d635 1796 VL53L0X_Error VL53L0X_get_pal_spec_version(
johnAlexander 6:8ac15bf6d635 1797 VL53L0X_Version_t *p_pal_spec_version);
johnAlexander 6:8ac15bf6d635 1798
johnAlexander 6:8ac15bf6d635 1799 /**
johnAlexander 6:8ac15bf6d635 1800 * @brief Reads the internal state of the PAL for a given Device
johnAlexander 6:8ac15bf6d635 1801 *
johnAlexander 6:8ac15bf6d635 1802 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1803 *
johnAlexander 6:8ac15bf6d635 1804 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1805 * @param p_pal_state Pointer to current state of the PAL for a
johnAlexander 6:8ac15bf6d635 1806 * given Device
johnAlexander 6:8ac15bf6d635 1807 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1808 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1809 */
johnAlexander 6:8ac15bf6d635 1810 VL53L0X_Error VL53L0X_get_pal_state(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1811 VL53L0X_State *p_pal_state);
johnAlexander 6:8ac15bf6d635 1812
johnAlexander 6:8ac15bf6d635 1813 /**
johnAlexander 6:8ac15bf6d635 1814 * @brief Human readable PAL State string
johnAlexander 6:8ac15bf6d635 1815 *
johnAlexander 6:8ac15bf6d635 1816 * @note This function doesn't access to the device
johnAlexander 6:8ac15bf6d635 1817 *
johnAlexander 6:8ac15bf6d635 1818 * @param pal_state_code The State code as stored on @a VL53L0X_State
johnAlexander 6:8ac15bf6d635 1819 * @param p_pal_state_string The State string corresponding to the
johnAlexander 6:8ac15bf6d635 1820 * PalStateCode
johnAlexander 6:8ac15bf6d635 1821 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1822 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1823 */
johnAlexander 6:8ac15bf6d635 1824 VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code,
johnAlexander 6:8ac15bf6d635 1825 char *p_pal_state_string);
johnAlexander 6:8ac15bf6d635 1826
johnAlexander 6:8ac15bf6d635 1827 /*** End High level API ***/
johnAlexander 6:8ac15bf6d635 1828 private:
johnAlexander 6:8ac15bf6d635 1829 /* api.h functions */
johnAlexander 6:8ac15bf6d635 1830
johnAlexander 6:8ac15bf6d635 1831 /**
johnAlexander 6:8ac15bf6d635 1832 * @brief Wait for device booted after chip enable (hardware standby)
johnAlexander 6:8ac15bf6d635 1833 * This function can be run only when VL53L0X_State is VL53L0X_STATE_POWERDOWN.
johnAlexander 6:8ac15bf6d635 1834 *
johnAlexander 6:8ac15bf6d635 1835 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 1836 *
johnAlexander 6:8ac15bf6d635 1837 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1838 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 1839 *
johnAlexander 6:8ac15bf6d635 1840 */
johnAlexander 6:8ac15bf6d635 1841 VL53L0X_Error VL53L0X_wait_device_booted(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1842
johnAlexander 6:8ac15bf6d635 1843
johnAlexander 6:8ac15bf6d635 1844 VL53L0X_Error sequence_step_enabled(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1845 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config,
johnAlexander 6:8ac15bf6d635 1846 uint8_t *p_sequence_step_enabled);
johnAlexander 6:8ac15bf6d635 1847
johnAlexander 6:8ac15bf6d635 1848 VL53L0X_Error VL53L0X_check_and_load_interrupt_settings(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1849 uint8_t start_not_stopflag);
johnAlexander 6:8ac15bf6d635 1850
johnAlexander 6:8ac15bf6d635 1851
johnAlexander 6:8ac15bf6d635 1852 /* api_core.h functions */
johnAlexander 6:8ac15bf6d635 1853
johnAlexander 6:8ac15bf6d635 1854 VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV dev, uint8_t option);
johnAlexander 6:8ac15bf6d635 1855
johnAlexander 6:8ac15bf6d635 1856 VL53L0X_Error VL53L0X_device_read_strobe(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1857
johnAlexander 6:8ac15bf6d635 1858 VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1859 uint32_t *p_measurement_timing_budget_micro_seconds);
johnAlexander 6:8ac15bf6d635 1860
johnAlexander 6:8ac15bf6d635 1861 VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1862 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
johnAlexander 6:8ac15bf6d635 1863
johnAlexander 6:8ac15bf6d635 1864 uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
johnAlexander 6:8ac15bf6d635 1865
johnAlexander 6:8ac15bf6d635 1866 uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
johnAlexander 6:8ac15bf6d635 1867
johnAlexander 6:8ac15bf6d635 1868 uint32_t VL53L0X_calc_timeout_us(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1869 uint16_t timeout_period_mclks,
johnAlexander 6:8ac15bf6d635 1870 uint8_t vcsel_period_pclks);
johnAlexander 6:8ac15bf6d635 1871
johnAlexander 6:8ac15bf6d635 1872 uint32_t VL53L0X_calc_macro_period_ps(VL53L0X_DEV dev, uint8_t vcsel_period_pclks);
johnAlexander 6:8ac15bf6d635 1873
johnAlexander 6:8ac15bf6d635 1874 VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1875
johnAlexander 6:8ac15bf6d635 1876 VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1877 uint8_t *p_tuning_setting_buffer);
johnAlexander 6:8ac15bf6d635 1878
johnAlexander 6:8ac15bf6d635 1879 VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1880 uint8_t device_range_status,
johnAlexander 6:8ac15bf6d635 1881 FixPoint1616_t signal_rate,
johnAlexander 6:8ac15bf6d635 1882 uint16_t effective_spad_rtn_count,
johnAlexander 6:8ac15bf6d635 1883 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 6:8ac15bf6d635 1884 uint8_t *p_pal_range_status);
johnAlexander 6:8ac15bf6d635 1885 VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1886 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 6:8ac15bf6d635 1887 FixPoint1616_t *p_sigma_estimate,
johnAlexander 6:8ac15bf6d635 1888 uint32_t *p_dmax_mm);
johnAlexander 6:8ac15bf6d635 1889 uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1890 uint32_t timeout_period_us,
johnAlexander 6:8ac15bf6d635 1891 uint8_t vcsel_period_pclks);
johnAlexander 6:8ac15bf6d635 1892 uint32_t VL53L0X_isqrt(uint32_t num);
johnAlexander 6:8ac15bf6d635 1893
johnAlexander 6:8ac15bf6d635 1894 uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b);
johnAlexander 6:8ac15bf6d635 1895
johnAlexander 6:8ac15bf6d635 1896 VL53L0X_Error VL53L0X_calc_dmax(
johnAlexander 6:8ac15bf6d635 1897 VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1898 FixPoint1616_t total_signal_rate_mcps,
johnAlexander 6:8ac15bf6d635 1899 FixPoint1616_t total_corr_signal_rate_mcps,
johnAlexander 6:8ac15bf6d635 1900 FixPoint1616_t pw_mult,
johnAlexander 6:8ac15bf6d635 1901 uint32_t sigma_estimate_p1,
johnAlexander 6:8ac15bf6d635 1902 FixPoint1616_t sigma_estimate_p2,
johnAlexander 6:8ac15bf6d635 1903 uint32_t peak_vcsel_duration_us,
johnAlexander 6:8ac15bf6d635 1904 uint32_t *pd_max_mm);
johnAlexander 6:8ac15bf6d635 1905 VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1906 uint32_t measurement_timing_budget_micro_seconds);
johnAlexander 6:8ac15bf6d635 1907 VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1908 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 6:8ac15bf6d635 1909 uint32_t *p_time_out_micro_secs);
johnAlexander 6:8ac15bf6d635 1910 VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1911 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 6:8ac15bf6d635 1912 uint32_t timeout_micro_secs);
johnAlexander 6:8ac15bf6d635 1913 uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks);
johnAlexander 6:8ac15bf6d635 1914 VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1915 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk);
johnAlexander 6:8ac15bf6d635 1916 uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
johnAlexander 6:8ac15bf6d635 1917
johnAlexander 6:8ac15bf6d635 1918 /* api_calibration.h functions */
johnAlexander 6:8ac15bf6d635 1919 VL53L0X_Error VL53L0X_apply_offset_adjustment(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1920 VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1921 int32_t *p_offset_calibration_data_micro_meter);
johnAlexander 6:8ac15bf6d635 1922 VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1923 int32_t offset_calibration_data_micro_meter);
johnAlexander 6:8ac15bf6d635 1924 VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1925 uint32_t *ref_spad_count,
johnAlexander 6:8ac15bf6d635 1926 uint8_t *is_aperture_spads);
johnAlexander 6:8ac15bf6d635 1927 VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1928 uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable);
johnAlexander 6:8ac15bf6d635 1929 VL53L0X_Error VL53L0X_perform_vhv_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1930 uint8_t *p_vhv_settings, const uint8_t get_data_enable,
johnAlexander 6:8ac15bf6d635 1931 const uint8_t restore_config);
johnAlexander 6:8ac15bf6d635 1932 VL53L0X_Error VL53L0X_perform_single_ref_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1933 uint8_t vhv_init_byte);
johnAlexander 6:8ac15bf6d635 1934 VL53L0X_Error VL53L0X_ref_calibration_io(VL53L0X_DEV dev, uint8_t read_not_write,
johnAlexander 6:8ac15bf6d635 1935 uint8_t vhv_settings, uint8_t phase_cal,
johnAlexander 6:8ac15bf6d635 1936 uint8_t *p_vhv_settings, uint8_t *p_phase_cal,
johnAlexander 6:8ac15bf6d635 1937 const uint8_t vhv_enable, const uint8_t phase_enable);
johnAlexander 6:8ac15bf6d635 1938 VL53L0X_Error VL53L0X_perform_phase_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1939 uint8_t *p_phase_cal, const uint8_t get_data_enable,
johnAlexander 6:8ac15bf6d635 1940 const uint8_t restore_config);
johnAlexander 6:8ac15bf6d635 1941 VL53L0X_Error enable_ref_spads(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1942 uint8_t aperture_spads,
johnAlexander 6:8ac15bf6d635 1943 uint8_t good_spad_array[],
johnAlexander 6:8ac15bf6d635 1944 uint8_t spad_array[],
johnAlexander 6:8ac15bf6d635 1945 uint32_t size,
johnAlexander 6:8ac15bf6d635 1946 uint32_t start,
johnAlexander 6:8ac15bf6d635 1947 uint32_t offset,
johnAlexander 6:8ac15bf6d635 1948 uint32_t spad_count,
johnAlexander 6:8ac15bf6d635 1949 uint32_t *p_last_spad);
johnAlexander 6:8ac15bf6d635 1950 void get_next_good_spad(uint8_t good_spad_array[], uint32_t size,
johnAlexander 6:8ac15bf6d635 1951 uint32_t curr, int32_t *p_next);
johnAlexander 6:8ac15bf6d635 1952 uint8_t is_aperture(uint32_t spad_index);
johnAlexander 6:8ac15bf6d635 1953 VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size,
johnAlexander 6:8ac15bf6d635 1954 uint32_t spad_index);
johnAlexander 6:8ac15bf6d635 1955 VL53L0X_Error set_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
johnAlexander 6:8ac15bf6d635 1956 VL53L0X_Error get_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
johnAlexander 6:8ac15bf6d635 1957 VL53L0X_Error perform_ref_signal_measurement(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1958 uint16_t *p_ref_signal_rate);
johnAlexander 6:8ac15bf6d635 1959 VL53L0X_Error wrapped_VL53L0X_set_reference_spads(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1960 uint32_t count, uint8_t is_aperture_spads);
johnAlexander 6:8ac15bf6d635 1961
johnAlexander 6:8ac15bf6d635 1962 /* api_strings.h functions */
johnAlexander 6:8ac15bf6d635 1963 VL53L0X_Error wrapped_VL53L0X_get_device_info(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1964 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
johnAlexander 6:8ac15bf6d635 1965 VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 1966 uint8_t *revision,
johnAlexander 6:8ac15bf6d635 1967 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
johnAlexander 6:8ac15bf6d635 1968
johnAlexander 6:8ac15bf6d635 1969 /* Read function of the ID device */
johnAlexander 6:8ac15bf6d635 1970 // virtual int read_id();
johnAlexander 6:8ac15bf6d635 1971 virtual int read_id(uint8_t *id);
johnAlexander 6:8ac15bf6d635 1972
johnAlexander 6:8ac15bf6d635 1973 VL53L0X_Error wait_measurement_data_ready(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1974
johnAlexander 6:8ac15bf6d635 1975 VL53L0X_Error wait_stop_completed(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 1976
johnAlexander 6:8ac15bf6d635 1977 /* Write and read functions from I2C */
johnAlexander 6:8ac15bf6d635 1978 /**
johnAlexander 6:8ac15bf6d635 1979 * Write single byte register
johnAlexander 6:8ac15bf6d635 1980 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1981 * @param index The register index
johnAlexander 6:8ac15bf6d635 1982 * @param data 8 bit register data
johnAlexander 6:8ac15bf6d635 1983 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1984 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1985 */
johnAlexander 6:8ac15bf6d635 1986 VL53L0X_Error VL53L0X_write_byte(VL53L0X_DEV dev, uint8_t index, uint8_t data);
johnAlexander 6:8ac15bf6d635 1987 /**
johnAlexander 6:8ac15bf6d635 1988 * Write word register
johnAlexander 6:8ac15bf6d635 1989 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1990 * @param index The register index
johnAlexander 6:8ac15bf6d635 1991 * @param data 16 bit register data
johnAlexander 6:8ac15bf6d635 1992 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 1993 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 1994 */
johnAlexander 6:8ac15bf6d635 1995 VL53L0X_Error VL53L0X_write_word(VL53L0X_DEV dev, uint8_t index, uint16_t data);
johnAlexander 6:8ac15bf6d635 1996 /**
johnAlexander 6:8ac15bf6d635 1997 * Write double word (4 byte) register
johnAlexander 6:8ac15bf6d635 1998 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 1999 * @param index The register index
johnAlexander 6:8ac15bf6d635 2000 * @param data 32 bit register data
johnAlexander 6:8ac15bf6d635 2001 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2002 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2003 */
johnAlexander 6:8ac15bf6d635 2004 VL53L0X_Error VL53L0X_write_dword(VL53L0X_DEV dev, uint8_t index, uint32_t data);
johnAlexander 6:8ac15bf6d635 2005 /**
johnAlexander 6:8ac15bf6d635 2006 * Read single byte register
johnAlexander 6:8ac15bf6d635 2007 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2008 * @param index The register index
johnAlexander 6:8ac15bf6d635 2009 * @param data pointer to 8 bit data
johnAlexander 6:8ac15bf6d635 2010 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2011 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2012 */
johnAlexander 6:8ac15bf6d635 2013 VL53L0X_Error VL53L0X_read_byte(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data);
johnAlexander 6:8ac15bf6d635 2014 /**
johnAlexander 6:8ac15bf6d635 2015 * Read word (2byte) register
johnAlexander 6:8ac15bf6d635 2016 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2017 * @param index The register index
johnAlexander 6:8ac15bf6d635 2018 * @param data pointer to 16 bit data
johnAlexander 6:8ac15bf6d635 2019 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2020 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2021 */
johnAlexander 6:8ac15bf6d635 2022 VL53L0X_Error VL53L0X_read_word(VL53L0X_DEV dev, uint8_t index, uint16_t *p_data);
johnAlexander 6:8ac15bf6d635 2023 /**
johnAlexander 6:8ac15bf6d635 2024 * Read dword (4byte) register
johnAlexander 6:8ac15bf6d635 2025 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2026 * @param index The register index
johnAlexander 6:8ac15bf6d635 2027 * @param data pointer to 32 bit data
johnAlexander 6:8ac15bf6d635 2028 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2029 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2030 */
johnAlexander 6:8ac15bf6d635 2031 VL53L0X_Error VL53L0X_read_dword(VL53L0X_DEV dev, uint8_t index, uint32_t *p_data);
johnAlexander 6:8ac15bf6d635 2032 /**
johnAlexander 6:8ac15bf6d635 2033 * Threat safe Update (read/modify/write) single byte register
johnAlexander 6:8ac15bf6d635 2034 *
johnAlexander 6:8ac15bf6d635 2035 * Final_reg = (Initial_reg & and_data) |or_data
johnAlexander 6:8ac15bf6d635 2036 *
johnAlexander 6:8ac15bf6d635 2037 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2038 * @param index The register index
johnAlexander 6:8ac15bf6d635 2039 * @param and_data 8 bit and data
johnAlexander 6:8ac15bf6d635 2040 * @param or_data 8 bit or data
johnAlexander 6:8ac15bf6d635 2041 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2042 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2043 */
johnAlexander 6:8ac15bf6d635 2044 VL53L0X_Error VL53L0X_update_byte(VL53L0X_DEV dev, uint8_t index, uint8_t and_data, uint8_t or_data);
johnAlexander 6:8ac15bf6d635 2045 /**
johnAlexander 6:8ac15bf6d635 2046 * Writes the supplied byte buffer to the device
johnAlexander 6:8ac15bf6d635 2047 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2048 * @param index The register index
johnAlexander 6:8ac15bf6d635 2049 * @param p_data Pointer to uint8_t buffer containing the data to be written
johnAlexander 6:8ac15bf6d635 2050 * @param count Number of bytes in the supplied byte buffer
johnAlexander 6:8ac15bf6d635 2051 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2052 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2053 */
johnAlexander 6:8ac15bf6d635 2054 VL53L0X_Error VL53L0X_write_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
johnAlexander 6:8ac15bf6d635 2055 /**
johnAlexander 6:8ac15bf6d635 2056 * Reads the requested number of bytes from the device
johnAlexander 6:8ac15bf6d635 2057 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2058 * @param index The register index
johnAlexander 6:8ac15bf6d635 2059 * @param p_data Pointer to the uint8_t buffer to store read data
johnAlexander 6:8ac15bf6d635 2060 * @param count Number of uint8_t's to read
johnAlexander 6:8ac15bf6d635 2061 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2062 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2063 */
johnAlexander 6:8ac15bf6d635 2064 VL53L0X_Error VL53L0X_read_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
johnAlexander 6:8ac15bf6d635 2065
johnAlexander 6:8ac15bf6d635 2066 /**
johnAlexander 6:8ac15bf6d635 2067 * @brief Writes a buffer towards the I2C peripheral device.
johnAlexander 6:8ac15bf6d635 2068 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2069 * @param p_data pointer to the byte-array data to send
johnAlexander 6:8ac15bf6d635 2070 * @param number_of_bytes number of bytes to be written.
johnAlexander 6:8ac15bf6d635 2071 * @retval 0 if ok,
johnAlexander 6:8ac15bf6d635 2072 * @retval -1 if an I2C error has occured
johnAlexander 6:8ac15bf6d635 2073 * @note On some devices if NumByteToWrite is greater
johnAlexander 6:8ac15bf6d635 2074 * than one, the RegisterAddr must be masked correctly!
johnAlexander 6:8ac15bf6d635 2075 */
johnAlexander 6:8ac15bf6d635 2076 VL53L0X_Error VL53L0X_i2c_write(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
johnAlexander 6:8ac15bf6d635 2077
johnAlexander 6:8ac15bf6d635 2078 /**
johnAlexander 6:8ac15bf6d635 2079 * @brief Reads a buffer from the I2C peripheral device.
johnAlexander 6:8ac15bf6d635 2080 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2081 * @param p_data pointer to the byte-array to read data in to
johnAlexander 6:8ac15bf6d635 2082 * @param number_of_bytes number of bytes to be read.
johnAlexander 6:8ac15bf6d635 2083 * @retval 0 if ok,
johnAlexander 6:8ac15bf6d635 2084 * @retval -1 if an I2C error has occured
johnAlexander 6:8ac15bf6d635 2085 * @note On some devices if NumByteToWrite is greater
johnAlexander 6:8ac15bf6d635 2086 * than one, the RegisterAddr must be masked correctly!
johnAlexander 6:8ac15bf6d635 2087 */
johnAlexander 6:8ac15bf6d635 2088 VL53L0X_Error VL53L0X_i2c_read(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
johnAlexander 6:8ac15bf6d635 2089
johnAlexander 6:8ac15bf6d635 2090 /**
johnAlexander 6:8ac15bf6d635 2091 * @brief execute delay in all polling API call
johnAlexander 6:8ac15bf6d635 2092 *
johnAlexander 6:8ac15bf6d635 2093 * A typical multi-thread or RTOs implementation is to sleep the task for some 5ms (with 100Hz max rate faster polling is not needed)
johnAlexander 6:8ac15bf6d635 2094 * if nothing specific is need you can define it as an empty/void macro
johnAlexander 6:8ac15bf6d635 2095 * @code
johnAlexander 6:8ac15bf6d635 2096 * #define VL53L0X_PollingDelay(...) (void)0
johnAlexander 6:8ac15bf6d635 2097 * @endcode
johnAlexander 6:8ac15bf6d635 2098 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2099 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2100 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2101 */
johnAlexander 6:8ac15bf6d635 2102 VL53L0X_Error VL53L0X_polling_delay(VL53L0X_DEV dev); /* usually best implemented as a real function */
johnAlexander 6:8ac15bf6d635 2103
johnAlexander 6:8ac15bf6d635 2104 int is_present()
johnAlexander 6:8ac15bf6d635 2105 {
johnAlexander 6:8ac15bf6d635 2106 int status;
johnAlexander 6:8ac15bf6d635 2107 uint8_t id = 0;
johnAlexander 6:8ac15bf6d635 2108
johnAlexander 6:8ac15bf6d635 2109 status = read_id(&id);
johnAlexander 6:8ac15bf6d635 2110 if (status) {
johnAlexander 6:8ac15bf6d635 2111 VL53L0X_ErrLog("Failed to read ID device. Device not present!\n\r");
johnAlexander 6:8ac15bf6d635 2112 }
johnAlexander 6:8ac15bf6d635 2113 return status;
johnAlexander 6:8ac15bf6d635 2114 }
johnAlexander 6:8ac15bf6d635 2115
johnAlexander 6:8ac15bf6d635 2116 ///////////////////////////////////////////////////////////////////////////////////////////////////////
johnAlexander 6:8ac15bf6d635 2117 //Added functions //
johnAlexander 6:8ac15bf6d635 2118 ///////////////////////////////////////////////////////////////////////////////////////////////////////
johnAlexander 6:8ac15bf6d635 2119
johnAlexander 6:8ac15bf6d635 2120 /**
johnAlexander 6:8ac15bf6d635 2121 * @brief Cycle Power to Device
johnAlexander 6:8ac15bf6d635 2122 *
johnAlexander 6:8ac15bf6d635 2123 * @return status - status 0 = ok, 1 = error
johnAlexander 6:8ac15bf6d635 2124 *
johnAlexander 6:8ac15bf6d635 2125 */
johnAlexander 6:8ac15bf6d635 2126 int32_t VL53L0X_cycle_power(void);
johnAlexander 6:8ac15bf6d635 2127
johnAlexander 6:8ac15bf6d635 2128 uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
johnAlexander 6:8ac15bf6d635 2129
johnAlexander 6:8ac15bf6d635 2130 VL53L0X_Error wrapped_VL53L0X_get_device_error_string(VL53L0X_DeviceError error_code,
johnAlexander 6:8ac15bf6d635 2131 char *p_device_error_string);
johnAlexander 6:8ac15bf6d635 2132
johnAlexander 6:8ac15bf6d635 2133 VL53L0X_Error wrapped_VL53L0X_get_limit_check_info(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 6:8ac15bf6d635 2134 char *p_limit_check_string);
johnAlexander 6:8ac15bf6d635 2135
johnAlexander 6:8ac15bf6d635 2136 VL53L0X_Error wrapped_VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code,
johnAlexander 6:8ac15bf6d635 2137 char *p_pal_error_string);
johnAlexander 6:8ac15bf6d635 2138
johnAlexander 6:8ac15bf6d635 2139 VL53L0X_Error wrapped_VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code,
johnAlexander 6:8ac15bf6d635 2140 char *p_pal_state_string);
johnAlexander 6:8ac15bf6d635 2141
johnAlexander 6:8ac15bf6d635 2142 VL53L0X_Error wrapped_VL53L0X_get_range_status_string(uint8_t range_status,
johnAlexander 6:8ac15bf6d635 2143 char *p_range_status_string);
johnAlexander 6:8ac15bf6d635 2144
johnAlexander 6:8ac15bf6d635 2145 VL53L0X_Error wrapped_VL53L0X_get_ref_calibration(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2146 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
johnAlexander 6:8ac15bf6d635 2147
johnAlexander 6:8ac15bf6d635 2148
johnAlexander 6:8ac15bf6d635 2149 VL53L0X_Error count_enabled_spads(uint8_t spad_array[],
johnAlexander 6:8ac15bf6d635 2150 uint32_t byte_count, uint32_t max_spads,
johnAlexander 6:8ac15bf6d635 2151 uint32_t *p_total_spads_enabled, uint8_t *p_is_aperture);
johnAlexander 6:8ac15bf6d635 2152
johnAlexander 6:8ac15bf6d635 2153 VL53L0X_Error wrapped_VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 6:8ac15bf6d635 2154 char *p_sequence_steps_string);
johnAlexander 6:8ac15bf6d635 2155
johnAlexander 6:8ac15bf6d635 2156
johnAlexander 6:8ac15bf6d635 2157 /**
johnAlexander 6:8ac15bf6d635 2158 * @brief Gets the name of a given sequence step.
johnAlexander 6:8ac15bf6d635 2159 *
johnAlexander 6:8ac15bf6d635 2160 * @par Function Description
johnAlexander 6:8ac15bf6d635 2161 * This function retrieves the name of sequence steps corresponding to
johnAlexander 6:8ac15bf6d635 2162 * SequenceStepId.
johnAlexander 6:8ac15bf6d635 2163 *
johnAlexander 6:8ac15bf6d635 2164 * @note This function doesn't Accesses the device
johnAlexander 6:8ac15bf6d635 2165 *
johnAlexander 6:8ac15bf6d635 2166 * @param sequence_step_id Sequence step identifier.
johnAlexander 6:8ac15bf6d635 2167 * @param p_sequence_steps_string Pointer to Info string
johnAlexander 6:8ac15bf6d635 2168 *
johnAlexander 6:8ac15bf6d635 2169 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2170 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2171 */
johnAlexander 6:8ac15bf6d635 2172 VL53L0X_Error VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 6:8ac15bf6d635 2173 char *p_sequence_steps_string);
johnAlexander 6:8ac15bf6d635 2174
johnAlexander 6:8ac15bf6d635 2175 /**
johnAlexander 6:8ac15bf6d635 2176 * @brief Get the frequency of the timer used for ranging results time stamps
johnAlexander 6:8ac15bf6d635 2177 *
johnAlexander 6:8ac15bf6d635 2178 * @param[out] p_timer_freq_hz : pointer for timer frequency
johnAlexander 6:8ac15bf6d635 2179 *
johnAlexander 6:8ac15bf6d635 2180 * @return status : 0 = ok, 1 = error
johnAlexander 6:8ac15bf6d635 2181 *
johnAlexander 6:8ac15bf6d635 2182 */
johnAlexander 6:8ac15bf6d635 2183 int32_t VL53L0X_get_timer_frequency(int32_t *p_timer_freq_hz);
johnAlexander 6:8ac15bf6d635 2184
johnAlexander 6:8ac15bf6d635 2185 /**
johnAlexander 6:8ac15bf6d635 2186 * @brief Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency())
johnAlexander 6:8ac15bf6d635 2187 *
johnAlexander 6:8ac15bf6d635 2188 * @param[out] p_timer_count : pointer for timer count value
johnAlexander 6:8ac15bf6d635 2189 *
johnAlexander 6:8ac15bf6d635 2190 * @return status : 0 = ok, 1 = error
johnAlexander 6:8ac15bf6d635 2191 *
johnAlexander 6:8ac15bf6d635 2192 */
johnAlexander 6:8ac15bf6d635 2193 int32_t VL53L0X_get_timer_value(int32_t *p_timer_count);
johnAlexander 6:8ac15bf6d635 2194
johnAlexander 6:8ac15bf6d635 2195 /**
johnAlexander 6:8ac15bf6d635 2196 * @brief Configure ranging interrupt reported to system
johnAlexander 6:8ac15bf6d635 2197 *
johnAlexander 6:8ac15bf6d635 2198 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 2199 *
johnAlexander 6:8ac15bf6d635 2200 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2201 * @param interrupt_mask Mask of interrupt to Enable/disable
johnAlexander 6:8ac15bf6d635 2202 * (0:interrupt disabled or 1: interrupt enabled)
johnAlexander 6:8ac15bf6d635 2203 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 2204 */
johnAlexander 6:8ac15bf6d635 2205 VL53L0X_Error VL53L0X_enable_interrupt_mask(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2206 uint32_t interrupt_mask);
johnAlexander 6:8ac15bf6d635 2207
johnAlexander 6:8ac15bf6d635 2208 /**
johnAlexander 6:8ac15bf6d635 2209 * @brief Get Dmax Calibration Parameters for a given device
johnAlexander 6:8ac15bf6d635 2210 *
johnAlexander 6:8ac15bf6d635 2211 *
johnAlexander 6:8ac15bf6d635 2212 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2213 *
johnAlexander 6:8ac15bf6d635 2214 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2215 * @param p_range_milli_meter Pointer to Calibration Distance
johnAlexander 6:8ac15bf6d635 2216 * @param p_signal_rate_rtn_mega_cps Pointer to Signal rate return
johnAlexander 6:8ac15bf6d635 2217 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2218 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2219 */
johnAlexander 6:8ac15bf6d635 2220 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2221 uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps);
johnAlexander 6:8ac15bf6d635 2222
johnAlexander 6:8ac15bf6d635 2223 /**
johnAlexander 6:8ac15bf6d635 2224 * @brief Set Dmax Calibration Parameters for a given device
johnAlexander 6:8ac15bf6d635 2225 * When one of the parameter is zero, this function will get parameter
johnAlexander 6:8ac15bf6d635 2226 * from NVM.
johnAlexander 6:8ac15bf6d635 2227 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2228 *
johnAlexander 6:8ac15bf6d635 2229 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2230 * @param range_milli_meter Calibration Distance
johnAlexander 6:8ac15bf6d635 2231 * @param signal_rate_rtn_mega_cps Signal rate return read at CalDistance
johnAlexander 6:8ac15bf6d635 2232 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2233 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2234 */
johnAlexander 6:8ac15bf6d635 2235 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2236 uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps);
johnAlexander 6:8ac15bf6d635 2237
johnAlexander 6:8ac15bf6d635 2238 /**
johnAlexander 6:8ac15bf6d635 2239 * @brief Retrieve the measurements from device for a given setup
johnAlexander 6:8ac15bf6d635 2240 *
johnAlexander 6:8ac15bf6d635 2241 * @par Function Description
johnAlexander 6:8ac15bf6d635 2242 * Get data from last successful Histogram measurement
johnAlexander 6:8ac15bf6d635 2243 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 6:8ac15bf6d635 2244 * before get data.
johnAlexander 6:8ac15bf6d635 2245 * PAL will fill a NumberOfROIZones times the corresponding data structure
johnAlexander 6:8ac15bf6d635 2246 * used in the measurement function.
johnAlexander 6:8ac15bf6d635 2247 *
johnAlexander 6:8ac15bf6d635 2248 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 2249 *
johnAlexander 6:8ac15bf6d635 2250 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2251 * @param p_histogram_measurement_data Pointer to the histogram data structure.
johnAlexander 6:8ac15bf6d635 2252 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 2253 */
johnAlexander 6:8ac15bf6d635 2254 VL53L0X_Error VL53L0X_get_histogram_measurement_data(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2255 VL53L0X_HistogramMeasurementData_t *p_histogram_measurement_data);
johnAlexander 6:8ac15bf6d635 2256
johnAlexander 6:8ac15bf6d635 2257 /**
johnAlexander 6:8ac15bf6d635 2258 * @brief Get current new device mode
johnAlexander 6:8ac15bf6d635 2259 * @par Function Description
johnAlexander 6:8ac15bf6d635 2260 * Get current Histogram mode of a Device
johnAlexander 6:8ac15bf6d635 2261 *
johnAlexander 6:8ac15bf6d635 2262 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2263 *
johnAlexander 6:8ac15bf6d635 2264 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2265 * @param p_histogram_mode Pointer to current Histogram Mode value
johnAlexander 6:8ac15bf6d635 2266 * Valid values are:
johnAlexander 6:8ac15bf6d635 2267 * VL53L0X_HISTOGRAMMODE_DISABLED
johnAlexander 6:8ac15bf6d635 2268 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 6:8ac15bf6d635 2269 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 6:8ac15bf6d635 2270 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 6:8ac15bf6d635 2271 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 6:8ac15bf6d635 2272 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2273 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2274 */
johnAlexander 6:8ac15bf6d635 2275 VL53L0X_Error VL53L0X_get_histogram_mode(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2276 VL53L0X_HistogramModes *p_histogram_mode);
johnAlexander 6:8ac15bf6d635 2277
johnAlexander 6:8ac15bf6d635 2278 /**
johnAlexander 6:8ac15bf6d635 2279 * @brief Set a new Histogram mode
johnAlexander 6:8ac15bf6d635 2280 * @par Function Description
johnAlexander 6:8ac15bf6d635 2281 * Set device to a new Histogram mode
johnAlexander 6:8ac15bf6d635 2282 *
johnAlexander 6:8ac15bf6d635 2283 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2284 *
johnAlexander 6:8ac15bf6d635 2285 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2286 * @param histogram_mode New device mode to apply
johnAlexander 6:8ac15bf6d635 2287 * Valid values are:
johnAlexander 6:8ac15bf6d635 2288 * VL53L0X_HISTOGRAMMODE_DISABLED
johnAlexander 6:8ac15bf6d635 2289 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 6:8ac15bf6d635 2290 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 6:8ac15bf6d635 2291 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 6:8ac15bf6d635 2292 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 6:8ac15bf6d635 2293 *
johnAlexander 6:8ac15bf6d635 2294 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2295 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 6:8ac15bf6d635 2296 * HistogramMode is not in the supported list
johnAlexander 6:8ac15bf6d635 2297 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2298 */
johnAlexander 6:8ac15bf6d635 2299 VL53L0X_Error VL53L0X_set_histogram_mode(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2300 VL53L0X_HistogramModes histogram_mode);
johnAlexander 6:8ac15bf6d635 2301
johnAlexander 6:8ac15bf6d635 2302 /**
johnAlexander 6:8ac15bf6d635 2303 * @brief Return a description string for a given limit check number
johnAlexander 6:8ac15bf6d635 2304 *
johnAlexander 6:8ac15bf6d635 2305 * @par Function Description
johnAlexander 6:8ac15bf6d635 2306 * This function returns a description string for a given limit check number.
johnAlexander 6:8ac15bf6d635 2307 * The limit check is identified with the LimitCheckId.
johnAlexander 6:8ac15bf6d635 2308 *
johnAlexander 6:8ac15bf6d635 2309 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2310 *
johnAlexander 6:8ac15bf6d635 2311 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2312 * @param limit_check_id Limit Check ID
johnAlexander 6:8ac15bf6d635 2313 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 6:8ac15bf6d635 2314 * @param p_limit_check_string Pointer to the
johnAlexander 6:8ac15bf6d635 2315 description string of the given check limit.
johnAlexander 6:8ac15bf6d635 2316 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2317 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
johnAlexander 6:8ac15bf6d635 2318 returned when LimitCheckId value is out of range.
johnAlexander 6:8ac15bf6d635 2319 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2320 */
johnAlexander 6:8ac15bf6d635 2321 VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2322 uint16_t limit_check_id, char *p_limit_check_string);
johnAlexander 6:8ac15bf6d635 2323
johnAlexander 6:8ac15bf6d635 2324 /**
johnAlexander 6:8ac15bf6d635 2325 * @brief Get the linearity corrective gain
johnAlexander 6:8ac15bf6d635 2326 *
johnAlexander 6:8ac15bf6d635 2327 * @par Function Description
johnAlexander 6:8ac15bf6d635 2328 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
johnAlexander 6:8ac15bf6d635 2329 * device NVM value
johnAlexander 6:8ac15bf6d635 2330 *
johnAlexander 6:8ac15bf6d635 2331 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2332 *
johnAlexander 6:8ac15bf6d635 2333 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2334 * @param p_linearity_corrective_gain Pointer to the linearity
johnAlexander 6:8ac15bf6d635 2335 * corrective gain in x1000
johnAlexander 6:8ac15bf6d635 2336 * if value is 1000 then no modification is applied.
johnAlexander 6:8ac15bf6d635 2337 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2338 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2339 */
johnAlexander 6:8ac15bf6d635 2340 VL53L0X_Error VL53L0X_get_linearity_corrective_gain(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2341 uint16_t *p_linearity_corrective_gain);
johnAlexander 6:8ac15bf6d635 2342
johnAlexander 6:8ac15bf6d635 2343 /**
johnAlexander 6:8ac15bf6d635 2344 * Set the linearity corrective gain
johnAlexander 6:8ac15bf6d635 2345 *
johnAlexander 6:8ac15bf6d635 2346 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2347 *
johnAlexander 6:8ac15bf6d635 2348 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2349 * @param linearity_corrective_gain Linearity corrective
johnAlexander 6:8ac15bf6d635 2350 * gain in x1000
johnAlexander 6:8ac15bf6d635 2351 * if value is 1000 then no modification is applied.
johnAlexander 6:8ac15bf6d635 2352 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2353 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2354 */
johnAlexander 6:8ac15bf6d635 2355 VL53L0X_Error VL53L0X_set_linearity_corrective_gain(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2356 int16_t linearity_corrective_gain);
johnAlexander 6:8ac15bf6d635 2357
johnAlexander 6:8ac15bf6d635 2358 /**
johnAlexander 6:8ac15bf6d635 2359 * @brief Get the Maximum number of ROI Zones managed by the Device
johnAlexander 6:8ac15bf6d635 2360 *
johnAlexander 6:8ac15bf6d635 2361 * @par Function Description
johnAlexander 6:8ac15bf6d635 2362 * Get Maximum number of ROI Zones managed by the Device.
johnAlexander 6:8ac15bf6d635 2363 *
johnAlexander 6:8ac15bf6d635 2364 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2365 *
johnAlexander 6:8ac15bf6d635 2366 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2367 * @param p_max_number_of_roi_zones Pointer to the Maximum Number
johnAlexander 6:8ac15bf6d635 2368 * of ROI Zones value.
johnAlexander 6:8ac15bf6d635 2369 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2370 */
johnAlexander 6:8ac15bf6d635 2371 VL53L0X_Error VL53L0X_get_max_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2372 uint8_t *p_max_number_of_roi_zones);
johnAlexander 6:8ac15bf6d635 2373
johnAlexander 6:8ac15bf6d635 2374 /**
johnAlexander 6:8ac15bf6d635 2375 * @brief Retrieve the Reference Signal after a measurements
johnAlexander 6:8ac15bf6d635 2376 *
johnAlexander 6:8ac15bf6d635 2377 * @par Function Description
johnAlexander 6:8ac15bf6d635 2378 * Get Reference Signal from last successful Ranging measurement
johnAlexander 6:8ac15bf6d635 2379 * This function return a valid value after that you call the
johnAlexander 6:8ac15bf6d635 2380 * @a VL53L0X_GetRangingMeasurementData().
johnAlexander 6:8ac15bf6d635 2381 *
johnAlexander 6:8ac15bf6d635 2382 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2383 *
johnAlexander 6:8ac15bf6d635 2384 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2385 * @param p_measurement_ref_signal Pointer to the Ref Signal to fill up.
johnAlexander 6:8ac15bf6d635 2386 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2387 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2388 */
johnAlexander 6:8ac15bf6d635 2389 VL53L0X_Error VL53L0X_get_measurement_ref_signal(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2390 FixPoint1616_t *p_measurement_ref_signal);
johnAlexander 6:8ac15bf6d635 2391
johnAlexander 6:8ac15bf6d635 2392 /**
johnAlexander 6:8ac15bf6d635 2393 * @brief Get the number of the check limit managed by a given Device
johnAlexander 6:8ac15bf6d635 2394 *
johnAlexander 6:8ac15bf6d635 2395 * @par Function Description
johnAlexander 6:8ac15bf6d635 2396 * This function give the number of the check limit managed by the Device
johnAlexander 6:8ac15bf6d635 2397 *
johnAlexander 6:8ac15bf6d635 2398 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2399 *
johnAlexander 6:8ac15bf6d635 2400 * @param p_number_of_limit_check Pointer to the number of check limit.
johnAlexander 6:8ac15bf6d635 2401 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2402 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2403 */
johnAlexander 6:8ac15bf6d635 2404 VL53L0X_Error VL53L0X_get_number_of_limit_check(
johnAlexander 6:8ac15bf6d635 2405 uint16_t *p_number_of_limit_check);
johnAlexander 6:8ac15bf6d635 2406
johnAlexander 6:8ac15bf6d635 2407 /**
johnAlexander 6:8ac15bf6d635 2408 * @brief Get the number of ROI Zones managed by the Device
johnAlexander 6:8ac15bf6d635 2409 *
johnAlexander 6:8ac15bf6d635 2410 * @par Function Description
johnAlexander 6:8ac15bf6d635 2411 * Get number of ROI Zones managed by the Device
johnAlexander 6:8ac15bf6d635 2412 * USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 6:8ac15bf6d635 2413 * before get data after a perform measurement.
johnAlexander 6:8ac15bf6d635 2414 * PAL will fill a NumberOfROIZones times the corresponding data
johnAlexander 6:8ac15bf6d635 2415 * structure used in the measurement function.
johnAlexander 6:8ac15bf6d635 2416 *
johnAlexander 6:8ac15bf6d635 2417 * @note This function doesn't Access to the device
johnAlexander 6:8ac15bf6d635 2418 *
johnAlexander 6:8ac15bf6d635 2419 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2420 * @param p_number_of_roi_zones Pointer to the Number of ROI Zones value.
johnAlexander 6:8ac15bf6d635 2421 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2422 */
johnAlexander 6:8ac15bf6d635 2423 VL53L0X_Error VL53L0X_get_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2424 uint8_t *p_number_of_roi_zones);
johnAlexander 6:8ac15bf6d635 2425
johnAlexander 6:8ac15bf6d635 2426 /**
johnAlexander 6:8ac15bf6d635 2427 * @brief Set the number of ROI Zones to be used for a specific Device
johnAlexander 6:8ac15bf6d635 2428 *
johnAlexander 6:8ac15bf6d635 2429 * @par Function Description
johnAlexander 6:8ac15bf6d635 2430 * Set the number of ROI Zones to be used for a specific Device.
johnAlexander 6:8ac15bf6d635 2431 * The programmed value should be less than the max number of ROI Zones given
johnAlexander 6:8ac15bf6d635 2432 * with @a VL53L0X_GetMaxNumberOfROIZones().
johnAlexander 6:8ac15bf6d635 2433 * This version of API manage only one zone.
johnAlexander 6:8ac15bf6d635 2434 *
johnAlexander 6:8ac15bf6d635 2435 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2436 * @param number_of_roi_zones Number of ROI Zones to be used for a
johnAlexander 6:8ac15bf6d635 2437 * specific Device.
johnAlexander 6:8ac15bf6d635 2438 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2439 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
johnAlexander 6:8ac15bf6d635 2440 * NumberOfROIZones != 1
johnAlexander 6:8ac15bf6d635 2441 */
johnAlexander 6:8ac15bf6d635 2442 VL53L0X_Error VL53L0X_set_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2443 uint8_t number_of_roi_zones);
johnAlexander 6:8ac15bf6d635 2444
johnAlexander 6:8ac15bf6d635 2445 /**
johnAlexander 6:8ac15bf6d635 2446 * @brief Gets number of sequence steps managed by the API.
johnAlexander 6:8ac15bf6d635 2447 *
johnAlexander 6:8ac15bf6d635 2448 * @par Function Description
johnAlexander 6:8ac15bf6d635 2449 * This function retrieves the number of sequence steps currently managed
johnAlexander 6:8ac15bf6d635 2450 * by the API
johnAlexander 6:8ac15bf6d635 2451 *
johnAlexander 6:8ac15bf6d635 2452 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 2453 *
johnAlexander 6:8ac15bf6d635 2454 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2455 * @param p_number_of_sequence_steps Out parameter reporting the number of
johnAlexander 6:8ac15bf6d635 2456 * sequence steps.
johnAlexander 6:8ac15bf6d635 2457 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2458 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2459 */
johnAlexander 6:8ac15bf6d635 2460 VL53L0X_Error VL53L0X_get_number_of_sequence_steps(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2461 uint8_t *p_number_of_sequence_steps);
johnAlexander 6:8ac15bf6d635 2462 /**
johnAlexander 6:8ac15bf6d635 2463 * @brief Get the power mode for a given Device
johnAlexander 6:8ac15bf6d635 2464 *
johnAlexander 6:8ac15bf6d635 2465 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2466 *
johnAlexander 6:8ac15bf6d635 2467 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2468 * @param p_power_mode Pointer to the current value of the power
johnAlexander 6:8ac15bf6d635 2469 * mode. see ::VL53L0X_PowerModes
johnAlexander 6:8ac15bf6d635 2470 * Valid values are:
johnAlexander 6:8ac15bf6d635 2471 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
johnAlexander 6:8ac15bf6d635 2472 * VL53L0X_POWERMODE_IDLE_LEVEL1
johnAlexander 6:8ac15bf6d635 2473 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2474 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2475 */
johnAlexander 6:8ac15bf6d635 2476 VL53L0X_Error VL53L0X_get_power_mode(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2477 VL53L0X_PowerModes *p_power_mode);
johnAlexander 6:8ac15bf6d635 2478
johnAlexander 6:8ac15bf6d635 2479 /**
johnAlexander 6:8ac15bf6d635 2480 * @brief Set the power mode for a given Device
johnAlexander 6:8ac15bf6d635 2481 * The power mode can be Standby or Idle. Different level of both Standby and
johnAlexander 6:8ac15bf6d635 2482 * Idle can exists.
johnAlexander 6:8ac15bf6d635 2483 * This function should not be used when device is in Ranging state.
johnAlexander 6:8ac15bf6d635 2484 *
johnAlexander 6:8ac15bf6d635 2485 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2486 *
johnAlexander 6:8ac15bf6d635 2487 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2488 * @param power_mode The value of the power mode to set.
johnAlexander 6:8ac15bf6d635 2489 * see ::VL53L0X_PowerModes
johnAlexander 6:8ac15bf6d635 2490 * Valid values are:
johnAlexander 6:8ac15bf6d635 2491 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
johnAlexander 6:8ac15bf6d635 2492 * VL53L0X_POWERMODE_IDLE_LEVEL1
johnAlexander 6:8ac15bf6d635 2493 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2494 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when PowerMode
johnAlexander 6:8ac15bf6d635 2495 * is not in the supported list
johnAlexander 6:8ac15bf6d635 2496 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2497 */
johnAlexander 6:8ac15bf6d635 2498 VL53L0X_Error VL53L0X_set_power_mode(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2499 VL53L0X_PowerModes power_mode);
johnAlexander 6:8ac15bf6d635 2500
johnAlexander 6:8ac15bf6d635 2501 /**
johnAlexander 6:8ac15bf6d635 2502 * @brief Retrieves SPAD configuration
johnAlexander 6:8ac15bf6d635 2503 *
johnAlexander 6:8ac15bf6d635 2504 * @par Function Description
johnAlexander 6:8ac15bf6d635 2505 * This function retrieves the current number of applied reference spads
johnAlexander 6:8ac15bf6d635 2506 * and also their type : Aperture or Non-Aperture.
johnAlexander 6:8ac15bf6d635 2507 *
johnAlexander 6:8ac15bf6d635 2508 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2509 *
johnAlexander 6:8ac15bf6d635 2510 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2511 * @param p_spad_count Number ref Spad Count
johnAlexander 6:8ac15bf6d635 2512 * @param p_is_aperture_spads Reports if spads are of type
johnAlexander 6:8ac15bf6d635 2513 * aperture or non-aperture.
johnAlexander 6:8ac15bf6d635 2514 * 1:=aperture, 0:=Non-Aperture
johnAlexander 6:8ac15bf6d635 2515 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2516 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 6:8ac15bf6d635 2517 * spad configuration.
johnAlexander 6:8ac15bf6d635 2518 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2519 */
johnAlexander 6:8ac15bf6d635 2520 VL53L0X_Error wrapped_VL53L0X_get_reference_spads(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2521 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
johnAlexander 6:8ac15bf6d635 2522
johnAlexander 6:8ac15bf6d635 2523 /**
johnAlexander 6:8ac15bf6d635 2524 * @brief Gets the (on/off) state of a requested sequence step.
johnAlexander 6:8ac15bf6d635 2525 *
johnAlexander 6:8ac15bf6d635 2526 * @par Function Description
johnAlexander 6:8ac15bf6d635 2527 * This function retrieves the state of a requested sequence step, i.e. on/off.
johnAlexander 6:8ac15bf6d635 2528 *
johnAlexander 6:8ac15bf6d635 2529 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 2530 *
johnAlexander 6:8ac15bf6d635 2531 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2532 * @param sequence_step_id Sequence step identifier.
johnAlexander 6:8ac15bf6d635 2533 * @param p_sequence_step_enabled Out parameter reporting if the sequence step
johnAlexander 6:8ac15bf6d635 2534 * is enabled {0=Off,1=On}.
johnAlexander 6:8ac15bf6d635 2535 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2536 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 6:8ac15bf6d635 2537 * supported.
johnAlexander 6:8ac15bf6d635 2538 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2539 */
johnAlexander 6:8ac15bf6d635 2540 VL53L0X_Error VL53L0X_get_sequence_step_enable(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2541 VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled);
johnAlexander 6:8ac15bf6d635 2542
johnAlexander 6:8ac15bf6d635 2543
johnAlexander 6:8ac15bf6d635 2544 /**
johnAlexander 6:8ac15bf6d635 2545 * @brief Gets the timeout of a requested sequence step.
johnAlexander 6:8ac15bf6d635 2546 *
johnAlexander 6:8ac15bf6d635 2547 * @par Function Description
johnAlexander 6:8ac15bf6d635 2548 * This function retrieves the timeout of a requested sequence step.
johnAlexander 6:8ac15bf6d635 2549 *
johnAlexander 6:8ac15bf6d635 2550 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 2551 *
johnAlexander 6:8ac15bf6d635 2552 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2553 * @param sequence_step_id Sequence step identifier.
johnAlexander 6:8ac15bf6d635 2554 * @param p_time_out_milli_secs Timeout value.
johnAlexander 6:8ac15bf6d635 2555 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2556 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 6:8ac15bf6d635 2557 * supported.
johnAlexander 6:8ac15bf6d635 2558 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2559 */
johnAlexander 6:8ac15bf6d635 2560 VL53L0X_Error VL53L0X_get_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2561 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 6:8ac15bf6d635 2562 FixPoint1616_t *p_time_out_milli_secs);
johnAlexander 6:8ac15bf6d635 2563
johnAlexander 6:8ac15bf6d635 2564 /**
johnAlexander 6:8ac15bf6d635 2565 * @brief Sets the timeout of a requested sequence step.
johnAlexander 6:8ac15bf6d635 2566 *
johnAlexander 6:8ac15bf6d635 2567 * @par Function Description
johnAlexander 6:8ac15bf6d635 2568 * This function sets the timeout of a requested sequence step.
johnAlexander 6:8ac15bf6d635 2569 *
johnAlexander 6:8ac15bf6d635 2570 * @note This function Accesses the device
johnAlexander 6:8ac15bf6d635 2571 *
johnAlexander 6:8ac15bf6d635 2572 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2573 * @param sequence_step_id Sequence step identifier.
johnAlexander 6:8ac15bf6d635 2574 * @param time_out_milli_secs Demanded timeout
johnAlexander 6:8ac15bf6d635 2575 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2576 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 6:8ac15bf6d635 2577 * supported.
johnAlexander 6:8ac15bf6d635 2578 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2579 */
johnAlexander 6:8ac15bf6d635 2580 VL53L0X_Error VL53L0X_set_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2581 VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs);
johnAlexander 6:8ac15bf6d635 2582
johnAlexander 6:8ac15bf6d635 2583 /**
johnAlexander 6:8ac15bf6d635 2584 * @brief Get the current SPAD Ambient Damper Factor value
johnAlexander 6:8ac15bf6d635 2585 *
johnAlexander 6:8ac15bf6d635 2586 * @par Function Description
johnAlexander 6:8ac15bf6d635 2587 * This function get the SPAD Ambient Damper Factor value
johnAlexander 6:8ac15bf6d635 2588 *
johnAlexander 6:8ac15bf6d635 2589 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2590 *
johnAlexander 6:8ac15bf6d635 2591 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2592 * @param p_spad_ambient_damper_factor Pointer to programmed SPAD Ambient
johnAlexander 6:8ac15bf6d635 2593 * Damper Factor value
johnAlexander 6:8ac15bf6d635 2594 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2595 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2596 */
johnAlexander 6:8ac15bf6d635 2597 VL53L0X_Error VL53L0X_get_spad_ambient_damper_factor(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2598 uint16_t *p_spad_ambient_damper_factor);
johnAlexander 6:8ac15bf6d635 2599 /**
johnAlexander 6:8ac15bf6d635 2600 * @brief Set the SPAD Ambient Damper Factor value
johnAlexander 6:8ac15bf6d635 2601 *
johnAlexander 6:8ac15bf6d635 2602 * @par Function Description
johnAlexander 6:8ac15bf6d635 2603 * This function set the SPAD Ambient Damper Factor value
johnAlexander 6:8ac15bf6d635 2604 *
johnAlexander 6:8ac15bf6d635 2605 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2606 *
johnAlexander 6:8ac15bf6d635 2607 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2608 * @param spad_ambient_damper_factor SPAD Ambient Damper Factor value
johnAlexander 6:8ac15bf6d635 2609 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2610 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2611 */
johnAlexander 6:8ac15bf6d635 2612 VL53L0X_Error VL53L0X_set_spad_ambient_damper_factor(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2613 uint16_t spad_ambient_damper_factor);
johnAlexander 6:8ac15bf6d635 2614
johnAlexander 6:8ac15bf6d635 2615 /**
johnAlexander 6:8ac15bf6d635 2616 * @brief Get the current SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2617 *
johnAlexander 6:8ac15bf6d635 2618 * @par Function Description
johnAlexander 6:8ac15bf6d635 2619 * This function get the SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2620 *
johnAlexander 6:8ac15bf6d635 2621 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2622 *
johnAlexander 6:8ac15bf6d635 2623 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2624 * @param p_spad_ambient_damper_threshold Pointer to programmed
johnAlexander 6:8ac15bf6d635 2625 * SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2626 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2627 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2628 */
johnAlexander 6:8ac15bf6d635 2629 VL53L0X_Error VL53L0X_get_spad_ambient_damper_threshold(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2630 uint16_t *p_spad_ambient_damper_threshold);
johnAlexander 6:8ac15bf6d635 2631
johnAlexander 6:8ac15bf6d635 2632 /**
johnAlexander 6:8ac15bf6d635 2633 * @brief Set the SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2634 *
johnAlexander 6:8ac15bf6d635 2635 * @par Function Description
johnAlexander 6:8ac15bf6d635 2636 * This function set the SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2637 *
johnAlexander 6:8ac15bf6d635 2638 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2639 *
johnAlexander 6:8ac15bf6d635 2640 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2641 * @param spad_ambient_damper_threshold SPAD Ambient Damper Threshold value
johnAlexander 6:8ac15bf6d635 2642 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2643 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2644 */
johnAlexander 6:8ac15bf6d635 2645 VL53L0X_Error VL53L0X_set_spad_ambient_damper_threshold(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2646 uint16_t spad_ambient_damper_threshold);
johnAlexander 6:8ac15bf6d635 2647
johnAlexander 6:8ac15bf6d635 2648 /**
johnAlexander 6:8ac15bf6d635 2649 * @brief Get the maximal distance for actual setup
johnAlexander 6:8ac15bf6d635 2650 * @par Function Description
johnAlexander 6:8ac15bf6d635 2651 * Device must be initialized through @a VL53L0X_SetParameters() prior calling
johnAlexander 6:8ac15bf6d635 2652 * this function.
johnAlexander 6:8ac15bf6d635 2653 *
johnAlexander 6:8ac15bf6d635 2654 * Any range value more than the value returned is to be considered as
johnAlexander 6:8ac15bf6d635 2655 * "no target detected" or
johnAlexander 6:8ac15bf6d635 2656 * "no target in detectable range"\n
johnAlexander 6:8ac15bf6d635 2657 * @warning The maximal distance depends on the setup
johnAlexander 6:8ac15bf6d635 2658 *
johnAlexander 6:8ac15bf6d635 2659 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 2660 *
johnAlexander 6:8ac15bf6d635 2661 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2662 * @param p_upper_limit_milli_meter The maximal range limit for actual setup
johnAlexander 6:8ac15bf6d635 2663 * (in millimeter)
johnAlexander 6:8ac15bf6d635 2664 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 2665 */
johnAlexander 6:8ac15bf6d635 2666 VL53L0X_Error VL53L0X_get_upper_limit_milli_meter(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2667 uint16_t *p_upper_limit_milli_meter);
johnAlexander 6:8ac15bf6d635 2668
johnAlexander 6:8ac15bf6d635 2669 /**
johnAlexander 6:8ac15bf6d635 2670 * @brief Get the tuning settings pointer and the internal external switch
johnAlexander 6:8ac15bf6d635 2671 * value.
johnAlexander 6:8ac15bf6d635 2672 *
johnAlexander 6:8ac15bf6d635 2673 * This function is used to get the Tuning settings buffer pointer and the
johnAlexander 6:8ac15bf6d635 2674 * value.
johnAlexander 6:8ac15bf6d635 2675 * of the switch to select either external or internal tuning settings.
johnAlexander 6:8ac15bf6d635 2676 *
johnAlexander 6:8ac15bf6d635 2677 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2678 *
johnAlexander 6:8ac15bf6d635 2679 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2680 * @param pp_tuning_setting_buffer Pointer to tuning settings buffer.
johnAlexander 6:8ac15bf6d635 2681 * @param p_use_internal_tuning_settings Pointer to store Use internal tuning
johnAlexander 6:8ac15bf6d635 2682 * settings value.
johnAlexander 6:8ac15bf6d635 2683 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2684 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2685 */
johnAlexander 6:8ac15bf6d635 2686 VL53L0X_Error VL53L0X_get_tuning_setting_buffer(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2687 uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings);
johnAlexander 6:8ac15bf6d635 2688
johnAlexander 6:8ac15bf6d635 2689 /**
johnAlexander 6:8ac15bf6d635 2690 * @brief Set the tuning settings pointer
johnAlexander 6:8ac15bf6d635 2691 *
johnAlexander 6:8ac15bf6d635 2692 * This function is used to specify the Tuning settings buffer to be used
johnAlexander 6:8ac15bf6d635 2693 * for a given device. The buffer contains all the necessary data to permit
johnAlexander 6:8ac15bf6d635 2694 * the API to write tuning settings.
johnAlexander 6:8ac15bf6d635 2695 * This function permit to force the usage of either external or internal
johnAlexander 6:8ac15bf6d635 2696 * tuning settings.
johnAlexander 6:8ac15bf6d635 2697 *
johnAlexander 6:8ac15bf6d635 2698 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2699 *
johnAlexander 6:8ac15bf6d635 2700 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2701 * @param p_tuning_setting_buffer Pointer to tuning settings buffer.
johnAlexander 6:8ac15bf6d635 2702 * @param use_internal_tuning_settings Use internal tuning settings value.
johnAlexander 6:8ac15bf6d635 2703 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2704 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2705 */
johnAlexander 6:8ac15bf6d635 2706 VL53L0X_Error VL53L0X_set_tuning_setting_buffer(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2707 uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings);
johnAlexander 6:8ac15bf6d635 2708
johnAlexander 6:8ac15bf6d635 2709 /**
johnAlexander 6:8ac15bf6d635 2710 * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions
johnAlexander 6:8ac15bf6d635 2711 * @brief PAL Register Access Functions
johnAlexander 6:8ac15bf6d635 2712 * @{
johnAlexander 6:8ac15bf6d635 2713 */
johnAlexander 6:8ac15bf6d635 2714
johnAlexander 6:8ac15bf6d635 2715 /**
johnAlexander 6:8ac15bf6d635 2716 * Lock comms interface to serialize all commands to a shared I2C interface for a specific device
johnAlexander 6:8ac15bf6d635 2717 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2718 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2719 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2720 */
johnAlexander 6:8ac15bf6d635 2721 VL53L0X_Error VL53L0X_lock_sequence_access(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 2722
johnAlexander 6:8ac15bf6d635 2723 /**
johnAlexander 6:8ac15bf6d635 2724 * Unlock comms interface to serialize all commands to a shared I2C interface for a specific device
johnAlexander 6:8ac15bf6d635 2725 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2726 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2727 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2728 */
johnAlexander 6:8ac15bf6d635 2729 VL53L0X_Error VL53L0X_unlock_sequence_access(VL53L0X_DEV dev);
johnAlexander 6:8ac15bf6d635 2730
johnAlexander 6:8ac15bf6d635 2731 /**
johnAlexander 6:8ac15bf6d635 2732 * @brief Prepare device for operation
johnAlexander 6:8ac15bf6d635 2733 * @par Function Description
johnAlexander 6:8ac15bf6d635 2734 * Update device with provided parameters
johnAlexander 6:8ac15bf6d635 2735 * @li Then start ranging operation.
johnAlexander 6:8ac15bf6d635 2736 *
johnAlexander 6:8ac15bf6d635 2737 * @note This function Access to the device
johnAlexander 6:8ac15bf6d635 2738 *
johnAlexander 6:8ac15bf6d635 2739 * @param Dev Device Handle
johnAlexander 6:8ac15bf6d635 2740 * @param pDeviceParameters Pointer to store current device parameters.
johnAlexander 6:8ac15bf6d635 2741 * @return VL53L0X_ERROR_NONE Success
johnAlexander 6:8ac15bf6d635 2742 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 6:8ac15bf6d635 2743 */
johnAlexander 6:8ac15bf6d635 2744 VL53L0X_Error vl53L0x_set_device_parameters(VL53L0X_DEV Dev,
johnAlexander 6:8ac15bf6d635 2745 const VL53L0X_DeviceParameters_t *pDeviceParameters);
johnAlexander 6:8ac15bf6d635 2746
johnAlexander 6:8ac15bf6d635 2747 /**
johnAlexander 6:8ac15bf6d635 2748 * Set Group parameter Hold state
johnAlexander 6:8ac15bf6d635 2749 *
johnAlexander 6:8ac15bf6d635 2750 * @par Function Description
johnAlexander 6:8ac15bf6d635 2751 * Set or remove device internal group parameter hold
johnAlexander 6:8ac15bf6d635 2752 *
johnAlexander 6:8ac15bf6d635 2753 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 2754 *
johnAlexander 6:8ac15bf6d635 2755 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2756 * @param group_param_hold Group parameter Hold state to be set (on/off)
johnAlexander 6:8ac15bf6d635 2757 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 2758 */
johnAlexander 6:8ac15bf6d635 2759 VL53L0X_Error VL53L0X_set_group_param_hold(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2760 uint8_t group_param_hold);
johnAlexander 6:8ac15bf6d635 2761
johnAlexander 6:8ac15bf6d635 2762
johnAlexander 6:8ac15bf6d635 2763 /**
johnAlexander 6:8ac15bf6d635 2764 * @brief Wait for device ready for a new measurement command.
johnAlexander 6:8ac15bf6d635 2765 * Blocking function.
johnAlexander 6:8ac15bf6d635 2766 *
johnAlexander 6:8ac15bf6d635 2767 * @note This function is not Implemented
johnAlexander 6:8ac15bf6d635 2768 *
johnAlexander 6:8ac15bf6d635 2769 * @param dev Device Handle
johnAlexander 6:8ac15bf6d635 2770 * @param max_loop Max Number of polling loop (timeout).
johnAlexander 6:8ac15bf6d635 2771 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 6:8ac15bf6d635 2772 */
johnAlexander 6:8ac15bf6d635 2773 VL53L0X_Error VL53L0X_wait_device_ready_for_new_measurement(VL53L0X_DEV dev,
johnAlexander 6:8ac15bf6d635 2774 uint32_t max_loop);
johnAlexander 6:8ac15bf6d635 2775
johnAlexander 6:8ac15bf6d635 2776 VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
johnAlexander 6:8ac15bf6d635 2777
johnAlexander 6:8ac15bf6d635 2778 int range_meas_int_continuous_mode(void (*fptr)(void));
johnAlexander 6:8ac15bf6d635 2779
johnAlexander 6:8ac15bf6d635 2780
johnAlexander 6:8ac15bf6d635 2781 VL53L0X_DeviceInfo_t _device_info;
johnAlexander 6:8ac15bf6d635 2782
johnAlexander 6:8ac15bf6d635 2783 /* IO Device */
johnAlexander 6:8ac15bf6d635 2784 DevI2C *_dev_i2c;
johnAlexander 6:8ac15bf6d635 2785 /* Digital out pin */
johnAlexander 6:8ac15bf6d635 2786 DigitalOut *_gpio0;
johnAlexander 6:8ac15bf6d635 2787 /* GPIO expander */
johnAlexander 6:8ac15bf6d635 2788 Stmpe1600DigiOut *_expgpio0;
johnAlexander 6:8ac15bf6d635 2789 /* Measure detection IRQ */
johnAlexander 6:8ac15bf6d635 2790 InterruptIn *_gpio1Int;
johnAlexander 6:8ac15bf6d635 2791 /* Device data */
johnAlexander 6:8ac15bf6d635 2792 VL53L0X_Dev_t _my_device;
johnAlexander 6:8ac15bf6d635 2793 VL53L0X_DEV _device;
johnAlexander 6:8ac15bf6d635 2794 };
johnAlexander 6:8ac15bf6d635 2795
johnAlexander 6:8ac15bf6d635 2796
johnAlexander 6:8ac15bf6d635 2797 #endif /* _VL53L0X_CLASS_H_ */