Library for use with VL53L1X, intended to represent the Proximity sensor expansion board with the same name.

Dependencies:   VL53L1X_mbed

Dependents:   HelloWorld_53L1A1 VL53L1A1_Simple_Ranging_With_One_Device VL53L1A1_Simple_Ranging_With_All_Devices VL53L1X_Ranging_With_Multiple_Devices_MbedOS ... more

Committer:
mapellil
Date:
Fri Dec 15 14:13:04 2017 +0000
Revision:
20:cb95ef8a3508
Parent:
15:44e6c9013bff
Added vl53l0x_get_device() to extend API usability

Who changed what in which revision?

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