TOFs library corrected

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   EvitObst mbed-perceptron-2

Committer:
evgeniik
Date:
Fri Jul 17 09:44:46 2020 +0000
Revision:
8:ab04ed7aa3ec
Parent:
7:a4452bd2b83b
TOFs library correced for A.I.Mergence

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