The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2

Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.

Committer:
lugandc
Date:
Wed Jul 21 17:06:38 2021 +0200
Revision:
18:0696efe39d08
Parent:
16:27131f13570d
Cleanup i2c functions, removed all bad references to L1X
Cleanup VL53L1CB class:
- i2c device object is passed in a consistent way in MyDevice structure
- removed useless functions
Updated VL53L1CB component driver with bare driver release 6.6.7 content

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Charles MacNeill 9:66969b9016ad 1 /**
Charles MacNeill 9:66969b9016ad 2 ******************************************************************************
Charles MacNeill 9:66969b9016ad 3 * @file vl53l1x_class.cpp
Charles MacNeill 9:66969b9016ad 4 * @author JS
Charles MacNeill 9:66969b9016ad 5 * @version V0.0.1
Charles MacNeill 9:66969b9016ad 6 * @date 15-January-2019
Charles MacNeill 9:66969b9016ad 7 * @brief Implementation file for the VL53L1 sensor component driver class
Charles MacNeill 9:66969b9016ad 8 ******************************************************************************
Charles MacNeill 9:66969b9016ad 9 * @attention
Charles MacNeill 9:66969b9016ad 10 *
Charles MacNeill 9:66969b9016ad 11 * <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2>
Charles MacNeill 9:66969b9016ad 12 *
Charles MacNeill 9:66969b9016ad 13 * Redistribution and use in source and binary forms, with or without modification,
Charles MacNeill 9:66969b9016ad 14 * are permitted provided that the following conditions are met:
Charles MacNeill 9:66969b9016ad 15 * 1. Redistributions of source code must retain the above copyright notice,
Charles MacNeill 9:66969b9016ad 16 * this list of conditions and the following disclaimer.
Charles MacNeill 9:66969b9016ad 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Charles MacNeill 9:66969b9016ad 18 * this list of conditions and the following disclaimer in the documentation
Charles MacNeill 9:66969b9016ad 19 * and/or other materials provided with the distribution.
Charles MacNeill 9:66969b9016ad 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Charles MacNeill 9:66969b9016ad 21 * may be used to endorse or promote products derived from this software
Charles MacNeill 9:66969b9016ad 22 * without specific prior written permission.
Charles MacNeill 9:66969b9016ad 23 *
Charles MacNeill 9:66969b9016ad 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Charles MacNeill 9:66969b9016ad 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Charles MacNeill 9:66969b9016ad 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Charles MacNeill 9:66969b9016ad 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Charles MacNeill 9:66969b9016ad 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Charles MacNeill 9:66969b9016ad 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Charles MacNeill 9:66969b9016ad 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Charles MacNeill 9:66969b9016ad 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Charles MacNeill 9:66969b9016ad 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Charles MacNeill 9:66969b9016ad 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Charles MacNeill 9:66969b9016ad 34 *
Charles MacNeill 9:66969b9016ad 35 ******************************************************************************
Charles MacNeill 9:66969b9016ad 36 */
Charles MacNeill 9:66969b9016ad 37
Charles MacNeill 9:66969b9016ad 38 /* Includes */
Charles MacNeill 9:66969b9016ad 39 #include <stdlib.h>
Charles MacNeill 9:66969b9016ad 40 #include "VL53L1CB.h"
Charles MacNeill 9:66969b9016ad 41 /************************************************/
Charles MacNeill 9:66969b9016ad 42 #include "vl53l1_platform_user_config.h"
Charles MacNeill 9:66969b9016ad 43 #include "vl53l1_def.h"
Charles MacNeill 9:66969b9016ad 44 #include "vl53l1_wait.h"
Charles MacNeill 9:66969b9016ad 45 #include "vl53l1_api.h"
Charles MacNeill 9:66969b9016ad 46 #include "vl53l1_api_debug.h"
Charles MacNeill 9:66969b9016ad 47 #include "vl53l1_api_strings.h"
Charles MacNeill 9:66969b9016ad 48 #include "vl53l1_preset_setup.h"
Charles MacNeill 9:66969b9016ad 49 #include "vl53l1_api_calibration.h"
Charles MacNeill 9:66969b9016ad 50 #include "vl53l1_nvm_structs.h"
Charles MacNeill 9:66969b9016ad 51 #include "vl53l1_nvm.h"
Charles MacNeill 9:66969b9016ad 52 #include "vl53l1_core.h"
Charles MacNeill 9:66969b9016ad 53 #include "vl53l1_register_funcs.h"
Charles MacNeill 9:66969b9016ad 54 /***********************************************************/
Charles MacNeill 9:66969b9016ad 55 #include "vl53l1_api_core.h"
Charles MacNeill 9:66969b9016ad 56
Charles MacNeill 9:66969b9016ad 57 #include "vl53l1_configuration.h"
Charles MacNeill 9:66969b9016ad 58
Charles MacNeill 9:66969b9016ad 59
Charles MacNeill 9:66969b9016ad 60 #ifndef MIN
Charles MacNeill 9:66969b9016ad 61 #define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2))
Charles MacNeill 9:66969b9016ad 62 #endif
Charles MacNeill 9:66969b9016ad 63 #ifndef MAX
Charles MacNeill 9:66969b9016ad 64 #define MAX(v1, v2) ((v1) < (v2) ? (v2) : (v1))
Charles MacNeill 9:66969b9016ad 65 #endif
Charles MacNeill 9:66969b9016ad 66
Charles MacNeill 9:66969b9016ad 67
Charles MacNeill 10:3687b5e79f98 68 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetSWVersion(VL53L1_Version_t *pVersion)
Charles MacNeill 9:66969b9016ad 69 {
Charles MacNeill 10:3687b5e79f98 70 VL53L1CB_ERROR Status = 0;
Charles MacNeill 9:66969b9016ad 71
lugandc 18:0696efe39d08 72 pVersion->major = VL53L1CB_IMPLEMENTATION_VER_MAJOR;
lugandc 18:0696efe39d08 73 pVersion->minor = VL53L1CB_IMPLEMENTATION_VER_MINOR;
lugandc 18:0696efe39d08 74 pVersion->build = VL53L1CB_IMPLEMENTATION_VER_SUB;
lugandc 18:0696efe39d08 75 pVersion->revision = VL53L1CB_IMPLEMENTATION_VER_REVISION;
Charles MacNeill 9:66969b9016ad 76 return Status;
Charles MacNeill 9:66969b9016ad 77 }
Charles MacNeill 9:66969b9016ad 78
Charles MacNeill 10:3687b5e79f98 79 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetI2CAddress(uint8_t new_address)
Charles MacNeill 9:66969b9016ad 80 {
Charles MacNeill 10:3687b5e79f98 81 VL53L1CB_ERROR status = 0;
Charles MacNeill 9:66969b9016ad 82 if ( Device->i2c_slave_address != new_address)
Charles MacNeill 9:66969b9016ad 83 {
lugandc 18:0696efe39d08 84 status = (VL53L1CB_ERROR)VL53L1_SetDeviceAddress(Device,new_address);
Charles MacNeill 9:66969b9016ad 85 printf("VL53L1_SetI2CAddress %d to %d status = %d\n", Device->i2c_slave_address,new_address,status);
lugandc 18:0696efe39d08 86 Device->i2c_slave_address = new_address;
Charles MacNeill 9:66969b9016ad 87 }
Charles MacNeill 9:66969b9016ad 88 return status;
Charles MacNeill 9:66969b9016ad 89 }
Charles MacNeill 9:66969b9016ad 90
Charles MacNeill 9:66969b9016ad 91
Charles MacNeill 10:3687b5e79f98 92 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SensorInit()
Charles MacNeill 9:66969b9016ad 93 {
Charles MacNeill 10:3687b5e79f98 94 VL53L1CB_ERROR status = 0;
Charles MacNeill 9:66969b9016ad 95
lugandc 18:0696efe39d08 96 /* Device Initialization and setting */
lugandc 18:0696efe39d08 97 status = VL53L1CB_DataInit();
lugandc 18:0696efe39d08 98 if (status != 0) {
lugandc 18:0696efe39d08 99 return status;
lugandc 18:0696efe39d08 100 }
lugandc 18:0696efe39d08 101 status = VL53L1CB_StaticInit();
lugandc 18:0696efe39d08 102 if (status != 0) {
lugandc 18:0696efe39d08 103 return status;
lugandc 18:0696efe39d08 104 }
Charles MacNeill 9:66969b9016ad 105
Charles MacNeill 9:66969b9016ad 106 return status;
Charles MacNeill 9:66969b9016ad 107 }
Charles MacNeill 9:66969b9016ad 108
Charles MacNeill 9:66969b9016ad 109
Charles MacNeill 9:66969b9016ad 110 /* Write and read functions from I2C */
Charles MacNeill 9:66969b9016ad 111
Charles MacNeill 9:66969b9016ad 112
lugandc 18:0696efe39d08 113 VL53L1CB_ERROR VL53L1CB::VL53L1CB_WaitDeviceBooted()
Charles MacNeill 9:66969b9016ad 114 {
Charles MacNeill 9:66969b9016ad 115
lugandc 18:0696efe39d08 116 return VL53L1_WaitDeviceBooted(Device);
Charles MacNeill 9:66969b9016ad 117 }
Charles MacNeill 9:66969b9016ad 118
Charles MacNeill 9:66969b9016ad 119
Charles MacNeill 10:3687b5e79f98 120 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetVersion(VL53L1_Version_t *pVersion)
Charles MacNeill 9:66969b9016ad 121 {
Charles MacNeill 9:66969b9016ad 122
Charles MacNeill 9:66969b9016ad 123 return VL53L1_GetVersion(pVersion);
Charles MacNeill 9:66969b9016ad 124 }
Charles MacNeill 9:66969b9016ad 125
Charles MacNeill 9:66969b9016ad 126
Charles MacNeill 10:3687b5e79f98 127 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetProductRevision(
Charles MacNeill 9:66969b9016ad 128 uint8_t *pProductRevisionMajor, uint8_t *pProductRevisionMinor)
Charles MacNeill 9:66969b9016ad 129 {
Charles MacNeill 9:66969b9016ad 130 return VL53L1_GetProductRevision(Device,pProductRevisionMajor,pProductRevisionMinor);
Charles MacNeill 9:66969b9016ad 131 }
Charles MacNeill 9:66969b9016ad 132
Charles MacNeill 9:66969b9016ad 133 //******************************************************************
Charles MacNeill 9:66969b9016ad 134
Charles MacNeill 10:3687b5e79f98 135 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetDeviceInfo(
Charles MacNeill 9:66969b9016ad 136 VL53L1_DeviceInfo_t *pVL53L1_DeviceInfo)
Charles MacNeill 9:66969b9016ad 137 {
Charles MacNeill 9:66969b9016ad 138 return VL53L1_GetDeviceInfo(Device,pVL53L1_DeviceInfo);
Charles MacNeill 9:66969b9016ad 139 }
Charles MacNeill 9:66969b9016ad 140
Charles MacNeill 10:3687b5e79f98 141 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetUID( uint64_t *pUid)
Charles MacNeill 9:66969b9016ad 142 {
Charles MacNeill 9:66969b9016ad 143 return VL53L1_GetUID(Device,pUid);
Charles MacNeill 9:66969b9016ad 144 }
Charles MacNeill 9:66969b9016ad 145
Charles MacNeill 10:3687b5e79f98 146 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetRangeStatusString(uint8_t RangeStatus,
Charles MacNeill 9:66969b9016ad 147 char *pRangeStatusString)
Charles MacNeill 9:66969b9016ad 148 {
Charles MacNeill 9:66969b9016ad 149 return VL53L1_GetRangeStatusString(RangeStatus,
Charles MacNeill 9:66969b9016ad 150 pRangeStatusString);
Charles MacNeill 9:66969b9016ad 151 }
Charles MacNeill 9:66969b9016ad 152
Charles MacNeill 10:3687b5e79f98 153 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetPalErrorString(VL53L1CB_ERROR PalErrorCode,
Charles MacNeill 9:66969b9016ad 154 char *pPalErrorString)
Charles MacNeill 9:66969b9016ad 155 {
Charles MacNeill 9:66969b9016ad 156 return VL53L1_GetPalErrorString(PalErrorCode,pPalErrorString);
Charles MacNeill 9:66969b9016ad 157 }
Charles MacNeill 9:66969b9016ad 158
Charles MacNeill 10:3687b5e79f98 159 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetPalStateString(VL53L1_State PalStateCode,
Charles MacNeill 9:66969b9016ad 160 char *pPalStateString)
Charles MacNeill 9:66969b9016ad 161 {
Charles MacNeill 9:66969b9016ad 162 return VL53L1_GetPalStateString(PalStateCode, pPalStateString);
Charles MacNeill 9:66969b9016ad 163 }
Charles MacNeill 9:66969b9016ad 164
lugandc 18:0696efe39d08 165 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetPalState(VL53L1_State *pPalState)
Charles MacNeill 9:66969b9016ad 166 {
lugandc 18:0696efe39d08 167 return VL53L1_GetPalState(Device, pPalState);
Charles MacNeill 9:66969b9016ad 168 }
Charles MacNeill 9:66969b9016ad 169
Charles MacNeill 9:66969b9016ad 170
Charles MacNeill 10:3687b5e79f98 171 VL53L1CB_ERROR VL53L1CB::VL53L1CB_DataInit()
Charles MacNeill 9:66969b9016ad 172 {
Charles MacNeill 9:66969b9016ad 173 return VL53L1_DataInit( Device);
Charles MacNeill 9:66969b9016ad 174 }
Charles MacNeill 9:66969b9016ad 175
Charles MacNeill 9:66969b9016ad 176
Charles MacNeill 10:3687b5e79f98 177 VL53L1CB_ERROR VL53L1CB::VL53L1CB_StaticInit()
Charles MacNeill 9:66969b9016ad 178 {
Charles MacNeill 9:66969b9016ad 179 return VL53L1_StaticInit( Device);
Charles MacNeill 9:66969b9016ad 180 }
Charles MacNeill 9:66969b9016ad 181
Charles MacNeill 9:66969b9016ad 182
Charles MacNeill 10:3687b5e79f98 183 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetPresetMode(VL53L1_PresetModes PresetMode)
Charles MacNeill 9:66969b9016ad 184 {
Charles MacNeill 9:66969b9016ad 185 return VL53L1_SetPresetMode(Device,PresetMode);
Charles MacNeill 9:66969b9016ad 186 }
Charles MacNeill 9:66969b9016ad 187
Charles MacNeill 9:66969b9016ad 188
Charles MacNeill 10:3687b5e79f98 189 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetPresetMode( VL53L1_PresetModes *pPresetMode)
Charles MacNeill 9:66969b9016ad 190 {
Charles MacNeill 9:66969b9016ad 191 return VL53L1_GetPresetMode(Device,pPresetMode);
Charles MacNeill 9:66969b9016ad 192 }
Charles MacNeill 9:66969b9016ad 193
Charles MacNeill 9:66969b9016ad 194
Charles MacNeill 10:3687b5e79f98 195 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetDistanceMode(VL53L1_DistanceModes DistanceMode)
Charles MacNeill 9:66969b9016ad 196 {
Charles MacNeill 9:66969b9016ad 197 return VL53L1_SetDistanceMode(Device,DistanceMode);
Charles MacNeill 9:66969b9016ad 198 }
Charles MacNeill 9:66969b9016ad 199
Charles MacNeill 10:3687b5e79f98 200 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetDistanceMode(VL53L1_DistanceModes *pDistanceMode)
Charles MacNeill 9:66969b9016ad 201 {
Charles MacNeill 9:66969b9016ad 202 return VL53L1_GetDistanceMode(Device,pDistanceMode);
Charles MacNeill 9:66969b9016ad 203 }
Charles MacNeill 9:66969b9016ad 204
Charles MacNeill 10:3687b5e79f98 205 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetOutputMode(VL53L1_OutputModes OutputMode)
Charles MacNeill 9:66969b9016ad 206 {
Charles MacNeill 9:66969b9016ad 207 return VL53L1_SetOutputMode(Device,OutputMode);
Charles MacNeill 9:66969b9016ad 208 }
Charles MacNeill 9:66969b9016ad 209
Charles MacNeill 10:3687b5e79f98 210 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetOutputMode(VL53L1_OutputModes *pOutputMode)
Charles MacNeill 9:66969b9016ad 211 {
Charles MacNeill 9:66969b9016ad 212 return VL53L1_GetOutputMode(Device,pOutputMode);
Charles MacNeill 9:66969b9016ad 213 }
Charles MacNeill 9:66969b9016ad 214
Charles MacNeill 9:66969b9016ad 215
Charles MacNeill 9:66969b9016ad 216
Charles MacNeill 10:3687b5e79f98 217 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetMeasurementTimingBudgetMicroSeconds(
Charles MacNeill 9:66969b9016ad 218 uint32_t MeasurementTimingBudgetMicroSeconds)
Charles MacNeill 9:66969b9016ad 219 {
Charles MacNeill 9:66969b9016ad 220 return VL53L1_SetMeasurementTimingBudgetMicroSeconds(Device,
Charles MacNeill 9:66969b9016ad 221 MeasurementTimingBudgetMicroSeconds);
Charles MacNeill 9:66969b9016ad 222 }
Charles MacNeill 9:66969b9016ad 223
Charles MacNeill 9:66969b9016ad 224
Charles MacNeill 10:3687b5e79f98 225 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetMeasurementTimingBudgetMicroSeconds(
Charles MacNeill 9:66969b9016ad 226 uint32_t *pMeasurementTimingBudgetMicroSeconds)
Charles MacNeill 9:66969b9016ad 227 {
Charles MacNeill 9:66969b9016ad 228 return VL53L1_GetMeasurementTimingBudgetMicroSeconds(Device,
Charles MacNeill 9:66969b9016ad 229 pMeasurementTimingBudgetMicroSeconds);
Charles MacNeill 9:66969b9016ad 230 }
Charles MacNeill 9:66969b9016ad 231
Charles MacNeill 9:66969b9016ad 232
Charles MacNeill 9:66969b9016ad 233
Charles MacNeill 10:3687b5e79f98 234 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetInterMeasurementPeriodMilliSeconds(
Charles MacNeill 9:66969b9016ad 235 uint32_t InterMeasurementPeriodMilliSeconds)
Charles MacNeill 9:66969b9016ad 236 {
Charles MacNeill 9:66969b9016ad 237 return VL53L1_SetInterMeasurementPeriodMilliSeconds(Device,InterMeasurementPeriodMilliSeconds);
Charles MacNeill 9:66969b9016ad 238 }
Charles MacNeill 9:66969b9016ad 239
Charles MacNeill 10:3687b5e79f98 240 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetInterMeasurementPeriodMilliSeconds(
Charles MacNeill 9:66969b9016ad 241 uint32_t *pInterMeasurementPeriodMilliSeconds)
Charles MacNeill 9:66969b9016ad 242 {
Charles MacNeill 9:66969b9016ad 243 return VL53L1_GetInterMeasurementPeriodMilliSeconds(Device,pInterMeasurementPeriodMilliSeconds);
Charles MacNeill 9:66969b9016ad 244 }
Charles MacNeill 9:66969b9016ad 245
Charles MacNeill 10:3687b5e79f98 246 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetDmaxReflectance(FixPoint1616_t DmaxReflectance)
Charles MacNeill 9:66969b9016ad 247 {
Charles MacNeill 9:66969b9016ad 248
Charles MacNeill 9:66969b9016ad 249 return VL53L1_SetDmaxReflectance(Device,DmaxReflectance);
Charles MacNeill 9:66969b9016ad 250 }
Charles MacNeill 9:66969b9016ad 251
Charles MacNeill 10:3687b5e79f98 252 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetDmaxReflectance(
Charles MacNeill 9:66969b9016ad 253 FixPoint1616_t *pDmaxReflectance)
Charles MacNeill 9:66969b9016ad 254 {
Charles MacNeill 9:66969b9016ad 255 return VL53L1_GetDmaxReflectance(Device,pDmaxReflectance);
Charles MacNeill 9:66969b9016ad 256 }
Charles MacNeill 9:66969b9016ad 257
Charles MacNeill 9:66969b9016ad 258
Charles MacNeill 10:3687b5e79f98 259 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetDmaxMode(VL53L1_DeviceDmaxModes DmaxMode)
Charles MacNeill 9:66969b9016ad 260 {
Charles MacNeill 9:66969b9016ad 261 return VL53L1_SetDmaxMode(Device,DmaxMode);
Charles MacNeill 9:66969b9016ad 262 }
Charles MacNeill 9:66969b9016ad 263
Charles MacNeill 9:66969b9016ad 264
Charles MacNeill 10:3687b5e79f98 265 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetDmaxMode(
Charles MacNeill 9:66969b9016ad 266 VL53L1_DeviceDmaxModes *pDmaxMode)
Charles MacNeill 9:66969b9016ad 267 {
Charles MacNeill 9:66969b9016ad 268 return VL53L1_GetDmaxMode(Device,pDmaxMode);
Charles MacNeill 9:66969b9016ad 269 }
Charles MacNeill 9:66969b9016ad 270
Charles MacNeill 9:66969b9016ad 271
Charles MacNeill 10:3687b5e79f98 272 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetNumberOfLimitCheck(uint16_t *pNumberOfLimitCheck)
Charles MacNeill 9:66969b9016ad 273 {
lugandc 18:0696efe39d08 274 return VL53L1_GetNumberOfLimitCheck(pNumberOfLimitCheck);
Charles MacNeill 9:66969b9016ad 275 }
Charles MacNeill 9:66969b9016ad 276
Charles MacNeill 10:3687b5e79f98 277 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetLimitCheckInfo(uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 278 char *pLimitCheckString)
Charles MacNeill 9:66969b9016ad 279 {
Charles MacNeill 9:66969b9016ad 280 return VL53L1_GetLimitCheckInfo(LimitCheckId,
Charles MacNeill 9:66969b9016ad 281 pLimitCheckString);
Charles MacNeill 9:66969b9016ad 282
Charles MacNeill 9:66969b9016ad 283 }
Charles MacNeill 9:66969b9016ad 284
Charles MacNeill 10:3687b5e79f98 285 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetLimitCheckStatus(uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 286 uint8_t *pLimitCheckStatus)
Charles MacNeill 9:66969b9016ad 287 {
Charles MacNeill 9:66969b9016ad 288 return VL53L1_GetLimitCheckStatus(Device,LimitCheckId,pLimitCheckStatus);
Charles MacNeill 9:66969b9016ad 289 }
Charles MacNeill 9:66969b9016ad 290
Charles MacNeill 9:66969b9016ad 291
Charles MacNeill 10:3687b5e79f98 292 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetLimitCheckEnable(uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 293 uint8_t LimitCheckEnable)
Charles MacNeill 9:66969b9016ad 294 {
Charles MacNeill 9:66969b9016ad 295
Charles MacNeill 9:66969b9016ad 296 return VL53L1_SetLimitCheckEnable(Device,LimitCheckId,LimitCheckEnable);
Charles MacNeill 9:66969b9016ad 297 }
Charles MacNeill 9:66969b9016ad 298
Charles MacNeill 10:3687b5e79f98 299 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetLimitCheckEnable(uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 300 uint8_t *pLimitCheckEnable)
Charles MacNeill 9:66969b9016ad 301 {
Charles MacNeill 9:66969b9016ad 302 return VL53L1_GetLimitCheckEnable(Device,LimitCheckId,pLimitCheckEnable);
Charles MacNeill 9:66969b9016ad 303 }
Charles MacNeill 9:66969b9016ad 304
Charles MacNeill 10:3687b5e79f98 305 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetLimitCheckValue( uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 306 FixPoint1616_t LimitCheckValue)
Charles MacNeill 9:66969b9016ad 307 {
Charles MacNeill 9:66969b9016ad 308 return VL53L1_SetLimitCheckValue(Device,LimitCheckId,LimitCheckValue);
Charles MacNeill 9:66969b9016ad 309 }
Charles MacNeill 9:66969b9016ad 310
Charles MacNeill 10:3687b5e79f98 311 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetLimitCheckValue( uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 312 FixPoint1616_t *pLimitCheckValue)
Charles MacNeill 9:66969b9016ad 313 {
Charles MacNeill 9:66969b9016ad 314 return VL53L1_GetLimitCheckValue(Device,LimitCheckId,pLimitCheckValue);
Charles MacNeill 9:66969b9016ad 315 }
Charles MacNeill 9:66969b9016ad 316
Charles MacNeill 10:3687b5e79f98 317 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetLimitCheckCurrent( uint16_t LimitCheckId,
Charles MacNeill 9:66969b9016ad 318 FixPoint1616_t *pLimitCheckCurrent)
Charles MacNeill 9:66969b9016ad 319 {
Charles MacNeill 9:66969b9016ad 320 return VL53L1_GetLimitCheckCurrent(Device,LimitCheckId,pLimitCheckCurrent);
Charles MacNeill 9:66969b9016ad 321 }
Charles MacNeill 9:66969b9016ad 322
Charles MacNeill 9:66969b9016ad 323
Charles MacNeill 10:3687b5e79f98 324 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetMaxNumberOfROI( uint8_t *pMaxNumberOfROI)
Charles MacNeill 9:66969b9016ad 325 {
Charles MacNeill 9:66969b9016ad 326 return VL53L1_GetMaxNumberOfROI(Device,pMaxNumberOfROI);
Charles MacNeill 9:66969b9016ad 327 }
Charles MacNeill 9:66969b9016ad 328
Charles MacNeill 10:3687b5e79f98 329 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetROI( VL53L1_RoiConfig_t *pRoiConfig)
Charles MacNeill 9:66969b9016ad 330 {
Charles MacNeill 9:66969b9016ad 331
Charles MacNeill 9:66969b9016ad 332 return VL53L1_SetROI(Device,pRoiConfig);
Charles MacNeill 9:66969b9016ad 333 }
Charles MacNeill 9:66969b9016ad 334
Charles MacNeill 10:3687b5e79f98 335 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetROI(VL53L1_RoiConfig_t *pRoiConfig)
Charles MacNeill 9:66969b9016ad 336 {
Charles MacNeill 9:66969b9016ad 337 return VL53L1_GetROI(Device,pRoiConfig);
Charles MacNeill 9:66969b9016ad 338 }
Charles MacNeill 9:66969b9016ad 339
Charles MacNeill 14:f06785b2a964 340
Charles MacNeill 14:f06785b2a964 341
Charles MacNeill 14:f06785b2a964 342
Charles MacNeill 10:3687b5e79f98 343 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetNumberOfSequenceSteps(uint8_t *pNumberOfSequenceSteps)
Charles MacNeill 9:66969b9016ad 344 {
Charles MacNeill 10:3687b5e79f98 345 VL53L1CB_ERROR Status = VL53L1_ERROR_NONE;
Charles MacNeill 9:66969b9016ad 346
Charles MacNeill 9:66969b9016ad 347 // SUPPRESS_UNUSED_WARNING(Dev);
Charles MacNeill 9:66969b9016ad 348
Charles MacNeill 9:66969b9016ad 349 // LOG_FUNCTION_START("");
Charles MacNeill 9:66969b9016ad 350
Charles MacNeill 9:66969b9016ad 351 *pNumberOfSequenceSteps = VL53L1_SEQUENCESTEP_NUMBER_OF_ITEMS;
Charles MacNeill 9:66969b9016ad 352
Charles MacNeill 9:66969b9016ad 353 // LOG_FUNCTION_END(Status);
Charles MacNeill 9:66969b9016ad 354 return Status;
Charles MacNeill 9:66969b9016ad 355 }
Charles MacNeill 9:66969b9016ad 356
Charles MacNeill 10:3687b5e79f98 357 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetSequenceStepsInfo(VL53L1_SequenceStepId SequenceStepId,
Charles MacNeill 9:66969b9016ad 358 char *pSequenceStepsString)
Charles MacNeill 9:66969b9016ad 359 {
Charles MacNeill 9:66969b9016ad 360 return VL53L1_GetSequenceStepsInfo(SequenceStepId,pSequenceStepsString);
Charles MacNeill 9:66969b9016ad 361 }
Charles MacNeill 9:66969b9016ad 362
Charles MacNeill 10:3687b5e79f98 363 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetSequenceStepEnable(VL53L1_SequenceStepId SequenceStepId,
Charles MacNeill 9:66969b9016ad 364 uint8_t SequenceStepEnabled)
Charles MacNeill 9:66969b9016ad 365 {
Charles MacNeill 9:66969b9016ad 366
Charles MacNeill 9:66969b9016ad 367 return VL53L1_SetSequenceStepEnable(Device,SequenceStepId,SequenceStepEnabled);
Charles MacNeill 9:66969b9016ad 368 }
Charles MacNeill 9:66969b9016ad 369
Charles MacNeill 9:66969b9016ad 370
Charles MacNeill 10:3687b5e79f98 371 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetSequenceStepEnable(VL53L1_SequenceStepId SequenceStepId,
Charles MacNeill 9:66969b9016ad 372 uint8_t *pSequenceStepEnabled)
Charles MacNeill 9:66969b9016ad 373 {
Charles MacNeill 9:66969b9016ad 374 return VL53L1_GetSequenceStepEnable(Device,SequenceStepId,pSequenceStepEnabled);
Charles MacNeill 9:66969b9016ad 375 }
Charles MacNeill 9:66969b9016ad 376
Charles MacNeill 9:66969b9016ad 377
Charles MacNeill 9:66969b9016ad 378
Charles MacNeill 10:3687b5e79f98 379 VL53L1CB_ERROR VL53L1CB::VL53L1CB_StartMeasurement()
Charles MacNeill 9:66969b9016ad 380 {
Charles MacNeill 9:66969b9016ad 381 return VL53L1_StartMeasurement(Device);
Charles MacNeill 9:66969b9016ad 382 }
Charles MacNeill 9:66969b9016ad 383
Charles MacNeill 10:3687b5e79f98 384 VL53L1CB_ERROR VL53L1CB::VL53L1CB_StopMeasurement()
Charles MacNeill 9:66969b9016ad 385 {
Charles MacNeill 9:66969b9016ad 386 return VL53L1_StopMeasurement(Device);
Charles MacNeill 9:66969b9016ad 387 }
Charles MacNeill 9:66969b9016ad 388
Charles MacNeill 9:66969b9016ad 389
charlesmn 16:27131f13570d 390 VL53L1CB_ERROR VL53L1CB::VL53L1CB_ClearInterruptAndStartMeasurement()
Charles MacNeill 9:66969b9016ad 391 {
Charles MacNeill 9:66969b9016ad 392
Charles MacNeill 9:66969b9016ad 393 return VL53L1_ClearInterruptAndStartMeasurement(Device);
Charles MacNeill 9:66969b9016ad 394 }
Charles MacNeill 9:66969b9016ad 395
Charles MacNeill 9:66969b9016ad 396
Charles MacNeill 10:3687b5e79f98 397 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetMeasurementDataReady(uint8_t *pMeasurementDataReady)
Charles MacNeill 9:66969b9016ad 398 {
Charles MacNeill 9:66969b9016ad 399 return VL53L1_GetMeasurementDataReady(Device, pMeasurementDataReady);
Charles MacNeill 9:66969b9016ad 400 }
Charles MacNeill 9:66969b9016ad 401
Charles MacNeill 10:3687b5e79f98 402 VL53L1CB_ERROR VL53L1CB::VL53L1CB_WaitMeasurementDataReady()
Charles MacNeill 9:66969b9016ad 403 {
Charles MacNeill 9:66969b9016ad 404 return VL53L1_WaitMeasurementDataReady(Device);
Charles MacNeill 9:66969b9016ad 405 }
Charles MacNeill 9:66969b9016ad 406
Charles MacNeill 9:66969b9016ad 407
Charles MacNeill 9:66969b9016ad 408 //******************************************************************
Charles MacNeill 9:66969b9016ad 409
Charles MacNeill 9:66969b9016ad 410
Charles MacNeill 9:66969b9016ad 411
Charles MacNeill 10:3687b5e79f98 412 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetCalibrationData(
Charles MacNeill 9:66969b9016ad 413 VL53L1_CalibrationData_t *pCalibrationData)
Charles MacNeill 9:66969b9016ad 414 {
Charles MacNeill 9:66969b9016ad 415
Charles MacNeill 10:3687b5e79f98 416 VL53L1CB_ERROR Status = VL53L1_ERROR_NONE;
Charles MacNeill 9:66969b9016ad 417 Status = VL53L1_GetCalibrationData(Device,pCalibrationData);
Charles MacNeill 9:66969b9016ad 418
Charles MacNeill 9:66969b9016ad 419 return Status;
Charles MacNeill 9:66969b9016ad 420 }
Charles MacNeill 9:66969b9016ad 421
Charles MacNeill 9:66969b9016ad 422
Charles MacNeill 10:3687b5e79f98 423 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetRangingMeasurementData(
Charles MacNeill 9:66969b9016ad 424 VL53L1_RangingMeasurementData_t *pRangingMeasurementData)
Charles MacNeill 9:66969b9016ad 425 {
Charles MacNeill 9:66969b9016ad 426 // printf(" VL53L1_GetRangingMeasurementData 000 \n");
Charles MacNeill 10:3687b5e79f98 427 VL53L1CB_ERROR Status = VL53L1_ERROR_NONE;
Charles MacNeill 9:66969b9016ad 428 Status = VL53L1_GetRangingMeasurementData(Device,pRangingMeasurementData);
Charles MacNeill 9:66969b9016ad 429
Charles MacNeill 9:66969b9016ad 430 return Status;
Charles MacNeill 9:66969b9016ad 431 }
Charles MacNeill 9:66969b9016ad 432
Charles MacNeill 9:66969b9016ad 433
Charles MacNeill 9:66969b9016ad 434
Charles MacNeill 9:66969b9016ad 435
Charles MacNeill 9:66969b9016ad 436
Charles MacNeill 10:3687b5e79f98 437 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetMultiRangingData(
Charles MacNeill 9:66969b9016ad 438 VL53L1_MultiRangingData_t *pMultiRangingData)
Charles MacNeill 9:66969b9016ad 439 {
Charles MacNeill 9:66969b9016ad 440 return VL53L1_GetMultiRangingData(Device,pMultiRangingData);
Charles MacNeill 9:66969b9016ad 441 }
Charles MacNeill 9:66969b9016ad 442
Charles MacNeill 10:3687b5e79f98 443 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetAdditionalData(
Charles MacNeill 9:66969b9016ad 444 VL53L1_AdditionalData_t *pAdditionalData)
Charles MacNeill 9:66969b9016ad 445 {
Charles MacNeill 9:66969b9016ad 446 return VL53L1_GetAdditionalData(Device, pAdditionalData);
Charles MacNeill 9:66969b9016ad 447 }
Charles MacNeill 9:66969b9016ad 448
Charles MacNeill 9:66969b9016ad 449
Charles MacNeill 9:66969b9016ad 450
Charles MacNeill 10:3687b5e79f98 451 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetTuningParameter(
Charles MacNeill 9:66969b9016ad 452 uint16_t TuningParameterId, int32_t TuningParameterValue)
Charles MacNeill 9:66969b9016ad 453 {
Charles MacNeill 9:66969b9016ad 454 return VL53L1_SetTuningParameter(Device,TuningParameterId,TuningParameterValue);
Charles MacNeill 9:66969b9016ad 455 }
Charles MacNeill 9:66969b9016ad 456
Charles MacNeill 10:3687b5e79f98 457 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetTuningParameter(
Charles MacNeill 9:66969b9016ad 458 uint16_t TuningParameterId, int32_t *pTuningParameterValue)
Charles MacNeill 9:66969b9016ad 459 {
Charles MacNeill 9:66969b9016ad 460
Charles MacNeill 9:66969b9016ad 461 return VL53L1_GetTuningParameter(Device,TuningParameterId,pTuningParameterValue);
Charles MacNeill 9:66969b9016ad 462 }
Charles MacNeill 9:66969b9016ad 463
Charles MacNeill 9:66969b9016ad 464
Charles MacNeill 10:3687b5e79f98 465 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetXTalkCompensationEnable(
Charles MacNeill 9:66969b9016ad 466 uint8_t XTalkCompensationEnable)
Charles MacNeill 9:66969b9016ad 467 {
Charles MacNeill 9:66969b9016ad 468
Charles MacNeill 9:66969b9016ad 469 return VL53L1_SetXTalkCompensationEnable(Device,XTalkCompensationEnable);
Charles MacNeill 9:66969b9016ad 470 }
Charles MacNeill 9:66969b9016ad 471
Charles MacNeill 9:66969b9016ad 472
Charles MacNeill 10:3687b5e79f98 473 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetXTalkCompensationEnable(
Charles MacNeill 9:66969b9016ad 474 uint8_t *pXTalkCompensationEnable)
Charles MacNeill 9:66969b9016ad 475 {
Charles MacNeill 10:3687b5e79f98 476 VL53L1CB_ERROR Status = VL53L1_ERROR_NONE;
Charles MacNeill 9:66969b9016ad 477
Charles MacNeill 9:66969b9016ad 478 // LOG_FUNCTION_START("");
Charles MacNeill 9:66969b9016ad 479
Charles MacNeill 9:66969b9016ad 480 VL53L1_GetXTalkCompensationEnable(
Charles MacNeill 9:66969b9016ad 481 Device,
Charles MacNeill 9:66969b9016ad 482 pXTalkCompensationEnable);
Charles MacNeill 9:66969b9016ad 483
Charles MacNeill 9:66969b9016ad 484 // LOG_FUNCTION_END(Status);
Charles MacNeill 9:66969b9016ad 485 return Status;
Charles MacNeill 9:66969b9016ad 486 }
Charles MacNeill 9:66969b9016ad 487
Charles MacNeill 9:66969b9016ad 488
Charles MacNeill 10:3687b5e79f98 489 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformXTalkCalibration(
Charles MacNeill 9:66969b9016ad 490 uint8_t CalibrationOption)
Charles MacNeill 9:66969b9016ad 491 {
Charles MacNeill 9:66969b9016ad 492
Charles MacNeill 9:66969b9016ad 493 return VL53L1_PerformXTalkCalibration(Device,CalibrationOption);
Charles MacNeill 9:66969b9016ad 494 }
Charles MacNeill 9:66969b9016ad 495
Charles MacNeill 10:3687b5e79f98 496 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetOffsetCalibrationMode(
Charles MacNeill 9:66969b9016ad 497 VL53L1_OffsetCalibrationModes OffsetCalibrationMode)
Charles MacNeill 9:66969b9016ad 498 {
Charles MacNeill 9:66969b9016ad 499 return VL53L1_SetOffsetCalibrationMode(Device,OffsetCalibrationMode);
Charles MacNeill 9:66969b9016ad 500 }
Charles MacNeill 9:66969b9016ad 501
Charles MacNeill 10:3687b5e79f98 502 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetOffsetCorrectionMode(
Charles MacNeill 9:66969b9016ad 503 VL53L1_OffsetCorrectionModes OffsetCorrectionMode)
Charles MacNeill 9:66969b9016ad 504 {
Charles MacNeill 9:66969b9016ad 505 return VL53L1_SetOffsetCorrectionMode(Device,OffsetCorrectionMode);
Charles MacNeill 9:66969b9016ad 506 }
Charles MacNeill 9:66969b9016ad 507
Charles MacNeill 10:3687b5e79f98 508 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformOffsetCalibration(
Charles MacNeill 9:66969b9016ad 509 int32_t CalDistanceMilliMeter, FixPoint1616_t CalReflectancePercent)
Charles MacNeill 9:66969b9016ad 510 {
Charles MacNeill 9:66969b9016ad 511 return VL53L1_PerformOffsetCalibration(Device,CalDistanceMilliMeter,CalReflectancePercent);
Charles MacNeill 9:66969b9016ad 512 }
Charles MacNeill 9:66969b9016ad 513
Charles MacNeill 10:3687b5e79f98 514 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformOffsetSimpleCalibration(
Charles MacNeill 9:66969b9016ad 515 int32_t CalDistanceMilliMeter)
Charles MacNeill 9:66969b9016ad 516 {
Charles MacNeill 9:66969b9016ad 517 return VL53L1_PerformOffsetSimpleCalibration(Device,CalDistanceMilliMeter);
Charles MacNeill 9:66969b9016ad 518 }
Charles MacNeill 9:66969b9016ad 519
Charles MacNeill 10:3687b5e79f98 520 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformOffsetZeroDistanceCalibration()
Charles MacNeill 9:66969b9016ad 521 {
Charles MacNeill 9:66969b9016ad 522 return VL53L1_PerformOffsetZeroDistanceCalibration(Device);
Charles MacNeill 9:66969b9016ad 523 }
Charles MacNeill 9:66969b9016ad 524
lugandc 18:0696efe39d08 525 VL53L1CB_ERROR VL53L1CB::VL53L1CB_PerformOffsetPerVcselCalibration(int32_t CalDistanceMilliMeter)
lugandc 18:0696efe39d08 526 {
lugandc 18:0696efe39d08 527 return VL53L1_PerformOffsetPerVcselCalibration(Device,CalDistanceMilliMeter);
lugandc 18:0696efe39d08 528 }
lugandc 18:0696efe39d08 529
Charles MacNeill 10:3687b5e79f98 530 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetCalibrationData(
Charles MacNeill 9:66969b9016ad 531 VL53L1_CalibrationData_t *pCalibrationData)
Charles MacNeill 9:66969b9016ad 532 {
Charles MacNeill 9:66969b9016ad 533 return VL53L1_SetCalibrationData(Device,pCalibrationData);
Charles MacNeill 9:66969b9016ad 534 }
Charles MacNeill 9:66969b9016ad 535
Charles MacNeill 9:66969b9016ad 536
Charles MacNeill 10:3687b5e79f98 537 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetZoneCalibrationData(
Charles MacNeill 9:66969b9016ad 538 VL53L1_ZoneCalibrationData_t *pZoneCalibrationData)
Charles MacNeill 9:66969b9016ad 539 {
Charles MacNeill 9:66969b9016ad 540 return VL53L1_SetZoneCalibrationData(Device, pZoneCalibrationData);
Charles MacNeill 9:66969b9016ad 541 }
Charles MacNeill 9:66969b9016ad 542
Charles MacNeill 10:3687b5e79f98 543 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetZoneCalibrationData(
Charles MacNeill 9:66969b9016ad 544 VL53L1_ZoneCalibrationData_t *pZoneCalibrationData)
Charles MacNeill 9:66969b9016ad 545 {
Charles MacNeill 9:66969b9016ad 546 return VL53L1_GetZoneCalibrationData(Device, pZoneCalibrationData);
Charles MacNeill 9:66969b9016ad 547 }
Charles MacNeill 9:66969b9016ad 548
Charles MacNeill 10:3687b5e79f98 549 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SmudgeCorrectionEnable(
Charles MacNeill 9:66969b9016ad 550 VL53L1_SmudgeCorrectionModes Mode)
Charles MacNeill 9:66969b9016ad 551
Charles MacNeill 9:66969b9016ad 552 {
Charles MacNeill 9:66969b9016ad 553 return VL53L1_SmudgeCorrectionEnable(Device, Mode);
Charles MacNeill 9:66969b9016ad 554 }
Charles MacNeill 9:66969b9016ad 555
Charles MacNeill 10:3687b5e79f98 556 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetOpticalCenter(
Charles MacNeill 9:66969b9016ad 557 FixPoint1616_t *pOpticalCenterX,
Charles MacNeill 9:66969b9016ad 558 FixPoint1616_t *pOpticalCenterY)
Charles MacNeill 9:66969b9016ad 559 {
Charles MacNeill 9:66969b9016ad 560 return VL53L1_GetOpticalCenter(Device,pOpticalCenterX,pOpticalCenterY);
Charles MacNeill 9:66969b9016ad 561 }
Charles MacNeill 9:66969b9016ad 562
Charles MacNeill 10:3687b5e79f98 563 VL53L1CB_ERROR VL53L1CB::VL53L1CB_SetThresholdConfig(VL53L1_DetectionConfig_t *pConfig)
Charles MacNeill 9:66969b9016ad 564 {
Charles MacNeill 9:66969b9016ad 565 return VL53L1_SetThresholdConfig(Device,pConfig);
Charles MacNeill 9:66969b9016ad 566 }
Charles MacNeill 9:66969b9016ad 567
Charles MacNeill 9:66969b9016ad 568
Charles MacNeill 10:3687b5e79f98 569 VL53L1CB_ERROR VL53L1CB::VL53L1CB_GetThresholdConfig(VL53L1_DetectionConfig_t *pConfig)
Charles MacNeill 9:66969b9016ad 570 {
Charles MacNeill 9:66969b9016ad 571 return VL53L1_GetThresholdConfig(Device,pConfig);
Charles MacNeill 9:66969b9016ad 572 }
Charles MacNeill 9:66969b9016ad 573
Charles MacNeill 14:f06785b2a964 574
Charles MacNeill 14:f06785b2a964 575
Charles MacNeill 10:3687b5e79f98 576 int VL53L1CB::handle_irq(uint16_t *distance)
Charles MacNeill 9:66969b9016ad 577 {
Charles MacNeill 9:66969b9016ad 578 int status;
Charles MacNeill 9:66969b9016ad 579 status = get_measurement(distance);
Charles MacNeill 9:66969b9016ad 580 enable_interrupt_measure_detection_irq();
Charles MacNeill 9:66969b9016ad 581 return status;
Charles MacNeill 9:66969b9016ad 582 }
Charles MacNeill 9:66969b9016ad 583
Charles MacNeill 10:3687b5e79f98 584 int VL53L1CB::get_measurement(uint16_t *distance)
Charles MacNeill 9:66969b9016ad 585 {
Charles MacNeill 9:66969b9016ad 586 int status = 0;
lugandc 18:0696efe39d08 587 VL53L1_RangingMeasurementData_t RangingMeasurementData;
Charles MacNeill 9:66969b9016ad 588
lugandc 18:0696efe39d08 589 status = VL53L1CB_GetRangingMeasurementData(&RangingMeasurementData);
lugandc 18:0696efe39d08 590 *distance = RangingMeasurementData.RangeMilliMeter;
lugandc 18:0696efe39d08 591 status = VL53L1CB_ClearInterruptAndStartMeasurement();
Charles MacNeill 9:66969b9016ad 592
Charles MacNeill 9:66969b9016ad 593 return status;
Charles MacNeill 9:66969b9016ad 594 }
Charles MacNeill 9:66969b9016ad 595
Charles MacNeill 10:3687b5e79f98 596 int VL53L1CB::start_measurement(void (*fptr)(void))
Charles MacNeill 9:66969b9016ad 597 {
Charles MacNeill 9:66969b9016ad 598 int status = 0;
Charles MacNeill 9:66969b9016ad 599
Charles MacNeill 9:66969b9016ad 600 if (_gpio1Int == NULL) {
Charles MacNeill 9:66969b9016ad 601 printf("GPIO1 Error\r\n");
Charles MacNeill 9:66969b9016ad 602 return 1;
Charles MacNeill 9:66969b9016ad 603 }
Charles MacNeill 9:66969b9016ad 604
lugandc 18:0696efe39d08 605 VL53L1CB_StopMeasurement(); // it is safer to do this while sensor is stopped
Charles MacNeill 9:66969b9016ad 606
lugandc 18:0696efe39d08 607 attach_interrupt_measure_detection_irq(fptr);
lugandc 18:0696efe39d08 608 enable_interrupt_measure_detection_irq();
Charles MacNeill 9:66969b9016ad 609
lugandc 18:0696efe39d08 610 status = VL53L1CB_StartMeasurement();
Charles MacNeill 9:66969b9016ad 611
Charles MacNeill 9:66969b9016ad 612 return status;
Charles MacNeill 9:66969b9016ad 613 }
Charles MacNeill 9:66969b9016ad 614
Charles MacNeill 10:3687b5e79f98 615 int VL53L1CB::stop_measurement()
Charles MacNeill 9:66969b9016ad 616 {
Charles MacNeill 9:66969b9016ad 617 int status = 0;
Charles MacNeill 9:66969b9016ad 618
Charles MacNeill 9:66969b9016ad 619 if (status == 0) {
lugandc 18:0696efe39d08 620 status = VL53L1CB_StopMeasurement();
Charles MacNeill 9:66969b9016ad 621 }
Charles MacNeill 9:66969b9016ad 622
Charles MacNeill 9:66969b9016ad 623 return status;
Charles MacNeill 9:66969b9016ad 624 }