Statistics
| Branch: | Tag: | Revision:

amiro-lld / include / VL53L0X / v1 / Api_vl53l0x / core / inc / vl53l0x_api.h @ c368a765

History | View | Annotate | Download (73.252 KB)

1
/*******************************************************************************
2
 Copyright � 2016, STMicroelectronics International N.V.
3
 All rights reserved.
4

5
 Redistribution and use in source and binary forms, with or without
6
 modification, are permitted provided that the following conditions are met:
7
 * Redistributions of source code must retain the above copyright
8
 notice, this list of conditions and the following disclaimer.
9
 * Redistributions in binary form must reproduce the above copyright
10
 notice, this list of conditions and the following disclaimer in the
11
 documentation and/or other materials provided with the distribution.
12
 * Neither the name of STMicroelectronics nor the
13
 names of its contributors may be used to endorse or promote products
14
 derived from this software without specific prior written permission.
15

16
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
19
 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
20
 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
21
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 *****************************************************************************/
28

    
29
#ifndef _VL53L0X_API_H_
30
#define _VL53L0X_API_H_
31

    
32

    
33

    
34
#include "vl53l0x_api_strings.h"
35
#include "vl53l0x_def.h"
36
#include "vl53l0x_platform.h"
37

    
38
//#include "alld_vl53l0x.h"
39

    
40

    
41
#ifdef __cplusplus
42
extern "C"
43
{
44
#endif
45

    
46
//#ifdef _MSC_VER
47
//#   ifdef VL53L0X_API_EXPORTS
48
//#       define VL53L0X_API  __declspec(dllexport)
49
//#   else
50
//#       define VL53L0X_API
51
//#   endif
52
//#else
53
#define VL53L0X_API
54
//#endif
55

    
56

    
57

    
58
/** @defgroup VL53L0X_cut11_group VL53L0X cut1.1 Function Definition
59
 *  @brief    VL53L0X cut1.1 Function Definition
60
 *  @{
61
 */
62

    
63
/** @defgroup VL53L0X_general_group VL53L0X General Functions
64
 *  @brief    General functions and definitions
65
 *  @{
66
 */
67

    
68
/**
69
 * @brief Return the VL53L0X PAL Implementation Version
70
 *
71
 * @note This function doesn't access to the device
72
 *
73
 * @param   pVersion              Pointer to current PAL Implementation Version
74
 * @return  VL53L0X_ERROR_NONE     Success
75
 * @return  "Other error code"    See ::VL53L0X_Error
76
 */
77
VL53L0X_API VL53L0X_Error VL53L0X_GetVersion(VL53L0X_Version_t *pVersion);
78

    
79
/**
80
 * @brief Return the PAL Specification Version used for the current
81
 * implementation.
82
 *
83
 * @note This function doesn't access to the device
84
 *
85
 * @param   pPalSpecVersion       Pointer to current PAL Specification Version
86
 * @return  VL53L0X_ERROR_NONE        Success
87
 * @return  "Other error code"    See ::VL53L0X_Error
88
 */
89
VL53L0X_API VL53L0X_Error VL53L0X_GetPalSpecVersion(
90
    VL53L0X_Version_t *pPalSpecVersion);
91

    
92
/**
93
 * @brief Reads the Product Revision for a for given Device
94
 * This function can be used to distinguish cut1.0 from cut1.1.
95
 *
96
 * @note This function Access to the device
97
 *
98
 * @param   Dev                 Device Handle
99
 * @param   pProductRevisionMajor  Pointer to Product Revision Major
100
 * for a given Device
101
 * @param   pProductRevisionMinor  Pointer to Product Revision Minor
102
 * for a given Device
103
 * @return  VL53L0X_ERROR_NONE      Success
104
 * @return  "Other error code"  See ::VL53L0X_Error
105
 */
106
VL53L0X_API VL53L0X_Error VL53L0X_GetProductRevision(VL53L0X_DEV Dev,
107
    uint8_t *pProductRevisionMajor, uint8_t *pProductRevisionMinor);
108

    
109
/**
110
 * @brief Reads the Device information for given Device
111
 *
112
 * @note This function Access to the device
113
 *
114
 * @param   Dev                 Device Handle
115
 * @param   pVL53L0X_DeviceInfo  Pointer to current device info for a given
116
 *  Device
117
 * @return  VL53L0X_ERROR_NONE   Success
118
 * @return  "Other error code"  See ::VL53L0X_Error
119
 */
120
VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceInfo(VL53L0X_DEV Dev,
121
    VL53L0X_DeviceInfo_t *pVL53L0X_DeviceInfo);
122

    
123
/**
124
 * @brief Read current status of the error register for the selected device
125
 *
126
 * @note This function Access to the device
127
 *
128
 * @param   Dev                   Device Handle
129
 * @param   pDeviceErrorStatus    Pointer to current error code of the device
130
 * @return  VL53L0X_ERROR_NONE     Success
131
 * @return  "Other error code"    See ::VL53L0X_Error
132
 */
133
VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceErrorStatus(VL53L0X_DEV Dev,
134
    VL53L0X_DeviceError *pDeviceErrorStatus);
135

    
136
/**
137
 * @brief Human readable Range Status string for a given RangeStatus
138
 *
139
 * @note This function doesn't access to the device
140
 *
141
 * @param   RangeStatus         The RangeStatus code as stored on
142
 * @a VL53L0X_RangingMeasurementData_t
143
 * @param   pRangeStatusString  The returned RangeStatus string.
144
 * @return  VL53L0X_ERROR_NONE   Success
145
 * @return  "Other error code"  See ::VL53L0X_Error
146
 */
147
VL53L0X_API VL53L0X_Error VL53L0X_GetRangeStatusString(uint8_t RangeStatus,
148
    char *pRangeStatusString);
149

    
150
/**
151
 * @brief Human readable error string for a given Error Code
152
 *
153
 * @note This function doesn't access to the device
154
 *
155
 * @param   ErrorCode           The error code as stored on ::VL53L0X_DeviceError
156
 * @param   pDeviceErrorString  The error string corresponding to the ErrorCode
157
 * @return  VL53L0X_ERROR_NONE   Success
158
 * @return  "Other error code"  See ::VL53L0X_Error
159
 */
160
VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceErrorString(
161
    VL53L0X_DeviceError ErrorCode, char *pDeviceErrorString);
162

    
163
/**
164
 * @brief Human readable error string for current PAL error status
165
 *
166
 * @note This function doesn't access to the device
167
 *
168
 * @param   PalErrorCode       The error code as stored on @a VL53L0X_Error
169
 * @param   pPalErrorString    The error string corresponding to the
170
 * PalErrorCode
171
 * @return  VL53L0X_ERROR_NONE  Success
172
 * @return  "Other error code" See ::VL53L0X_Error
173
 */
174
VL53L0X_API VL53L0X_Error VL53L0X_GetPalErrorString(VL53L0X_Error PalErrorCode,
175
    char *pPalErrorString);
176

    
177
/**
178
 * @brief Human readable PAL State string
179
 *
180
 * @note This function doesn't access to the device
181
 *
182
 * @param   PalStateCode          The State code as stored on @a VL53L0X_State
183
 * @param   pPalStateString       The State string corresponding to the
184
 * PalStateCode
185
 * @return  VL53L0X_ERROR_NONE     Success
186
 * @return  "Other error code"    See ::VL53L0X_Error
187
 */
188
VL53L0X_API VL53L0X_Error VL53L0X_GetPalStateString(VL53L0X_State PalStateCode,
189
    char *pPalStateString);
190

    
191
/**
192
 * @brief Reads the internal state of the PAL for a given Device
193
 *
194
 * @note This function doesn't access to the device
195
 *
196
 * @param   Dev                   Device Handle
197
 * @param   pPalState             Pointer to current state of the PAL for a
198
 * given Device
199
 * @return  VL53L0X_ERROR_NONE     Success
200
 * @return  "Other error code"    See ::VL53L0X_Error
201
 */
202
VL53L0X_API VL53L0X_Error VL53L0X_GetPalState(VL53L0X_DEV Dev,
203
    VL53L0X_State *pPalState);
204

    
205
/**
206
 * @brief Set the power mode for a given Device
207
 * The power mode can be Standby or Idle. Different level of both Standby and
208
 * Idle can exists.
209
 * This function should not be used when device is in Ranging state.
210
 *
211
 * @note This function Access to the device
212
 *
213
 * @param   Dev                   Device Handle
214
 * @param   PowerMode             The value of the power mode to set.
215
 * see ::VL53L0X_PowerModes
216
 *                                Valid values are:
217
 *                                VL53L0X_POWERMODE_STANDBY_LEVEL1,
218
 *                                VL53L0X_POWERMODE_IDLE_LEVEL1
219
 * @return  VL53L0X_ERROR_NONE                  Success
220
 * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED    This error occurs when PowerMode
221
 * is not in the supported list
222
 * @return  "Other error code"    See ::VL53L0X_Error
223
 */
224
VL53L0X_API VL53L0X_Error VL53L0X_SetPowerMode(VL53L0X_DEV Dev,
225
    VL53L0X_PowerModes PowerMode);
226

    
227
/**
228
 * @brief Get the power mode for a given Device
229
 *
230
 * @note This function Access to the device
231
 *
232
 * @param   Dev                   Device Handle
233
 * @param   pPowerMode            Pointer to the current value of the power
234
 * mode. see ::VL53L0X_PowerModes
235
 *                                Valid values are:
236
 *                                VL53L0X_POWERMODE_STANDBY_LEVEL1,
237
 *                                VL53L0X_POWERMODE_IDLE_LEVEL1
238
 * @return  VL53L0X_ERROR_NONE     Success
239
 * @return  "Other error code"    See ::VL53L0X_Error
240
 */
241
VL53L0X_API VL53L0X_Error VL53L0X_GetPowerMode(VL53L0X_DEV Dev,
242
    VL53L0X_PowerModes *pPowerMode);
243

    
244
/**
245
 * Set or over-hide part to part calibration offset
246
 * \sa VL53L0X_DataInit()   VL53L0X_GetOffsetCalibrationDataMicroMeter()
247
 *
248
 * @note This function Access to the device
249
 *
250
 * @param   Dev                                Device Handle
251
 * @param   OffsetCalibrationDataMicroMeter    Offset (microns)
252
 * @return  VL53L0X_ERROR_NONE                  Success
253
 * @return  "Other error code"                 See ::VL53L0X_Error
254
 */
255
VL53L0X_API VL53L0X_Error VL53L0X_SetOffsetCalibrationDataMicroMeter(
256
    VL53L0X_DEV Dev, int32_t OffsetCalibrationDataMicroMeter);
257

    
258
/**
259
 * @brief Get part to part calibration offset
260
 *
261
 * @par Function Description
262
 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
263
 * device NVM value
264
 *
265
 * @note This function Access to the device
266
 *
267
 * @param   Dev                                Device Handle
268
 * @param   pOffsetCalibrationDataMicroMeter   Return part to part
269
 * calibration offset from device (microns)
270
 * @return  VL53L0X_ERROR_NONE                  Success
271
 * @return  "Other error code"                 See ::VL53L0X_Error
272
 */
273
VL53L0X_API VL53L0X_Error VL53L0X_GetOffsetCalibrationDataMicroMeter(
274
    VL53L0X_DEV Dev, int32_t *pOffsetCalibrationDataMicroMeter);
275

    
276
/**
277
 * Set the linearity corrective gain
278
 *
279
 * @note This function Access to the device
280
 *
281
 * @param   Dev                                Device Handle
282
 * @param   LinearityCorrectiveGain            Linearity corrective
283
 * gain in x1000
284
 * if value is 1000 then no modification is applied.
285
 * @return  VL53L0X_ERROR_NONE                  Success
286
 * @return  "Other error code"                 See ::VL53L0X_Error
287
 */
288
VL53L0X_API VL53L0X_Error VL53L0X_SetLinearityCorrectiveGain(VL53L0X_DEV Dev,
289
    int16_t LinearityCorrectiveGain);
290

    
291
/**
292
 * @brief Get the linearity corrective gain
293
 *
294
 * @par Function Description
295
 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
296
 * device NVM value
297
 *
298
 * @note This function Access to the device
299
 *
300
 * @param   Dev                                Device Handle
301
 * @param   pLinearityCorrectiveGain           Pointer to the linearity
302
 * corrective gain in x1000
303
 * if value is 1000 then no modification is applied.
304
 * @return  VL53L0X_ERROR_NONE                  Success
305
 * @return  "Other error code"                 See ::VL53L0X_Error
306
 */
307
VL53L0X_API VL53L0X_Error VL53L0X_GetLinearityCorrectiveGain(VL53L0X_DEV Dev,
308
    uint16_t *pLinearityCorrectiveGain);
309

    
310
/**
311
 * Set Group parameter Hold state
312
 *
313
 * @par Function Description
314
 * Set or remove device internal group parameter hold
315
 *
316
 * @note This function is not Implemented
317
 *
318
 * @param   Dev      Device Handle
319
 * @param   GroupParamHold   Group parameter Hold state to be set (on/off)
320
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED        Not implemented
321
 */
322
VL53L0X_API VL53L0X_Error VL53L0X_SetGroupParamHold(VL53L0X_DEV Dev,
323
    uint8_t GroupParamHold);
324

    
325
/**
326
 * @brief Get the maximal distance for actual setup
327
 * @par Function Description
328
 * Device must be initialized through @a VL53L0X_SetParameters() prior calling
329
 * this function.
330
 *
331
 * Any range value more than the value returned is to be considered as
332
 * "no target detected" or
333
 * "no target in detectable range"\n
334
 * @warning The maximal distance depends on the setup
335
 *
336
 * @note This function is not Implemented
337
 *
338
 * @param   Dev      Device Handle
339
 * @param   pUpperLimitMilliMeter   The maximal range limit for actual setup
340
 * (in millimeter)
341
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED        Not implemented
342
 */
343
VL53L0X_API VL53L0X_Error VL53L0X_GetUpperLimitMilliMeter(VL53L0X_DEV Dev,
344
    uint16_t *pUpperLimitMilliMeter);
345

    
346

    
347
/**
348
 * @brief Get the Total Signal Rate
349
 * @par Function Description
350
 * This function will return the Total Signal Rate after a good ranging is done.
351
 *
352
 * @note This function access to Device
353
 *
354
 * @param   Dev      Device Handle
355
 * @param   pTotalSignalRate   Total Signal Rate value in Mega count per second
356
 * @return  VL53L0X_ERROR_NONE     Success
357
 * @return  "Other error code"    See ::VL53L0X_Error
358
 */
359
VL53L0X_Error VL53L0X_GetTotalSignalRate(VL53L0X_DEV Dev,
360
    FixPoint1616_t *pTotalSignalRate);
361

    
362
/** @} VL53L0X_general_group */
363

    
364
/** @defgroup VL53L0X_init_group VL53L0X Init Functions
365
 *  @brief    VL53L0X Init Functions
366
 *  @{
367
 */
368

    
369
/**
370
 * @brief Set new device address
371
 *
372
 * After completion the device will answer to the new address programmed.
373
 * This function should be called when several devices are used in parallel
374
 * before start programming the sensor.
375
 * When a single device us used, there is no need to call this function.
376
 *
377
 * @note This function Access to the device
378
 *
379
 * @param   Dev                   Device Handle
380
 * @param   DeviceAddress         The new Device address
381
 * @return  VL53L0X_ERROR_NONE     Success
382
 * @return  "Other error code"    See ::VL53L0X_Error
383
 */
384
VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceAddress(VL53L0X_DEV Dev,
385
    uint8_t DeviceAddress);
386

    
387
/**
388
 *
389
 * @brief One time device initialization
390
 *
391
 * To be called once and only once after device is brought out of reset
392
 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted()
393
 *
394
 * @par Function Description
395
 * When not used after a fresh device "power up" or reset, it may return
396
 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data
397
 * may have been fetched from device that can result in ranging offset error\n
398
 * If application cannot execute device reset or need to run VL53L0X_DataInit
399
 * multiple time then it  must ensure proper offset calibration saving and
400
 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first
401
 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init
402
 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to
403
 * VL53L0X_STATE_WAIT_STATICINIT.
404
 *
405
 * @note This function Access to the device
406
 *
407
 * @param   Dev                   Device Handle
408
 * @return  VL53L0X_ERROR_NONE     Success
409
 * @return  "Other error code"    See ::VL53L0X_Error
410
 */
411
VL53L0X_API VL53L0X_Error VL53L0X_DataInit(VL53L0X_DEV Dev);
412

    
413
/**
414
 * @brief Set the tuning settings pointer
415
 *
416
 * This function is used to specify the Tuning settings buffer to be used
417
 * for a given device. The buffer contains all the necessary data to permit
418
 * the API to write tuning settings.
419
 * This function permit to force the usage of either external or internal
420
 * tuning settings.
421
 *
422
 * @note This function Access to the device
423
 *
424
 * @param   Dev                             Device Handle
425
 * @param   pTuningSettingBuffer            Pointer to tuning settings buffer.
426
 * @param   UseInternalTuningSettings       Use internal tuning settings value.
427
 * @return  VL53L0X_ERROR_NONE     Success
428
 * @return  "Other error code"    See ::VL53L0X_Error
429
 */
430
VL53L0X_API VL53L0X_Error VL53L0X_SetTuningSettingBuffer(VL53L0X_DEV Dev,
431
    uint8_t *pTuningSettingBuffer, uint8_t UseInternalTuningSettings);
432

    
433
/**
434
 * @brief Get the tuning settings pointer and the internal external switch
435
 * value.
436
 *
437
 * This function is used to get the Tuning settings buffer pointer and the
438
 * value.
439
 * of the switch to select either external or internal tuning settings.
440
 *
441
 * @note This function Access to the device
442
 *
443
 * @param   Dev                        Device Handle
444
 * @param   ppTuningSettingBuffer      Pointer to tuning settings buffer.
445
 * @param   pUseInternalTuningSettings Pointer to store Use internal tuning
446
 *                                     settings value.
447
 * @return  VL53L0X_ERROR_NONE          Success
448
 * @return  "Other error code"         See ::VL53L0X_Error
449
 */
450
VL53L0X_API VL53L0X_Error VL53L0X_GetTuningSettingBuffer(VL53L0X_DEV Dev,
451
    uint8_t **ppTuningSettingBuffer, uint8_t *pUseInternalTuningSettings);
452

    
453
/**
454
 * @brief Do basic device init (and eventually patch loading)
455
 * This function will change the VL53L0X_State from
456
 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
457
 * In this stage all default setting will be applied.
458
 *
459
 * @note This function Access to the device
460
 *
461
 * @param   Dev                   Device Handle
462
 * @return  VL53L0X_ERROR_NONE     Success
463
 * @return  "Other error code"    See ::VL53L0X_Error
464
 */
465
VL53L0X_API VL53L0X_Error VL53L0X_StaticInit(VL53L0X_DEV Dev);
466

    
467
/**
468
 * @brief Wait for device booted after chip enable (hardware standby)
469
 * This function can be run only when VL53L0X_State is VL53L0X_STATE_POWERDOWN.
470
 *
471
 * @note This function is not Implemented
472
 *
473
 * @param   Dev      Device Handle
474
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
475
 *
476
 */
477
VL53L0X_API VL53L0X_Error VL53L0X_WaitDeviceBooted(VL53L0X_DEV Dev);
478

    
479
/**
480
 * @brief Do an hard reset or soft reset (depending on implementation) of the
481
 * device \nAfter call of this function, device must be in same state as right
482
 * after a power-up sequence.This function will change the VL53L0X_State to
483
 * VL53L0X_STATE_POWERDOWN.
484
 *
485
 * @note This function Access to the device
486
 *
487
 * @param   Dev                   Device Handle
488
 * @return  VL53L0X_ERROR_NONE     Success
489
 * @return  "Other error code"    See ::VL53L0X_Error
490
 */
491
VL53L0X_API VL53L0X_Error VL53L0X_ResetDevice(VL53L0X_DEV Dev);
492

    
493
/** @} VL53L0X_init_group */
494

    
495
/** @defgroup VL53L0X_parameters_group VL53L0X Parameters Functions
496
 *  @brief    Functions used to prepare and setup the device
497
 *  @{
498
 */
499

    
500
/**
501
 * @brief  Prepare device for operation
502
 * @par Function Description
503
 * Update device with provided parameters
504
 * @li Then start ranging operation.
505
 *
506
 * @note This function Access to the device
507
 *
508
 * @param   Dev                   Device Handle
509
 * @param   pDeviceParameters     Pointer to store current device parameters.
510
 * @return  VL53L0X_ERROR_NONE     Success
511
 * @return  "Other error code"    See ::VL53L0X_Error
512
 */
513
VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceParameters(VL53L0X_DEV Dev,
514
    const VL53L0X_DeviceParameters_t *pDeviceParameters);
515

    
516
/**
517
 * @brief  Retrieve current device parameters
518
 * @par Function Description
519
 * Get actual parameters of the device
520
 * @li Then start ranging operation.
521
 *
522
 * @note This function Access to the device
523
 *
524
 * @param   Dev                   Device Handle
525
 * @param   pDeviceParameters     Pointer to store current device parameters.
526
 * @return  VL53L0X_ERROR_NONE     Success
527
 * @return  "Other error code"    See ::VL53L0X_Error
528
 */
529
VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceParameters(VL53L0X_DEV Dev,
530
    VL53L0X_DeviceParameters_t *pDeviceParameters);
531

    
532
/**
533
 * @brief  Set a new device mode
534
 * @par Function Description
535
 * Set device to a new mode (ranging, histogram ...)
536
 *
537
 * @note This function doesn't Access to the device
538
 *
539
 * @param   Dev                   Device Handle
540
 * @param   DeviceMode            New device mode to apply
541
 *                                Valid values are:
542
 *                                VL53L0X_DEVICEMODE_SINGLE_RANGING
543
 *                                VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
544
 *                                VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
545
 *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
546
 *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
547
 *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
548
 *                                VL53L0X_HISTOGRAMMODE_BOTH
549
 *
550
 *
551
 * @return  VL53L0X_ERROR_NONE               Success
552
 * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when DeviceMode is
553
 *                                          not in the supported list
554
 */
555
VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceMode(VL53L0X_DEV Dev,
556
    VL53L0X_DeviceModes DeviceMode);
557

    
558
/**
559
 * @brief  Get current new device mode
560
 * @par Function Description
561
 * Get actual mode of the device(ranging, histogram ...)
562
 *
563
 * @note This function doesn't Access to the device
564
 *
565
 * @param   Dev                   Device Handle
566
 * @param   pDeviceMode           Pointer to current apply mode value
567
 *                                Valid values are:
568
 *                                VL53L0X_DEVICEMODE_SINGLE_RANGING
569
 *                                VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
570
 *                                VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
571
 *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
572
 *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
573
 *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
574
 *                                VL53L0X_HISTOGRAMMODE_BOTH
575
 *
576
 * @return  VL53L0X_ERROR_NONE                   Success
577
 * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED     This error occurs when
578
 * DeviceMode is not in the supported list
579
 */
580
VL53L0X_API VL53L0X_Error VL53L0X_GetDeviceMode(VL53L0X_DEV Dev,
581
    VL53L0X_DeviceModes *pDeviceMode);
582

    
583
/**
584
 * @brief  Sets the resolution of range measurements.
585
 * @par Function Description
586
 * Set resolution of range measurements to either 0.25mm if
587
 * fraction enabled or 1mm if not enabled.
588
 *
589
 * @note This function Accesses the device
590
 *
591
 * @param   Dev               Device Handle
592
 * @param   Enable            Enable high resolution
593
 *
594
 * @return  VL53L0X_ERROR_NONE               Success
595
 * @return  "Other error code"              See ::VL53L0X_Error
596
 */
597
VL53L0X_API VL53L0X_Error VL53L0X_SetRangeFractionEnable(VL53L0X_DEV Dev,
598
    uint8_t Enable);
599

    
600
/**
601
 * @brief  Gets the fraction enable parameter indicating the resolution of
602
 * range measurements.
603
 *
604
 * @par Function Description
605
 * Gets the fraction enable state, which translates to the resolution of
606
 * range measurements as follows :Enabled:=0.25mm resolution,
607
 * Not Enabled:=1mm resolution.
608
 *
609
 * @note This function Accesses the device
610
 *
611
 * @param   Dev               Device Handle
612
 * @param   pEnable           Output Parameter reporting the fraction enable state.
613
 *
614
 * @return  VL53L0X_ERROR_NONE                   Success
615
 * @return  "Other error code"                  See ::VL53L0X_Error
616
 */
617
VL53L0X_API VL53L0X_Error VL53L0X_GetFractionEnable(VL53L0X_DEV Dev,
618
    uint8_t *pEnable);
619

    
620
/**
621
 * @brief  Set a new Histogram mode
622
 * @par Function Description
623
 * Set device to a new Histogram mode
624
 *
625
 * @note This function doesn't Access to the device
626
 *
627
 * @param   Dev                   Device Handle
628
 * @param   HistogramMode         New device mode to apply
629
 *                                Valid values are:
630
 *                                VL53L0X_HISTOGRAMMODE_DISABLED
631
 *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
632
 *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
633
 *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
634
 *                                VL53L0X_HISTOGRAMMODE_BOTH
635
 *
636
 * @return  VL53L0X_ERROR_NONE                   Success
637
 * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED     This error occurs when
638
 * HistogramMode is not in the supported list
639
 * @return  "Other error code"    See ::VL53L0X_Error
640
 */
641
VL53L0X_API VL53L0X_Error VL53L0X_SetHistogramMode(VL53L0X_DEV Dev,
642
    VL53L0X_HistogramModes HistogramMode);
643

    
644
/**
645
 * @brief  Get current new device mode
646
 * @par Function Description
647
 * Get current Histogram mode of a Device
648
 *
649
 * @note This function doesn't Access to the device
650
 *
651
 * @param   Dev                   Device Handle
652
 * @param   pHistogramMode        Pointer to current Histogram Mode value
653
 *                                Valid values are:
654
 *                                VL53L0X_HISTOGRAMMODE_DISABLED
655
 *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
656
 *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
657
 *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
658
 *                                VL53L0X_HISTOGRAMMODE_BOTH
659
 * @return  VL53L0X_ERROR_NONE     Success
660
 * @return  "Other error code"    See ::VL53L0X_Error
661
 */
662
VL53L0X_API VL53L0X_Error VL53L0X_GetHistogramMode(VL53L0X_DEV Dev,
663
    VL53L0X_HistogramModes *pHistogramMode);
664

    
665
/**
666
 * @brief Set Ranging Timing Budget in microseconds
667
 *
668
 * @par Function Description
669
 * Defines the maximum time allowed by the user to the device to run a
670
 * full ranging sequence for the current mode (ranging, histogram, ASL ...)
671
 *
672
 * @note This function Access to the device
673
 *
674
 * @param   Dev                                Device Handle
675
 * @param MeasurementTimingBudgetMicroSeconds  Max measurement time in
676
 * microseconds.
677
 *                                   Valid values are:
678
 *                                   >= 17000 microsecs when wraparound enabled
679
 *                                   >= 12000 microsecs when wraparound disabled
680
 * @return  VL53L0X_ERROR_NONE             Success
681
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned if
682
 MeasurementTimingBudgetMicroSeconds out of range
683
 * @return  "Other error code"            See ::VL53L0X_Error
684
 */
685
VL53L0X_API VL53L0X_Error VL53L0X_SetMeasurementTimingBudgetMicroSeconds(
686
    VL53L0X_DEV Dev, uint32_t MeasurementTimingBudgetMicroSeconds);
687

    
688
/**
689
 * @brief Get Ranging Timing Budget in microseconds
690
 *
691
 * @par Function Description
692
 * Returns the programmed the maximum time allowed by the user to the
693
 * device to run a full ranging sequence for the current mode
694
 * (ranging, histogram, ASL ...)
695
 *
696
 * @note This function Access to the device
697
 *
698
 * @param   Dev                                    Device Handle
699
 * @param   pMeasurementTimingBudgetMicroSeconds   Max measurement time in
700
 * microseconds.
701
 *                                   Valid values are:
702
 *                                   >= 17000 microsecs when wraparound enabled
703
 *                                   >= 12000 microsecs when wraparound disabled
704
 * @return  VL53L0X_ERROR_NONE                      Success
705
 * @return  "Other error code"                     See ::VL53L0X_Error
706
 */
707
VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementTimingBudgetMicroSeconds(
708
    VL53L0X_DEV Dev, uint32_t *pMeasurementTimingBudgetMicroSeconds);
709

    
710
/**
711
 * @brief Gets the VCSEL pulse period.
712
 *
713
 * @par Function Description
714
 * This function retrieves the VCSEL pulse period for the given period type.
715
 *
716
 * @note This function Accesses the device
717
 *
718
 * @param   Dev                      Device Handle
719
 * @param   VcselPeriodType          VCSEL period identifier (pre-range|final).
720
 * @param   pVCSELPulsePeriod        Pointer to VCSEL period value.
721
 * @return  VL53L0X_ERROR_NONE        Success
722
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error VcselPeriodType parameter not
723
 *                                       supported.
724
 * @return  "Other error code"           See ::VL53L0X_Error
725
 */
726
VL53L0X_API VL53L0X_Error VL53L0X_GetVcselPulsePeriod(VL53L0X_DEV Dev,
727
    VL53L0X_VcselPeriod VcselPeriodType, uint8_t *pVCSELPulsePeriod);
728

    
729
/**
730
 * @brief Sets the VCSEL pulse period.
731
 *
732
 * @par Function Description
733
 * This function retrieves the VCSEL pulse period for the given period type.
734
 *
735
 * @note This function Accesses the device
736
 *
737
 * @param   Dev                       Device Handle
738
 * @param   VcselPeriodType              VCSEL period identifier (pre-range|final).
739
 * @param   VCSELPulsePeriod          VCSEL period value
740
 * @return  VL53L0X_ERROR_NONE            Success
741
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error VcselPeriodType parameter not
742
 *                                       supported.
743
 * @return  "Other error code"           See ::VL53L0X_Error
744
 */
745
VL53L0X_API VL53L0X_Error VL53L0X_SetVcselPulsePeriod(VL53L0X_DEV Dev,
746
    VL53L0X_VcselPeriod VcselPeriodType, uint8_t VCSELPulsePeriod);
747

    
748
/**
749
 * @brief Sets the (on/off) state of a requested sequence step.
750
 *
751
 * @par Function Description
752
 * This function enables/disables a requested sequence step.
753
 *
754
 * @note This function Accesses the device
755
 *
756
 * @param   Dev                          Device Handle
757
 * @param   SequenceStepId                 Sequence step identifier.
758
 * @param   SequenceStepEnabled          Demanded state {0=Off,1=On}
759
 *                                       is enabled.
760
 * @return  VL53L0X_ERROR_NONE            Success
761
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
762
 *                                       supported.
763
 * @return  "Other error code"           See ::VL53L0X_Error
764
 */
765
VL53L0X_API VL53L0X_Error VL53L0X_SetSequenceStepEnable(VL53L0X_DEV Dev,
766
    VL53L0X_SequenceStepId SequenceStepId, uint8_t SequenceStepEnabled);
767

    
768
/**
769
 * @brief Gets the (on/off) state of a requested sequence step.
770
 *
771
 * @par Function Description
772
 * This function retrieves the state of a requested sequence step, i.e. on/off.
773
 *
774
 * @note This function Accesses the device
775
 *
776
 * @param   Dev                    Device Handle
777
 * @param   SequenceStepId         Sequence step identifier.
778
 * @param   pSequenceStepEnabled   Out parameter reporting if the sequence step
779
 *                                 is enabled {0=Off,1=On}.
780
 * @return  VL53L0X_ERROR_NONE            Success
781
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
782
 *                                       supported.
783
 * @return  "Other error code"           See ::VL53L0X_Error
784
 */
785
VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepEnable(VL53L0X_DEV Dev,
786
    VL53L0X_SequenceStepId SequenceStepId, uint8_t *pSequenceStepEnabled);
787

    
788
/**
789
 * @brief Gets the (on/off) state of all sequence steps.
790
 *
791
 * @par Function Description
792
 * This function retrieves the state of all sequence step in the scheduler.
793
 *
794
 * @note This function Accesses the device
795
 *
796
 * @param   Dev                          Device Handle
797
 * @param   pSchedulerSequenceSteps      Pointer to struct containing result.
798
 * @return  VL53L0X_ERROR_NONE            Success
799
 * @return  "Other error code"           See ::VL53L0X_Error
800
 */
801
VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepEnables(VL53L0X_DEV Dev,
802
    VL53L0X_SchedulerSequenceSteps_t *pSchedulerSequenceSteps);
803

    
804
/**
805
 * @brief Sets the timeout of a requested sequence step.
806
 *
807
 * @par Function Description
808
 * This function sets the timeout of a requested sequence step.
809
 *
810
 * @note This function Accesses the device
811
 *
812
 * @param   Dev                          Device Handle
813
 * @param   SequenceStepId               Sequence step identifier.
814
 * @param   TimeOutMilliSecs             Demanded timeout
815
 * @return  VL53L0X_ERROR_NONE            Success
816
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
817
 *                                       supported.
818
 * @return  "Other error code"           See ::VL53L0X_Error
819
 */
820
VL53L0X_API VL53L0X_Error VL53L0X_SetSequenceStepTimeout(VL53L0X_DEV Dev,
821
    VL53L0X_SequenceStepId SequenceStepId, FixPoint1616_t TimeOutMilliSecs);
822

    
823
/**
824
 * @brief Gets the timeout of a requested sequence step.
825
 *
826
 * @par Function Description
827
 * This function retrieves the timeout of a requested sequence step.
828
 *
829
 * @note This function Accesses the device
830
 *
831
 * @param   Dev                          Device Handle
832
 * @param   SequenceStepId               Sequence step identifier.
833
 * @param   pTimeOutMilliSecs            Timeout value.
834
 * @return  VL53L0X_ERROR_NONE            Success
835
 * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
836
 *                                       supported.
837
 * @return  "Other error code"           See ::VL53L0X_Error
838
 */
839
VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepTimeout(VL53L0X_DEV Dev,
840
    VL53L0X_SequenceStepId SequenceStepId,
841
    FixPoint1616_t *pTimeOutMilliSecs);
842

    
843
/**
844
 * @brief Gets number of sequence steps managed by the API.
845
 *
846
 * @par Function Description
847
 * This function retrieves the number of sequence steps currently managed
848
 * by the API
849
 *
850
 * @note This function Accesses the device
851
 *
852
 * @param   Dev                          Device Handle
853
 * @param   pNumberOfSequenceSteps       Out parameter reporting the number of
854
 *                                       sequence steps.
855
 * @return  VL53L0X_ERROR_NONE            Success
856
 * @return  "Other error code"           See ::VL53L0X_Error
857
 */
858
VL53L0X_API VL53L0X_Error VL53L0X_GetNumberOfSequenceSteps(VL53L0X_DEV Dev,
859
    uint8_t *pNumberOfSequenceSteps);
860

    
861
/**
862
 * @brief Gets the name of a given sequence step.
863
 *
864
 * @par Function Description
865
 * This function retrieves the name of sequence steps corresponding to
866
 * SequenceStepId.
867
 *
868
 * @note This function doesn't Accesses the device
869
 *
870
 * @param   SequenceStepId               Sequence step identifier.
871
 * @param   pSequenceStepsString         Pointer to Info string
872
 *
873
 * @return  VL53L0X_ERROR_NONE            Success
874
 * @return  "Other error code"           See ::VL53L0X_Error
875
 */
876
VL53L0X_API VL53L0X_Error VL53L0X_GetSequenceStepsInfo(
877
    VL53L0X_SequenceStepId SequenceStepId, char *pSequenceStepsString);
878

    
879
/**
880
 * Program continuous mode Inter-Measurement period in milliseconds
881
 *
882
 * @par Function Description
883
 * When trying to set too short time return  INVALID_PARAMS minimal value
884
 *
885
 * @note This function Access to the device
886
 *
887
 * @param   Dev                                  Device Handle
888
 * @param   InterMeasurementPeriodMilliSeconds   Inter-Measurement Period in ms.
889
 * @return  VL53L0X_ERROR_NONE                    Success
890
 * @return  "Other error code"                   See ::VL53L0X_Error
891
 */
892
VL53L0X_API VL53L0X_Error VL53L0X_SetInterMeasurementPeriodMilliSeconds(
893
    VL53L0X_DEV Dev, uint32_t InterMeasurementPeriodMilliSeconds);
894

    
895
/**
896
 * Get continuous mode Inter-Measurement period in milliseconds
897
 *
898
 * @par Function Description
899
 * When trying to set too short time return  INVALID_PARAMS minimal value
900
 *
901
 * @note This function Access to the device
902
 *
903
 * @param   Dev                                  Device Handle
904
 * @param   pInterMeasurementPeriodMilliSeconds  Pointer to programmed
905
 *  Inter-Measurement Period in milliseconds.
906
 * @return  VL53L0X_ERROR_NONE                    Success
907
 * @return  "Other error code"                   See ::VL53L0X_Error
908
 */
909
VL53L0X_API VL53L0X_Error VL53L0X_GetInterMeasurementPeriodMilliSeconds(
910
    VL53L0X_DEV Dev, uint32_t *pInterMeasurementPeriodMilliSeconds);
911

    
912
/**
913
 * @brief Enable/Disable Cross talk compensation feature
914
 *
915
 * @note This function is not Implemented.
916
 * Enable/Disable Cross Talk by set to zero the Cross Talk value
917
 * by using @a VL53L0X_SetXTalkCompensationRateMegaCps().
918
 *
919
 * @param   Dev                       Device Handle
920
 * @param   XTalkCompensationEnable   Cross talk compensation
921
 *  to be set 0=disabled else = enabled
922
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
923
 */
924
VL53L0X_API VL53L0X_Error VL53L0X_SetXTalkCompensationEnable(VL53L0X_DEV Dev,
925
    uint8_t XTalkCompensationEnable);
926

    
927
/**
928
 * @brief Get Cross talk compensation rate
929
 *
930
 * @note This function is not Implemented.
931
 * Enable/Disable Cross Talk by set to zero the Cross Talk value by
932
 * using @a VL53L0X_SetXTalkCompensationRateMegaCps().
933
 *
934
 * @param   Dev                        Device Handle
935
 * @param   pXTalkCompensationEnable   Pointer to the Cross talk compensation
936
 *  state 0=disabled or 1 = enabled
937
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
938
 */
939
VL53L0X_API VL53L0X_Error VL53L0X_GetXTalkCompensationEnable(VL53L0X_DEV Dev,
940
    uint8_t *pXTalkCompensationEnable);
941

    
942
/**
943
 * @brief Set Cross talk compensation rate
944
 *
945
 * @par Function Description
946
 * Set Cross talk compensation rate.
947
 *
948
 * @note This function Access to the device
949
 *
950
 * @param   Dev                            Device Handle
951
 * @param   XTalkCompensationRateMegaCps   Compensation rate in
952
 *  Mega counts per second (16.16 fix point) see datasheet for details
953
 * @return  VL53L0X_ERROR_NONE              Success
954
 * @return  "Other error code"             See ::VL53L0X_Error
955
 */
956
VL53L0X_API VL53L0X_Error VL53L0X_SetXTalkCompensationRateMegaCps(VL53L0X_DEV Dev,
957
    FixPoint1616_t XTalkCompensationRateMegaCps);
958

    
959
/**
960
 * @brief Get Cross talk compensation rate
961
 *
962
 * @par Function Description
963
 * Get Cross talk compensation rate.
964
 *
965
 * @note This function Access to the device
966
 *
967
 * @param   Dev                            Device Handle
968
 * @param   pXTalkCompensationRateMegaCps  Pointer to Compensation rate
969
 in Mega counts per second (16.16 fix point) see datasheet for details
970
 * @return  VL53L0X_ERROR_NONE              Success
971
 * @return  "Other error code"             See ::VL53L0X_Error
972
 */
973
VL53L0X_API VL53L0X_Error VL53L0X_GetXTalkCompensationRateMegaCps(VL53L0X_DEV Dev,
974
    FixPoint1616_t *pXTalkCompensationRateMegaCps);
975

    
976
/**
977
 * @brief Set Reference Calibration Parameters
978
 *
979
 * @par Function Description
980
 * Set Reference Calibration Parameters.
981
 *
982
 * @note This function Access to the device
983
 *
984
 * @param   Dev                            Device Handle
985
 * @param   VhvSettings                    Parameter for VHV
986
 * @param   PhaseCal                       Parameter for PhaseCal
987
 * @return  VL53L0X_ERROR_NONE              Success
988
 * @return  "Other error code"             See ::VL53L0X_Error
989
 */
990
VL53L0X_API VL53L0X_Error VL53L0X_SetRefCalibration(VL53L0X_DEV Dev,
991
    uint8_t VhvSettings, uint8_t PhaseCal);
992

    
993
/**
994
 * @brief Get Reference Calibration Parameters
995
 *
996
 * @par Function Description
997
 * Get Reference Calibration Parameters.
998
 *
999
 * @note This function Access to the device
1000
 *
1001
 * @param   Dev                            Device Handle
1002
 * @param   pVhvSettings                   Pointer to VHV parameter
1003
 * @param   pPhaseCal                      Pointer to PhaseCal Parameter
1004
 * @return  VL53L0X_ERROR_NONE              Success
1005
 * @return  "Other error code"             See ::VL53L0X_Error
1006
 */
1007
VL53L0X_API VL53L0X_Error VL53L0X_GetRefCalibration(VL53L0X_DEV Dev,
1008
    uint8_t *pVhvSettings, uint8_t *pPhaseCal);
1009

    
1010
/**
1011
 * @brief  Get the number of the check limit managed by a given Device
1012
 *
1013
 * @par Function Description
1014
 * This function give the number of the check limit managed by the Device
1015
 *
1016
 * @note This function doesn't Access to the device
1017
 *
1018
 * @param   pNumberOfLimitCheck           Pointer to the number of check limit.
1019
 * @return  VL53L0X_ERROR_NONE             Success
1020
 * @return  "Other error code"            See ::VL53L0X_Error
1021
 */
1022
VL53L0X_API VL53L0X_Error VL53L0X_GetNumberOfLimitCheck(
1023
    uint16_t *pNumberOfLimitCheck);
1024

    
1025
/**
1026
 * @brief  Return a description string for a given limit check number
1027
 *
1028
 * @par Function Description
1029
 * This function returns a description string for a given limit check number.
1030
 * The limit check is identified with the LimitCheckId.
1031
 *
1032
 * @note This function doesn't Access to the device
1033
 *
1034
 * @param   Dev                           Device Handle
1035
 * @param   LimitCheckId                  Limit Check ID
1036
 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1037
 * @param   pLimitCheckString             Pointer to the
1038
 description string of the given check limit.
1039
 * @return  VL53L0X_ERROR_NONE             Success
1040
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is
1041
 returned when LimitCheckId value is out of range.
1042
 * @return  "Other error code"            See ::VL53L0X_Error
1043
 */
1044
VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckInfo(VL53L0X_DEV Dev,
1045
    uint16_t LimitCheckId, char *pLimitCheckString);
1046

    
1047
/**
1048
 * @brief  Return a the Status of the specified check limit
1049
 *
1050
 * @par Function Description
1051
 * This function returns the Status of the specified check limit.
1052
 * The value indicate if the check is fail or not.
1053
 * The limit check is identified with the LimitCheckId.
1054
 *
1055
 * @note This function doesn't Access to the device
1056
 *
1057
 * @param   Dev                           Device Handle
1058
 * @param   LimitCheckId                  Limit Check ID
1059
 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1060
 * @param   pLimitCheckStatus             Pointer to the
1061
 Limit Check Status of the given check limit.
1062
 * LimitCheckStatus :
1063
 * 0 the check is not fail
1064
 * 1 the check if fail or not enabled
1065
 *
1066
 * @return  VL53L0X_ERROR_NONE             Success
1067
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is
1068
 returned when LimitCheckId value is out of range.
1069
 * @return  "Other error code"            See ::VL53L0X_Error
1070
 */
1071
VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckStatus(VL53L0X_DEV Dev,
1072
    uint16_t LimitCheckId, uint8_t *pLimitCheckStatus);
1073

    
1074
/**
1075
 * @brief  Enable/Disable a specific limit check
1076
 *
1077
 * @par Function Description
1078
 * This function Enable/Disable a specific limit check.
1079
 * The limit check is identified with the LimitCheckId.
1080
 *
1081
 * @note This function doesn't Access to the device
1082
 *
1083
 * @param   Dev                           Device Handle
1084
 * @param   LimitCheckId                  Limit Check ID
1085
 *  (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1086
 * @param   LimitCheckEnable              if 1 the check limit
1087
 *  corresponding to LimitCheckId is Enabled
1088
 *                                        if 0 the check limit
1089
 *  corresponding to LimitCheckId is disabled
1090
 * @return  VL53L0X_ERROR_NONE             Success
1091
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned
1092
 *  when LimitCheckId value is out of range.
1093
 * @return  "Other error code"            See ::VL53L0X_Error
1094
 */
1095
VL53L0X_API VL53L0X_Error VL53L0X_SetLimitCheckEnable(VL53L0X_DEV Dev,
1096
    uint16_t LimitCheckId, uint8_t LimitCheckEnable);
1097

    
1098
/**
1099
 * @brief  Get specific limit check enable state
1100
 *
1101
 * @par Function Description
1102
 * This function get the enable state of a specific limit check.
1103
 * The limit check is identified with the LimitCheckId.
1104
 *
1105
 * @note This function Access to the device
1106
 *
1107
 * @param   Dev                           Device Handle
1108
 * @param   LimitCheckId                  Limit Check ID
1109
 *  (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1110
 * @param   pLimitCheckEnable             Pointer to the check limit enable
1111
 * value.
1112
 *  if 1 the check limit
1113
 *        corresponding to LimitCheckId is Enabled
1114
 *  if 0 the check limit
1115
 *        corresponding to LimitCheckId is disabled
1116
 * @return  VL53L0X_ERROR_NONE             Success
1117
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned
1118
 *  when LimitCheckId value is out of range.
1119
 * @return  "Other error code"            See ::VL53L0X_Error
1120
 */
1121
VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckEnable(VL53L0X_DEV Dev,
1122
    uint16_t LimitCheckId, uint8_t *pLimitCheckEnable);
1123

    
1124
/**
1125
 * @brief  Set a specific limit check value
1126
 *
1127
 * @par Function Description
1128
 * This function set a specific limit check value.
1129
 * The limit check is identified with the LimitCheckId.
1130
 *
1131
 * @note This function Access to the device
1132
 *
1133
 * @param   Dev                           Device Handle
1134
 * @param   LimitCheckId                  Limit Check ID
1135
 *  (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1136
 * @param   LimitCheckValue               Limit check Value for a given
1137
 * LimitCheckId
1138
 * @return  VL53L0X_ERROR_NONE             Success
1139
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned when either
1140
 *  LimitCheckId or LimitCheckValue value is out of range.
1141
 * @return  "Other error code"            See ::VL53L0X_Error
1142
 */
1143
VL53L0X_API VL53L0X_Error VL53L0X_SetLimitCheckValue(VL53L0X_DEV Dev,
1144
    uint16_t LimitCheckId, FixPoint1616_t LimitCheckValue);
1145

    
1146
/**
1147
 * @brief  Get a specific limit check value
1148
 *
1149
 * @par Function Description
1150
 * This function get a specific limit check value from device then it updates
1151
 * internal values and check enables.
1152
 * The limit check is identified with the LimitCheckId.
1153
 *
1154
 * @note This function Access to the device
1155
 *
1156
 * @param   Dev                           Device Handle
1157
 * @param   LimitCheckId                  Limit Check ID
1158
 *  (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1159
 * @param   pLimitCheckValue              Pointer to Limit
1160
 *  check Value for a given LimitCheckId.
1161
 * @return  VL53L0X_ERROR_NONE             Success
1162
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned
1163
 *  when LimitCheckId value is out of range.
1164
 * @return  "Other error code"            See ::VL53L0X_Error
1165
 */
1166
VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckValue(VL53L0X_DEV Dev,
1167
    uint16_t LimitCheckId, FixPoint1616_t *pLimitCheckValue);
1168

    
1169
/**
1170
 * @brief  Get the current value of the signal used for the limit check
1171
 *
1172
 * @par Function Description
1173
 * This function get a the current value of the signal used for the limit check.
1174
 * To obtain the latest value you should run a ranging before.
1175
 * The value reported is linked to the limit check identified with the
1176
 * LimitCheckId.
1177
 *
1178
 * @note This function Access to the device
1179
 *
1180
 * @param   Dev                           Device Handle
1181
 * @param   LimitCheckId                  Limit Check ID
1182
 *  (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
1183
 * @param   pLimitCheckCurrent            Pointer to current Value for a
1184
 * given LimitCheckId.
1185
 * @return  VL53L0X_ERROR_NONE             Success
1186
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned when
1187
 * LimitCheckId value is out of range.
1188
 * @return  "Other error code"            See ::VL53L0X_Error
1189
 */
1190
VL53L0X_API VL53L0X_Error VL53L0X_GetLimitCheckCurrent(VL53L0X_DEV Dev,
1191
    uint16_t LimitCheckId, FixPoint1616_t *pLimitCheckCurrent);
1192

    
1193
/**
1194
 * @brief  Enable (or disable) Wrap around Check
1195
 *
1196
 * @note This function Access to the device
1197
 *
1198
 * @param   Dev                    Device Handle
1199
 * @param   WrapAroundCheckEnable  Wrap around Check to be set
1200
 *                                 0=disabled, other = enabled
1201
 * @return  VL53L0X_ERROR_NONE      Success
1202
 * @return  "Other error code"     See ::VL53L0X_Error
1203
 */
1204
VL53L0X_API VL53L0X_Error VL53L0X_SetWrapAroundCheckEnable(VL53L0X_DEV Dev,
1205
        uint8_t WrapAroundCheckEnable);
1206

    
1207
/**
1208
 * @brief  Get setup of Wrap around Check
1209
 *
1210
 * @par Function Description
1211
 * This function get the wrapAround check enable parameters
1212
 *
1213
 * @note This function Access to the device
1214
 *
1215
 * @param   Dev                     Device Handle
1216
 * @param   pWrapAroundCheckEnable  Pointer to the Wrap around Check state
1217
 *                                  0=disabled or 1 = enabled
1218
 * @return  VL53L0X_ERROR_NONE       Success
1219
 * @return  "Other error code"      See ::VL53L0X_Error
1220
 */
1221
VL53L0X_API VL53L0X_Error VL53L0X_GetWrapAroundCheckEnable(VL53L0X_DEV Dev,
1222
        uint8_t *pWrapAroundCheckEnable);
1223

    
1224
/**
1225
 * @brief   Set Dmax Calibration Parameters for a given device
1226
 * When one of the parameter is zero, this function will get parameter
1227
 * from NVM.
1228
 * @note This function doesn't Access to the device
1229
 *
1230
 * @param   Dev                    Device Handle
1231
 * @param   RangeMilliMeter        Calibration Distance
1232
 * @param   SignalRateRtnMegaCps   Signal rate return read at CalDistance
1233
 * @return  VL53L0X_ERROR_NONE      Success
1234
 * @return  "Other error code"     See ::VL53L0X_Error
1235
 */
1236
VL53L0X_API VL53L0X_Error VL53L0X_SetDmaxCalParameters(VL53L0X_DEV Dev,
1237
        uint16_t RangeMilliMeter, FixPoint1616_t SignalRateRtnMegaCps);
1238

    
1239
/**
1240
 * @brief  Get Dmax Calibration Parameters for a given device
1241
 *
1242
 *
1243
 * @note This function Access to the device
1244
 *
1245
 * @param   Dev                     Device Handle
1246
 * @param   pRangeMilliMeter        Pointer to Calibration Distance
1247
 * @param   pSignalRateRtnMegaCps   Pointer to Signal rate return
1248
 * @return  VL53L0X_ERROR_NONE       Success
1249
 * @return  "Other error code"      See ::VL53L0X_Error
1250
 */
1251
VL53L0X_API VL53L0X_Error VL53L0X_GetDmaxCalParameters(VL53L0X_DEV Dev,
1252
    uint16_t *pRangeMilliMeter, FixPoint1616_t *pSignalRateRtnMegaCps);
1253

    
1254
/** @} VL53L0X_parameters_group */
1255

    
1256
/** @defgroup VL53L0X_measurement_group VL53L0X Measurement Functions
1257
 *  @brief    Functions used for the measurements
1258
 *  @{
1259
 */
1260

    
1261
/**
1262
 * @brief Single shot measurement.
1263
 *
1264
 * @par Function Description
1265
 * Perform simple measurement sequence (Start measure, Wait measure to end,
1266
 * and returns when measurement is done).
1267
 * Once function returns, user can get valid data by calling
1268
 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement
1269
 * depending on defined measurement mode
1270
 * User should Clear the interrupt in case this are enabled by using the
1271
 * function VL53L0X_ClearInterruptMask().
1272
 *
1273
 * @warning This function is a blocking function
1274
 *
1275
 * @note This function Access to the device
1276
 *
1277
 * @param   Dev                  Device Handle
1278
 * @return  VL53L0X_ERROR_NONE    Success
1279
 * @return  "Other error code"   See ::VL53L0X_Error
1280
 */
1281
VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleMeasurement(VL53L0X_DEV Dev);
1282

    
1283
/**
1284
 * @brief Perform Reference Calibration
1285
 *
1286
 * @details Perform a reference calibration of the Device.
1287
 * This function should be run from time to time before doing
1288
 * a ranging measurement.
1289
 * This function will launch a special ranging measurement, so
1290
 * if interrupt are enable an interrupt will be done.
1291
 * This function will clear the interrupt generated automatically.
1292
 *
1293
 * @warning This function is a blocking function
1294
 *
1295
 * @note This function Access to the device
1296
 *
1297
 * @param   Dev                  Device Handle
1298
 * @param   pVhvSettings         Pointer to vhv settings parameter.
1299
 * @param   pPhaseCal            Pointer to PhaseCal parameter.
1300
 * @return  VL53L0X_ERROR_NONE    Success
1301
 * @return  "Other error code"   See ::VL53L0X_Error
1302
 */
1303
VL53L0X_API VL53L0X_Error VL53L0X_PerformRefCalibration(VL53L0X_DEV Dev,
1304
    uint8_t *pVhvSettings, uint8_t *pPhaseCal);
1305

    
1306
/**
1307
 * @brief Perform XTalk Measurement
1308
 *
1309
 * @details Measures the current cross talk from glass in front
1310
 * of the sensor.
1311
 * This functions performs a histogram measurement and uses the results
1312
 * to measure the crosstalk. For the function to be successful, there
1313
 * must be no target in front of the sensor.
1314
 *
1315
 * @warning This function is a blocking function
1316
 *
1317
 * @warning This function is not supported when the final range
1318
 * vcsel clock period is set below 10 PCLKS.
1319
 *
1320
 * @note This function Access to the device
1321
 *
1322
 * @param   Dev                  Device Handle
1323
 * @param   TimeoutMs            Histogram measurement duration.
1324
 * @param   pXtalkPerSpad        Output parameter containing the crosstalk
1325
 * measurement result, in MCPS/Spad. Format fixpoint 16:16.
1326
 * @param   pAmbientTooHigh      Output parameter which indicate that
1327
 * pXtalkPerSpad is not good if the Ambient is too high.
1328
 * @return  VL53L0X_ERROR_NONE    Success
1329
 * @return  VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported
1330
 * for this operation. Must not be less than 10PCLKS.
1331
 * @return  "Other error code"   See ::VL53L0X_Error
1332
 */
1333
VL53L0X_API VL53L0X_Error VL53L0X_PerformXTalkMeasurement(VL53L0X_DEV Dev,
1334
    uint32_t TimeoutMs, FixPoint1616_t *pXtalkPerSpad,
1335
    uint8_t *pAmbientTooHigh);
1336

    
1337
/**
1338
 * @brief Perform XTalk Calibration
1339
 *
1340
 * @details Perform a XTalk calibration of the Device.
1341
 * This function will launch a ranging measurement, if interrupts
1342
 * are enabled an interrupt will be done.
1343
 * This function will clear the interrupt generated automatically.
1344
 * This function will program a new value for the XTalk compensation
1345
 * and it will enable the cross talk before exit.
1346
 * This function will disable the VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD.
1347
 *
1348
 * @warning This function is a blocking function
1349
 *
1350
 * @note This function Access to the device
1351
 *
1352
 * @note This function change the device mode to
1353
 * VL53L0X_DEVICEMODE_SINGLE_RANGING
1354
 *
1355
 * @param   Dev                  Device Handle
1356
 * @param   XTalkCalDistance     XTalkCalDistance value used for the XTalk
1357
 * computation.
1358
 * @param   pXTalkCompensationRateMegaCps  Pointer to new
1359
 * XTalkCompensation value.
1360
 * @return  VL53L0X_ERROR_NONE    Success
1361
 * @return  "Other error code"   See ::VL53L0X_Error
1362
 */
1363
VL53L0X_API VL53L0X_Error VL53L0X_PerformXTalkCalibration(VL53L0X_DEV Dev,
1364
    FixPoint1616_t XTalkCalDistance,
1365
    FixPoint1616_t *pXTalkCompensationRateMegaCps);
1366

    
1367
/**
1368
 * @brief Perform Offset Calibration
1369
 *
1370
 * @details Perform a Offset calibration of the Device.
1371
 * This function will launch a ranging measurement, if interrupts are
1372
 * enabled an interrupt will be done.
1373
 * This function will clear the interrupt generated automatically.
1374
 * This function will program a new value for the Offset calibration value
1375
 * This function will disable the VL53L0X_CHECKENABLE_RANGE_IGNORE_THRESHOLD.
1376
 *
1377
 * @warning This function is a blocking function
1378
 *
1379
 * @note This function Access to the device
1380
 *
1381
 * @note This function does not change the device mode.
1382
 *
1383
 * @param   Dev                  Device Handle
1384
 * @param   CalDistanceMilliMeter     Calibration distance value used for the
1385
 * offset compensation.
1386
 * @param   pOffsetMicroMeter  Pointer to new Offset value computed by the
1387
 * function.
1388
 *
1389
 * @return  VL53L0X_ERROR_NONE    Success
1390
 * @return  "Other error code"   See ::VL53L0X_Error
1391
 */
1392
VL53L0X_API VL53L0X_Error VL53L0X_PerformOffsetCalibration(VL53L0X_DEV Dev,
1393
    FixPoint1616_t CalDistanceMilliMeter, int32_t *pOffsetMicroMeter);
1394

    
1395
/**
1396
 * @brief Start device measurement
1397
 *
1398
 * @details Started measurement will depend on device parameters set through
1399
 * @a VL53L0X_SetParameters()
1400
 * This is a non-blocking function.
1401
 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to
1402
 * VL53L0X_STATE_RUNNING.
1403
 *
1404
 * @note This function Access to the device
1405
 *
1406

1407
 * @param   Dev                  Device Handle
1408
 * @return  VL53L0X_ERROR_NONE                  Success
1409
 * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED    This error occurs when
1410
 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported
1411
 * list:
1412
 *                                   Supported mode are:
1413
 *                                   VL53L0X_DEVICEMODE_SINGLE_RANGING,
1414
 *                                   VL53L0X_DEVICEMODE_CONTINUOUS_RANGING,
1415
 *                                   VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
1416
 * @return  VL53L0X_ERROR_TIME_OUT    Time out on start measurement
1417
 * @return  "Other error code"   See ::VL53L0X_Error
1418
 */
1419
VL53L0X_API VL53L0X_Error VL53L0X_StartMeasurement(VL53L0X_DEV Dev);
1420

    
1421
/**
1422
 * @brief Stop device measurement
1423
 *
1424
 * @details Will set the device in standby mode at end of current measurement\n
1425
 *          Not necessary in single mode as device shall return automatically
1426
 *          in standby mode at end of measurement.
1427
 *          This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING
1428
 *          to VL53L0X_STATE_IDLE.
1429
 *
1430
 * @note This function Access to the device
1431
 *
1432
 * @param   Dev                  Device Handle
1433
 * @return  VL53L0X_ERROR_NONE    Success
1434
 * @return  "Other error code"   See ::VL53L0X_Error
1435
 */
1436
VL53L0X_API VL53L0X_Error VL53L0X_StopMeasurement(VL53L0X_DEV Dev);
1437

    
1438
/**
1439
 * @brief Return Measurement Data Ready
1440
 *
1441
 * @par Function Description
1442
 * This function indicate that a measurement data is ready.
1443
 * This function check if interrupt mode is used then check is done accordingly.
1444
 * If perform function clear the interrupt, this function will not work,
1445
 * like in case of @a VL53L0X_PerformSingleRangingMeasurement().
1446
 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady
1447
 * is used for non-blocking capture.
1448
 *
1449
 * @note This function Access to the device
1450
 *
1451
 * @param   Dev                    Device Handle
1452
 * @param   pMeasurementDataReady  Pointer to Measurement Data Ready.
1453
 *  0=data not ready, 1 = data ready
1454
 * @return  VL53L0X_ERROR_NONE      Success
1455
 * @return  "Other error code"     See ::VL53L0X_Error
1456
 */
1457
VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementDataReady(VL53L0X_DEV Dev,
1458
    uint8_t *pMeasurementDataReady);
1459

    
1460
/**
1461
 * @brief Wait for device ready for a new measurement command.
1462
 * Blocking function.
1463
 *
1464
 * @note This function is not Implemented
1465
 *
1466
 * @param   Dev      Device Handle
1467
 * @param   MaxLoop    Max Number of polling loop (timeout).
1468
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
1469
 */
1470
VL53L0X_API VL53L0X_Error VL53L0X_WaitDeviceReadyForNewMeasurement(VL53L0X_DEV Dev,
1471
    uint32_t MaxLoop);
1472

    
1473
/**
1474
 * @brief Retrieve the Reference Signal after a measurements
1475
 *
1476
 * @par Function Description
1477
 * Get Reference Signal from last successful Ranging measurement
1478
 * This function return a valid value after that you call the
1479
 * @a VL53L0X_GetRangingMeasurementData().
1480
 *
1481
 * @note This function Access to the device
1482
 *
1483
 * @param   Dev                      Device Handle
1484
 * @param   pMeasurementRefSignal    Pointer to the Ref Signal to fill up.
1485
 * @return  VL53L0X_ERROR_NONE        Success
1486
 * @return  "Other error code"       See ::VL53L0X_Error
1487
 */
1488
VL53L0X_API VL53L0X_Error VL53L0X_GetMeasurementRefSignal(VL53L0X_DEV Dev,
1489
    FixPoint1616_t *pMeasurementRefSignal);
1490

    
1491
/**
1492
 * @brief Retrieve the measurements from device for a given setup
1493
 *
1494
 * @par Function Description
1495
 * Get data from last successful Ranging measurement
1496
 * @warning USER should take care about  @a VL53L0X_GetNumberOfROIZones()
1497
 * before get data.
1498
 * PAL will fill a NumberOfROIZones times the corresponding data
1499
 * structure used in the measurement function.
1500
 *
1501
 * @note This function Access to the device
1502
 *
1503
 * @param   Dev                      Device Handle
1504
 * @param   pRangingMeasurementData  Pointer to the data structure to fill up.
1505
 * @return  VL53L0X_ERROR_NONE        Success
1506
 * @return  "Other error code"       See ::VL53L0X_Error
1507
 */
1508
VL53L0X_API VL53L0X_Error VL53L0X_GetRangingMeasurementData(VL53L0X_DEV Dev,
1509
    VL53L0X_RangingMeasurementData_t *pRangingMeasurementData);
1510

    
1511
/**
1512
 * @brief Retrieve the measurements from device for a given setup
1513
 *
1514
 * @par Function Description
1515
 * Get data from last successful Histogram measurement
1516
 * @warning USER should take care about  @a VL53L0X_GetNumberOfROIZones()
1517
 * before get data.
1518
 * PAL will fill a NumberOfROIZones times the corresponding data structure
1519
 * used in the measurement function.
1520
 *
1521
 * @note This function is not Implemented
1522
 *
1523
 * @param   Dev                         Device Handle
1524
 * @param   pHistogramMeasurementData   Pointer to the histogram data structure.
1525
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
1526
 */
1527
VL53L0X_API VL53L0X_Error VL53L0X_GetHistogramMeasurementData(VL53L0X_DEV Dev,
1528
    VL53L0X_HistogramMeasurementData_t *pHistogramMeasurementData);
1529

    
1530
/**
1531
 * @brief Performs a single ranging measurement and retrieve the ranging
1532
 * measurement data
1533
 *
1534
 * @par Function Description
1535
 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
1536
 * with @a VL53L0X_SetDeviceMode(),
1537
 * It performs measurement with @a VL53L0X_PerformSingleMeasurement()
1538
 * It get data from last successful Ranging measurement with
1539
 * @a VL53L0X_GetRangingMeasurementData.
1540
 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask().
1541
 *
1542
 * @note This function Access to the device
1543
 *
1544
 * @note This function change the device mode to
1545
 * VL53L0X_DEVICEMODE_SINGLE_RANGING
1546
 *
1547
 * @param   Dev                       Device Handle
1548
 * @param   pRangingMeasurementData   Pointer to the data structure to fill up.
1549
 * @return  VL53L0X_ERROR_NONE         Success
1550
 * @return  "Other error code"        See ::VL53L0X_Error
1551
 */
1552
VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleRangingMeasurement(VL53L0X_DEV Dev,
1553
    VL53L0X_RangingMeasurementData_t *pRangingMeasurementData);
1554

    
1555
/**
1556
 * @brief Performs a single histogram measurement and retrieve the histogram
1557
 * measurement data
1558
 *   Is equivalent to VL53L0X_PerformSingleMeasurement +
1559
 *   VL53L0X_GetHistogramMeasurementData
1560
 *
1561
 * @par Function Description
1562
 * Get data from last successful Ranging measurement.
1563
 * This function will clear the interrupt in case of these are enabled.
1564
 *
1565
 * @note This function is not Implemented
1566
 *
1567
 * @param   Dev                        Device Handle
1568
 * @param   pHistogramMeasurementData  Pointer to the data structure to fill up.
1569
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
1570
 */
1571
VL53L0X_API VL53L0X_Error VL53L0X_PerformSingleHistogramMeasurement(VL53L0X_DEV Dev,
1572
    VL53L0X_HistogramMeasurementData_t *pHistogramMeasurementData);
1573

    
1574
/**
1575
 * @brief Set the number of ROI Zones to be used for a specific Device
1576
 *
1577
 * @par Function Description
1578
 * Set the number of ROI Zones to be used for a specific Device.
1579
 * The programmed value should be less than the max number of ROI Zones given
1580
 * with @a VL53L0X_GetMaxNumberOfROIZones().
1581
 * This version of API manage only one zone.
1582
 *
1583
 * @param   Dev                           Device Handle
1584
 * @param   NumberOfROIZones              Number of ROI Zones to be used for a
1585
 *  specific Device.
1586
 * @return  VL53L0X_ERROR_NONE             Success
1587
 * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned if
1588
 * NumberOfROIZones != 1
1589
 */
1590
VL53L0X_API VL53L0X_Error VL53L0X_SetNumberOfROIZones(VL53L0X_DEV Dev,
1591
    uint8_t NumberOfROIZones);
1592

    
1593
/**
1594
 * @brief Get the number of ROI Zones managed by the Device
1595
 *
1596
 * @par Function Description
1597
 * Get number of ROI Zones managed by the Device
1598
 * USER should take care about  @a VL53L0X_GetNumberOfROIZones()
1599
 * before get data after a perform measurement.
1600
 * PAL will fill a NumberOfROIZones times the corresponding data
1601
 * structure used in the measurement function.
1602
 *
1603
 * @note This function doesn't Access to the device
1604
 *
1605
 * @param   Dev                   Device Handle
1606
 * @param   pNumberOfROIZones     Pointer to the Number of ROI Zones value.
1607
 * @return  VL53L0X_ERROR_NONE     Success
1608
 */
1609
VL53L0X_API VL53L0X_Error VL53L0X_GetNumberOfROIZones(VL53L0X_DEV Dev,
1610
    uint8_t *pNumberOfROIZones);
1611

    
1612
/**
1613
 * @brief Get the Maximum number of ROI Zones managed by the Device
1614
 *
1615
 * @par Function Description
1616
 * Get Maximum number of ROI Zones managed by the Device.
1617
 *
1618
 * @note This function doesn't Access to the device
1619
 *
1620
 * @param   Dev                    Device Handle
1621
 * @param   pMaxNumberOfROIZones   Pointer to the Maximum Number
1622
 *  of ROI Zones value.
1623
 * @return  VL53L0X_ERROR_NONE      Success
1624
 */
1625
VL53L0X_API VL53L0X_Error VL53L0X_GetMaxNumberOfROIZones(VL53L0X_DEV Dev,
1626
    uint8_t *pMaxNumberOfROIZones);
1627

    
1628
/** @} VL53L0X_measurement_group */
1629

    
1630
/** @defgroup VL53L0X_interrupt_group VL53L0X Interrupt Functions
1631
 *  @brief    Functions used for interrupt managements
1632
 *  @{
1633
 */
1634

    
1635
/**
1636
 * @brief Set the configuration of GPIO pin for a given device
1637
 *
1638
 * @note This function Access to the device
1639
 *
1640
 * @param   Dev                   Device Handle
1641
 * @param   Pin                   ID of the GPIO Pin
1642
 * @param   Functionality         Select Pin functionality.
1643
 *  Refer to ::VL53L0X_GpioFunctionality
1644
 * @param   DeviceMode            Device Mode associated to the Gpio.
1645
 * @param   Polarity              Set interrupt polarity. Active high
1646
 *   or active low see ::VL53L0X_InterruptPolarity
1647
 * @return  VL53L0X_ERROR_NONE                            Success
1648
 * @return  VL53L0X_ERROR_GPIO_NOT_EXISTING               Only Pin=0 is accepted.
1649
 * @return  VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED    This error occurs
1650
 * when Functionality programmed is not in the supported list:
1651
 *                             Supported value are:
1652
 *                             VL53L0X_GPIOFUNCTIONALITY_OFF,
1653
 *                             VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
1654
 *                             VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
1655
 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
1656
 *                               VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
1657
 * @return  "Other error code"    See ::VL53L0X_Error
1658
 */
1659
VL53L0X_API VL53L0X_Error VL53L0X_SetGpioConfig(VL53L0X_DEV Dev, uint8_t Pin,
1660
    VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality,
1661
    VL53L0X_InterruptPolarity Polarity);
1662

    
1663
/**
1664
 * @brief Get current configuration for GPIO pin for a given device
1665
 *
1666
 * @note This function Access to the device
1667
 *
1668
 * @param   Dev                   Device Handle
1669
 * @param   Pin                   ID of the GPIO Pin
1670
 * @param   pDeviceMode           Pointer to Device Mode associated to the Gpio.
1671
 * @param   pFunctionality        Pointer to Pin functionality.
1672
 *  Refer to ::VL53L0X_GpioFunctionality
1673
 * @param   pPolarity             Pointer to interrupt polarity.
1674
 *  Active high or active low see ::VL53L0X_InterruptPolarity
1675
 * @return  VL53L0X_ERROR_NONE                            Success
1676
 * @return  VL53L0X_ERROR_GPIO_NOT_EXISTING               Only Pin=0 is accepted.
1677
 * @return  VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED   This error occurs
1678
 * when Functionality programmed is not in the supported list:
1679
 *                      Supported value are:
1680
 *                      VL53L0X_GPIOFUNCTIONALITY_OFF,
1681
 *                      VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
1682
 *                      VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
1683
 *                      VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
1684
 *                      VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
1685
 * @return  "Other error code"    See ::VL53L0X_Error
1686
 */
1687
VL53L0X_API VL53L0X_Error VL53L0X_GetGpioConfig(VL53L0X_DEV Dev, uint8_t Pin,
1688
    VL53L0X_DeviceModes *pDeviceMode,
1689
    VL53L0X_GpioFunctionality *pFunctionality,
1690
    VL53L0X_InterruptPolarity *pPolarity);
1691

    
1692
/**
1693
 * @brief Set low and high Interrupt thresholds for a given mode
1694
 * (ranging, ALS, ...) for a given device
1695
 *
1696
 * @par Function Description
1697
 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...)
1698
 * for a given device
1699
 *
1700
 * @note This function Access to the device
1701
 *
1702
 * @note DeviceMode is ignored for the current device
1703
 *
1704
 * @param   Dev              Device Handle
1705
 * @param   DeviceMode       Device Mode for which change thresholds
1706
 * @param   ThresholdLow     Low threshold (mm, lux ..., depending on the mode)
1707
 * @param   ThresholdHigh    High threshold (mm, lux ..., depending on the mode)
1708
 * @return  VL53L0X_ERROR_NONE    Success
1709
 * @return  "Other error code"   See ::VL53L0X_Error
1710
 */
1711
VL53L0X_API VL53L0X_Error VL53L0X_SetInterruptThresholds(VL53L0X_DEV Dev,
1712
    VL53L0X_DeviceModes DeviceMode, FixPoint1616_t ThresholdLow,
1713
    FixPoint1616_t ThresholdHigh);
1714

    
1715
/**
1716
 * @brief  Get high and low Interrupt thresholds for a given mode
1717
 *  (ranging, ALS, ...) for a given device
1718
 *
1719
 * @par Function Description
1720
 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...)
1721
 * for a given device
1722
 *
1723
 * @note This function Access to the device
1724
 *
1725
 * @note DeviceMode is ignored for the current device
1726
 *
1727
 * @param   Dev              Device Handle
1728
 * @param   DeviceMode       Device Mode from which read thresholds
1729
 * @param   pThresholdLow    Low threshold (mm, lux ..., depending on the mode)
1730
 * @param   pThresholdHigh   High threshold (mm, lux ..., depending on the mode)
1731
 * @return  VL53L0X_ERROR_NONE   Success
1732
 * @return  "Other error code"  See ::VL53L0X_Error
1733
 */
1734
VL53L0X_API VL53L0X_Error VL53L0X_GetInterruptThresholds(VL53L0X_DEV Dev,
1735
    VL53L0X_DeviceModes DeviceMode, FixPoint1616_t *pThresholdLow,
1736
    FixPoint1616_t *pThresholdHigh);
1737

    
1738
/**
1739
 * @brief Return device stop completion status
1740
 *
1741
 * @par Function Description
1742
 * Returns stop completiob status.
1743
 * User shall call this function after a stop command
1744
 *
1745
 * @note This function Access to the device
1746
 *
1747
 * @param   Dev                    Device Handle
1748
 * @param   pStopStatus            Pointer to status variable to update
1749
 * @return  VL53L0X_ERROR_NONE      Success
1750
 * @return  "Other error code"     See ::VL53L0X_Error
1751
 */
1752
VL53L0X_API VL53L0X_Error VL53L0X_GetStopCompletedStatus(VL53L0X_DEV Dev,
1753
    uint32_t *pStopStatus);
1754

    
1755

    
1756
/**
1757
 * @brief Clear given system interrupt condition
1758
 *
1759
 * @par Function Description
1760
 * Clear given interrupt(s).
1761
 *
1762
 * @note This function Access to the device
1763
 *
1764
 * @param   Dev                  Device Handle
1765
 * @param   InterruptMask        Mask of interrupts to clear
1766
 * @return  VL53L0X_ERROR_NONE    Success
1767
 * @return  VL53L0X_ERROR_INTERRUPT_NOT_CLEARED    Cannot clear interrupts
1768
 *
1769
 * @return  "Other error code"   See ::VL53L0X_Error
1770
 */
1771
VL53L0X_API VL53L0X_Error VL53L0X_ClearInterruptMask(VL53L0X_DEV Dev,
1772
    uint32_t InterruptMask);
1773

    
1774
/**
1775
 * @brief Return device interrupt status
1776
 *
1777
 * @par Function Description
1778
 * Returns currently raised interrupts by the device.
1779
 * User shall be able to activate/deactivate interrupts through
1780
 * @a VL53L0X_SetGpioConfig()
1781
 *
1782
 * @note This function Access to the device
1783
 *
1784
 * @param   Dev                    Device Handle
1785
 * @param   pInterruptMaskStatus   Pointer to status variable to update
1786
 * @return  VL53L0X_ERROR_NONE      Success
1787
 * @return  "Other error code"     See ::VL53L0X_Error
1788
 */
1789
VL53L0X_API VL53L0X_Error VL53L0X_GetInterruptMaskStatus(VL53L0X_DEV Dev,
1790
    uint32_t *pInterruptMaskStatus);
1791

    
1792
/**
1793
 * @brief Configure ranging interrupt reported to system
1794
 *
1795
 * @note This function is not Implemented
1796
 *
1797
 * @param   Dev                  Device Handle
1798
 * @param   InterruptMask         Mask of interrupt to Enable/disable
1799
 *  (0:interrupt disabled or 1: interrupt enabled)
1800
 * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
1801
 */
1802
VL53L0X_API VL53L0X_Error VL53L0X_EnableInterruptMask(VL53L0X_DEV Dev,
1803
    uint32_t InterruptMask);
1804

    
1805
/** @} VL53L0X_interrupt_group */
1806

    
1807
/** @defgroup VL53L0X_SPADfunctions_group VL53L0X SPAD Functions
1808
 *  @brief    Functions used for SPAD managements
1809
 *  @{
1810
 */
1811

    
1812
/**
1813
 * @brief  Set the SPAD Ambient Damper Threshold value
1814
 *
1815
 * @par Function Description
1816
 * This function set the SPAD Ambient Damper Threshold value
1817
 *
1818
 * @note This function Access to the device
1819
 *
1820
 * @param   Dev                           Device Handle
1821
 * @param   SpadAmbientDamperThreshold    SPAD Ambient Damper Threshold value
1822
 * @return  VL53L0X_ERROR_NONE             Success
1823
 * @return  "Other error code"            See ::VL53L0X_Error
1824
 */
1825
VL53L0X_API VL53L0X_Error VL53L0X_SetSpadAmbientDamperThreshold(VL53L0X_DEV Dev,
1826
    uint16_t SpadAmbientDamperThreshold);
1827

    
1828
/**
1829
 * @brief  Get the current SPAD Ambient Damper Threshold value
1830
 *
1831
 * @par Function Description
1832
 * This function get the SPAD Ambient Damper Threshold value
1833
 *
1834
 * @note This function Access to the device
1835
 *
1836
 * @param   Dev                           Device Handle
1837
 * @param   pSpadAmbientDamperThreshold   Pointer to programmed
1838
 *                                        SPAD Ambient Damper Threshold value
1839
 * @return  VL53L0X_ERROR_NONE             Success
1840
 * @return  "Other error code"            See ::VL53L0X_Error
1841
 */
1842
VL53L0X_API VL53L0X_Error VL53L0X_GetSpadAmbientDamperThreshold(VL53L0X_DEV Dev,
1843
    uint16_t *pSpadAmbientDamperThreshold);
1844

    
1845
/**
1846
 * @brief  Set the SPAD Ambient Damper Factor value
1847
 *
1848
 * @par Function Description
1849
 * This function set the SPAD Ambient Damper Factor value
1850
 *
1851
 * @note This function Access to the device
1852
 *
1853
 * @param   Dev                           Device Handle
1854
 * @param   SpadAmbientDamperFactor       SPAD Ambient Damper Factor value
1855
 * @return  VL53L0X_ERROR_NONE             Success
1856
 * @return  "Other error code"            See ::VL53L0X_Error
1857
 */
1858
VL53L0X_API VL53L0X_Error VL53L0X_SetSpadAmbientDamperFactor(VL53L0X_DEV Dev,
1859
    uint16_t SpadAmbientDamperFactor);
1860

    
1861
/**
1862
 * @brief  Get the current SPAD Ambient Damper Factor value
1863
 *
1864
 * @par Function Description
1865
 * This function get the SPAD Ambient Damper Factor value
1866
 *
1867
 * @note This function Access to the device
1868
 *
1869
 * @param   Dev                           Device Handle
1870
 * @param   pSpadAmbientDamperFactor      Pointer to programmed SPAD Ambient
1871
 * Damper Factor value
1872
 * @return  VL53L0X_ERROR_NONE             Success
1873
 * @return  "Other error code"            See ::VL53L0X_Error
1874
 */
1875
VL53L0X_API VL53L0X_Error VL53L0X_GetSpadAmbientDamperFactor(VL53L0X_DEV Dev,
1876
    uint16_t *pSpadAmbientDamperFactor);
1877

    
1878
/**
1879
 * @brief Performs Reference Spad Management
1880
 *
1881
 * @par Function Description
1882
 * The reference SPAD initialization procedure determines the minimum amount
1883
 * of reference spads to be enables to achieve a target reference signal rate
1884
 * and should be performed once during initialization.
1885
 *
1886
 * @note This function Access to the device
1887
 *
1888
 * @note This function change the device mode to
1889
 * VL53L0X_DEVICEMODE_SINGLE_RANGING
1890
 *
1891
 * @param   Dev                          Device Handle
1892
 * @param   refSpadCount                 Reports ref Spad Count
1893
 * @param   isApertureSpads              Reports if spads are of type
1894
 *                                       aperture or non-aperture.
1895
 *                                       1:=aperture, 0:=Non-Aperture
1896
 * @return  VL53L0X_ERROR_NONE            Success
1897
 * @return  VL53L0X_ERROR_REF_SPAD_INIT   Error in the Ref Spad procedure.
1898
 * @return  "Other error code"           See ::VL53L0X_Error
1899
 */
1900
VL53L0X_API VL53L0X_Error VL53L0X_PerformRefSpadManagement(VL53L0X_DEV Dev,
1901
    uint32_t *refSpadCount, uint8_t *isApertureSpads);
1902

    
1903
/**
1904
 * @brief Applies Reference SPAD configuration
1905
 *
1906
 * @par Function Description
1907
 * This function applies a given number of reference spads, identified as
1908
 * either Aperture or Non-Aperture.
1909
 * The requested spad count and type are stored within the device specific
1910
 * parameters data for access by the host.
1911
 *
1912
 * @note This function Access to the device
1913
 *
1914
 * @param   Dev                          Device Handle
1915
 * @param   refSpadCount                 Number of ref spads.
1916
 * @param   isApertureSpads              Defines if spads are of type
1917
 *                                       aperture or non-aperture.
1918
 *                                       1:=aperture, 0:=Non-Aperture
1919
 * @return  VL53L0X_ERROR_NONE            Success
1920
 * @return  VL53L0X_ERROR_REF_SPAD_INIT   Error in the in the reference
1921
 *                                       spad configuration.
1922
 * @return  "Other error code"           See ::VL53L0X_Error
1923
 */
1924
VL53L0X_API VL53L0X_Error VL53L0X_SetReferenceSpads(VL53L0X_DEV Dev,
1925
    uint32_t refSpadCount, uint8_t isApertureSpads);
1926

    
1927
/**
1928
 * @brief Retrieves SPAD configuration
1929
 *
1930
 * @par Function Description
1931
 * This function retrieves the current number of applied reference spads
1932
 * and also their type : Aperture or Non-Aperture.
1933
 *
1934
 * @note This function Access to the device
1935
 *
1936
 * @param   Dev                          Device Handle
1937
 * @param   refSpadCount                 Number ref Spad Count
1938
 * @param   isApertureSpads              Reports if spads are of type
1939
 *                                       aperture or non-aperture.
1940
 *                                       1:=aperture, 0:=Non-Aperture
1941
 * @return  VL53L0X_ERROR_NONE            Success
1942
 * @return  VL53L0X_ERROR_REF_SPAD_INIT   Error in the in the reference
1943
 *                                       spad configuration.
1944
 * @return  "Other error code"           See ::VL53L0X_Error
1945
 */
1946
VL53L0X_API VL53L0X_Error VL53L0X_GetReferenceSpads(VL53L0X_DEV Dev,
1947
    uint32_t *refSpadCount, uint8_t *isApertureSpads);
1948

    
1949
/** @} VL53L0X_SPADfunctions_group */
1950

    
1951
/** @} VL53L0X_cut11_group */
1952

    
1953
#ifdef __cplusplus
1954
}
1955
#endif
1956

    
1957
#endif /* _VL53L0X_API_H_ */