Library for use with VL53L0X, cut 1.1, based on mass-market API v1.1.

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   ConcorsoFinal HelloWorld_IHM01A1 m3pi_BT m3pi_LIDAR ... more

Fork of X_NUCLEO_53L0A1 by ST Expansion SW Team

X-NUCLEO-53L0A1 Proximity Sensor Expansion Board Firmware Package

Introduction

This firmware package includes Component Device Drivers and the Board Support Package for STMicroelectronics' X-NUCLEO-53L0A1 Proximity sensor expansion board based on VL53L0X.

Firmware Library

Class X_NUCLEO_53L0A1 is intended to represent the Proximity sensor expansion board with the same name.

The expansion board provides support for the following components:

  1. on-board VL53L0X proximity sensor,
  2. up to two additional VL53L0X Satellites,
  3. on-board 4-digit display

It is intentionally implemented as a singleton because only one X-NUCLEO-VL53L0A1 may be deployed at a time in a HW component stack. In order to get the singleton instance you have to call class method `Instance()`, e.g.:

// Sensors expansion board singleton instance
static X_NUCLEO_53L0A1 *board = X_NUCLEO_53L0A1::Instance(device_i2c, A2, D8, D2);

Example Applications

The library and sample application code were tested against mbed revision 143, dated 26th May 2017.

Committer:
johnAlexander
Date:
Mon Aug 07 14:30:21 2017 +0000
Revision:
14:8320b5ff96fa
Parent:
13:615f7e38568c
Child:
15:44e6c9013bff
Aligned to ARM mbed coding style.

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 14:8320b5ff96fa 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 14:8320b5ff96fa 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 *
johnAlexander 14:8320b5ff96fa 455 * @brief One time device initialization
johnAlexander 14:8320b5ff96fa 456 *
johnAlexander 14:8320b5ff96fa 457 * To be called once and only once after device is brought out of reset (Chip enable) and booted.
johnAlexander 14:8320b5ff96fa 458 *
johnAlexander 14:8320b5ff96fa 459 * @par Function Description
johnAlexander 14:8320b5ff96fa 460 * When not used after a fresh device "power up" or reset, it may return @a #CALIBRATION_WARNING
johnAlexander 14:8320b5ff96fa 461 * meaning wrong calibration data may have been fetched from device that can result in ranging offset error\n
johnAlexander 14:8320b5ff96fa 462 * If application cannot execute device reset or need to run vl53l0x_data_init multiple time
johnAlexander 14:8320b5ff96fa 463 * then it must ensure proper offset calibration saving and restore on its own
johnAlexander 14:8320b5ff96fa 464 * 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 465 *
johnAlexander 14:8320b5ff96fa 466 * @param void
johnAlexander 14:8320b5ff96fa 467 * @return 0 on success, @a #CALIBRATION_WARNING if failed
johnAlexander 14:8320b5ff96fa 468 */
johnAlexander 14:8320b5ff96fa 469 virtual int init(void *init)
johnAlexander 0:c523920bcc09 470 {
johnAlexander 14:8320b5ff96fa 471 return vl53l0x_data_init(_device);
johnAlexander 0:c523920bcc09 472 }
johnAlexander 0:c523920bcc09 473
johnAlexander 14:8320b5ff96fa 474 /**
johnAlexander 14:8320b5ff96fa 475 * @brief Prepare device for operation
johnAlexander 14:8320b5ff96fa 476 * @par Function Description
johnAlexander 14:8320b5ff96fa 477 * Does static initialization and reprogram common default settings \n
johnAlexander 14:8320b5ff96fa 478 * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n
johnAlexander 14:8320b5ff96fa 479 * After prepare user can : \n
johnAlexander 14:8320b5ff96fa 480 * @li Call other API function to set other settings\n
johnAlexander 14:8320b5ff96fa 481 * @li Configure the interrupt pins, etc... \n
johnAlexander 14:8320b5ff96fa 482 * @li Then start ranging or ALS operations in single shot or continuous mode
johnAlexander 14:8320b5ff96fa 483 *
johnAlexander 14:8320b5ff96fa 484 * @param void
johnAlexander 14:8320b5ff96fa 485 * @return 0 on success
johnAlexander 14:8320b5ff96fa 486 */
johnAlexander 14:8320b5ff96fa 487 int prepare()
johnAlexander 0:c523920bcc09 488 {
johnAlexander 14:8320b5ff96fa 489 VL53L0X_Error status = VL53L0X_ERROR_NONE;
johnAlexander 14:8320b5ff96fa 490 uint32_t ref_spad_count;
johnAlexander 14:8320b5ff96fa 491 uint8_t is_aperture_spads;
johnAlexander 14:8320b5ff96fa 492 uint8_t vhv_settings;
johnAlexander 14:8320b5ff96fa 493 uint8_t phase_cal;
johnAlexander 0:c523920bcc09 494
johnAlexander 14:8320b5ff96fa 495 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 14:8320b5ff96fa 496 printf("Call of VL53L0X_StaticInit\n");
johnAlexander 14:8320b5ff96fa 497 status = vl53l0x_static_init(_device); // Device Initialization
johnAlexander 14:8320b5ff96fa 498 }
johnAlexander 0:c523920bcc09 499
johnAlexander 14:8320b5ff96fa 500 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 14:8320b5ff96fa 501 printf("Call of VL53L0X_PerformRefCalibration\n");
johnAlexander 14:8320b5ff96fa 502 status = vl53l0x_perform_ref_calibration(_device,
johnAlexander 14:8320b5ff96fa 503 &vhv_settings, &phase_cal); // Device Initialization
johnAlexander 14:8320b5ff96fa 504 }
johnAlexander 10:faf8d62ce6d1 505
johnAlexander 14:8320b5ff96fa 506 if (status == VL53L0X_ERROR_NONE) {
johnAlexander 14:8320b5ff96fa 507 printf("Call of VL53L0X_PerformRefSpadManagement\n");
johnAlexander 14:8320b5ff96fa 508 status = vl53l0x_perform_ref_spad_management(_device,
johnAlexander 14:8320b5ff96fa 509 &ref_spad_count, &is_aperture_spads); // Device Initialization
johnAlexander 14:8320b5ff96fa 510 // printf ("refSpadCount = %d, isApertureSpads = %d\n", refSpadCount, isApertureSpads);
johnAlexander 10:faf8d62ce6d1 511 }
johnAlexander 14:8320b5ff96fa 512
johnAlexander 10:faf8d62ce6d1 513 return status;
johnAlexander 0:c523920bcc09 514 }
johnAlexander 0:c523920bcc09 515
johnAlexander 14:8320b5ff96fa 516 /**
johnAlexander 14:8320b5ff96fa 517 * @brief Start continuous ranging mode
johnAlexander 14:8320b5ff96fa 518 *
johnAlexander 14:8320b5ff96fa 519 * @details End user should ensure device is in idle state and not already running
johnAlexander 14:8320b5ff96fa 520 * @return 0 on success
johnAlexander 14:8320b5ff96fa 521 */
johnAlexander 14:8320b5ff96fa 522 int range_start_continuous_mode()
johnAlexander 0:c523920bcc09 523 {
johnAlexander 14:8320b5ff96fa 524 int status;
johnAlexander 14:8320b5ff96fa 525 status = vl53l0x_set_device_mode(_device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
johnAlexander 0:c523920bcc09 526
johnAlexander 14:8320b5ff96fa 527 if(status == VL53L0X_ERROR_NONE) {
johnAlexander 14:8320b5ff96fa 528 printf ("Call of VL53L0X_StartMeasurement\n");
johnAlexander 14:8320b5ff96fa 529 status = vl53l0x_start_measurement(_device);
johnAlexander 14:8320b5ff96fa 530 }
johnAlexander 0:c523920bcc09 531
johnAlexander 14:8320b5ff96fa 532 return status;
johnAlexander 0:c523920bcc09 533 }
johnAlexander 0:c523920bcc09 534
johnAlexander 14:8320b5ff96fa 535 /**
johnAlexander 14:8320b5ff96fa 536 * @brief Get ranging result and only that
johnAlexander 14:8320b5ff96fa 537 *
johnAlexander 14:8320b5ff96fa 538 * @par Function Description
johnAlexander 14:8320b5ff96fa 539 * Unlike @a vl53l0x_get_ranging_measurement_data() this function only retrieves the range in millimeter \n
johnAlexander 14:8320b5ff96fa 540 * It does any required up-scale translation\n
johnAlexander 14:8320b5ff96fa 541 * It can be called after success status polling or in interrupt mode \n
johnAlexander 14:8320b5ff96fa 542 * @warning these function is not doing wrap around filtering \n
johnAlexander 14:8320b5ff96fa 543 * This function doesn't perform any data ready check!
johnAlexander 14:8320b5ff96fa 544 *
johnAlexander 14:8320b5ff96fa 545 * @param p_data Pointer to range distance
johnAlexander 14:8320b5ff96fa 546 * @return 0 on success
johnAlexander 14:8320b5ff96fa 547 */
johnAlexander 14:8320b5ff96fa 548 virtual int get_distance(uint32_t *p_data)
johnAlexander 0:c523920bcc09 549 {
johnAlexander 14:8320b5ff96fa 550 int status = 0;
johnAlexander 14:8320b5ff96fa 551 VL53L0X_RangingMeasurementData_t p_ranging_measurement_data;
johnAlexander 0:c523920bcc09 552
johnAlexander 14:8320b5ff96fa 553 status = start_measurement(range_single_shot_polling, NULL);
johnAlexander 14:8320b5ff96fa 554 if (!status) {
johnAlexander 14:8320b5ff96fa 555 status = get_measurement(range_single_shot_polling, &p_ranging_measurement_data);
johnAlexander 14:8320b5ff96fa 556 }
johnAlexander 14:8320b5ff96fa 557 if (p_ranging_measurement_data.RangeStatus == 0) {
johnAlexander 14:8320b5ff96fa 558 // we have a valid range.
johnAlexander 14:8320b5ff96fa 559 *p_data = p_ranging_measurement_data.RangeMilliMeter;
johnAlexander 14:8320b5ff96fa 560 } else {
johnAlexander 14:8320b5ff96fa 561 *p_data = 0;
johnAlexander 14:8320b5ff96fa 562 status = VL53L0X_ERROR_RANGE_ERROR;
johnAlexander 14:8320b5ff96fa 563 }
johnAlexander 14:8320b5ff96fa 564 stop_measurement(range_single_shot_polling);
johnAlexander 14:8320b5ff96fa 565 return status;
johnAlexander 0:c523920bcc09 566 }
johnAlexander 0:c523920bcc09 567
johnAlexander 14:8320b5ff96fa 568 /** @} */
johnAlexander 0:c523920bcc09 569
johnAlexander 14:8320b5ff96fa 570 /**
johnAlexander 14:8320b5ff96fa 571 * @brief Set new device i2c address
johnAlexander 14:8320b5ff96fa 572 *
johnAlexander 14:8320b5ff96fa 573 * After completion the device will answer to the new address programmed.
johnAlexander 14:8320b5ff96fa 574 *
johnAlexander 14:8320b5ff96fa 575 * @param new_addr The new i2c address (7bit)
johnAlexander 14:8320b5ff96fa 576 * @return 0 on success
johnAlexander 14:8320b5ff96fa 577 */
johnAlexander 14:8320b5ff96fa 578 int set_device_address(int new_addr)
johnAlexander 0:c523920bcc09 579 {
johnAlexander 14:8320b5ff96fa 580 int status;
johnAlexander 0:c523920bcc09 581
johnAlexander 14:8320b5ff96fa 582 status = vl53l0x_set_device_address(_device, new_addr);
johnAlexander 14:8320b5ff96fa 583 if (!status)
johnAlexander 14:8320b5ff96fa 584 _device->I2cDevAddr = new_addr;
johnAlexander 14:8320b5ff96fa 585 return status;
johnAlexander 12:f6e2bad00dc7 586
johnAlexander 0:c523920bcc09 587 }
johnAlexander 0:c523920bcc09 588
johnAlexander 14:8320b5ff96fa 589 /**
johnAlexander 14:8320b5ff96fa 590 * @brief Clear given system interrupt condition
johnAlexander 14:8320b5ff96fa 591 *
johnAlexander 14:8320b5ff96fa 592 * @par Function Description
johnAlexander 14:8320b5ff96fa 593 * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register.
johnAlexander 14:8320b5ff96fa 594 * @param dev The device
johnAlexander 14:8320b5ff96fa 595 * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR.
johnAlexander 14:8320b5ff96fa 596 * @return 0 On success
johnAlexander 14:8320b5ff96fa 597 */
johnAlexander 14:8320b5ff96fa 598 int clear_interrupt(uint8_t int_clear)
johnAlexander 0:c523920bcc09 599 {
johnAlexander 14:8320b5ff96fa 600 return vl53l0x_clear_interrupt_mask(_device, int_clear);
johnAlexander 0:c523920bcc09 601 }
johnAlexander 0:c523920bcc09 602
johnAlexander 14:8320b5ff96fa 603 /**
johnAlexander 14:8320b5ff96fa 604 *
johnAlexander 14:8320b5ff96fa 605 * @brief One time device initialization
johnAlexander 14:8320b5ff96fa 606 *
johnAlexander 14:8320b5ff96fa 607 * To be called once and only once after device is brought out of reset
johnAlexander 14:8320b5ff96fa 608 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted()
johnAlexander 14:8320b5ff96fa 609 *
johnAlexander 14:8320b5ff96fa 610 * @par Function Description
johnAlexander 14:8320b5ff96fa 611 * When not used after a fresh device "power up" or reset, it may return
johnAlexander 14:8320b5ff96fa 612 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data
johnAlexander 14:8320b5ff96fa 613 * may have been fetched from device that can result in ranging offset error\n
johnAlexander 14:8320b5ff96fa 614 * If application cannot execute device reset or need to run VL53L0X_DataInit
johnAlexander 14:8320b5ff96fa 615 * multiple time then it must ensure proper offset calibration saving and
johnAlexander 14:8320b5ff96fa 616 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first
johnAlexander 14:8320b5ff96fa 617 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init
johnAlexander 14:8320b5ff96fa 618 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to
johnAlexander 14:8320b5ff96fa 619 * VL53L0X_STATE_WAIT_STATICINIT.
johnAlexander 14:8320b5ff96fa 620 *
johnAlexander 14:8320b5ff96fa 621 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 622 *
johnAlexander 14:8320b5ff96fa 623 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 624 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 625 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 626 */
johnAlexander 14:8320b5ff96fa 627 VL53L0X_Error vl53l0x_data_init(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 628
johnAlexander 14:8320b5ff96fa 629 /**
johnAlexander 14:8320b5ff96fa 630 * @brief Do basic device init (and eventually patch loading)
johnAlexander 14:8320b5ff96fa 631 * This function will change the VL53L0X_State from
johnAlexander 14:8320b5ff96fa 632 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
johnAlexander 14:8320b5ff96fa 633 * In this stage all default setting will be applied.
johnAlexander 14:8320b5ff96fa 634 *
johnAlexander 14:8320b5ff96fa 635 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 636 *
johnAlexander 14:8320b5ff96fa 637 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 638 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 639 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 640 */
johnAlexander 14:8320b5ff96fa 641 VL53L0X_Error vl53l0x_static_init(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 642
johnAlexander 14:8320b5ff96fa 643 /**
johnAlexander 14:8320b5ff96fa 644 * @brief Perform Reference Calibration
johnAlexander 14:8320b5ff96fa 645 *
johnAlexander 14:8320b5ff96fa 646 * @details Perform a reference calibration of the Device.
johnAlexander 14:8320b5ff96fa 647 * This function should be run from time to time before doing
johnAlexander 14:8320b5ff96fa 648 * a ranging measurement.
johnAlexander 14:8320b5ff96fa 649 * This function will launch a special ranging measurement, so
johnAlexander 14:8320b5ff96fa 650 * if interrupt are enable an interrupt will be done.
johnAlexander 14:8320b5ff96fa 651 * This function will clear the interrupt generated automatically.
johnAlexander 14:8320b5ff96fa 652 *
johnAlexander 14:8320b5ff96fa 653 * @warning This function is a blocking function
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 * @param p_vhv_settings Pointer to vhv settings parameter.
johnAlexander 14:8320b5ff96fa 659 * @param p_phase_cal Pointer to PhaseCal parameter.
johnAlexander 14:8320b5ff96fa 660 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 661 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 662 */
johnAlexander 14:8320b5ff96fa 663 VL53L0X_Error vl53l0x_perform_ref_calibration(VL53L0X_DEV dev, uint8_t *p_vhv_settings,
johnAlexander 14:8320b5ff96fa 664 uint8_t *p_phase_cal);
johnAlexander 14:8320b5ff96fa 665
johnAlexander 14:8320b5ff96fa 666 /**
johnAlexander 14:8320b5ff96fa 667 * @brief Get Reference Calibration Parameters
johnAlexander 14:8320b5ff96fa 668 *
johnAlexander 14:8320b5ff96fa 669 * @par Function Description
johnAlexander 14:8320b5ff96fa 670 * Get Reference Calibration Parameters.
johnAlexander 14:8320b5ff96fa 671 *
johnAlexander 14:8320b5ff96fa 672 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 673 *
johnAlexander 14:8320b5ff96fa 674 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 675 * @param p_vhv_settings Pointer to VHV parameter
johnAlexander 14:8320b5ff96fa 676 * @param p_phase_cal Pointer to PhaseCal Parameter
johnAlexander 14:8320b5ff96fa 677 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 678 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 679 */
johnAlexander 14:8320b5ff96fa 680 VL53L0X_Error vl53l0x_get_ref_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 681 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
johnAlexander 14:8320b5ff96fa 682
johnAlexander 14:8320b5ff96fa 683 VL53L0X_Error vl53l0x_set_ref_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 684 uint8_t vhv_settings, uint8_t phase_cal);
johnAlexander 14:8320b5ff96fa 685
johnAlexander 14:8320b5ff96fa 686 /**
johnAlexander 14:8320b5ff96fa 687 * @brief Performs Reference Spad Management
johnAlexander 14:8320b5ff96fa 688 *
johnAlexander 14:8320b5ff96fa 689 * @par Function Description
johnAlexander 14:8320b5ff96fa 690 * The reference SPAD initialization procedure determines the minimum amount
johnAlexander 14:8320b5ff96fa 691 * of reference spads to be enables to achieve a target reference signal rate
johnAlexander 14:8320b5ff96fa 692 * and should be performed once during initialization.
johnAlexander 14:8320b5ff96fa 693 *
johnAlexander 14:8320b5ff96fa 694 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 695 *
johnAlexander 14:8320b5ff96fa 696 * @note This function change the device mode to
johnAlexander 14:8320b5ff96fa 697 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 14:8320b5ff96fa 698 *
johnAlexander 14:8320b5ff96fa 699 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 700 * @param ref_spad_count Reports ref Spad Count
johnAlexander 14:8320b5ff96fa 701 * @param is_aperture_spads Reports if spads are of type
johnAlexander 14:8320b5ff96fa 702 * aperture or non-aperture.
johnAlexander 14:8320b5ff96fa 703 * 1:=aperture, 0:=Non-Aperture
johnAlexander 14:8320b5ff96fa 704 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 705 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure.
johnAlexander 14:8320b5ff96fa 706 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 707 */
johnAlexander 14:8320b5ff96fa 708 VL53L0X_Error vl53l0x_perform_ref_spad_management(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 709 uint32_t *ref_spad_count, uint8_t *is_aperture_spads);
johnAlexander 14:8320b5ff96fa 710
johnAlexander 14:8320b5ff96fa 711 /**
johnAlexander 14:8320b5ff96fa 712 * @brief Applies Reference SPAD configuration
johnAlexander 14:8320b5ff96fa 713 *
johnAlexander 14:8320b5ff96fa 714 * @par Function Description
johnAlexander 14:8320b5ff96fa 715 * This function applies a given number of reference spads, identified as
johnAlexander 14:8320b5ff96fa 716 * either Aperture or Non-Aperture.
johnAlexander 14:8320b5ff96fa 717 * The requested spad count and type are stored within the device specific
johnAlexander 14:8320b5ff96fa 718 * parameters data for access by the host.
johnAlexander 14:8320b5ff96fa 719 *
johnAlexander 14:8320b5ff96fa 720 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 721 *
johnAlexander 14:8320b5ff96fa 722 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 723 * @param refSpadCount Number of ref spads.
johnAlexander 14:8320b5ff96fa 724 * @param is_aperture_spads Defines if spads are of type
johnAlexander 14:8320b5ff96fa 725 * aperture or non-aperture.
johnAlexander 14:8320b5ff96fa 726 * 1:=aperture, 0:=Non-Aperture
johnAlexander 14:8320b5ff96fa 727 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 728 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 14:8320b5ff96fa 729 * spad configuration.
johnAlexander 14:8320b5ff96fa 730 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 731 */
johnAlexander 14:8320b5ff96fa 732 VL53L0X_Error vl53l0x_set_reference_spads(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 733 uint32_t refSpadCount, uint8_t is_aperture_spads);
johnAlexander 14:8320b5ff96fa 734
johnAlexander 14:8320b5ff96fa 735 /**
johnAlexander 14:8320b5ff96fa 736 * @brief Retrieves SPAD configuration
johnAlexander 14:8320b5ff96fa 737 *
johnAlexander 14:8320b5ff96fa 738 * @par Function Description
johnAlexander 14:8320b5ff96fa 739 * This function retrieves the current number of applied reference spads
johnAlexander 14:8320b5ff96fa 740 * and also their type : Aperture or Non-Aperture.
johnAlexander 14:8320b5ff96fa 741 *
johnAlexander 14:8320b5ff96fa 742 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 743 *
johnAlexander 14:8320b5ff96fa 744 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 745 * @param p_spad_count Number ref Spad Count
johnAlexander 14:8320b5ff96fa 746 * @param p_is_aperture_spads Reports if spads are of type
johnAlexander 14:8320b5ff96fa 747 * aperture or non-aperture.
johnAlexander 14:8320b5ff96fa 748 * 1:=aperture, 0:=Non-Aperture
johnAlexander 14:8320b5ff96fa 749 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 750 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 14:8320b5ff96fa 751 * spad configuration.
johnAlexander 14:8320b5ff96fa 752 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 753 */
johnAlexander 14:8320b5ff96fa 754 VL53L0X_Error vl53l0x_get_reference_spads(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 755 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
johnAlexander 14:8320b5ff96fa 756
johnAlexander 14:8320b5ff96fa 757 /**
johnAlexander 14:8320b5ff96fa 758 * @brief Get part to part calibration offset
johnAlexander 14:8320b5ff96fa 759 *
johnAlexander 14:8320b5ff96fa 760 * @par Function Description
johnAlexander 14:8320b5ff96fa 761 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
johnAlexander 14:8320b5ff96fa 762 * device NVM value
johnAlexander 14:8320b5ff96fa 763 *
johnAlexander 14:8320b5ff96fa 764 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 765 *
johnAlexander 14:8320b5ff96fa 766 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 767 * @param p_offset_calibration_data_micro_meter Return part to part
johnAlexander 14:8320b5ff96fa 768 * calibration offset from device (microns)
johnAlexander 14:8320b5ff96fa 769 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 770 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 771 */
johnAlexander 14:8320b5ff96fa 772 VL53L0X_Error vl53l0x_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 773 int32_t *p_offset_calibration_data_micro_meter);
johnAlexander 14:8320b5ff96fa 774 /**
johnAlexander 14:8320b5ff96fa 775 * Set or over-hide part to part calibration offset
johnAlexander 14:8320b5ff96fa 776 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter()
johnAlexander 14:8320b5ff96fa 777 *
johnAlexander 14:8320b5ff96fa 778 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 779 *
johnAlexander 14:8320b5ff96fa 780 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 781 * @param p_offset_calibration_data_micro_meter Offset (microns)
johnAlexander 14:8320b5ff96fa 782 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 783 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 784 */
johnAlexander 14:8320b5ff96fa 785 VL53L0X_Error vl53l0x_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 786 int32_t offset_calibration_data_micro_meter);
johnAlexander 14:8320b5ff96fa 787
johnAlexander 14:8320b5ff96fa 788 VL53L0X_Error vl53l0x_perform_offset_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 789 FixPoint1616_t cal_distance_milli_meter,
johnAlexander 14:8320b5ff96fa 790 int32_t *p_offset_micro_meter);
johnAlexander 14:8320b5ff96fa 791
johnAlexander 14:8320b5ff96fa 792 VL53L0X_Error vl53l0x_perform_xtalk_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 793 FixPoint1616_t xtalk_cal_distance,
johnAlexander 14:8320b5ff96fa 794 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
johnAlexander 14:8320b5ff96fa 795
johnAlexander 14:8320b5ff96fa 796 /**
johnAlexander 14:8320b5ff96fa 797 * @brief Perform XTalk Measurement
johnAlexander 14:8320b5ff96fa 798 *
johnAlexander 14:8320b5ff96fa 799 * @details Measures the current cross talk from glass in front
johnAlexander 14:8320b5ff96fa 800 * of the sensor.
johnAlexander 14:8320b5ff96fa 801 * This functions performs a histogram measurement and uses the results
johnAlexander 14:8320b5ff96fa 802 * to measure the crosstalk. For the function to be successful, there
johnAlexander 14:8320b5ff96fa 803 * must be no target in front of the sensor.
johnAlexander 14:8320b5ff96fa 804 *
johnAlexander 14:8320b5ff96fa 805 * @warning This function is a blocking function
johnAlexander 14:8320b5ff96fa 806 *
johnAlexander 14:8320b5ff96fa 807 * @warning This function is not supported when the final range
johnAlexander 14:8320b5ff96fa 808 * vcsel clock period is set below 10 PCLKS.
johnAlexander 14:8320b5ff96fa 809 *
johnAlexander 14:8320b5ff96fa 810 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 811 *
johnAlexander 14:8320b5ff96fa 812 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 813 * @param timeout_ms Histogram measurement duration.
johnAlexander 14:8320b5ff96fa 814 * @param p_xtalk_per_spad Output parameter containing the crosstalk
johnAlexander 14:8320b5ff96fa 815 * measurement result, in MCPS/Spad. Format fixpoint 16:16.
johnAlexander 14:8320b5ff96fa 816 * @param p_ambient_too_high Output parameter which indicate that
johnAlexander 14:8320b5ff96fa 817 * pXtalkPerSpad is not good if the Ambient is too high.
johnAlexander 14:8320b5ff96fa 818 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 819 * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported
johnAlexander 14:8320b5ff96fa 820 * for this operation. Must not be less than 10PCLKS.
johnAlexander 14:8320b5ff96fa 821 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 822 */
johnAlexander 14:8320b5ff96fa 823 VL53L0X_Error vl53l0x_perform_xtalk_measurement(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 824 uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad,
johnAlexander 14:8320b5ff96fa 825 uint8_t *p_ambient_too_high);
johnAlexander 14:8320b5ff96fa 826
johnAlexander 14:8320b5ff96fa 827 /**
johnAlexander 14:8320b5ff96fa 828 * @brief Enable/Disable Cross talk compensation feature
johnAlexander 14:8320b5ff96fa 829 *
johnAlexander 14:8320b5ff96fa 830 * @note This function is not Implemented.
johnAlexander 14:8320b5ff96fa 831 * Enable/Disable Cross Talk by set to zero the Cross Talk value
johnAlexander 14:8320b5ff96fa 832 * by using @a VL53L0X_SetXTalkCompensationRateMegaCps().
johnAlexander 14:8320b5ff96fa 833 *
johnAlexander 14:8320b5ff96fa 834 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 835 * @param x_talk_compensation_enable Cross talk compensation
johnAlexander 14:8320b5ff96fa 836 * to be set 0=disabled else = enabled
johnAlexander 14:8320b5ff96fa 837 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 838 */
johnAlexander 14:8320b5ff96fa 839 VL53L0X_Error vl53l0x_set_x_talk_compensation_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 840 uint8_t x_talk_compensation_enable);
johnAlexander 14:8320b5ff96fa 841
johnAlexander 14:8320b5ff96fa 842 /**
johnAlexander 14:8320b5ff96fa 843 * @brief Get Cross talk compensation rate
johnAlexander 14:8320b5ff96fa 844 *
johnAlexander 14:8320b5ff96fa 845 * @note This function is not Implemented.
johnAlexander 14:8320b5ff96fa 846 * Enable/Disable Cross Talk by set to zero the Cross Talk value by
johnAlexander 14:8320b5ff96fa 847 * using @a VL53L0X_SetXTalkCompensationRateMegaCps().
johnAlexander 14:8320b5ff96fa 848 *
johnAlexander 14:8320b5ff96fa 849 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 850 * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation
johnAlexander 14:8320b5ff96fa 851 * state 0=disabled or 1 = enabled
johnAlexander 14:8320b5ff96fa 852 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 853 */
johnAlexander 14:8320b5ff96fa 854 VL53L0X_Error vl53l0x_get_x_talk_compensation_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 855 uint8_t *p_x_talk_compensation_enable);
johnAlexander 14:8320b5ff96fa 856 /**
johnAlexander 14:8320b5ff96fa 857 * @brief Set Cross talk compensation rate
johnAlexander 14:8320b5ff96fa 858 *
johnAlexander 14:8320b5ff96fa 859 * @par Function Description
johnAlexander 14:8320b5ff96fa 860 * Set Cross talk compensation rate.
johnAlexander 14:8320b5ff96fa 861 *
johnAlexander 14:8320b5ff96fa 862 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 863 *
johnAlexander 14:8320b5ff96fa 864 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 865 * @param x_talk_compensation_rate_mega_cps Compensation rate in
johnAlexander 14:8320b5ff96fa 866 * Mega counts per second (16.16 fix point) see datasheet for details
johnAlexander 14:8320b5ff96fa 867 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 868 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 869 */
johnAlexander 14:8320b5ff96fa 870 VL53L0X_Error vl53l0x_set_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 871 FixPoint1616_t x_talk_compensation_rate_mega_cps);
johnAlexander 14:8320b5ff96fa 872
johnAlexander 14:8320b5ff96fa 873 /**
johnAlexander 14:8320b5ff96fa 874 * @brief Get Cross talk compensation rate
johnAlexander 14:8320b5ff96fa 875 *
johnAlexander 14:8320b5ff96fa 876 * @par Function Description
johnAlexander 14:8320b5ff96fa 877 * Get Cross talk compensation rate.
johnAlexander 14:8320b5ff96fa 878 *
johnAlexander 14:8320b5ff96fa 879 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 880 *
johnAlexander 14:8320b5ff96fa 881 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 882 * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate
johnAlexander 14:8320b5ff96fa 883 in Mega counts per second (16.16 fix point) see datasheet for details
johnAlexander 14:8320b5ff96fa 884 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 885 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 886 */
johnAlexander 14:8320b5ff96fa 887 VL53L0X_Error vl53l0x_get_x_talk_compensation_rate_mega_cps(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 888 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
johnAlexander 14:8320b5ff96fa 889
johnAlexander 14:8320b5ff96fa 890 /**
johnAlexander 14:8320b5ff96fa 891 * @brief Set a new device mode
johnAlexander 14:8320b5ff96fa 892 * @par Function Description
johnAlexander 14:8320b5ff96fa 893 * Set device to a new mode (ranging, histogram ...)
johnAlexander 14:8320b5ff96fa 894 *
johnAlexander 14:8320b5ff96fa 895 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 896 *
johnAlexander 14:8320b5ff96fa 897 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 898 * @param device_mode New device mode to apply
johnAlexander 14:8320b5ff96fa 899 * Valid values are:
johnAlexander 14:8320b5ff96fa 900 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 14:8320b5ff96fa 901 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
johnAlexander 14:8320b5ff96fa 902 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 14:8320b5ff96fa 903 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 14:8320b5ff96fa 904 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 14:8320b5ff96fa 905 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 14:8320b5ff96fa 906 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 14:8320b5ff96fa 907 *
johnAlexander 14:8320b5ff96fa 908 *
johnAlexander 14:8320b5ff96fa 909 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 910 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when DeviceMode is
johnAlexander 14:8320b5ff96fa 911 * not in the supported list
johnAlexander 14:8320b5ff96fa 912 */
johnAlexander 14:8320b5ff96fa 913 VL53L0X_Error vl53l0x_set_device_mode(VL53L0X_DEV dev, VL53L0X_DeviceModes device_mode);
johnAlexander 14:8320b5ff96fa 914
johnAlexander 14:8320b5ff96fa 915 /**
johnAlexander 14:8320b5ff96fa 916 * @brief Get current new device mode
johnAlexander 14:8320b5ff96fa 917 * @par Function Description
johnAlexander 14:8320b5ff96fa 918 * Get actual mode of the device(ranging, histogram ...)
johnAlexander 14:8320b5ff96fa 919 *
johnAlexander 14:8320b5ff96fa 920 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 921 *
johnAlexander 14:8320b5ff96fa 922 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 923 * @param p_device_mode Pointer to current apply mode value
johnAlexander 14:8320b5ff96fa 924 * Valid values are:
johnAlexander 14:8320b5ff96fa 925 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 14:8320b5ff96fa 926 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
johnAlexander 14:8320b5ff96fa 927 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 14:8320b5ff96fa 928 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 14:8320b5ff96fa 929 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 14:8320b5ff96fa 930 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 14:8320b5ff96fa 931 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 14:8320b5ff96fa 932 *
johnAlexander 14:8320b5ff96fa 933 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 934 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 14:8320b5ff96fa 935 * DeviceMode is not in the supported list
johnAlexander 14:8320b5ff96fa 936 */
johnAlexander 14:8320b5ff96fa 937 VL53L0X_Error vl53l0x_get_device_mode(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 938 VL53L0X_DeviceModes *p_device_mode);
johnAlexander 14:8320b5ff96fa 939
johnAlexander 14:8320b5ff96fa 940 /**
johnAlexander 14:8320b5ff96fa 941 * @brief Get current configuration for GPIO pin for a given device
johnAlexander 14:8320b5ff96fa 942 *
johnAlexander 14:8320b5ff96fa 943 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 944 *
johnAlexander 14:8320b5ff96fa 945 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 946 * @param pin ID of the GPIO Pin
johnAlexander 14:8320b5ff96fa 947 * @param p_device_mode Pointer to Device Mode associated to the Gpio.
johnAlexander 14:8320b5ff96fa 948 * @param p_functionality Pointer to Pin functionality.
johnAlexander 14:8320b5ff96fa 949 * Refer to ::VL53L0X_GpioFunctionality
johnAlexander 14:8320b5ff96fa 950 * @param p_polarity Pointer to interrupt polarity.
johnAlexander 14:8320b5ff96fa 951 * Active high or active low see ::VL53L0X_InterruptPolarity
johnAlexander 14:8320b5ff96fa 952 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 953 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
johnAlexander 14:8320b5ff96fa 954 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs
johnAlexander 14:8320b5ff96fa 955 * when Functionality programmed is not in the supported list:
johnAlexander 14:8320b5ff96fa 956 * Supported value are:
johnAlexander 14:8320b5ff96fa 957 * VL53L0X_GPIOFUNCTIONALITY_OFF,
johnAlexander 14:8320b5ff96fa 958 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
johnAlexander 14:8320b5ff96fa 959 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
johnAlexander 14:8320b5ff96fa 960 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
johnAlexander 14:8320b5ff96fa 961 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
johnAlexander 14:8320b5ff96fa 962 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 963 */
johnAlexander 14:8320b5ff96fa 964 VL53L0X_Error vl53l0x_get_gpio_config(VL53L0X_DEV dev, uint8_t pin,
johnAlexander 14:8320b5ff96fa 965 VL53L0X_DeviceModes *p_device_mode,
johnAlexander 14:8320b5ff96fa 966 VL53L0X_GpioFunctionality *p_functionality,
johnAlexander 14:8320b5ff96fa 967 VL53L0X_InterruptPolarity *p_polarity);
johnAlexander 14:8320b5ff96fa 968
johnAlexander 14:8320b5ff96fa 969 /**
johnAlexander 14:8320b5ff96fa 970 * @brief Set the configuration of GPIO pin for a given device
johnAlexander 14:8320b5ff96fa 971 *
johnAlexander 14:8320b5ff96fa 972 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 973 *
johnAlexander 14:8320b5ff96fa 974 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 975 * @param pin ID of the GPIO Pin
johnAlexander 14:8320b5ff96fa 976 * @param functionality Select Pin functionality.
johnAlexander 14:8320b5ff96fa 977 * Refer to ::VL53L0X_GpioFunctionality
johnAlexander 14:8320b5ff96fa 978 * @param device_mode Device Mode associated to the Gpio.
johnAlexander 14:8320b5ff96fa 979 * @param polarity Set interrupt polarity. Active high
johnAlexander 14:8320b5ff96fa 980 * or active low see ::VL53L0X_InterruptPolarity
johnAlexander 14:8320b5ff96fa 981 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 982 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
johnAlexander 14:8320b5ff96fa 983 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs
johnAlexander 14:8320b5ff96fa 984 * when Functionality programmed is not in the supported list:
johnAlexander 14:8320b5ff96fa 985 * Supported value are:
johnAlexander 14:8320b5ff96fa 986 * VL53L0X_GPIOFUNCTIONALITY_OFF,
johnAlexander 14:8320b5ff96fa 987 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
johnAlexander 14:8320b5ff96fa 988 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
johnAlexander 14:8320b5ff96fa 989 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
johnAlexander 14:8320b5ff96fa 990 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
johnAlexander 14:8320b5ff96fa 991 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 992 */
johnAlexander 14:8320b5ff96fa 993 VL53L0X_Error vl53l0x_set_gpio_config(VL53L0X_DEV dev, uint8_t pin,
johnAlexander 14:8320b5ff96fa 994 VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality,
johnAlexander 14:8320b5ff96fa 995 VL53L0X_InterruptPolarity polarity);
johnAlexander 14:8320b5ff96fa 996
johnAlexander 14:8320b5ff96fa 997 /**
johnAlexander 14:8320b5ff96fa 998 * @brief Start device measurement
johnAlexander 14:8320b5ff96fa 999 *
johnAlexander 14:8320b5ff96fa 1000 * @details Started measurement will depend on device parameters set through
johnAlexander 14:8320b5ff96fa 1001 * @a VL53L0X_SetParameters()
johnAlexander 14:8320b5ff96fa 1002 * This is a non-blocking function.
johnAlexander 14:8320b5ff96fa 1003 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to
johnAlexander 14:8320b5ff96fa 1004 * VL53L0X_STATE_RUNNING.
johnAlexander 14:8320b5ff96fa 1005 *
johnAlexander 14:8320b5ff96fa 1006 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1007 *
johnAlexander 14:8320b5ff96fa 1008
johnAlexander 14:8320b5ff96fa 1009 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1010 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1011 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 14:8320b5ff96fa 1012 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported
johnAlexander 14:8320b5ff96fa 1013 * list:
johnAlexander 14:8320b5ff96fa 1014 * Supported mode are:
johnAlexander 14:8320b5ff96fa 1015 * VL53L0X_DEVICEMODE_SINGLE_RANGING,
johnAlexander 14:8320b5ff96fa 1016 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING,
johnAlexander 14:8320b5ff96fa 1017 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
johnAlexander 14:8320b5ff96fa 1018 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement
johnAlexander 14:8320b5ff96fa 1019 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1020 */
johnAlexander 14:8320b5ff96fa 1021 VL53L0X_Error vl53l0x_start_measurement(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1022
johnAlexander 14:8320b5ff96fa 1023 /**
johnAlexander 14:8320b5ff96fa 1024 * @brief Stop device measurement
johnAlexander 14:8320b5ff96fa 1025 *
johnAlexander 14:8320b5ff96fa 1026 * @details Will set the device in standby mode at end of current measurement\n
johnAlexander 14:8320b5ff96fa 1027 * Not necessary in single mode as device shall return automatically
johnAlexander 14:8320b5ff96fa 1028 * in standby mode at end of measurement.
johnAlexander 14:8320b5ff96fa 1029 * This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING
johnAlexander 14:8320b5ff96fa 1030 * to VL53L0X_STATE_IDLE.
johnAlexander 14:8320b5ff96fa 1031 *
johnAlexander 14:8320b5ff96fa 1032 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1033 *
johnAlexander 14:8320b5ff96fa 1034 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1035 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1036 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1037 */
johnAlexander 14:8320b5ff96fa 1038 VL53L0X_Error vl53l0x_stop_measurement(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1039
johnAlexander 14:8320b5ff96fa 1040 /**
johnAlexander 14:8320b5ff96fa 1041 * @brief Return device stop completion status
johnAlexander 14:8320b5ff96fa 1042 *
johnAlexander 14:8320b5ff96fa 1043 * @par Function Description
johnAlexander 14:8320b5ff96fa 1044 * Returns stop completiob status.
johnAlexander 14:8320b5ff96fa 1045 * User shall call this function after a stop command
johnAlexander 14:8320b5ff96fa 1046 *
johnAlexander 14:8320b5ff96fa 1047 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1048 *
johnAlexander 14:8320b5ff96fa 1049 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1050 * @param p_stop_status Pointer to status variable to update
johnAlexander 14:8320b5ff96fa 1051 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1052 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1053 */
johnAlexander 14:8320b5ff96fa 1054 VL53L0X_Error vl53l0x_get_stop_completed_status(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1055 uint32_t *p_stop_status);
johnAlexander 14:8320b5ff96fa 1056
johnAlexander 14:8320b5ff96fa 1057 /**
johnAlexander 14:8320b5ff96fa 1058 * @brief Return Measurement Data Ready
johnAlexander 14:8320b5ff96fa 1059 *
johnAlexander 14:8320b5ff96fa 1060 * @par Function Description
johnAlexander 14:8320b5ff96fa 1061 * This function indicate that a measurement data is ready.
johnAlexander 14:8320b5ff96fa 1062 * This function check if interrupt mode is used then check is done accordingly.
johnAlexander 14:8320b5ff96fa 1063 * If perform function clear the interrupt, this function will not work,
johnAlexander 14:8320b5ff96fa 1064 * like in case of @a VL53L0X_PerformSingleRangingMeasurement().
johnAlexander 14:8320b5ff96fa 1065 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady
johnAlexander 14:8320b5ff96fa 1066 * is used for non-blocking capture.
johnAlexander 14:8320b5ff96fa 1067 *
johnAlexander 14:8320b5ff96fa 1068 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1069 *
johnAlexander 14:8320b5ff96fa 1070 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1071 * @param p_measurement_data_ready Pointer to Measurement Data Ready.
johnAlexander 14:8320b5ff96fa 1072 * 0=data not ready, 1 = data ready
johnAlexander 14:8320b5ff96fa 1073 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1074 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1075 */
johnAlexander 14:8320b5ff96fa 1076 VL53L0X_Error vl53l0x_get_measurement_data_ready(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1077 uint8_t *p_measurement_data_ready);
johnAlexander 14:8320b5ff96fa 1078
johnAlexander 14:8320b5ff96fa 1079 /**
johnAlexander 14:8320b5ff96fa 1080 * @brief Retrieve the measurements from device for a given setup
johnAlexander 14:8320b5ff96fa 1081 *
johnAlexander 14:8320b5ff96fa 1082 * @par Function Description
johnAlexander 14:8320b5ff96fa 1083 * Get data from last successful Ranging measurement
johnAlexander 14:8320b5ff96fa 1084 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 14:8320b5ff96fa 1085 * before get data.
johnAlexander 14:8320b5ff96fa 1086 * PAL will fill a NumberOfROIZones times the corresponding data
johnAlexander 14:8320b5ff96fa 1087 * structure used in the measurement function.
johnAlexander 14:8320b5ff96fa 1088 *
johnAlexander 14:8320b5ff96fa 1089 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1090 *
johnAlexander 14:8320b5ff96fa 1091 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1092 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
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_ranging_measurement_data(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1097 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
johnAlexander 14:8320b5ff96fa 1098
johnAlexander 14:8320b5ff96fa 1099 /**
johnAlexander 14:8320b5ff96fa 1100 * @brief Clear given system interrupt condition
johnAlexander 14:8320b5ff96fa 1101 *
johnAlexander 14:8320b5ff96fa 1102 * @par Function Description
johnAlexander 14:8320b5ff96fa 1103 * Clear given interrupt(s).
johnAlexander 14:8320b5ff96fa 1104 *
johnAlexander 14:8320b5ff96fa 1105 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1106 *
johnAlexander 14:8320b5ff96fa 1107 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1108 * @param interrupt_mask Mask of interrupts to clear
johnAlexander 14:8320b5ff96fa 1109 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1110 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts
johnAlexander 14:8320b5ff96fa 1111 *
johnAlexander 14:8320b5ff96fa 1112 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1113 */
johnAlexander 14:8320b5ff96fa 1114 VL53L0X_Error vl53l0x_clear_interrupt_mask(VL53L0X_DEV dev, uint32_t interrupt_mask);
johnAlexander 14:8320b5ff96fa 1115
johnAlexander 14:8320b5ff96fa 1116 /**
johnAlexander 14:8320b5ff96fa 1117 * @brief Return device interrupt status
johnAlexander 14:8320b5ff96fa 1118 *
johnAlexander 14:8320b5ff96fa 1119 * @par Function Description
johnAlexander 14:8320b5ff96fa 1120 * Returns currently raised interrupts by the device.
johnAlexander 14:8320b5ff96fa 1121 * User shall be able to activate/deactivate interrupts through
johnAlexander 14:8320b5ff96fa 1122 * @a VL53L0X_SetGpioConfig()
johnAlexander 14:8320b5ff96fa 1123 *
johnAlexander 14:8320b5ff96fa 1124 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1125 *
johnAlexander 14:8320b5ff96fa 1126 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1127 * @param p_interrupt_mask_status Pointer to status variable to update
johnAlexander 14:8320b5ff96fa 1128 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1129 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1130 */
johnAlexander 14:8320b5ff96fa 1131 VL53L0X_Error vl53l0x_get_interrupt_mask_status(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1132 uint32_t *p_interrupt_mask_status);
johnAlexander 14:8320b5ff96fa 1133
johnAlexander 14:8320b5ff96fa 1134 /**
johnAlexander 14:8320b5ff96fa 1135 * @brief Performs a single ranging measurement and retrieve the ranging
johnAlexander 14:8320b5ff96fa 1136 * measurement data
johnAlexander 14:8320b5ff96fa 1137 *
johnAlexander 14:8320b5ff96fa 1138 * @par Function Description
johnAlexander 14:8320b5ff96fa 1139 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 14:8320b5ff96fa 1140 * with @a VL53L0X_SetDeviceMode(),
johnAlexander 14:8320b5ff96fa 1141 * It performs measurement with @a VL53L0X_PerformSingleMeasurement()
johnAlexander 14:8320b5ff96fa 1142 * It get data from last successful Ranging measurement with
johnAlexander 14:8320b5ff96fa 1143 * @a VL53L0X_GetRangingMeasurementData.
johnAlexander 14:8320b5ff96fa 1144 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask().
johnAlexander 14:8320b5ff96fa 1145 *
johnAlexander 14:8320b5ff96fa 1146 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1147 *
johnAlexander 14:8320b5ff96fa 1148 * @note This function change the device mode to
johnAlexander 14:8320b5ff96fa 1149 * VL53L0X_DEVICEMODE_SINGLE_RANGING
johnAlexander 14:8320b5ff96fa 1150 *
johnAlexander 14:8320b5ff96fa 1151 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1152 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
johnAlexander 14:8320b5ff96fa 1153 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1154 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1155 */
johnAlexander 14:8320b5ff96fa 1156 VL53L0X_Error vl53l0x_perform_single_ranging_measurement(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1157 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
johnAlexander 14:8320b5ff96fa 1158
johnAlexander 14:8320b5ff96fa 1159 /**
johnAlexander 14:8320b5ff96fa 1160 * @brief Single shot measurement.
johnAlexander 14:8320b5ff96fa 1161 *
johnAlexander 14:8320b5ff96fa 1162 * @par Function Description
johnAlexander 14:8320b5ff96fa 1163 * Perform simple measurement sequence (Start measure, Wait measure to end,
johnAlexander 14:8320b5ff96fa 1164 * and returns when measurement is done).
johnAlexander 14:8320b5ff96fa 1165 * Once function returns, user can get valid data by calling
johnAlexander 14:8320b5ff96fa 1166 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement
johnAlexander 14:8320b5ff96fa 1167 * depending on defined measurement mode
johnAlexander 14:8320b5ff96fa 1168 * User should Clear the interrupt in case this are enabled by using the
johnAlexander 14:8320b5ff96fa 1169 * function VL53L0X_ClearInterruptMask().
johnAlexander 14:8320b5ff96fa 1170 *
johnAlexander 14:8320b5ff96fa 1171 * @warning This function is a blocking function
johnAlexander 14:8320b5ff96fa 1172 *
johnAlexander 14:8320b5ff96fa 1173 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1174 *
johnAlexander 14:8320b5ff96fa 1175 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1176 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1177 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1178 */
johnAlexander 14:8320b5ff96fa 1179 VL53L0X_Error vl53l0x_perform_single_measurement(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1180
johnAlexander 14:8320b5ff96fa 1181 /**
johnAlexander 14:8320b5ff96fa 1182 * @brief Read current status of the error register for the selected device
johnAlexander 14:8320b5ff96fa 1183 *
johnAlexander 14:8320b5ff96fa 1184 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1185 *
johnAlexander 14:8320b5ff96fa 1186 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1187 * @param p_device_error_status Pointer to current error code of the device
johnAlexander 14:8320b5ff96fa 1188 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1189 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1190 */
johnAlexander 14:8320b5ff96fa 1191 VL53L0X_Error vl53l0x_get_device_error_status(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1192 VL53L0X_DeviceError *p_device_error_status);
johnAlexander 0:c523920bcc09 1193
johnAlexander 14:8320b5ff96fa 1194 /**
johnAlexander 14:8320b5ff96fa 1195 * @brief Human readable error string for a given Error Code
johnAlexander 14:8320b5ff96fa 1196 *
johnAlexander 14:8320b5ff96fa 1197 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1198 *
johnAlexander 14:8320b5ff96fa 1199 * @param error_code The error code as stored on ::VL53L0X_DeviceError
johnAlexander 14:8320b5ff96fa 1200 * @param p_device_error_string The error string corresponding to the ErrorCode
johnAlexander 14:8320b5ff96fa 1201 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1202 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1203 */
johnAlexander 14:8320b5ff96fa 1204 VL53L0X_Error vl53l0x_get_device_error_string(
johnAlexander 14:8320b5ff96fa 1205 VL53L0X_DeviceError error_code, char *p_device_error_string);
johnAlexander 14:8320b5ff96fa 1206
johnAlexander 14:8320b5ff96fa 1207 /**
johnAlexander 14:8320b5ff96fa 1208 * @brief Human readable Range Status string for a given RangeStatus
johnAlexander 14:8320b5ff96fa 1209 *
johnAlexander 14:8320b5ff96fa 1210 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1211 *
johnAlexander 14:8320b5ff96fa 1212 * @param range_status The RangeStatus code as stored on
johnAlexander 14:8320b5ff96fa 1213 * @a VL53L0X_RangingMeasurementData_t
johnAlexander 14:8320b5ff96fa 1214 * @param p_range_status_string The returned RangeStatus string.
johnAlexander 14:8320b5ff96fa 1215 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1216 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1217 */
johnAlexander 14:8320b5ff96fa 1218 VL53L0X_Error vl53l0x_get_range_status_string(uint8_t range_status,
johnAlexander 14:8320b5ff96fa 1219 char *p_range_status_string);
johnAlexander 14:8320b5ff96fa 1220
johnAlexander 14:8320b5ff96fa 1221 VL53L0X_Error vl53l0x_get_total_signal_rate(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1222 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 14:8320b5ff96fa 1223 FixPoint1616_t *p_total_signal_rate_mcps);
johnAlexander 14:8320b5ff96fa 1224
johnAlexander 14:8320b5ff96fa 1225 VL53L0X_Error vl53l0x_get_total_xtalk_rate(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1226 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 14:8320b5ff96fa 1227 FixPoint1616_t *p_total_xtalk_rate_mcps);
johnAlexander 14:8320b5ff96fa 1228
johnAlexander 14:8320b5ff96fa 1229 /**
johnAlexander 14:8320b5ff96fa 1230 * @brief Get Ranging Timing Budget in microseconds
johnAlexander 14:8320b5ff96fa 1231 *
johnAlexander 14:8320b5ff96fa 1232 * @par Function Description
johnAlexander 14:8320b5ff96fa 1233 * Returns the programmed the maximum time allowed by the user to the
johnAlexander 14:8320b5ff96fa 1234 * device to run a full ranging sequence for the current mode
johnAlexander 14:8320b5ff96fa 1235 * (ranging, histogram, ASL ...)
johnAlexander 14:8320b5ff96fa 1236 *
johnAlexander 14:8320b5ff96fa 1237 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1238 *
johnAlexander 14:8320b5ff96fa 1239 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1240 * @param p_measurement_timing_budget_micro_seconds Max measurement time in
johnAlexander 14:8320b5ff96fa 1241 * microseconds.
johnAlexander 14:8320b5ff96fa 1242 * Valid values are:
johnAlexander 14:8320b5ff96fa 1243 * >= 17000 microsecs when wraparound enabled
johnAlexander 14:8320b5ff96fa 1244 * >= 12000 microsecs when wraparound disabled
johnAlexander 14:8320b5ff96fa 1245 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1246 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1247 */
johnAlexander 14:8320b5ff96fa 1248 VL53L0X_Error vl53l0x_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1249 uint32_t *p_measurement_timing_budget_micro_seconds);
johnAlexander 14:8320b5ff96fa 1250
johnAlexander 14:8320b5ff96fa 1251 /**
johnAlexander 14:8320b5ff96fa 1252 * @brief Set Ranging Timing Budget in microseconds
johnAlexander 14:8320b5ff96fa 1253 *
johnAlexander 14:8320b5ff96fa 1254 * @par Function Description
johnAlexander 14:8320b5ff96fa 1255 * Defines the maximum time allowed by the user to the device to run a
johnAlexander 14:8320b5ff96fa 1256 * full ranging sequence for the current mode (ranging, histogram, ASL ...)
johnAlexander 14:8320b5ff96fa 1257 *
johnAlexander 14:8320b5ff96fa 1258 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1259 *
johnAlexander 14:8320b5ff96fa 1260 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1261 * @param measurement_timing_budget_micro_seconds Max measurement time in
johnAlexander 14:8320b5ff96fa 1262 * microseconds.
johnAlexander 14:8320b5ff96fa 1263 * Valid values are:
johnAlexander 14:8320b5ff96fa 1264 * >= 17000 microsecs when wraparound enabled
johnAlexander 14:8320b5ff96fa 1265 * >= 12000 microsecs when wraparound disabled
johnAlexander 14:8320b5ff96fa 1266 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1267 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
johnAlexander 14:8320b5ff96fa 1268 MeasurementTimingBudgetMicroSeconds out of range
johnAlexander 14:8320b5ff96fa 1269 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1270 */
johnAlexander 14:8320b5ff96fa 1271 VL53L0X_Error vl53l0x_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1272 uint32_t measurement_timing_budget_micro_seconds);
johnAlexander 14:8320b5ff96fa 1273
johnAlexander 14:8320b5ff96fa 1274 /**
johnAlexander 14:8320b5ff96fa 1275 * @brief Get specific limit check enable state
johnAlexander 14:8320b5ff96fa 1276 *
johnAlexander 14:8320b5ff96fa 1277 * @par Function Description
johnAlexander 14:8320b5ff96fa 1278 * This function get the enable state of a specific limit check.
johnAlexander 14:8320b5ff96fa 1279 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 1280 *
johnAlexander 14:8320b5ff96fa 1281 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1282 *
johnAlexander 14:8320b5ff96fa 1283 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1284 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1285 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1286 * @param p_limit_check_enable Pointer to the check limit enable
johnAlexander 14:8320b5ff96fa 1287 * value.
johnAlexander 14:8320b5ff96fa 1288 * if 1 the check limit
johnAlexander 14:8320b5ff96fa 1289 * corresponding to LimitCheckId is Enabled
johnAlexander 14:8320b5ff96fa 1290 * if 0 the check limit
johnAlexander 14:8320b5ff96fa 1291 * corresponding to LimitCheckId is disabled
johnAlexander 14:8320b5ff96fa 1292 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1293 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 14:8320b5ff96fa 1294 * when LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 1295 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1296 */
johnAlexander 14:8320b5ff96fa 1297 VL53L0X_Error vl53l0x_get_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 1298 uint8_t *p_limit_check_enable);
johnAlexander 14:8320b5ff96fa 1299
johnAlexander 14:8320b5ff96fa 1300 /**
johnAlexander 14:8320b5ff96fa 1301 * @brief Enable/Disable a specific limit check
johnAlexander 14:8320b5ff96fa 1302 *
johnAlexander 14:8320b5ff96fa 1303 * @par Function Description
johnAlexander 14:8320b5ff96fa 1304 * This function Enable/Disable a specific limit check.
johnAlexander 14:8320b5ff96fa 1305 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 1306 *
johnAlexander 14:8320b5ff96fa 1307 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 1308 *
johnAlexander 14:8320b5ff96fa 1309 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1310 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1311 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1312 * @param limit_check_enable if 1 the check limit
johnAlexander 14:8320b5ff96fa 1313 * corresponding to LimitCheckId is Enabled
johnAlexander 14:8320b5ff96fa 1314 * if 0 the check limit
johnAlexander 14:8320b5ff96fa 1315 * corresponding to LimitCheckId is disabled
johnAlexander 14:8320b5ff96fa 1316 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1317 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 14:8320b5ff96fa 1318 * when LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 1319 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1320 */
johnAlexander 14:8320b5ff96fa 1321 VL53L0X_Error vl53l0x_set_limit_check_enable(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 1322 uint8_t limit_check_enable);
johnAlexander 14:8320b5ff96fa 1323
johnAlexander 14:8320b5ff96fa 1324 /**
johnAlexander 14:8320b5ff96fa 1325 * @brief Get a specific limit check value
johnAlexander 14:8320b5ff96fa 1326 *
johnAlexander 14:8320b5ff96fa 1327 * @par Function Description
johnAlexander 14:8320b5ff96fa 1328 * This function get a specific limit check value from device then it updates
johnAlexander 14:8320b5ff96fa 1329 * internal values and check enables.
johnAlexander 14:8320b5ff96fa 1330 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 1331 *
johnAlexander 14:8320b5ff96fa 1332 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1333 *
johnAlexander 14:8320b5ff96fa 1334 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1335 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1336 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1337 * @param p_limit_check_value Pointer to Limit
johnAlexander 14:8320b5ff96fa 1338 * check Value for a given LimitCheckId.
johnAlexander 14:8320b5ff96fa 1339 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1340 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
johnAlexander 14:8320b5ff96fa 1341 * when LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 1342 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1343 */
johnAlexander 14:8320b5ff96fa 1344 VL53L0X_Error vl53l0x_get_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 1345 FixPoint1616_t *p_limit_check_value);
johnAlexander 14:8320b5ff96fa 1346
johnAlexander 14:8320b5ff96fa 1347 /**
johnAlexander 14:8320b5ff96fa 1348 * @brief Set a specific limit check value
johnAlexander 14:8320b5ff96fa 1349 *
johnAlexander 14:8320b5ff96fa 1350 * @par Function Description
johnAlexander 14:8320b5ff96fa 1351 * This function set a specific limit check value.
johnAlexander 14:8320b5ff96fa 1352 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 1353 *
johnAlexander 14:8320b5ff96fa 1354 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1355 *
johnAlexander 14:8320b5ff96fa 1356 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1357 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1358 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1359 * @param limit_check_value Limit check Value for a given
johnAlexander 14:8320b5ff96fa 1360 * LimitCheckId
johnAlexander 14:8320b5ff96fa 1361 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1362 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when either
johnAlexander 14:8320b5ff96fa 1363 * LimitCheckId or LimitCheckValue value is out of range.
johnAlexander 14:8320b5ff96fa 1364 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1365 */
johnAlexander 14:8320b5ff96fa 1366 VL53L0X_Error vl53l0x_set_limit_check_value(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 1367 FixPoint1616_t limit_check_value);
johnAlexander 14:8320b5ff96fa 1368
johnAlexander 14:8320b5ff96fa 1369 /**
johnAlexander 14:8320b5ff96fa 1370 * @brief Get the current value of the signal used for the limit check
johnAlexander 14:8320b5ff96fa 1371 *
johnAlexander 14:8320b5ff96fa 1372 * @par Function Description
johnAlexander 14:8320b5ff96fa 1373 * This function get a the current value of the signal used for the limit check.
johnAlexander 14:8320b5ff96fa 1374 * To obtain the latest value you should run a ranging before.
johnAlexander 14:8320b5ff96fa 1375 * The value reported is linked to the limit check identified with the
johnAlexander 14:8320b5ff96fa 1376 * LimitCheckId.
johnAlexander 14:8320b5ff96fa 1377 *
johnAlexander 14:8320b5ff96fa 1378 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1379 *
johnAlexander 14:8320b5ff96fa 1380 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1381 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1382 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1383 * @param p_limit_check_current Pointer to current Value for a
johnAlexander 14:8320b5ff96fa 1384 * given LimitCheckId.
johnAlexander 14:8320b5ff96fa 1385 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1386 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when
johnAlexander 14:8320b5ff96fa 1387 * LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 1388 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1389 */
johnAlexander 14:8320b5ff96fa 1390 VL53L0X_Error vl53l0x_get_limit_check_current(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 1391 FixPoint1616_t *p_limit_check_current);
johnAlexander 14:8320b5ff96fa 1392
johnAlexander 14:8320b5ff96fa 1393 /**
johnAlexander 14:8320b5ff96fa 1394 * @brief Return a the Status of the specified check limit
johnAlexander 14:8320b5ff96fa 1395 *
johnAlexander 14:8320b5ff96fa 1396 * @par Function Description
johnAlexander 14:8320b5ff96fa 1397 * This function returns the Status of the specified check limit.
johnAlexander 14:8320b5ff96fa 1398 * The value indicate if the check is fail or not.
johnAlexander 14:8320b5ff96fa 1399 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 1400 *
johnAlexander 14:8320b5ff96fa 1401 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 1402 *
johnAlexander 14:8320b5ff96fa 1403 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1404 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 1405 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 1406 * @param p_limit_check_status Pointer to the
johnAlexander 14:8320b5ff96fa 1407 Limit Check Status of the given check limit.
johnAlexander 14:8320b5ff96fa 1408 * LimitCheckStatus :
johnAlexander 14:8320b5ff96fa 1409 * 0 the check is not fail
johnAlexander 14:8320b5ff96fa 1410 * 1 the check if fail or not enabled
johnAlexander 14:8320b5ff96fa 1411 *
johnAlexander 14:8320b5ff96fa 1412 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1413 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
johnAlexander 14:8320b5ff96fa 1414 returned when LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 1415 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1416 */
johnAlexander 14:8320b5ff96fa 1417 VL53L0X_Error vl53l0x_get_limit_check_status(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1418 uint16_t limit_check_id, uint8_t *p_limit_check_status);
johnAlexander 14:8320b5ff96fa 1419
johnAlexander 14:8320b5ff96fa 1420 /**
johnAlexander 14:8320b5ff96fa 1421 * Get continuous mode Inter-Measurement period in milliseconds
johnAlexander 14:8320b5ff96fa 1422 *
johnAlexander 14:8320b5ff96fa 1423 * @par Function Description
johnAlexander 14:8320b5ff96fa 1424 * When trying to set too short time return INVALID_PARAMS minimal value
johnAlexander 14:8320b5ff96fa 1425 *
johnAlexander 14:8320b5ff96fa 1426 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1427 *
johnAlexander 14:8320b5ff96fa 1428 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1429 * @param p_inter_measurement_period_milli_seconds Pointer to programmed
johnAlexander 14:8320b5ff96fa 1430 * Inter-Measurement Period in milliseconds.
johnAlexander 14:8320b5ff96fa 1431 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1432 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1433 */
johnAlexander 14:8320b5ff96fa 1434 VL53L0X_Error vl53l0x_get_inter_measurement_period_milli_seconds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1435 uint32_t *p_inter_measurement_period_milli_seconds);
johnAlexander 14:8320b5ff96fa 1436
johnAlexander 14:8320b5ff96fa 1437 /**
johnAlexander 14:8320b5ff96fa 1438 * Program continuous mode Inter-Measurement period in milliseconds
johnAlexander 14:8320b5ff96fa 1439 *
johnAlexander 14:8320b5ff96fa 1440 * @par Function Description
johnAlexander 14:8320b5ff96fa 1441 * When trying to set too short time return INVALID_PARAMS minimal value
johnAlexander 14:8320b5ff96fa 1442 *
johnAlexander 14:8320b5ff96fa 1443 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1444 *
johnAlexander 14:8320b5ff96fa 1445 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1446 * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms.
johnAlexander 14:8320b5ff96fa 1447 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1448 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1449 */
johnAlexander 14:8320b5ff96fa 1450 VL53L0X_Error vl53l0x_set_inter_measurement_period_milli_seconds(
johnAlexander 14:8320b5ff96fa 1451 VL53L0X_DEV dev, uint32_t inter_measurement_period_milli_seconds);
johnAlexander 14:8320b5ff96fa 1452
johnAlexander 14:8320b5ff96fa 1453 /**
johnAlexander 14:8320b5ff96fa 1454 * @brief Set new device address
johnAlexander 14:8320b5ff96fa 1455 *
johnAlexander 14:8320b5ff96fa 1456 * After completion the device will answer to the new address programmed.
johnAlexander 14:8320b5ff96fa 1457 * This function should be called when several devices are used in parallel
johnAlexander 14:8320b5ff96fa 1458 * before start programming the sensor.
johnAlexander 14:8320b5ff96fa 1459 * When a single device us used, there is no need to call this function.
johnAlexander 14:8320b5ff96fa 1460 *
johnAlexander 14:8320b5ff96fa 1461 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1462 *
johnAlexander 14:8320b5ff96fa 1463 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1464 * @param device_address The new Device address
johnAlexander 14:8320b5ff96fa 1465 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1466 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1467 */
johnAlexander 14:8320b5ff96fa 1468 VL53L0X_Error vl53l0x_set_device_address(VL53L0X_DEV dev, uint8_t device_address);
johnAlexander 14:8320b5ff96fa 1469
johnAlexander 14:8320b5ff96fa 1470 /**
johnAlexander 14:8320b5ff96fa 1471 * @brief Do an hard reset or soft reset (depending on implementation) of the
johnAlexander 14:8320b5ff96fa 1472 * device \nAfter call of this function, device must be in same state as right
johnAlexander 14:8320b5ff96fa 1473 * after a power-up sequence.This function will change the VL53L0X_State to
johnAlexander 14:8320b5ff96fa 1474 * VL53L0X_STATE_POWERDOWN.
johnAlexander 14:8320b5ff96fa 1475 *
johnAlexander 14:8320b5ff96fa 1476 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1477 *
johnAlexander 14:8320b5ff96fa 1478 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1479 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1480 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1481 */
johnAlexander 14:8320b5ff96fa 1482 VL53L0X_Error vl53l0x_reset_device(VL53L0X_DEV dev);
johnAlexander 0:c523920bcc09 1483
johnAlexander 14:8320b5ff96fa 1484 /**
johnAlexander 14:8320b5ff96fa 1485 * @brief Get setup of Wrap around Check
johnAlexander 14:8320b5ff96fa 1486 *
johnAlexander 14:8320b5ff96fa 1487 * @par Function Description
johnAlexander 14:8320b5ff96fa 1488 * This function get the wrapAround check enable parameters
johnAlexander 14:8320b5ff96fa 1489 *
johnAlexander 14:8320b5ff96fa 1490 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1491 *
johnAlexander 14:8320b5ff96fa 1492 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1493 * @param p_wrap_around_check_enable Pointer to the Wrap around Check state
johnAlexander 14:8320b5ff96fa 1494 * 0=disabled or 1 = enabled
johnAlexander 14:8320b5ff96fa 1495 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1496 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1497 */
johnAlexander 14:8320b5ff96fa 1498 VL53L0X_Error vl53l0x_get_wrap_around_check_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1499 uint8_t *p_wrap_around_check_enable);
johnAlexander 14:8320b5ff96fa 1500
johnAlexander 14:8320b5ff96fa 1501 /**
johnAlexander 14:8320b5ff96fa 1502 * @brief Enable (or disable) Wrap around Check
johnAlexander 14:8320b5ff96fa 1503 *
johnAlexander 14:8320b5ff96fa 1504 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1505 *
johnAlexander 14:8320b5ff96fa 1506 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1507 * @param wrap_around_check_enable Wrap around Check to be set
johnAlexander 14:8320b5ff96fa 1508 * 0=disabled, other = enabled
johnAlexander 14:8320b5ff96fa 1509 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1510 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1511 */
johnAlexander 14:8320b5ff96fa 1512 VL53L0X_Error vl53l0x_set_wrap_around_check_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1513 uint8_t wrap_around_check_enable);
johnAlexander 14:8320b5ff96fa 1514
johnAlexander 14:8320b5ff96fa 1515 /**
johnAlexander 14:8320b5ff96fa 1516 * @brief Gets the VCSEL pulse period.
johnAlexander 14:8320b5ff96fa 1517 *
johnAlexander 14:8320b5ff96fa 1518 * @par Function Description
johnAlexander 14:8320b5ff96fa 1519 * This function retrieves the VCSEL pulse period for the given period type.
johnAlexander 14:8320b5ff96fa 1520 *
johnAlexander 14:8320b5ff96fa 1521 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1522 *
johnAlexander 14:8320b5ff96fa 1523 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1524 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
johnAlexander 14:8320b5ff96fa 1525 * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value.
johnAlexander 14:8320b5ff96fa 1526 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1527 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
johnAlexander 14:8320b5ff96fa 1528 * supported.
johnAlexander 14:8320b5ff96fa 1529 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1530 */
johnAlexander 14:8320b5ff96fa 1531 VL53L0X_Error vl53l0x_get_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1532 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
johnAlexander 14:8320b5ff96fa 1533
johnAlexander 14:8320b5ff96fa 1534 /**
johnAlexander 14:8320b5ff96fa 1535 * @brief Sets the VCSEL pulse period.
johnAlexander 14:8320b5ff96fa 1536 *
johnAlexander 14:8320b5ff96fa 1537 * @par Function Description
johnAlexander 14:8320b5ff96fa 1538 * This function retrieves the VCSEL pulse period for the given period type.
johnAlexander 14:8320b5ff96fa 1539 *
johnAlexander 14:8320b5ff96fa 1540 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1541 *
johnAlexander 14:8320b5ff96fa 1542 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1543 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
johnAlexander 14:8320b5ff96fa 1544 * @param vcsel_pulse_period VCSEL period value
johnAlexander 14:8320b5ff96fa 1545 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1546 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
johnAlexander 14:8320b5ff96fa 1547 * supported.
johnAlexander 14:8320b5ff96fa 1548 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1549 */
johnAlexander 14:8320b5ff96fa 1550 VL53L0X_Error vl53l0x_set_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1551 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period);
johnAlexander 14:8320b5ff96fa 1552
johnAlexander 14:8320b5ff96fa 1553 /**
johnAlexander 14:8320b5ff96fa 1554 * @brief Set low and high Interrupt thresholds for a given mode
johnAlexander 14:8320b5ff96fa 1555 * (ranging, ALS, ...) for a given device
johnAlexander 14:8320b5ff96fa 1556 *
johnAlexander 14:8320b5ff96fa 1557 * @par Function Description
johnAlexander 14:8320b5ff96fa 1558 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...)
johnAlexander 14:8320b5ff96fa 1559 * for a given device
johnAlexander 14:8320b5ff96fa 1560 *
johnAlexander 14:8320b5ff96fa 1561 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1562 *
johnAlexander 14:8320b5ff96fa 1563 * @note DeviceMode is ignored for the current device
johnAlexander 14:8320b5ff96fa 1564 *
johnAlexander 14:8320b5ff96fa 1565 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1566 * @param device_mode Device Mode for which change thresholds
johnAlexander 14:8320b5ff96fa 1567 * @param threshold_low Low threshold (mm, lux ..., depending on the mode)
johnAlexander 14:8320b5ff96fa 1568 * @param threshold_high High threshold (mm, lux ..., depending on the mode)
johnAlexander 14:8320b5ff96fa 1569 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1570 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1571 */
johnAlexander 14:8320b5ff96fa 1572 VL53L0X_Error vl53l0x_set_interrupt_thresholds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1573 VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low,
johnAlexander 14:8320b5ff96fa 1574 FixPoint1616_t threshold_high);
johnAlexander 14:8320b5ff96fa 1575
johnAlexander 14:8320b5ff96fa 1576 /**
johnAlexander 14:8320b5ff96fa 1577 * @brief Get high and low Interrupt thresholds for a given mode
johnAlexander 14:8320b5ff96fa 1578 * (ranging, ALS, ...) for a given device
johnAlexander 14:8320b5ff96fa 1579 *
johnAlexander 14:8320b5ff96fa 1580 * @par Function Description
johnAlexander 14:8320b5ff96fa 1581 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...)
johnAlexander 14:8320b5ff96fa 1582 * for a given device
johnAlexander 14:8320b5ff96fa 1583 *
johnAlexander 14:8320b5ff96fa 1584 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1585 *
johnAlexander 14:8320b5ff96fa 1586 * @note DeviceMode is ignored for the current device
johnAlexander 14:8320b5ff96fa 1587 *
johnAlexander 14:8320b5ff96fa 1588 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1589 * @param device_mode Device Mode from which read thresholds
johnAlexander 14:8320b5ff96fa 1590 * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode)
johnAlexander 14:8320b5ff96fa 1591 * @param p_threshold_high High threshold (mm, lux ..., depending on the mode)
johnAlexander 14:8320b5ff96fa 1592 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1593 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1594 */
johnAlexander 14:8320b5ff96fa 1595 VL53L0X_Error vl53l0x_get_interrupt_thresholds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1596 VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low,
johnAlexander 14:8320b5ff96fa 1597 FixPoint1616_t *p_threshold_high);
johnAlexander 14:8320b5ff96fa 1598
johnAlexander 14:8320b5ff96fa 1599 /**
johnAlexander 14:8320b5ff96fa 1600 * @brief Reads the Device information for given Device
johnAlexander 14:8320b5ff96fa 1601 *
johnAlexander 14:8320b5ff96fa 1602 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1603 *
johnAlexander 14:8320b5ff96fa 1604 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1605 * @param p_vl53l0x_device_info Pointer to current device info for a given
johnAlexander 14:8320b5ff96fa 1606 * Device
johnAlexander 14:8320b5ff96fa 1607 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1608 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1609 */
johnAlexander 14:8320b5ff96fa 1610 VL53L0X_Error vl53l0x_get_device_info(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1611 VL53L0X_DeviceInfo_t *p_vl53l0x_device_info);
johnAlexander 14:8320b5ff96fa 1612
johnAlexander 14:8320b5ff96fa 1613 /**
johnAlexander 14:8320b5ff96fa 1614 * @brief Gets the (on/off) state of all sequence steps.
johnAlexander 14:8320b5ff96fa 1615 *
johnAlexander 14:8320b5ff96fa 1616 * @par Function Description
johnAlexander 14:8320b5ff96fa 1617 * This function retrieves the state of all sequence step in the scheduler.
johnAlexander 14:8320b5ff96fa 1618 *
johnAlexander 14:8320b5ff96fa 1619 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1620 *
johnAlexander 14:8320b5ff96fa 1621 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1622 * @param p_scheduler_sequence_steps Pointer to struct containing result.
johnAlexander 14:8320b5ff96fa 1623 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1624 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1625 */
johnAlexander 14:8320b5ff96fa 1626 VL53L0X_Error vl53l0x_get_sequence_step_enables(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1627 VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps);
johnAlexander 14:8320b5ff96fa 1628
johnAlexander 14:8320b5ff96fa 1629 /**
johnAlexander 14:8320b5ff96fa 1630 * @brief Sets the (on/off) state of a requested sequence step.
johnAlexander 14:8320b5ff96fa 1631 *
johnAlexander 14:8320b5ff96fa 1632 * @par Function Description
johnAlexander 14:8320b5ff96fa 1633 * This function enables/disables a requested sequence step.
johnAlexander 14:8320b5ff96fa 1634 *
johnAlexander 14:8320b5ff96fa 1635 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1636 *
johnAlexander 14:8320b5ff96fa 1637 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1638 * @param sequence_step_id Sequence step identifier.
johnAlexander 14:8320b5ff96fa 1639 * @param sequence_step_enabled Demanded state {0=Off,1=On}
johnAlexander 14:8320b5ff96fa 1640 * is enabled.
johnAlexander 14:8320b5ff96fa 1641 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1642 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 14:8320b5ff96fa 1643 * supported.
johnAlexander 14:8320b5ff96fa 1644 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1645 */
johnAlexander 14:8320b5ff96fa 1646 VL53L0X_Error vl53l0x_set_sequence_step_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1647 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled);
johnAlexander 14:8320b5ff96fa 1648
johnAlexander 14:8320b5ff96fa 1649 /**
johnAlexander 14:8320b5ff96fa 1650 * @brief Gets the fraction enable parameter indicating the resolution of
johnAlexander 14:8320b5ff96fa 1651 * range measurements.
johnAlexander 14:8320b5ff96fa 1652 *
johnAlexander 14:8320b5ff96fa 1653 * @par Function Description
johnAlexander 14:8320b5ff96fa 1654 * Gets the fraction enable state, which translates to the resolution of
johnAlexander 14:8320b5ff96fa 1655 * range measurements as follows :Enabled:=0.25mm resolution,
johnAlexander 14:8320b5ff96fa 1656 * Not Enabled:=1mm resolution.
johnAlexander 14:8320b5ff96fa 1657 *
johnAlexander 14:8320b5ff96fa 1658 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1659 *
johnAlexander 14:8320b5ff96fa 1660 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1661 * @param p_enabled Output Parameter reporting the fraction enable state.
johnAlexander 14:8320b5ff96fa 1662 *
johnAlexander 14:8320b5ff96fa 1663 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1664 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1665 */
johnAlexander 14:8320b5ff96fa 1666 VL53L0X_Error vl53l0x_get_fraction_enable(VL53L0X_DEV dev, uint8_t *p_enabled);
johnAlexander 14:8320b5ff96fa 1667
johnAlexander 14:8320b5ff96fa 1668 /**
johnAlexander 14:8320b5ff96fa 1669 * @brief Sets the resolution of range measurements.
johnAlexander 14:8320b5ff96fa 1670 * @par Function Description
johnAlexander 14:8320b5ff96fa 1671 * Set resolution of range measurements to either 0.25mm if
johnAlexander 14:8320b5ff96fa 1672 * fraction enabled or 1mm if not enabled.
johnAlexander 14:8320b5ff96fa 1673 *
johnAlexander 14:8320b5ff96fa 1674 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 1675 *
johnAlexander 14:8320b5ff96fa 1676 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1677 * @param enable Enable high resolution
johnAlexander 14:8320b5ff96fa 1678 *
johnAlexander 14:8320b5ff96fa 1679 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1680 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1681 */
johnAlexander 14:8320b5ff96fa 1682 VL53L0X_Error vl53l0x_set_range_fraction_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1683 uint8_t enable);
johnAlexander 14:8320b5ff96fa 1684
johnAlexander 14:8320b5ff96fa 1685 /**
johnAlexander 14:8320b5ff96fa 1686 * @brief Return the VL53L0X PAL Implementation Version
johnAlexander 14:8320b5ff96fa 1687 *
johnAlexander 14:8320b5ff96fa 1688 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1689 *
johnAlexander 14:8320b5ff96fa 1690 * @param p_version Pointer to current PAL Implementation Version
johnAlexander 14:8320b5ff96fa 1691 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1692 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1693 */
johnAlexander 14:8320b5ff96fa 1694 VL53L0X_Error vl53l0x_get_version(VL53L0X_Version_t *p_version);
johnAlexander 14:8320b5ff96fa 1695
johnAlexander 14:8320b5ff96fa 1696 /**
johnAlexander 14:8320b5ff96fa 1697 * @brief Reads the Product Revision for a for given Device
johnAlexander 14:8320b5ff96fa 1698 * This function can be used to distinguish cut1.0 from cut1.1.
johnAlexander 14:8320b5ff96fa 1699 *
johnAlexander 14:8320b5ff96fa 1700 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1701 *
johnAlexander 14:8320b5ff96fa 1702 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1703 * @param p_product_revision_major Pointer to Product Revision Major
johnAlexander 14:8320b5ff96fa 1704 * for a given Device
johnAlexander 14:8320b5ff96fa 1705 * @param p_product_revision_minor Pointer to Product Revision Minor
johnAlexander 14:8320b5ff96fa 1706 * for a given Device
johnAlexander 14:8320b5ff96fa 1707 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1708 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1709 */
johnAlexander 14:8320b5ff96fa 1710 VL53L0X_Error vl53l0x_get_product_revision(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1711 uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor);
johnAlexander 14:8320b5ff96fa 1712
johnAlexander 14:8320b5ff96fa 1713 /**
johnAlexander 14:8320b5ff96fa 1714 * @brief Retrieve current device parameters
johnAlexander 14:8320b5ff96fa 1715 * @par Function Description
johnAlexander 14:8320b5ff96fa 1716 * Get actual parameters of the device
johnAlexander 14:8320b5ff96fa 1717 * @li Then start ranging operation.
johnAlexander 14:8320b5ff96fa 1718 *
johnAlexander 14:8320b5ff96fa 1719 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 1720 *
johnAlexander 14:8320b5ff96fa 1721 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1722 * @param p_device_parameters Pointer to store current device parameters.
johnAlexander 14:8320b5ff96fa 1723 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1724 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1725 */
johnAlexander 14:8320b5ff96fa 1726 VL53L0X_Error vl53l0x_get_device_parameters(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1727 VL53L0X_DeviceParameters_t *p_device_parameters);
johnAlexander 14:8320b5ff96fa 1728
johnAlexander 14:8320b5ff96fa 1729 /**
johnAlexander 14:8320b5ff96fa 1730 * @brief Human readable error string for current PAL error status
johnAlexander 14:8320b5ff96fa 1731 *
johnAlexander 14:8320b5ff96fa 1732 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1733 *
johnAlexander 14:8320b5ff96fa 1734 * @param pal_error_code The error code as stored on @a VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1735 * @param p_pal_error_string The error string corresponding to the
johnAlexander 14:8320b5ff96fa 1736 * PalErrorCode
johnAlexander 14:8320b5ff96fa 1737 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1738 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1739 */
johnAlexander 14:8320b5ff96fa 1740 VL53L0X_Error vl53l0x_get_pal_error_string(VL53L0X_Error pal_error_code,
johnAlexander 14:8320b5ff96fa 1741 char *p_pal_error_string);
johnAlexander 14:8320b5ff96fa 1742
johnAlexander 14:8320b5ff96fa 1743 /**
johnAlexander 14:8320b5ff96fa 1744 * @brief Return the PAL Specification Version used for the current
johnAlexander 14:8320b5ff96fa 1745 * implementation.
johnAlexander 14:8320b5ff96fa 1746 *
johnAlexander 14:8320b5ff96fa 1747 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1748 *
johnAlexander 14:8320b5ff96fa 1749 * @param p_pal_spec_version Pointer to current PAL Specification Version
johnAlexander 14:8320b5ff96fa 1750 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1751 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1752 */
johnAlexander 14:8320b5ff96fa 1753 VL53L0X_Error vl53l0x_get_pal_spec_version(
johnAlexander 14:8320b5ff96fa 1754 VL53L0X_Version_t *p_pal_spec_version);
johnAlexander 14:8320b5ff96fa 1755
johnAlexander 14:8320b5ff96fa 1756 /**
johnAlexander 14:8320b5ff96fa 1757 * @brief Reads the internal state of the PAL for a given Device
johnAlexander 14:8320b5ff96fa 1758 *
johnAlexander 14:8320b5ff96fa 1759 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1760 *
johnAlexander 14:8320b5ff96fa 1761 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1762 * @param p_pal_state Pointer to current state of the PAL for a
johnAlexander 14:8320b5ff96fa 1763 * given Device
johnAlexander 14:8320b5ff96fa 1764 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1765 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1766 */
johnAlexander 14:8320b5ff96fa 1767 VL53L0X_Error vl53l0x_get_pal_state(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1768 VL53L0X_State *p_pal_state);
johnAlexander 14:8320b5ff96fa 1769
johnAlexander 14:8320b5ff96fa 1770 /**
johnAlexander 14:8320b5ff96fa 1771 * @brief Human readable PAL State string
johnAlexander 14:8320b5ff96fa 1772 *
johnAlexander 14:8320b5ff96fa 1773 * @note This function doesn't access to the device
johnAlexander 14:8320b5ff96fa 1774 *
johnAlexander 14:8320b5ff96fa 1775 * @param pal_state_code The State code as stored on @a VL53L0X_State
johnAlexander 14:8320b5ff96fa 1776 * @param p_pal_state_string The State string corresponding to the
johnAlexander 14:8320b5ff96fa 1777 * PalStateCode
johnAlexander 14:8320b5ff96fa 1778 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1779 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1780 */
johnAlexander 14:8320b5ff96fa 1781 VL53L0X_Error vl53l0x_get_pal_state_string(VL53L0X_State pal_state_code,
johnAlexander 14:8320b5ff96fa 1782 char *p_pal_state_string);
johnAlexander 14:8320b5ff96fa 1783
johnAlexander 14:8320b5ff96fa 1784 /*** End High level API ***/
johnAlexander 14:8320b5ff96fa 1785 private:
johnAlexander 0:c523920bcc09 1786 /* api.h functions */
johnAlexander 14:8320b5ff96fa 1787
johnAlexander 14:8320b5ff96fa 1788 /**
johnAlexander 14:8320b5ff96fa 1789 * @brief Wait for device booted after chip enable (hardware standby)
johnAlexander 14:8320b5ff96fa 1790 * This function can be run only when VL53L0X_State is VL53L0X_STATE_POWERDOWN.
johnAlexander 14:8320b5ff96fa 1791 *
johnAlexander 14:8320b5ff96fa 1792 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 1793 *
johnAlexander 14:8320b5ff96fa 1794 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1795 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 1796 *
johnAlexander 14:8320b5ff96fa 1797 */
johnAlexander 14:8320b5ff96fa 1798 VL53L0X_Error vl53l0x_wait_device_booted(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1799
johnAlexander 14:8320b5ff96fa 1800
johnAlexander 14:8320b5ff96fa 1801 VL53L0X_Error sequence_step_enabled(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1802 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config,
johnAlexander 14:8320b5ff96fa 1803 uint8_t *p_sequence_step_enabled);
johnAlexander 14:8320b5ff96fa 1804
johnAlexander 14:8320b5ff96fa 1805 VL53L0X_Error vl53l0x_check_and_load_interrupt_settings(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1806 uint8_t start_not_stopflag);
johnAlexander 14:8320b5ff96fa 1807
johnAlexander 0:c523920bcc09 1808
johnAlexander 0:c523920bcc09 1809 /* api_core.h functions */
johnAlexander 14:8320b5ff96fa 1810
johnAlexander 14:8320b5ff96fa 1811 VL53L0X_Error vl53l0x_get_info_from_device(VL53L0X_DEV dev, uint8_t option);
johnAlexander 14:8320b5ff96fa 1812
johnAlexander 14:8320b5ff96fa 1813 VL53L0X_Error vl53l0x_device_read_strobe(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1814
johnAlexander 14:8320b5ff96fa 1815 VL53L0X_Error wrapped_vl53l0x_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1816 uint32_t *p_measurement_timing_budget_micro_seconds);
johnAlexander 14:8320b5ff96fa 1817
johnAlexander 14:8320b5ff96fa 1818 VL53L0X_Error wrapped_vl53l0x_get_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1819 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
johnAlexander 14:8320b5ff96fa 1820
johnAlexander 14:8320b5ff96fa 1821 uint8_t vl53l0x_decode_vcsel_period(uint8_t vcsel_period_reg);
johnAlexander 14:8320b5ff96fa 1822
johnAlexander 14:8320b5ff96fa 1823 uint32_t vl53l0x_decode_timeout(uint16_t encoded_timeout);
johnAlexander 14:8320b5ff96fa 1824
johnAlexander 14:8320b5ff96fa 1825 uint32_t vl53l0x_calc_timeout_us(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1826 uint16_t timeout_period_mclks,
johnAlexander 14:8320b5ff96fa 1827 uint8_t vcsel_period_pclks);
johnAlexander 14:8320b5ff96fa 1828
johnAlexander 14:8320b5ff96fa 1829 uint32_t vl53l0x_calc_macro_period_ps(VL53L0X_DEV dev, uint8_t vcsel_period_pclks);
johnAlexander 14:8320b5ff96fa 1830
johnAlexander 14:8320b5ff96fa 1831 VL53L0X_Error vl53l0x_measurement_poll_for_completion(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1832
johnAlexander 14:8320b5ff96fa 1833 VL53L0X_Error vl53l0x_load_tuning_settings(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1834 uint8_t *p_tuning_setting_buffer);
johnAlexander 14:8320b5ff96fa 1835
johnAlexander 14:8320b5ff96fa 1836 VL53L0X_Error vl53l0x_get_pal_range_status(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1837 uint8_t device_range_status,
johnAlexander 14:8320b5ff96fa 1838 FixPoint1616_t signal_rate,
johnAlexander 14:8320b5ff96fa 1839 uint16_t effective_spad_rtn_count,
johnAlexander 14:8320b5ff96fa 1840 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 14:8320b5ff96fa 1841 uint8_t *p_pal_range_status);
johnAlexander 14:8320b5ff96fa 1842 VL53L0X_Error vl53l0x_calc_sigma_estimate(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1843 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
johnAlexander 14:8320b5ff96fa 1844 FixPoint1616_t *p_sigma_estimate,
johnAlexander 14:8320b5ff96fa 1845 uint32_t *p_dmax_mm);
johnAlexander 14:8320b5ff96fa 1846 uint32_t vl53l0x_calc_timeout_mclks(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1847 uint32_t timeout_period_us,
johnAlexander 14:8320b5ff96fa 1848 uint8_t vcsel_period_pclks);
johnAlexander 14:8320b5ff96fa 1849 uint32_t vl53l0x_isqrt(uint32_t num);
johnAlexander 14:8320b5ff96fa 1850
johnAlexander 14:8320b5ff96fa 1851 uint32_t vl53l0x_quadrature_sum(uint32_t a, uint32_t b);
johnAlexander 14:8320b5ff96fa 1852
johnAlexander 14:8320b5ff96fa 1853 VL53L0X_Error vl53l0x_calc_dmax(
johnAlexander 14:8320b5ff96fa 1854 VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1855 FixPoint1616_t total_signal_rate_mcps,
johnAlexander 14:8320b5ff96fa 1856 FixPoint1616_t total_corr_signal_rate_mcps,
johnAlexander 14:8320b5ff96fa 1857 FixPoint1616_t pw_mult,
johnAlexander 14:8320b5ff96fa 1858 uint32_t sigma_estimate_p1,
johnAlexander 14:8320b5ff96fa 1859 FixPoint1616_t sigma_estimate_p2,
johnAlexander 14:8320b5ff96fa 1860 uint32_t peak_vcsel_duration_us,
johnAlexander 14:8320b5ff96fa 1861 uint32_t *pd_max_mm);
johnAlexander 14:8320b5ff96fa 1862 VL53L0X_Error wrapped_vl53l0x_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1863 uint32_t measurement_timing_budget_micro_seconds);
johnAlexander 14:8320b5ff96fa 1864 VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1865 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 14:8320b5ff96fa 1866 uint32_t *p_time_out_micro_secs);
johnAlexander 14:8320b5ff96fa 1867 VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1868 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 14:8320b5ff96fa 1869 uint32_t timeout_micro_secs);
johnAlexander 14:8320b5ff96fa 1870 uint16_t vl53l0x_encode_timeout(uint32_t timeout_macro_clks);
johnAlexander 14:8320b5ff96fa 1871 VL53L0X_Error wrapped_vl53l0x_set_vcsel_pulse_period(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1872 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk);
johnAlexander 14:8320b5ff96fa 1873 uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
johnAlexander 0:c523920bcc09 1874
johnAlexander 0:c523920bcc09 1875 /* api_calibration.h functions */
johnAlexander 14:8320b5ff96fa 1876 VL53L0X_Error vl53l0x_apply_offset_adjustment(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1877 VL53L0X_Error wrapped_vl53l0x_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1878 int32_t *p_offset_calibration_data_micro_meter);
johnAlexander 14:8320b5ff96fa 1879 VL53L0X_Error wrapped_vl53l0x_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1880 int32_t offset_calibration_data_micro_meter);
johnAlexander 14:8320b5ff96fa 1881 VL53L0X_Error wrapped_vl53l0x_perform_ref_spad_management(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1882 uint32_t *ref_spad_count,
johnAlexander 14:8320b5ff96fa 1883 uint8_t *is_aperture_spads);
johnAlexander 14:8320b5ff96fa 1884 VL53L0X_Error vl53l0x_perform_ref_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1885 uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable);
johnAlexander 14:8320b5ff96fa 1886 VL53L0X_Error vl53l0x_perform_vhv_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1887 uint8_t *p_vhv_settings, const uint8_t get_data_enable,
johnAlexander 14:8320b5ff96fa 1888 const uint8_t restore_config);
johnAlexander 14:8320b5ff96fa 1889 VL53L0X_Error vl53l0x_perform_single_ref_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1890 uint8_t vhv_init_byte);
johnAlexander 14:8320b5ff96fa 1891 VL53L0X_Error vl53l0x_ref_calibration_io(VL53L0X_DEV dev, uint8_t read_not_write,
johnAlexander 14:8320b5ff96fa 1892 uint8_t vhv_settings, uint8_t phase_cal,
johnAlexander 14:8320b5ff96fa 1893 uint8_t *p_vhv_settings, uint8_t *p_phase_cal,
johnAlexander 14:8320b5ff96fa 1894 const uint8_t vhv_enable, const uint8_t phase_enable);
johnAlexander 14:8320b5ff96fa 1895 VL53L0X_Error vl53l0x_perform_phase_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1896 uint8_t *p_phase_cal, const uint8_t get_data_enable,
johnAlexander 14:8320b5ff96fa 1897 const uint8_t restore_config);
johnAlexander 14:8320b5ff96fa 1898 VL53L0X_Error enable_ref_spads(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1899 uint8_t aperture_spads,
johnAlexander 14:8320b5ff96fa 1900 uint8_t good_spad_array[],
johnAlexander 14:8320b5ff96fa 1901 uint8_t spad_array[],
johnAlexander 14:8320b5ff96fa 1902 uint32_t size,
johnAlexander 14:8320b5ff96fa 1903 uint32_t start,
johnAlexander 14:8320b5ff96fa 1904 uint32_t offset,
johnAlexander 14:8320b5ff96fa 1905 uint32_t spad_count,
johnAlexander 14:8320b5ff96fa 1906 uint32_t *p_last_spad);
johnAlexander 14:8320b5ff96fa 1907 void get_next_good_spad(uint8_t good_spad_array[], uint32_t size,
johnAlexander 14:8320b5ff96fa 1908 uint32_t curr, int32_t *p_next);
johnAlexander 14:8320b5ff96fa 1909 uint8_t is_aperture(uint32_t spad_index);
johnAlexander 14:8320b5ff96fa 1910 VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size,
johnAlexander 14:8320b5ff96fa 1911 uint32_t spad_index);
johnAlexander 14:8320b5ff96fa 1912 VL53L0X_Error set_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
johnAlexander 14:8320b5ff96fa 1913 VL53L0X_Error get_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
johnAlexander 14:8320b5ff96fa 1914 VL53L0X_Error perform_ref_signal_measurement(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1915 uint16_t *p_ref_signal_rate);
johnAlexander 14:8320b5ff96fa 1916 VL53L0X_Error wrapped_vl53l0x_set_reference_spads(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1917 uint32_t count, uint8_t is_aperture_spads);
johnAlexander 0:c523920bcc09 1918
johnAlexander 0:c523920bcc09 1919 /* api_strings.h functions */
johnAlexander 14:8320b5ff96fa 1920 VL53L0X_Error wrapped_vl53l0x_get_device_info(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1921 VL53L0X_DeviceInfo_t *p_vl53l0x_device_info);
johnAlexander 14:8320b5ff96fa 1922 VL53L0X_Error vl53l0x_check_part_used(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 1923 uint8_t *revision,
johnAlexander 14:8320b5ff96fa 1924 VL53L0X_DeviceInfo_t *p_vl53l0x_device_info);
johnAlexander 0:c523920bcc09 1925
johnAlexander 14:8320b5ff96fa 1926 /* Read function of the ID device */
johnAlexander 14:8320b5ff96fa 1927 // virtual int read_id();
johnAlexander 14:8320b5ff96fa 1928 virtual int read_id(uint8_t *id);
JerrySzczurak 11:ceaa5a026412 1929
johnAlexander 14:8320b5ff96fa 1930 VL53L0X_Error wait_measurement_data_ready(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 1931
johnAlexander 14:8320b5ff96fa 1932 VL53L0X_Error wait_stop_completed(VL53L0X_DEV dev);
johnAlexander 0:c523920bcc09 1933
johnAlexander 0:c523920bcc09 1934 /* Write and read functions from I2C */
johnAlexander 14:8320b5ff96fa 1935 /**
johnAlexander 14:8320b5ff96fa 1936 * Write single byte register
johnAlexander 14:8320b5ff96fa 1937 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1938 * @param index The register index
johnAlexander 14:8320b5ff96fa 1939 * @param data 8 bit register data
johnAlexander 14:8320b5ff96fa 1940 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1941 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1942 */
johnAlexander 14:8320b5ff96fa 1943 VL53L0X_Error vl53l0x_write_byte(VL53L0X_DEV dev, uint8_t index, uint8_t data);
johnAlexander 14:8320b5ff96fa 1944 /**
johnAlexander 14:8320b5ff96fa 1945 * Write word register
johnAlexander 14:8320b5ff96fa 1946 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1947 * @param index The register index
johnAlexander 14:8320b5ff96fa 1948 * @param data 16 bit register data
johnAlexander 14:8320b5ff96fa 1949 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1950 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1951 */
johnAlexander 14:8320b5ff96fa 1952 VL53L0X_Error vl53l0x_write_word(VL53L0X_DEV dev, uint8_t index, uint16_t data);
johnAlexander 14:8320b5ff96fa 1953 /**
johnAlexander 14:8320b5ff96fa 1954 * Write double word (4 byte) register
johnAlexander 14:8320b5ff96fa 1955 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1956 * @param index The register index
johnAlexander 14:8320b5ff96fa 1957 * @param data 32 bit register data
johnAlexander 14:8320b5ff96fa 1958 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1959 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1960 */
johnAlexander 14:8320b5ff96fa 1961 VL53L0X_Error vl53l0x_write_dword(VL53L0X_DEV dev, uint8_t index, uint32_t data);
johnAlexander 14:8320b5ff96fa 1962 /**
johnAlexander 14:8320b5ff96fa 1963 * Read single byte register
johnAlexander 14:8320b5ff96fa 1964 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1965 * @param index The register index
johnAlexander 14:8320b5ff96fa 1966 * @param data pointer to 8 bit data
johnAlexander 14:8320b5ff96fa 1967 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1968 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1969 */
johnAlexander 14:8320b5ff96fa 1970 VL53L0X_Error vl53l0x_read_byte(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data);
johnAlexander 14:8320b5ff96fa 1971 /**
johnAlexander 14:8320b5ff96fa 1972 * Read word (2byte) register
johnAlexander 14:8320b5ff96fa 1973 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1974 * @param index The register index
johnAlexander 14:8320b5ff96fa 1975 * @param data pointer to 16 bit data
johnAlexander 14:8320b5ff96fa 1976 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1977 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1978 */
johnAlexander 14:8320b5ff96fa 1979 VL53L0X_Error vl53l0x_read_word(VL53L0X_DEV dev, uint8_t index, uint16_t *p_data);
johnAlexander 14:8320b5ff96fa 1980 /**
johnAlexander 14:8320b5ff96fa 1981 * Read dword (4byte) register
johnAlexander 14:8320b5ff96fa 1982 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1983 * @param index The register index
johnAlexander 14:8320b5ff96fa 1984 * @param data pointer to 32 bit data
johnAlexander 14:8320b5ff96fa 1985 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1986 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 1987 */
johnAlexander 14:8320b5ff96fa 1988 VL53L0X_Error vl53l0x_read_dword(VL53L0X_DEV dev, uint8_t index, uint32_t *p_data);
johnAlexander 14:8320b5ff96fa 1989 /**
johnAlexander 14:8320b5ff96fa 1990 * Threat safe Update (read/modify/write) single byte register
johnAlexander 14:8320b5ff96fa 1991 *
johnAlexander 14:8320b5ff96fa 1992 * Final_reg = (Initial_reg & and_data) |or_data
johnAlexander 14:8320b5ff96fa 1993 *
johnAlexander 14:8320b5ff96fa 1994 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 1995 * @param index The register index
johnAlexander 14:8320b5ff96fa 1996 * @param and_data 8 bit and data
johnAlexander 14:8320b5ff96fa 1997 * @param or_data 8 bit or data
johnAlexander 14:8320b5ff96fa 1998 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 1999 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2000 */
johnAlexander 14:8320b5ff96fa 2001 VL53L0X_Error vl53l0x_update_byte(VL53L0X_DEV dev, uint8_t index, uint8_t and_data, uint8_t or_data);
johnAlexander 14:8320b5ff96fa 2002 /**
johnAlexander 14:8320b5ff96fa 2003 * Writes the supplied byte buffer to the device
johnAlexander 14:8320b5ff96fa 2004 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2005 * @param index The register index
johnAlexander 14:8320b5ff96fa 2006 * @param p_data Pointer to uint8_t buffer containing the data to be written
johnAlexander 14:8320b5ff96fa 2007 * @param count Number of bytes in the supplied byte buffer
johnAlexander 14:8320b5ff96fa 2008 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2009 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2010 */
johnAlexander 14:8320b5ff96fa 2011 VL53L0X_Error vl53l0x_write_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
johnAlexander 14:8320b5ff96fa 2012 /**
johnAlexander 14:8320b5ff96fa 2013 * Reads the requested number of bytes from the device
johnAlexander 14:8320b5ff96fa 2014 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2015 * @param index The register index
johnAlexander 14:8320b5ff96fa 2016 * @param p_data Pointer to the uint8_t buffer to store read data
johnAlexander 14:8320b5ff96fa 2017 * @param count Number of uint8_t's to read
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_read_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
johnAlexander 14:8320b5ff96fa 2022
johnAlexander 14:8320b5ff96fa 2023 /**
johnAlexander 14:8320b5ff96fa 2024 * @brief Writes a buffer towards the I2C peripheral device.
johnAlexander 14:8320b5ff96fa 2025 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2026 * @param p_data pointer to the byte-array data to send
johnAlexander 14:8320b5ff96fa 2027 * @param number_of_bytes number of bytes to be written.
johnAlexander 14:8320b5ff96fa 2028 * @retval 0 if ok,
johnAlexander 14:8320b5ff96fa 2029 * @retval -1 if an I2C error has occured
johnAlexander 14:8320b5ff96fa 2030 * @note On some devices if NumByteToWrite is greater
johnAlexander 14:8320b5ff96fa 2031 * than one, the RegisterAddr must be masked correctly!
johnAlexander 14:8320b5ff96fa 2032 */
johnAlexander 14:8320b5ff96fa 2033 VL53L0X_Error vl53l0x_i2c_write(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
johnAlexander 14:8320b5ff96fa 2034
johnAlexander 14:8320b5ff96fa 2035 /**
johnAlexander 14:8320b5ff96fa 2036 * @brief Reads a buffer from the I2C peripheral device.
johnAlexander 14:8320b5ff96fa 2037 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2038 * @param p_data pointer to the byte-array to read data in to
johnAlexander 14:8320b5ff96fa 2039 * @param number_of_bytes number of bytes to be read.
johnAlexander 14:8320b5ff96fa 2040 * @retval 0 if ok,
johnAlexander 14:8320b5ff96fa 2041 * @retval -1 if an I2C error has occured
johnAlexander 14:8320b5ff96fa 2042 * @note On some devices if NumByteToWrite is greater
johnAlexander 14:8320b5ff96fa 2043 * than one, the RegisterAddr must be masked correctly!
johnAlexander 14:8320b5ff96fa 2044 */
johnAlexander 14:8320b5ff96fa 2045 VL53L0X_Error vl53l0x_i2c_read(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
johnAlexander 14:8320b5ff96fa 2046
johnAlexander 14:8320b5ff96fa 2047 /**
johnAlexander 14:8320b5ff96fa 2048 * @brief execute delay in all polling API call
johnAlexander 14:8320b5ff96fa 2049 *
johnAlexander 14:8320b5ff96fa 2050 * 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 2051 * if nothing specific is need you can define it as an empty/void macro
johnAlexander 14:8320b5ff96fa 2052 * @code
johnAlexander 14:8320b5ff96fa 2053 * #define VL53L0X_PollingDelay(...) (void)0
johnAlexander 14:8320b5ff96fa 2054 * @endcode
johnAlexander 14:8320b5ff96fa 2055 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2056 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2057 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2058 */
johnAlexander 14:8320b5ff96fa 2059 VL53L0X_Error vl53l0x_polling_delay(VL53L0X_DEV dev); /* usually best implemented as a real function */
johnAlexander 14:8320b5ff96fa 2060
johnAlexander 14:8320b5ff96fa 2061 int is_present()
johnAlexander 0:c523920bcc09 2062 {
johnAlexander 14:8320b5ff96fa 2063 int status;
johnAlexander 14:8320b5ff96fa 2064 uint8_t id = 0;
johnAlexander 14:8320b5ff96fa 2065
johnAlexander 14:8320b5ff96fa 2066 status = read_id(&id);
johnAlexander 14:8320b5ff96fa 2067 if (status)
johnAlexander 14:8320b5ff96fa 2068 VL53L0X_ErrLog("Failed to read ID device. Device not present!\n\r");
johnAlexander 14:8320b5ff96fa 2069 return status;
johnAlexander 14:8320b5ff96fa 2070 }
johnAlexander 14:8320b5ff96fa 2071
johnAlexander 14:8320b5ff96fa 2072 ///////////////////////////////////////////////////////////////////////////////////////////////////////
johnAlexander 14:8320b5ff96fa 2073 //Added functions //
johnAlexander 14:8320b5ff96fa 2074 ///////////////////////////////////////////////////////////////////////////////////////////////////////
johnAlexander 14:8320b5ff96fa 2075
johnAlexander 14:8320b5ff96fa 2076 /**
johnAlexander 14:8320b5ff96fa 2077 * @brief Cycle Power to Device
johnAlexander 14:8320b5ff96fa 2078 *
johnAlexander 14:8320b5ff96fa 2079 * @return status - status 0 = ok, 1 = error
johnAlexander 14:8320b5ff96fa 2080 *
johnAlexander 14:8320b5ff96fa 2081 */
johnAlexander 14:8320b5ff96fa 2082 int32_t vl53l0x_cycle_power(void);
johnAlexander 14:8320b5ff96fa 2083
johnAlexander 14:8320b5ff96fa 2084 uint8_t vl53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
johnAlexander 14:8320b5ff96fa 2085
johnAlexander 14:8320b5ff96fa 2086 VL53L0X_Error wrapped_vl53l0x_get_device_error_string(VL53L0X_DeviceError error_code,
johnAlexander 14:8320b5ff96fa 2087 char *p_device_error_string);
johnAlexander 14:8320b5ff96fa 2088
johnAlexander 14:8320b5ff96fa 2089 VL53L0X_Error wrapped_vl53l0x_get_limit_check_info(VL53L0X_DEV dev, uint16_t limit_check_id,
johnAlexander 14:8320b5ff96fa 2090 char *p_limit_check_string);
johnAlexander 14:8320b5ff96fa 2091
johnAlexander 14:8320b5ff96fa 2092 VL53L0X_Error wrapped_vl53l0x_get_pal_error_string(VL53L0X_Error pal_error_code,
johnAlexander 14:8320b5ff96fa 2093 char *p_pal_error_string);
johnAlexander 14:8320b5ff96fa 2094
johnAlexander 14:8320b5ff96fa 2095 VL53L0X_Error wrapped_vl53l0x_get_pal_state_string(VL53L0X_State pal_state_code,
johnAlexander 14:8320b5ff96fa 2096 char *p_pal_state_string);
johnAlexander 14:8320b5ff96fa 2097
johnAlexander 14:8320b5ff96fa 2098 VL53L0X_Error wrapped_vl53l0x_get_range_status_string(uint8_t range_status,
johnAlexander 14:8320b5ff96fa 2099 char *p_range_status_string);
johnAlexander 14:8320b5ff96fa 2100
johnAlexander 14:8320b5ff96fa 2101 VL53L0X_Error wrapped_vl53l0x_get_ref_calibration(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2102 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
johnAlexander 14:8320b5ff96fa 2103
johnAlexander 14:8320b5ff96fa 2104
johnAlexander 14:8320b5ff96fa 2105 VL53L0X_Error count_enabled_spads(uint8_t spad_array[],
johnAlexander 14:8320b5ff96fa 2106 uint32_t byte_count, uint32_t max_spads,
johnAlexander 14:8320b5ff96fa 2107 uint32_t *p_total_spads_enabled, uint8_t *p_is_aperture);
johnAlexander 14:8320b5ff96fa 2108
johnAlexander 14:8320b5ff96fa 2109 VL53L0X_Error wrapped_vl53l0x_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 14:8320b5ff96fa 2110 char *p_sequence_steps_string);
johnAlexander 0:c523920bcc09 2111
johnAlexander 0:c523920bcc09 2112
johnAlexander 14:8320b5ff96fa 2113 /**
johnAlexander 14:8320b5ff96fa 2114 * @brief Gets the name of a given sequence step.
johnAlexander 14:8320b5ff96fa 2115 *
johnAlexander 14:8320b5ff96fa 2116 * @par Function Description
johnAlexander 14:8320b5ff96fa 2117 * This function retrieves the name of sequence steps corresponding to
johnAlexander 14:8320b5ff96fa 2118 * SequenceStepId.
johnAlexander 14:8320b5ff96fa 2119 *
johnAlexander 14:8320b5ff96fa 2120 * @note This function doesn't Accesses the device
johnAlexander 14:8320b5ff96fa 2121 *
johnAlexander 14:8320b5ff96fa 2122 * @param sequence_step_id Sequence step identifier.
johnAlexander 14:8320b5ff96fa 2123 * @param p_sequence_steps_string Pointer to Info string
johnAlexander 14:8320b5ff96fa 2124 *
johnAlexander 14:8320b5ff96fa 2125 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2126 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2127 */
johnAlexander 14:8320b5ff96fa 2128 VL53L0X_Error vl53l0x_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 14:8320b5ff96fa 2129 char *p_sequence_steps_string);
johnAlexander 14:8320b5ff96fa 2130
johnAlexander 14:8320b5ff96fa 2131 /**
johnAlexander 14:8320b5ff96fa 2132 * @brief Get the frequency of the timer used for ranging results time stamps
johnAlexander 14:8320b5ff96fa 2133 *
johnAlexander 14:8320b5ff96fa 2134 * @param[out] p_timer_freq_hz : pointer for timer frequency
johnAlexander 14:8320b5ff96fa 2135 *
johnAlexander 14:8320b5ff96fa 2136 * @return status : 0 = ok, 1 = error
johnAlexander 14:8320b5ff96fa 2137 *
johnAlexander 14:8320b5ff96fa 2138 */
johnAlexander 14:8320b5ff96fa 2139 int32_t vl53l0x_get_timer_frequency(int32_t *p_timer_freq_hz);
johnAlexander 14:8320b5ff96fa 2140
johnAlexander 14:8320b5ff96fa 2141 /**
johnAlexander 14:8320b5ff96fa 2142 * @brief Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency())
johnAlexander 14:8320b5ff96fa 2143 *
johnAlexander 14:8320b5ff96fa 2144 * @param[out] p_timer_count : pointer for timer count value
johnAlexander 14:8320b5ff96fa 2145 *
johnAlexander 14:8320b5ff96fa 2146 * @return status : 0 = ok, 1 = error
johnAlexander 14:8320b5ff96fa 2147 *
johnAlexander 14:8320b5ff96fa 2148 */
johnAlexander 14:8320b5ff96fa 2149 int32_t vl53l0x_get_timer_value(int32_t *p_timer_count);
johnAlexander 14:8320b5ff96fa 2150
johnAlexander 14:8320b5ff96fa 2151 /**
johnAlexander 14:8320b5ff96fa 2152 * @brief Configure ranging interrupt reported to system
johnAlexander 14:8320b5ff96fa 2153 *
johnAlexander 14:8320b5ff96fa 2154 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 2155 *
johnAlexander 14:8320b5ff96fa 2156 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2157 * @param interrupt_mask Mask of interrupt to Enable/disable
johnAlexander 14:8320b5ff96fa 2158 * (0:interrupt disabled or 1: interrupt enabled)
johnAlexander 14:8320b5ff96fa 2159 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 2160 */
johnAlexander 14:8320b5ff96fa 2161 VL53L0X_Error vl53l0x_enable_interrupt_mask(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2162 uint32_t interrupt_mask);
johnAlexander 14:8320b5ff96fa 2163
johnAlexander 14:8320b5ff96fa 2164 /**
johnAlexander 14:8320b5ff96fa 2165 * @brief Get Dmax Calibration Parameters for a given device
johnAlexander 14:8320b5ff96fa 2166 *
johnAlexander 14:8320b5ff96fa 2167 *
johnAlexander 14:8320b5ff96fa 2168 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2169 *
johnAlexander 14:8320b5ff96fa 2170 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2171 * @param p_range_milli_meter Pointer to Calibration Distance
johnAlexander 14:8320b5ff96fa 2172 * @param p_signal_rate_rtn_mega_cps Pointer to Signal rate return
johnAlexander 14:8320b5ff96fa 2173 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2174 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2175 */
johnAlexander 14:8320b5ff96fa 2176 VL53L0X_Error vl53l0x_get_dmax_cal_parameters(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2177 uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps);
johnAlexander 14:8320b5ff96fa 2178
johnAlexander 14:8320b5ff96fa 2179 /**
johnAlexander 14:8320b5ff96fa 2180 * @brief Set Dmax Calibration Parameters for a given device
johnAlexander 14:8320b5ff96fa 2181 * When one of the parameter is zero, this function will get parameter
johnAlexander 14:8320b5ff96fa 2182 * from NVM.
johnAlexander 14:8320b5ff96fa 2183 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2184 *
johnAlexander 14:8320b5ff96fa 2185 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2186 * @param range_milli_meter Calibration Distance
johnAlexander 14:8320b5ff96fa 2187 * @param signal_rate_rtn_mega_cps Signal rate return read at CalDistance
johnAlexander 14:8320b5ff96fa 2188 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2189 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2190 */
johnAlexander 14:8320b5ff96fa 2191 VL53L0X_Error vl53l0x_get_dmax_cal_parameters(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2192 uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps);
johnAlexander 14:8320b5ff96fa 2193
johnAlexander 14:8320b5ff96fa 2194 /**
johnAlexander 14:8320b5ff96fa 2195 * @brief Retrieve the measurements from device for a given setup
johnAlexander 14:8320b5ff96fa 2196 *
johnAlexander 14:8320b5ff96fa 2197 * @par Function Description
johnAlexander 14:8320b5ff96fa 2198 * Get data from last successful Histogram measurement
johnAlexander 14:8320b5ff96fa 2199 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 14:8320b5ff96fa 2200 * before get data.
johnAlexander 14:8320b5ff96fa 2201 * PAL will fill a NumberOfROIZones times the corresponding data structure
johnAlexander 14:8320b5ff96fa 2202 * used in the measurement function.
johnAlexander 14:8320b5ff96fa 2203 *
johnAlexander 14:8320b5ff96fa 2204 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 2205 *
johnAlexander 14:8320b5ff96fa 2206 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2207 * @param p_histogram_measurement_data Pointer to the histogram data structure.
johnAlexander 14:8320b5ff96fa 2208 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 2209 */
johnAlexander 14:8320b5ff96fa 2210 VL53L0X_Error vl53l0x_get_histogram_measurement_data(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2211 VL53L0X_HistogramMeasurementData_t *p_histogram_measurement_data);
johnAlexander 14:8320b5ff96fa 2212
johnAlexander 14:8320b5ff96fa 2213 /**
johnAlexander 14:8320b5ff96fa 2214 * @brief Get current new device mode
johnAlexander 14:8320b5ff96fa 2215 * @par Function Description
johnAlexander 14:8320b5ff96fa 2216 * Get current Histogram mode of a Device
johnAlexander 14:8320b5ff96fa 2217 *
johnAlexander 14:8320b5ff96fa 2218 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2219 *
johnAlexander 14:8320b5ff96fa 2220 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2221 * @param p_histogram_mode Pointer to current Histogram Mode value
johnAlexander 14:8320b5ff96fa 2222 * Valid values are:
johnAlexander 14:8320b5ff96fa 2223 * VL53L0X_HISTOGRAMMODE_DISABLED
johnAlexander 14:8320b5ff96fa 2224 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 14:8320b5ff96fa 2225 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 14:8320b5ff96fa 2226 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 14:8320b5ff96fa 2227 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 14:8320b5ff96fa 2228 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2229 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2230 */
johnAlexander 14:8320b5ff96fa 2231 VL53L0X_Error vl53l0x_get_histogram_mode(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2232 VL53L0X_HistogramModes *p_histogram_mode);
johnAlexander 14:8320b5ff96fa 2233
johnAlexander 14:8320b5ff96fa 2234 /**
johnAlexander 14:8320b5ff96fa 2235 * @brief Set a new Histogram mode
johnAlexander 14:8320b5ff96fa 2236 * @par Function Description
johnAlexander 14:8320b5ff96fa 2237 * Set device to a new Histogram mode
johnAlexander 14:8320b5ff96fa 2238 *
johnAlexander 14:8320b5ff96fa 2239 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2240 *
johnAlexander 14:8320b5ff96fa 2241 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2242 * @param histogram_mode New device mode to apply
johnAlexander 14:8320b5ff96fa 2243 * Valid values are:
johnAlexander 14:8320b5ff96fa 2244 * VL53L0X_HISTOGRAMMODE_DISABLED
johnAlexander 14:8320b5ff96fa 2245 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
johnAlexander 14:8320b5ff96fa 2246 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
johnAlexander 14:8320b5ff96fa 2247 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
johnAlexander 14:8320b5ff96fa 2248 * VL53L0X_HISTOGRAMMODE_BOTH
johnAlexander 14:8320b5ff96fa 2249 *
johnAlexander 14:8320b5ff96fa 2250 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2251 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
johnAlexander 14:8320b5ff96fa 2252 * HistogramMode is not in the supported list
johnAlexander 14:8320b5ff96fa 2253 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2254 */
johnAlexander 14:8320b5ff96fa 2255 VL53L0X_Error vl53l0x_set_histogram_mode(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2256 VL53L0X_HistogramModes histogram_mode);
johnAlexander 14:8320b5ff96fa 2257
johnAlexander 14:8320b5ff96fa 2258 /**
johnAlexander 14:8320b5ff96fa 2259 * @brief Return a description string for a given limit check number
johnAlexander 14:8320b5ff96fa 2260 *
johnAlexander 14:8320b5ff96fa 2261 * @par Function Description
johnAlexander 14:8320b5ff96fa 2262 * This function returns a description string for a given limit check number.
johnAlexander 14:8320b5ff96fa 2263 * The limit check is identified with the LimitCheckId.
johnAlexander 14:8320b5ff96fa 2264 *
johnAlexander 14:8320b5ff96fa 2265 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2266 *
johnAlexander 14:8320b5ff96fa 2267 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2268 * @param limit_check_id Limit Check ID
johnAlexander 14:8320b5ff96fa 2269 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
johnAlexander 14:8320b5ff96fa 2270 * @param p_limit_check_string Pointer to the
johnAlexander 14:8320b5ff96fa 2271 description string of the given check limit.
johnAlexander 14:8320b5ff96fa 2272 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2273 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
johnAlexander 14:8320b5ff96fa 2274 returned when LimitCheckId value is out of range.
johnAlexander 14:8320b5ff96fa 2275 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2276 */
johnAlexander 14:8320b5ff96fa 2277 VL53L0X_Error vl53l0x_get_limit_check_info(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2278 uint16_t limit_check_id, char *p_limit_check_string);
johnAlexander 14:8320b5ff96fa 2279
johnAlexander 14:8320b5ff96fa 2280 /**
johnAlexander 14:8320b5ff96fa 2281 * @brief Get the linearity corrective gain
johnAlexander 14:8320b5ff96fa 2282 *
johnAlexander 14:8320b5ff96fa 2283 * @par Function Description
johnAlexander 14:8320b5ff96fa 2284 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
johnAlexander 14:8320b5ff96fa 2285 * device NVM value
johnAlexander 14:8320b5ff96fa 2286 *
johnAlexander 14:8320b5ff96fa 2287 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2288 *
johnAlexander 14:8320b5ff96fa 2289 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2290 * @param p_linearity_corrective_gain Pointer to the linearity
johnAlexander 14:8320b5ff96fa 2291 * corrective gain in x1000
johnAlexander 14:8320b5ff96fa 2292 * if value is 1000 then no modification is applied.
johnAlexander 14:8320b5ff96fa 2293 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2294 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2295 */
johnAlexander 14:8320b5ff96fa 2296 VL53L0X_Error vl53l0x_get_linearity_corrective_gain(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2297 uint16_t *p_linearity_corrective_gain);
johnAlexander 14:8320b5ff96fa 2298
johnAlexander 14:8320b5ff96fa 2299 /**
johnAlexander 14:8320b5ff96fa 2300 * Set the linearity corrective gain
johnAlexander 14:8320b5ff96fa 2301 *
johnAlexander 14:8320b5ff96fa 2302 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2303 *
johnAlexander 14:8320b5ff96fa 2304 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2305 * @param linearity_corrective_gain Linearity corrective
johnAlexander 14:8320b5ff96fa 2306 * gain in x1000
johnAlexander 14:8320b5ff96fa 2307 * if value is 1000 then no modification is applied.
johnAlexander 14:8320b5ff96fa 2308 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2309 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2310 */
johnAlexander 14:8320b5ff96fa 2311 VL53L0X_Error vl53l0x_set_linearity_corrective_gain(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2312 int16_t linearity_corrective_gain);
johnAlexander 14:8320b5ff96fa 2313
johnAlexander 14:8320b5ff96fa 2314 /**
johnAlexander 14:8320b5ff96fa 2315 * @brief Get the Maximum number of ROI Zones managed by the Device
johnAlexander 14:8320b5ff96fa 2316 *
johnAlexander 14:8320b5ff96fa 2317 * @par Function Description
johnAlexander 14:8320b5ff96fa 2318 * Get Maximum number of ROI Zones managed by the Device.
johnAlexander 14:8320b5ff96fa 2319 *
johnAlexander 14:8320b5ff96fa 2320 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2321 *
johnAlexander 14:8320b5ff96fa 2322 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2323 * @param p_max_number_of_roi_zones Pointer to the Maximum Number
johnAlexander 14:8320b5ff96fa 2324 * of ROI Zones value.
johnAlexander 14:8320b5ff96fa 2325 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2326 */
johnAlexander 14:8320b5ff96fa 2327 VL53L0X_Error vl53l0x_get_max_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2328 uint8_t *p_max_number_of_roi_zones);
johnAlexander 14:8320b5ff96fa 2329
johnAlexander 14:8320b5ff96fa 2330 /**
johnAlexander 14:8320b5ff96fa 2331 * @brief Retrieve the Reference Signal after a measurements
johnAlexander 14:8320b5ff96fa 2332 *
johnAlexander 14:8320b5ff96fa 2333 * @par Function Description
johnAlexander 14:8320b5ff96fa 2334 * Get Reference Signal from last successful Ranging measurement
johnAlexander 14:8320b5ff96fa 2335 * This function return a valid value after that you call the
johnAlexander 14:8320b5ff96fa 2336 * @a VL53L0X_GetRangingMeasurementData().
johnAlexander 14:8320b5ff96fa 2337 *
johnAlexander 14:8320b5ff96fa 2338 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2339 *
johnAlexander 14:8320b5ff96fa 2340 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2341 * @param p_measurement_ref_signal Pointer to the Ref Signal to fill up.
johnAlexander 14:8320b5ff96fa 2342 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2343 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2344 */
johnAlexander 14:8320b5ff96fa 2345 VL53L0X_Error vl53l0x_get_measurement_ref_signal(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2346 FixPoint1616_t *p_measurement_ref_signal);
johnAlexander 14:8320b5ff96fa 2347
johnAlexander 14:8320b5ff96fa 2348 /**
johnAlexander 14:8320b5ff96fa 2349 * @brief Get the number of the check limit managed by a given Device
johnAlexander 14:8320b5ff96fa 2350 *
johnAlexander 14:8320b5ff96fa 2351 * @par Function Description
johnAlexander 14:8320b5ff96fa 2352 * This function give the number of the check limit managed by the Device
johnAlexander 14:8320b5ff96fa 2353 *
johnAlexander 14:8320b5ff96fa 2354 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2355 *
johnAlexander 14:8320b5ff96fa 2356 * @param p_number_of_limit_check Pointer to the number of check limit.
johnAlexander 14:8320b5ff96fa 2357 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2358 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2359 */
johnAlexander 14:8320b5ff96fa 2360 VL53L0X_Error vl53l0x_get_number_of_limit_check(
johnAlexander 14:8320b5ff96fa 2361 uint16_t *p_number_of_limit_check);
johnAlexander 14:8320b5ff96fa 2362
johnAlexander 14:8320b5ff96fa 2363 /**
johnAlexander 14:8320b5ff96fa 2364 * @brief Get the number of ROI Zones managed by the Device
johnAlexander 14:8320b5ff96fa 2365 *
johnAlexander 14:8320b5ff96fa 2366 * @par Function Description
johnAlexander 14:8320b5ff96fa 2367 * Get number of ROI Zones managed by the Device
johnAlexander 14:8320b5ff96fa 2368 * USER should take care about @a VL53L0X_GetNumberOfROIZones()
johnAlexander 14:8320b5ff96fa 2369 * before get data after a perform measurement.
johnAlexander 14:8320b5ff96fa 2370 * PAL will fill a NumberOfROIZones times the corresponding data
johnAlexander 14:8320b5ff96fa 2371 * structure used in the measurement function.
johnAlexander 14:8320b5ff96fa 2372 *
johnAlexander 14:8320b5ff96fa 2373 * @note This function doesn't Access to the device
johnAlexander 14:8320b5ff96fa 2374 *
johnAlexander 14:8320b5ff96fa 2375 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2376 * @param p_number_of_roi_zones Pointer to the Number of ROI Zones value.
johnAlexander 14:8320b5ff96fa 2377 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2378 */
johnAlexander 14:8320b5ff96fa 2379 VL53L0X_Error vl53l0x_get_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2380 uint8_t *p_number_of_roi_zones);
johnAlexander 14:8320b5ff96fa 2381
johnAlexander 14:8320b5ff96fa 2382 /**
johnAlexander 14:8320b5ff96fa 2383 * @brief Set the number of ROI Zones to be used for a specific Device
johnAlexander 14:8320b5ff96fa 2384 *
johnAlexander 14:8320b5ff96fa 2385 * @par Function Description
johnAlexander 14:8320b5ff96fa 2386 * Set the number of ROI Zones to be used for a specific Device.
johnAlexander 14:8320b5ff96fa 2387 * The programmed value should be less than the max number of ROI Zones given
johnAlexander 14:8320b5ff96fa 2388 * with @a VL53L0X_GetMaxNumberOfROIZones().
johnAlexander 14:8320b5ff96fa 2389 * This version of API manage only one zone.
johnAlexander 14:8320b5ff96fa 2390 *
johnAlexander 14:8320b5ff96fa 2391 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2392 * @param number_of_roi_zones Number of ROI Zones to be used for a
johnAlexander 14:8320b5ff96fa 2393 * specific Device.
johnAlexander 14:8320b5ff96fa 2394 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2395 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
johnAlexander 14:8320b5ff96fa 2396 * NumberOfROIZones != 1
johnAlexander 14:8320b5ff96fa 2397 */
johnAlexander 14:8320b5ff96fa 2398 VL53L0X_Error vl53l0x_set_number_of_roi_zones(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2399 uint8_t number_of_roi_zones);
johnAlexander 14:8320b5ff96fa 2400
johnAlexander 14:8320b5ff96fa 2401 /**
johnAlexander 14:8320b5ff96fa 2402 * @brief Gets number of sequence steps managed by the API.
johnAlexander 14:8320b5ff96fa 2403 *
johnAlexander 14:8320b5ff96fa 2404 * @par Function Description
johnAlexander 14:8320b5ff96fa 2405 * This function retrieves the number of sequence steps currently managed
johnAlexander 14:8320b5ff96fa 2406 * by the API
johnAlexander 14:8320b5ff96fa 2407 *
johnAlexander 14:8320b5ff96fa 2408 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 2409 *
johnAlexander 14:8320b5ff96fa 2410 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2411 * @param p_number_of_sequence_steps Out parameter reporting the number of
johnAlexander 14:8320b5ff96fa 2412 * sequence steps.
johnAlexander 14:8320b5ff96fa 2413 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2414 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2415 */
johnAlexander 14:8320b5ff96fa 2416 VL53L0X_Error vl53l0x_get_number_of_sequence_steps(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2417 uint8_t *p_number_of_sequence_steps);
johnAlexander 14:8320b5ff96fa 2418 /**
johnAlexander 14:8320b5ff96fa 2419 * @brief Get the power mode for a given Device
johnAlexander 14:8320b5ff96fa 2420 *
johnAlexander 14:8320b5ff96fa 2421 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2422 *
johnAlexander 14:8320b5ff96fa 2423 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2424 * @param p_power_mode Pointer to the current value of the power
johnAlexander 14:8320b5ff96fa 2425 * mode. see ::VL53L0X_PowerModes
johnAlexander 14:8320b5ff96fa 2426 * Valid values are:
johnAlexander 14:8320b5ff96fa 2427 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
johnAlexander 14:8320b5ff96fa 2428 * VL53L0X_POWERMODE_IDLE_LEVEL1
johnAlexander 14:8320b5ff96fa 2429 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2430 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2431 */
johnAlexander 14:8320b5ff96fa 2432 VL53L0X_Error vl53l0x_get_power_mode(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2433 VL53L0X_PowerModes *p_power_mode);
johnAlexander 14:8320b5ff96fa 2434
johnAlexander 14:8320b5ff96fa 2435 /**
johnAlexander 14:8320b5ff96fa 2436 * @brief Set the power mode for a given Device
johnAlexander 14:8320b5ff96fa 2437 * The power mode can be Standby or Idle. Different level of both Standby and
johnAlexander 14:8320b5ff96fa 2438 * Idle can exists.
johnAlexander 14:8320b5ff96fa 2439 * This function should not be used when device is in Ranging state.
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 power_mode The value of the power mode to set.
johnAlexander 14:8320b5ff96fa 2445 * 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 VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when PowerMode
johnAlexander 14:8320b5ff96fa 2451 * is not in the supported list
johnAlexander 14:8320b5ff96fa 2452 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2453 */
johnAlexander 14:8320b5ff96fa 2454 VL53L0X_Error vl53l0x_set_power_mode(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2455 VL53L0X_PowerModes power_mode);
johnAlexander 14:8320b5ff96fa 2456
johnAlexander 14:8320b5ff96fa 2457 /**
johnAlexander 14:8320b5ff96fa 2458 * @brief Retrieves SPAD configuration
johnAlexander 14:8320b5ff96fa 2459 *
johnAlexander 14:8320b5ff96fa 2460 * @par Function Description
johnAlexander 14:8320b5ff96fa 2461 * This function retrieves the current number of applied reference spads
johnAlexander 14:8320b5ff96fa 2462 * and also their type : Aperture or Non-Aperture.
johnAlexander 14:8320b5ff96fa 2463 *
johnAlexander 14:8320b5ff96fa 2464 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2465 *
johnAlexander 14:8320b5ff96fa 2466 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2467 * @param p_spad_count Number ref Spad Count
johnAlexander 14:8320b5ff96fa 2468 * @param p_is_aperture_spads Reports if spads are of type
johnAlexander 14:8320b5ff96fa 2469 * aperture or non-aperture.
johnAlexander 14:8320b5ff96fa 2470 * 1:=aperture, 0:=Non-Aperture
johnAlexander 14:8320b5ff96fa 2471 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2472 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
johnAlexander 14:8320b5ff96fa 2473 * spad configuration.
johnAlexander 14:8320b5ff96fa 2474 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2475 */
johnAlexander 14:8320b5ff96fa 2476 VL53L0X_Error wrapped_vl53l0x_get_reference_spads(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2477 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
johnAlexander 14:8320b5ff96fa 2478
johnAlexander 14:8320b5ff96fa 2479 /**
johnAlexander 14:8320b5ff96fa 2480 * @brief Gets the (on/off) state of a requested sequence step.
johnAlexander 14:8320b5ff96fa 2481 *
johnAlexander 14:8320b5ff96fa 2482 * @par Function Description
johnAlexander 14:8320b5ff96fa 2483 * This function retrieves the state of a requested sequence step, i.e. on/off.
johnAlexander 14:8320b5ff96fa 2484 *
johnAlexander 14:8320b5ff96fa 2485 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 2486 *
johnAlexander 14:8320b5ff96fa 2487 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2488 * @param sequence_step_id Sequence step identifier.
johnAlexander 14:8320b5ff96fa 2489 * @param p_sequence_step_enabled Out parameter reporting if the sequence step
johnAlexander 14:8320b5ff96fa 2490 * is enabled {0=Off,1=On}.
johnAlexander 14:8320b5ff96fa 2491 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2492 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
johnAlexander 14:8320b5ff96fa 2493 * supported.
johnAlexander 14:8320b5ff96fa 2494 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2495 */
johnAlexander 14:8320b5ff96fa 2496 VL53L0X_Error vl53l0x_get_sequence_step_enable(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2497 VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled);
johnAlexander 14:8320b5ff96fa 2498
johnAlexander 14:8320b5ff96fa 2499
johnAlexander 14:8320b5ff96fa 2500 /**
johnAlexander 14:8320b5ff96fa 2501 * @brief Gets the timeout of a requested sequence step.
johnAlexander 14:8320b5ff96fa 2502 *
johnAlexander 14:8320b5ff96fa 2503 * @par Function Description
johnAlexander 14:8320b5ff96fa 2504 * This function retrieves the timeout of a requested sequence step.
johnAlexander 14:8320b5ff96fa 2505 *
johnAlexander 14:8320b5ff96fa 2506 * @note This function Accesses the device
johnAlexander 14:8320b5ff96fa 2507 *
johnAlexander 14:8320b5ff96fa 2508 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2509 * @param sequence_step_id Sequence step identifier.
johnAlexander 14:8320b5ff96fa 2510 * @param p_time_out_milli_secs Timeout value.
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_timeout(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2517 VL53L0X_SequenceStepId sequence_step_id,
johnAlexander 14:8320b5ff96fa 2518 FixPoint1616_t *p_time_out_milli_secs);
johnAlexander 14:8320b5ff96fa 2519
johnAlexander 14:8320b5ff96fa 2520 /**
johnAlexander 14:8320b5ff96fa 2521 * @brief Sets the timeout of a requested sequence step.
johnAlexander 14:8320b5ff96fa 2522 *
johnAlexander 14:8320b5ff96fa 2523 * @par Function Description
johnAlexander 14:8320b5ff96fa 2524 * This function sets 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 time_out_milli_secs Demanded timeout
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_set_sequence_step_timeout(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2537 VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs);
johnAlexander 14:8320b5ff96fa 2538
johnAlexander 14:8320b5ff96fa 2539 /**
johnAlexander 14:8320b5ff96fa 2540 * @brief Get the current SPAD Ambient Damper Factor value
johnAlexander 14:8320b5ff96fa 2541 *
johnAlexander 14:8320b5ff96fa 2542 * @par Function Description
johnAlexander 14:8320b5ff96fa 2543 * This function get the SPAD Ambient Damper Factor value
johnAlexander 14:8320b5ff96fa 2544 *
johnAlexander 14:8320b5ff96fa 2545 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2546 *
johnAlexander 14:8320b5ff96fa 2547 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2548 * @param p_spad_ambient_damper_factor Pointer to programmed SPAD Ambient
johnAlexander 14:8320b5ff96fa 2549 * Damper Factor value
johnAlexander 14:8320b5ff96fa 2550 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2551 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2552 */
johnAlexander 14:8320b5ff96fa 2553 VL53L0X_Error vl53l0x_get_spad_ambient_damper_factor(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2554 uint16_t *p_spad_ambient_damper_factor);
johnAlexander 14:8320b5ff96fa 2555 /**
johnAlexander 14:8320b5ff96fa 2556 * @brief Set the SPAD Ambient Damper Factor value
johnAlexander 14:8320b5ff96fa 2557 *
johnAlexander 14:8320b5ff96fa 2558 * @par Function Description
johnAlexander 14:8320b5ff96fa 2559 * This function set the SPAD Ambient Damper Factor value
johnAlexander 14:8320b5ff96fa 2560 *
johnAlexander 14:8320b5ff96fa 2561 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2562 *
johnAlexander 14:8320b5ff96fa 2563 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2564 * @param spad_ambient_damper_factor SPAD Ambient Damper Factor value
johnAlexander 14:8320b5ff96fa 2565 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2566 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2567 */
johnAlexander 14:8320b5ff96fa 2568 VL53L0X_Error vl53l0x_set_spad_ambient_damper_factor(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2569 uint16_t spad_ambient_damper_factor);
johnAlexander 14:8320b5ff96fa 2570
johnAlexander 14:8320b5ff96fa 2571 /**
johnAlexander 14:8320b5ff96fa 2572 * @brief Get the current SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2573 *
johnAlexander 14:8320b5ff96fa 2574 * @par Function Description
johnAlexander 14:8320b5ff96fa 2575 * This function get the SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2576 *
johnAlexander 14:8320b5ff96fa 2577 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2578 *
johnAlexander 14:8320b5ff96fa 2579 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2580 * @param p_spad_ambient_damper_threshold Pointer to programmed
johnAlexander 14:8320b5ff96fa 2581 * SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2582 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2583 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2584 */
johnAlexander 14:8320b5ff96fa 2585 VL53L0X_Error vl53l0x_get_spad_ambient_damper_threshold(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2586 uint16_t *p_spad_ambient_damper_threshold);
johnAlexander 14:8320b5ff96fa 2587
johnAlexander 14:8320b5ff96fa 2588 /**
johnAlexander 14:8320b5ff96fa 2589 * @brief Set the SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2590 *
johnAlexander 14:8320b5ff96fa 2591 * @par Function Description
johnAlexander 14:8320b5ff96fa 2592 * This function set the SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2593 *
johnAlexander 14:8320b5ff96fa 2594 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2595 *
johnAlexander 14:8320b5ff96fa 2596 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2597 * @param spad_ambient_damper_threshold SPAD Ambient Damper Threshold value
johnAlexander 14:8320b5ff96fa 2598 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2599 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2600 */
johnAlexander 14:8320b5ff96fa 2601 VL53L0X_Error vl53l0x_set_spad_ambient_damper_threshold(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2602 uint16_t spad_ambient_damper_threshold);
johnAlexander 14:8320b5ff96fa 2603
johnAlexander 14:8320b5ff96fa 2604 /**
johnAlexander 14:8320b5ff96fa 2605 * @brief Get the maximal distance for actual setup
johnAlexander 14:8320b5ff96fa 2606 * @par Function Description
johnAlexander 14:8320b5ff96fa 2607 * Device must be initialized through @a VL53L0X_SetParameters() prior calling
johnAlexander 14:8320b5ff96fa 2608 * this function.
johnAlexander 14:8320b5ff96fa 2609 *
johnAlexander 14:8320b5ff96fa 2610 * Any range value more than the value returned is to be considered as
johnAlexander 14:8320b5ff96fa 2611 * "no target detected" or
johnAlexander 14:8320b5ff96fa 2612 * "no target in detectable range"\n
johnAlexander 14:8320b5ff96fa 2613 * @warning The maximal distance depends on the setup
johnAlexander 14:8320b5ff96fa 2614 *
johnAlexander 14:8320b5ff96fa 2615 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 2616 *
johnAlexander 14:8320b5ff96fa 2617 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2618 * @param p_upper_limit_milli_meter The maximal range limit for actual setup
johnAlexander 14:8320b5ff96fa 2619 * (in millimeter)
johnAlexander 14:8320b5ff96fa 2620 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 2621 */
johnAlexander 14:8320b5ff96fa 2622 VL53L0X_Error vl53l0x_get_upper_limit_milli_meter(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2623 uint16_t *p_upper_limit_milli_meter);
johnAlexander 14:8320b5ff96fa 2624
johnAlexander 14:8320b5ff96fa 2625 /**
johnAlexander 14:8320b5ff96fa 2626 * @brief Get the tuning settings pointer and the internal external switch
johnAlexander 14:8320b5ff96fa 2627 * value.
johnAlexander 14:8320b5ff96fa 2628 *
johnAlexander 14:8320b5ff96fa 2629 * This function is used to get the Tuning settings buffer pointer and the
johnAlexander 14:8320b5ff96fa 2630 * value.
johnAlexander 14:8320b5ff96fa 2631 * of the switch to select either external or internal tuning settings.
johnAlexander 14:8320b5ff96fa 2632 *
johnAlexander 14:8320b5ff96fa 2633 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2634 *
johnAlexander 14:8320b5ff96fa 2635 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2636 * @param pp_tuning_setting_buffer Pointer to tuning settings buffer.
johnAlexander 14:8320b5ff96fa 2637 * @param p_use_internal_tuning_settings Pointer to store Use internal tuning
johnAlexander 14:8320b5ff96fa 2638 * settings value.
johnAlexander 14:8320b5ff96fa 2639 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2640 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2641 */
johnAlexander 14:8320b5ff96fa 2642 VL53L0X_Error vl53l0x_get_tuning_setting_buffer(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2643 uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings);
johnAlexander 14:8320b5ff96fa 2644
johnAlexander 14:8320b5ff96fa 2645 /**
johnAlexander 14:8320b5ff96fa 2646 * @brief Set the tuning settings pointer
johnAlexander 14:8320b5ff96fa 2647 *
johnAlexander 14:8320b5ff96fa 2648 * This function is used to specify the Tuning settings buffer to be used
johnAlexander 14:8320b5ff96fa 2649 * for a given device. The buffer contains all the necessary data to permit
johnAlexander 14:8320b5ff96fa 2650 * the API to write tuning settings.
johnAlexander 14:8320b5ff96fa 2651 * This function permit to force the usage of either external or internal
johnAlexander 14:8320b5ff96fa 2652 * tuning settings.
johnAlexander 14:8320b5ff96fa 2653 *
johnAlexander 14:8320b5ff96fa 2654 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2655 *
johnAlexander 14:8320b5ff96fa 2656 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2657 * @param p_tuning_setting_buffer Pointer to tuning settings buffer.
johnAlexander 14:8320b5ff96fa 2658 * @param use_internal_tuning_settings Use internal tuning 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_set_tuning_setting_buffer(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2663 uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings);
johnAlexander 14:8320b5ff96fa 2664
johnAlexander 14:8320b5ff96fa 2665 /**
johnAlexander 14:8320b5ff96fa 2666 * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions
johnAlexander 14:8320b5ff96fa 2667 * @brief PAL Register Access Functions
johnAlexander 14:8320b5ff96fa 2668 * @{
johnAlexander 14:8320b5ff96fa 2669 */
johnAlexander 14:8320b5ff96fa 2670
johnAlexander 14:8320b5ff96fa 2671 /**
johnAlexander 14:8320b5ff96fa 2672 * Lock comms interface to serialize all commands to a shared I2C interface for a specific device
johnAlexander 14:8320b5ff96fa 2673 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2674 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2675 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2676 */
johnAlexander 14:8320b5ff96fa 2677 VL53L0X_Error vl53l0x_lock_sequence_access(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 2678
johnAlexander 14:8320b5ff96fa 2679 /**
johnAlexander 14:8320b5ff96fa 2680 * Unlock comms interface to serialize all commands to a shared I2C interface for a specific device
johnAlexander 14:8320b5ff96fa 2681 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2682 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2683 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2684 */
johnAlexander 14:8320b5ff96fa 2685 VL53L0X_Error vl53l0x_unlock_sequence_access(VL53L0X_DEV dev);
johnAlexander 14:8320b5ff96fa 2686
johnAlexander 14:8320b5ff96fa 2687 /**
johnAlexander 14:8320b5ff96fa 2688 * @brief Prepare device for operation
johnAlexander 14:8320b5ff96fa 2689 * @par Function Description
johnAlexander 14:8320b5ff96fa 2690 * Update device with provided parameters
johnAlexander 14:8320b5ff96fa 2691 * @li Then start ranging operation.
johnAlexander 14:8320b5ff96fa 2692 *
johnAlexander 14:8320b5ff96fa 2693 * @note This function Access to the device
johnAlexander 14:8320b5ff96fa 2694 *
johnAlexander 14:8320b5ff96fa 2695 * @param Dev Device Handle
johnAlexander 14:8320b5ff96fa 2696 * @param pDeviceParameters Pointer to store current device parameters.
johnAlexander 14:8320b5ff96fa 2697 * @return VL53L0X_ERROR_NONE Success
johnAlexander 14:8320b5ff96fa 2698 * @return "Other error code" See ::VL53L0X_Error
johnAlexander 14:8320b5ff96fa 2699 */
johnAlexander 14:8320b5ff96fa 2700 VL53L0X_Error vl53L0x_set_device_parameters(VL53L0X_DEV Dev,
johnAlexander 14:8320b5ff96fa 2701 const VL53L0X_DeviceParameters_t *pDeviceParameters);
johnAlexander 14:8320b5ff96fa 2702
johnAlexander 14:8320b5ff96fa 2703 /**
johnAlexander 14:8320b5ff96fa 2704 * Set Group parameter Hold state
johnAlexander 14:8320b5ff96fa 2705 *
johnAlexander 14:8320b5ff96fa 2706 * @par Function Description
johnAlexander 14:8320b5ff96fa 2707 * Set or remove device internal group parameter hold
johnAlexander 14:8320b5ff96fa 2708 *
johnAlexander 14:8320b5ff96fa 2709 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 2710 *
johnAlexander 14:8320b5ff96fa 2711 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2712 * @param group_param_hold Group parameter Hold state to be set (on/off)
johnAlexander 14:8320b5ff96fa 2713 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 2714 */
johnAlexander 14:8320b5ff96fa 2715 VL53L0X_Error vl53l0x_set_group_param_hold(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2716 uint8_t group_param_hold);
johnAlexander 14:8320b5ff96fa 2717
johnAlexander 14:8320b5ff96fa 2718
johnAlexander 14:8320b5ff96fa 2719 /**
johnAlexander 14:8320b5ff96fa 2720 * @brief Wait for device ready for a new measurement command.
johnAlexander 14:8320b5ff96fa 2721 * Blocking function.
johnAlexander 14:8320b5ff96fa 2722 *
johnAlexander 14:8320b5ff96fa 2723 * @note This function is not Implemented
johnAlexander 14:8320b5ff96fa 2724 *
johnAlexander 14:8320b5ff96fa 2725 * @param dev Device Handle
johnAlexander 14:8320b5ff96fa 2726 * @param max_loop Max Number of polling loop (timeout).
johnAlexander 14:8320b5ff96fa 2727 * @return VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
johnAlexander 14:8320b5ff96fa 2728 */
johnAlexander 14:8320b5ff96fa 2729 VL53L0X_Error vl53l0x_wait_device_ready_for_new_measurement(VL53L0X_DEV dev,
johnAlexander 14:8320b5ff96fa 2730 uint32_t max_loop);
johnAlexander 14:8320b5ff96fa 2731
johnAlexander 14:8320b5ff96fa 2732 VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
johnAlexander 14:8320b5ff96fa 2733
johnAlexander 14:8320b5ff96fa 2734 int range_meas_int_continuous_mode(void (*fptr)(void));
johnAlexander 14:8320b5ff96fa 2735
johnAlexander 14:8320b5ff96fa 2736
johnAlexander 14:8320b5ff96fa 2737 VL53L0X_DeviceInfo_t _device_info;
johnAlexander 14:8320b5ff96fa 2738
johnAlexander 0:c523920bcc09 2739 /* IO Device */
johnAlexander 0:c523920bcc09 2740 DevI2C &dev_i2c;
johnAlexander 0:c523920bcc09 2741 /* Digital out pin */
johnAlexander 0:c523920bcc09 2742 DigitalOut *gpio0;
johnAlexander 0:c523920bcc09 2743 /* GPIO expander */
johnAlexander 14:8320b5ff96fa 2744 Stmpe1600DigiOut *expgpio0;
johnAlexander 0:c523920bcc09 2745 /* Measure detection IRQ */
johnAlexander 0:c523920bcc09 2746 InterruptIn *gpio1Int;
johnAlexander 0:c523920bcc09 2747 /* Device data */
johnAlexander 14:8320b5ff96fa 2748 VL53L0X_Dev_t _my_device;
johnAlexander 14:8320b5ff96fa 2749 VL53L0X_DEV _device;
johnAlexander 0:c523920bcc09 2750 };
johnAlexander 0:c523920bcc09 2751
johnAlexander 0:c523920bcc09 2752
johnAlexander 0:c523920bcc09 2753 #endif /* _VL53L0X_CLASS_H_ */