Greatly simplified Architecture, Identical Functions Removed: Platform Interfaces, STP6001 interface

Committer:
sepp_nepp
Date:
Thu Jun 20 12:54:25 2019 +0000
Revision:
7:3a1115c2556b
Parent:
6:fb11b746ceb5
Child:
8:2fd7cb217068
Removed all notions of device handle. The class is the device, and the device is the class. This is the base strategy of object oriented programming!; Then flattened the Device properties hierarchy. ; Removed Functions that are "not implemented".

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sepp_nepp 6:fb11b746ceb5 1 /*******************************************************************************
sepp_nepp 6:fb11b746ceb5 2 Copyright © 2016, STMicroelectronics International N.V.
sepp_nepp 6:fb11b746ceb5 3 All rights reserved.
sepp_nepp 6:fb11b746ceb5 4
sepp_nepp 6:fb11b746ceb5 5 Redistribution and use in source and binary forms, with or without
sepp_nepp 6:fb11b746ceb5 6 modification, are permitted provided that the following conditions are met:
sepp_nepp 6:fb11b746ceb5 7 * Redistributions of source code must retain the above copyright
sepp_nepp 6:fb11b746ceb5 8 notice, this list of conditions and the following disclaimer.
sepp_nepp 6:fb11b746ceb5 9 * Redistributions in binary form must reproduce the above copyright
sepp_nepp 6:fb11b746ceb5 10 notice, this list of conditions and the following disclaimer in the
sepp_nepp 6:fb11b746ceb5 11 documentation and/or other materials provided with the distribution.
sepp_nepp 6:fb11b746ceb5 12 * Neither the name of STMicroelectronics nor the
sepp_nepp 6:fb11b746ceb5 13 names of its contributors may be used to endorse or promote products
sepp_nepp 6:fb11b746ceb5 14 derived from this software without specific prior written permission.
sepp_nepp 6:fb11b746ceb5 15
sepp_nepp 6:fb11b746ceb5 16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
sepp_nepp 6:fb11b746ceb5 17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
sepp_nepp 6:fb11b746ceb5 18 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
sepp_nepp 6:fb11b746ceb5 19 NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED.
sepp_nepp 6:fb11b746ceb5 20 IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY
sepp_nepp 6:fb11b746ceb5 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
sepp_nepp 6:fb11b746ceb5 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
sepp_nepp 6:fb11b746ceb5 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
sepp_nepp 6:fb11b746ceb5 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
sepp_nepp 6:fb11b746ceb5 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
sepp_nepp 6:fb11b746ceb5 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sepp_nepp 6:fb11b746ceb5 27 *****************************************************************************/
sepp_nepp 6:fb11b746ceb5 28
sepp_nepp 6:fb11b746ceb5 29 #ifndef __VL53L0X_CLASS_H
sepp_nepp 6:fb11b746ceb5 30 #define __VL53L0X_CLASS_H
sepp_nepp 6:fb11b746ceb5 31
sepp_nepp 6:fb11b746ceb5 32
sepp_nepp 6:fb11b746ceb5 33 /* Includes ------------------------------------------------------------------*/
sepp_nepp 6:fb11b746ceb5 34 #include "mbed.h"
sepp_nepp 6:fb11b746ceb5 35 #include "pinmap.h"
sepp_nepp 6:fb11b746ceb5 36 #include "PinNames.h"
sepp_nepp 6:fb11b746ceb5 37 #include "VL53L0X_def.h"
sepp_nepp 6:fb11b746ceb5 38 #include "VL53L0X_tuning.h"
sepp_nepp 6:fb11b746ceb5 39
sepp_nepp 6:fb11b746ceb5 40 /* Classes -------------------------------------------------------------------*/
sepp_nepp 6:fb11b746ceb5 41 /** Class representing a VL53L0 sensor component
sepp_nepp 6:fb11b746ceb5 42 */
sepp_nepp 6:fb11b746ceb5 43 class VL53L0X
sepp_nepp 6:fb11b746ceb5 44 {
sepp_nepp 6:fb11b746ceb5 45 public:
sepp_nepp 6:fb11b746ceb5 46 /** Constructor
sepp_nepp 6:fb11b746ceb5 47 * @param[in] &i2c device I2C to be used for communication
sepp_nepp 6:fb11b746ceb5 48 * @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
sepp_nepp 6:fb11b746ceb5 49 * @param[in] dev_addr device address, 0x29 by default
sepp_nepp 6:fb11b746ceb5 50 */
sepp_nepp 6:fb11b746ceb5 51 VL53L0X(I2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c),
sepp_nepp 6:fb11b746ceb5 52 _gpio0(pin)
sepp_nepp 6:fb11b746ceb5 53 {
sepp_nepp 7:3a1115c2556b 54 I2cDevAddr = dev_addr;
sepp_nepp 7:3a1115c2556b 55 comms_type = 1; // VL53L0X_COMMS_I2C
sepp_nepp 7:3a1115c2556b 56 comms_speed_khz = 400;
sepp_nepp 7:3a1115c2556b 57 if (pin_gpio1 != NC) { _gpio1Int = new InterruptIn(pin_gpio1); }
sepp_nepp 7:3a1115c2556b 58 else { _gpio1Int = NULL; }
sepp_nepp 6:fb11b746ceb5 59 }
sepp_nepp 6:fb11b746ceb5 60
sepp_nepp 6:fb11b746ceb5 61 /** Destructor
sepp_nepp 6:fb11b746ceb5 62 */
sepp_nepp 6:fb11b746ceb5 63 virtual ~VL53L0X()
sepp_nepp 6:fb11b746ceb5 64 {
sepp_nepp 6:fb11b746ceb5 65 if (_gpio1Int != NULL) { delete _gpio1Int; }
sepp_nepp 6:fb11b746ceb5 66 }
sepp_nepp 6:fb11b746ceb5 67
sepp_nepp 6:fb11b746ceb5 68 /*** Interface Methods ***/
sepp_nepp 6:fb11b746ceb5 69 /*** High level API ***/
sepp_nepp 6:fb11b746ceb5 70 /**
sepp_nepp 6:fb11b746ceb5 71 * @brief PowerOn the sensor
sepp_nepp 6:fb11b746ceb5 72 * @return void
sepp_nepp 6:fb11b746ceb5 73 */
sepp_nepp 6:fb11b746ceb5 74 /* turns on the sensor */
sepp_nepp 6:fb11b746ceb5 75 void VL53L0X_on(void)
sepp_nepp 6:fb11b746ceb5 76 {
sepp_nepp 6:fb11b746ceb5 77 if (_gpio0) { *_gpio0 = 1; }
sepp_nepp 6:fb11b746ceb5 78 wait_ms(10);
sepp_nepp 6:fb11b746ceb5 79 }
sepp_nepp 6:fb11b746ceb5 80
sepp_nepp 6:fb11b746ceb5 81 /**
sepp_nepp 6:fb11b746ceb5 82 * @brief PowerOff the sensor
sepp_nepp 6:fb11b746ceb5 83 * @return void
sepp_nepp 6:fb11b746ceb5 84 */
sepp_nepp 6:fb11b746ceb5 85 /* turns off the sensor */
sepp_nepp 6:fb11b746ceb5 86 void VL53L0X_off(void)
sepp_nepp 6:fb11b746ceb5 87 {
sepp_nepp 6:fb11b746ceb5 88 if (_gpio0) { *_gpio0 = 0; }
sepp_nepp 6:fb11b746ceb5 89 wait_ms(10);
sepp_nepp 6:fb11b746ceb5 90 }
sepp_nepp 6:fb11b746ceb5 91
sepp_nepp 6:fb11b746ceb5 92
sepp_nepp 6:fb11b746ceb5 93 /**
sepp_nepp 6:fb11b746ceb5 94 * @brief Initialize the sensor with default values
sepp_nepp 6:fb11b746ceb5 95 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 96 */
sepp_nepp 6:fb11b746ceb5 97 int init_sensor(uint8_t new_addr = VL53L0X_DEFAULT_ADDRESS);
sepp_nepp 6:fb11b746ceb5 98
sepp_nepp 6:fb11b746ceb5 99 /**
sepp_nepp 6:fb11b746ceb5 100 * @brief Start the measure indicated by operating mode
sepp_nepp 6:fb11b746ceb5 101 * @param[in] operating_mode specifies requested measure
sepp_nepp 6:fb11b746ceb5 102 * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure
sepp_nepp 6:fb11b746ceb5 103 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 104 */
sepp_nepp 6:fb11b746ceb5 105 int start_measurement(OperatingMode operating_mode, void (*fptr)(void),
sepp_nepp 6:fb11b746ceb5 106 VL53L0X_RangingConfig rangingConfig = Range_Config_DEFAULT);
sepp_nepp 6:fb11b746ceb5 107
sepp_nepp 6:fb11b746ceb5 108 /**
sepp_nepp 6:fb11b746ceb5 109 * @brief Get results for the measure indicated by operating mode
sepp_nepp 6:fb11b746ceb5 110 * @param[in] operating_mode specifies requested measure results
sepp_nepp 6:fb11b746ceb5 111 * @param[out] p_data pointer to the MeasureData_t structure to read data in to
sepp_nepp 6:fb11b746ceb5 112 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 113 */
sepp_nepp 6:fb11b746ceb5 114 int get_measurement(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *p_data);
sepp_nepp 6:fb11b746ceb5 115
sepp_nepp 6:fb11b746ceb5 116 /**
sepp_nepp 6:fb11b746ceb5 117 * @brief Stop the currently running measure indicate by operating_mode
sepp_nepp 6:fb11b746ceb5 118 * @param[in] operating_mode specifies requested measure to stop
sepp_nepp 6:fb11b746ceb5 119 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 120 */
sepp_nepp 6:fb11b746ceb5 121 int stop_measurement(OperatingMode operating_mode);
sepp_nepp 6:fb11b746ceb5 122
sepp_nepp 6:fb11b746ceb5 123 /**
sepp_nepp 6:fb11b746ceb5 124 * @brief Interrupt handling func to be called by user after an INT is occourred
sepp_nepp 6:fb11b746ceb5 125 * @param[in] opeating_mode indicating the in progress measure
sepp_nepp 6:fb11b746ceb5 126 * @param[out] Data pointer to the MeasureData_t structure to read data in to
sepp_nepp 6:fb11b746ceb5 127 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 128 */
sepp_nepp 6:fb11b746ceb5 129 int handle_irq(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *data);
sepp_nepp 6:fb11b746ceb5 130
sepp_nepp 6:fb11b746ceb5 131 /**
sepp_nepp 6:fb11b746ceb5 132 * @brief Enable interrupt measure IRQ
sepp_nepp 6:fb11b746ceb5 133 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 134 */
sepp_nepp 6:fb11b746ceb5 135 void enable_interrupt_measure_detection_irq(void)
sepp_nepp 6:fb11b746ceb5 136 {
sepp_nepp 6:fb11b746ceb5 137 if (_gpio1Int != NULL) { _gpio1Int->enable_irq();}
sepp_nepp 6:fb11b746ceb5 138 }
sepp_nepp 6:fb11b746ceb5 139
sepp_nepp 6:fb11b746ceb5 140 /**
sepp_nepp 6:fb11b746ceb5 141 * @brief Disable interrupt measure IRQ
sepp_nepp 6:fb11b746ceb5 142 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 143 */
sepp_nepp 6:fb11b746ceb5 144 void disable_interrupt_measure_detection_irq(void)
sepp_nepp 6:fb11b746ceb5 145 {
sepp_nepp 6:fb11b746ceb5 146 if (_gpio1Int != NULL) { _gpio1Int->disable_irq(); }
sepp_nepp 6:fb11b746ceb5 147 }
sepp_nepp 6:fb11b746ceb5 148
sepp_nepp 6:fb11b746ceb5 149 /**
sepp_nepp 6:fb11b746ceb5 150 * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
sepp_nepp 6:fb11b746ceb5 151 * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
sepp_nepp 6:fb11b746ceb5 152 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 153 */
sepp_nepp 6:fb11b746ceb5 154 void attach_interrupt_measure_detection_irq(void (*fptr)(void))
sepp_nepp 6:fb11b746ceb5 155 {
sepp_nepp 6:fb11b746ceb5 156 if (_gpio1Int != NULL) { _gpio1Int->rise(fptr); }
sepp_nepp 6:fb11b746ceb5 157 }
sepp_nepp 6:fb11b746ceb5 158
sepp_nepp 6:fb11b746ceb5 159 /** Wrapper functions */
sepp_nepp 6:fb11b746ceb5 160 /** @defgroup api_init Init functions
sepp_nepp 6:fb11b746ceb5 161 * @brief API init functions
sepp_nepp 6:fb11b746ceb5 162 * @ingroup api_hl
sepp_nepp 6:fb11b746ceb5 163 * @{
sepp_nepp 6:fb11b746ceb5 164 */
sepp_nepp 6:fb11b746ceb5 165
sepp_nepp 6:fb11b746ceb5 166 /**
sepp_nepp 6:fb11b746ceb5 167 * @brief Prepare device for operation
sepp_nepp 6:fb11b746ceb5 168 * @par Function Description
sepp_nepp 6:fb11b746ceb5 169 * Does static initialization and reprogram common default settings \n
sepp_nepp 6:fb11b746ceb5 170 * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n
sepp_nepp 6:fb11b746ceb5 171 * After prepare user can : \n
sepp_nepp 6:fb11b746ceb5 172 * @li Call other API function to set other settings\n
sepp_nepp 6:fb11b746ceb5 173 * @li Configure the interrupt pins, etc... \n
sepp_nepp 6:fb11b746ceb5 174 * @li Then start ranging or ALS operations in single shot or continuous mode
sepp_nepp 6:fb11b746ceb5 175 *
sepp_nepp 6:fb11b746ceb5 176 * @param void
sepp_nepp 6:fb11b746ceb5 177 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 178 */
sepp_nepp 6:fb11b746ceb5 179 int prepare();
sepp_nepp 6:fb11b746ceb5 180
sepp_nepp 6:fb11b746ceb5 181 /**
sepp_nepp 6:fb11b746ceb5 182 * @brief Start continuous ranging mode
sepp_nepp 6:fb11b746ceb5 183 *
sepp_nepp 6:fb11b746ceb5 184 * @details End user should ensure device is in idle state and not already running
sepp_nepp 6:fb11b746ceb5 185 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 186 */
sepp_nepp 6:fb11b746ceb5 187 int range_start_continuous_mode();
sepp_nepp 6:fb11b746ceb5 188
sepp_nepp 6:fb11b746ceb5 189 /**
sepp_nepp 6:fb11b746ceb5 190 * @brief Get ranging result and only that
sepp_nepp 6:fb11b746ceb5 191 *
sepp_nepp 6:fb11b746ceb5 192 * @par Function Description
sepp_nepp 6:fb11b746ceb5 193 * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in millimeter \n
sepp_nepp 6:fb11b746ceb5 194 * It does any required up-scale translation\n
sepp_nepp 6:fb11b746ceb5 195 * It can be called after success status polling or in interrupt mode \n
sepp_nepp 6:fb11b746ceb5 196 * @warning these function is not doing wrap around filtering \n
sepp_nepp 6:fb11b746ceb5 197 * This function doesn't perform any data ready check!
sepp_nepp 6:fb11b746ceb5 198 *
sepp_nepp 6:fb11b746ceb5 199 * @param p_data Pointer to range distance
sepp_nepp 6:fb11b746ceb5 200 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 201 */
sepp_nepp 6:fb11b746ceb5 202 virtual int get_distance(uint32_t *p_data)
sepp_nepp 6:fb11b746ceb5 203 {
sepp_nepp 6:fb11b746ceb5 204 int status = 0;
sepp_nepp 6:fb11b746ceb5 205 VL53L0X_RangingMeasurementData_t p_ranging_measurement_data;
sepp_nepp 6:fb11b746ceb5 206
sepp_nepp 6:fb11b746ceb5 207 status = start_measurement(range_single_shot_polling, NULL);
sepp_nepp 6:fb11b746ceb5 208 if (!status) {
sepp_nepp 6:fb11b746ceb5 209 status = get_measurement(range_single_shot_polling, &p_ranging_measurement_data);
sepp_nepp 6:fb11b746ceb5 210 }
sepp_nepp 6:fb11b746ceb5 211 if (p_ranging_measurement_data.RangeStatus == 0) {
sepp_nepp 6:fb11b746ceb5 212 // we have a valid range.
sepp_nepp 6:fb11b746ceb5 213 *p_data = p_ranging_measurement_data.RangeMilliMeter;
sepp_nepp 6:fb11b746ceb5 214 } else {
sepp_nepp 6:fb11b746ceb5 215 *p_data = 0;
sepp_nepp 6:fb11b746ceb5 216 status = VL53L0X_ERROR_RANGE_ERROR;
sepp_nepp 6:fb11b746ceb5 217 }
sepp_nepp 6:fb11b746ceb5 218 stop_measurement(range_single_shot_polling);
sepp_nepp 6:fb11b746ceb5 219 return status;
sepp_nepp 6:fb11b746ceb5 220 }
sepp_nepp 6:fb11b746ceb5 221
sepp_nepp 6:fb11b746ceb5 222 /** @} */
sepp_nepp 6:fb11b746ceb5 223
sepp_nepp 6:fb11b746ceb5 224 /**
sepp_nepp 6:fb11b746ceb5 225 * @brief Set new device i2c address
sepp_nepp 6:fb11b746ceb5 226 *
sepp_nepp 6:fb11b746ceb5 227 * After completion the device will answer to the new address programmed.
sepp_nepp 6:fb11b746ceb5 228 *
sepp_nepp 6:fb11b746ceb5 229 * @param new_addr The new i2c address (7bit)
sepp_nepp 6:fb11b746ceb5 230 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 231 */
sepp_nepp 6:fb11b746ceb5 232 int set_device_address(int new_addr)
sepp_nepp 6:fb11b746ceb5 233 {
sepp_nepp 6:fb11b746ceb5 234 int status;
sepp_nepp 6:fb11b746ceb5 235
sepp_nepp 7:3a1115c2556b 236 status = VL53L0X_set_device_address(new_addr);
sepp_nepp 7:3a1115c2556b 237 if (!status) { I2cDevAddr = new_addr; }
sepp_nepp 6:fb11b746ceb5 238 return status;
sepp_nepp 6:fb11b746ceb5 239 }
sepp_nepp 6:fb11b746ceb5 240
sepp_nepp 6:fb11b746ceb5 241 /**
sepp_nepp 6:fb11b746ceb5 242 * @brief Clear given system interrupt condition
sepp_nepp 6:fb11b746ceb5 243 *
sepp_nepp 6:fb11b746ceb5 244 * @par Function Description
sepp_nepp 6:fb11b746ceb5 245 * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register.
sepp_nepp 7:3a1115c2556b 246 * @param int_clear Which interrupt source to clear. Use any combinations of #INTERRUPT_CLEAR_RANGING , #INTERRUPT_CLEAR_ALS , #INTERRUPT_CLEAR_ERROR.
sepp_nepp 6:fb11b746ceb5 247 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 248 */
sepp_nepp 6:fb11b746ceb5 249 int clear_interrupt(uint8_t int_clear)
sepp_nepp 7:3a1115c2556b 250 { return VL53L0X_clear_interrupt_mask(int_clear); }
sepp_nepp 6:fb11b746ceb5 251
sepp_nepp 6:fb11b746ceb5 252
sepp_nepp 6:fb11b746ceb5 253 /**
sepp_nepp 6:fb11b746ceb5 254 *
sepp_nepp 6:fb11b746ceb5 255 * @brief One time device initialization
sepp_nepp 6:fb11b746ceb5 256 *
sepp_nepp 6:fb11b746ceb5 257 * To be called once and only once after device is brought out of reset
sepp_nepp 6:fb11b746ceb5 258 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted()
sepp_nepp 6:fb11b746ceb5 259 *
sepp_nepp 6:fb11b746ceb5 260 * @par Function Description
sepp_nepp 6:fb11b746ceb5 261 * When not used after a fresh device "power up" or reset, it may return
sepp_nepp 6:fb11b746ceb5 262 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data
sepp_nepp 6:fb11b746ceb5 263 * may have been fetched from device that can result in ranging offset error\n
sepp_nepp 6:fb11b746ceb5 264 * If application cannot execute device reset or need to run VL53L0X_DataInit
sepp_nepp 6:fb11b746ceb5 265 * multiple time then it must ensure proper offset calibration saving and
sepp_nepp 6:fb11b746ceb5 266 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first
sepp_nepp 6:fb11b746ceb5 267 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init
sepp_nepp 6:fb11b746ceb5 268 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to
sepp_nepp 6:fb11b746ceb5 269 * VL53L0X_STATE_WAIT_STATICINIT.
sepp_nepp 6:fb11b746ceb5 270 *
sepp_nepp 6:fb11b746ceb5 271 * @note This function accesses to the device
sepp_nepp 6:fb11b746ceb5 272 *
sepp_nepp 7:3a1115c2556b 273 *
sepp_nepp 6:fb11b746ceb5 274 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 275 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 276 */
sepp_nepp 7:3a1115c2556b 277 VL53L0X_Error VL53L0X_data_init(void);
sepp_nepp 6:fb11b746ceb5 278
sepp_nepp 6:fb11b746ceb5 279 /**
sepp_nepp 6:fb11b746ceb5 280 * @brief Do basic device init (and eventually patch loading)
sepp_nepp 6:fb11b746ceb5 281 * This function will change the VL53L0X_State from
sepp_nepp 6:fb11b746ceb5 282 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
sepp_nepp 6:fb11b746ceb5 283 * In this stage all default setting will be applied.
sepp_nepp 6:fb11b746ceb5 284 *
sepp_nepp 6:fb11b746ceb5 285 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 286 *
sepp_nepp 7:3a1115c2556b 287 *
sepp_nepp 6:fb11b746ceb5 288 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 289 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 290 */
sepp_nepp 7:3a1115c2556b 291 VL53L0X_Error VL53L0X_static_init(void);
sepp_nepp 6:fb11b746ceb5 292
sepp_nepp 6:fb11b746ceb5 293 /**
sepp_nepp 6:fb11b746ceb5 294 * @brief Perform Reference Calibration
sepp_nepp 6:fb11b746ceb5 295 *
sepp_nepp 6:fb11b746ceb5 296 * @details Perform a reference calibration of the Device.
sepp_nepp 6:fb11b746ceb5 297 * This function should be run from time to time before doing
sepp_nepp 6:fb11b746ceb5 298 * a ranging measurement.
sepp_nepp 6:fb11b746ceb5 299 * This function will launch a special ranging measurement, so
sepp_nepp 6:fb11b746ceb5 300 * if interrupt are enable an interrupt will be done.
sepp_nepp 6:fb11b746ceb5 301 * This function will clear the interrupt generated automatically.
sepp_nepp 6:fb11b746ceb5 302 *
sepp_nepp 6:fb11b746ceb5 303 * @warning This function is a blocking function
sepp_nepp 6:fb11b746ceb5 304 *
sepp_nepp 6:fb11b746ceb5 305 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 306 *
sepp_nepp 7:3a1115c2556b 307 *
sepp_nepp 6:fb11b746ceb5 308 * @param p_vhv_settings Pointer to vhv settings parameter.
sepp_nepp 6:fb11b746ceb5 309 * @param p_phase_cal Pointer to PhaseCal parameter.
sepp_nepp 6:fb11b746ceb5 310 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 311 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 312 */
sepp_nepp 7:3a1115c2556b 313 VL53L0X_Error VL53L0X_perform_ref_calibration( uint8_t *p_vhv_settings,
sepp_nepp 6:fb11b746ceb5 314 uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 315
sepp_nepp 6:fb11b746ceb5 316 /**
sepp_nepp 6:fb11b746ceb5 317 * @brief Get Reference Calibration Parameters
sepp_nepp 6:fb11b746ceb5 318 *
sepp_nepp 6:fb11b746ceb5 319 * @par Function Description
sepp_nepp 6:fb11b746ceb5 320 * Get Reference Calibration Parameters.
sepp_nepp 6:fb11b746ceb5 321 *
sepp_nepp 6:fb11b746ceb5 322 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 323 *
sepp_nepp 7:3a1115c2556b 324 *
sepp_nepp 6:fb11b746ceb5 325 * @param p_vhv_settings Pointer to VHV parameter
sepp_nepp 6:fb11b746ceb5 326 * @param p_phase_cal Pointer to PhaseCal Parameter
sepp_nepp 6:fb11b746ceb5 327 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 328 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 329 */
sepp_nepp 7:3a1115c2556b 330 VL53L0X_Error VL53L0X_get_ref_calibration(
sepp_nepp 6:fb11b746ceb5 331 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 332
sepp_nepp 7:3a1115c2556b 333 VL53L0X_Error VL53L0X_set_ref_calibration(
sepp_nepp 6:fb11b746ceb5 334 uint8_t vhv_settings, uint8_t phase_cal);
sepp_nepp 6:fb11b746ceb5 335
sepp_nepp 6:fb11b746ceb5 336 /**
sepp_nepp 6:fb11b746ceb5 337 * @brief Performs Reference Spad Management
sepp_nepp 6:fb11b746ceb5 338 *
sepp_nepp 6:fb11b746ceb5 339 * @par Function Description
sepp_nepp 6:fb11b746ceb5 340 * The reference SPAD initialization procedure determines the minimum amount
sepp_nepp 6:fb11b746ceb5 341 * of reference spads to be enables to achieve a target reference signal rate
sepp_nepp 6:fb11b746ceb5 342 * and should be performed once during initialization.
sepp_nepp 6:fb11b746ceb5 343 *
sepp_nepp 6:fb11b746ceb5 344 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 345 *
sepp_nepp 6:fb11b746ceb5 346 * @note This function change the device mode to
sepp_nepp 6:fb11b746ceb5 347 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 348 *
sepp_nepp 7:3a1115c2556b 349 *
sepp_nepp 6:fb11b746ceb5 350 * @param ref_spad_count Reports ref Spad Count
sepp_nepp 6:fb11b746ceb5 351 * @param is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 352 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 353 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 354 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 355 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure.
sepp_nepp 6:fb11b746ceb5 356 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 357 */
sepp_nepp 7:3a1115c2556b 358 VL53L0X_Error VL53L0X_perform_ref_spad_management(
sepp_nepp 6:fb11b746ceb5 359 uint32_t *ref_spad_count, uint8_t *is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 360
sepp_nepp 6:fb11b746ceb5 361 /**
sepp_nepp 6:fb11b746ceb5 362 * @brief Applies Reference SPAD configuration
sepp_nepp 6:fb11b746ceb5 363 *
sepp_nepp 6:fb11b746ceb5 364 * @par Function Description
sepp_nepp 6:fb11b746ceb5 365 * This function applies a given number of reference spads, identified as
sepp_nepp 6:fb11b746ceb5 366 * either Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 367 * The requested spad count and type are stored within the device specific
sepp_nepp 6:fb11b746ceb5 368 * parameters data for access by the host.
sepp_nepp 6:fb11b746ceb5 369 *
sepp_nepp 6:fb11b746ceb5 370 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 371 *
sepp_nepp 7:3a1115c2556b 372 *
sepp_nepp 6:fb11b746ceb5 373 * @param refSpadCount Number of ref spads.
sepp_nepp 6:fb11b746ceb5 374 * @param is_aperture_spads Defines if spads are of type
sepp_nepp 6:fb11b746ceb5 375 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 376 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 377 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 378 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 379 * spad configuration.
sepp_nepp 6:fb11b746ceb5 380 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 381 */
sepp_nepp 7:3a1115c2556b 382 VL53L0X_Error VL53L0X_set_reference_spads(
sepp_nepp 6:fb11b746ceb5 383 uint32_t refSpadCount, uint8_t is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 384
sepp_nepp 6:fb11b746ceb5 385 /**
sepp_nepp 6:fb11b746ceb5 386 * @brief Retrieves SPAD configuration
sepp_nepp 6:fb11b746ceb5 387 *
sepp_nepp 6:fb11b746ceb5 388 * @par Function Description
sepp_nepp 6:fb11b746ceb5 389 * This function retrieves the current number of applied reference spads
sepp_nepp 6:fb11b746ceb5 390 * and also their type : Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 391 *
sepp_nepp 6:fb11b746ceb5 392 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 393 *
sepp_nepp 7:3a1115c2556b 394 *
sepp_nepp 6:fb11b746ceb5 395 * @param p_spad_count Number ref Spad Count
sepp_nepp 6:fb11b746ceb5 396 * @param p_is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 397 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 398 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 399 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 400 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 401 * spad configuration.
sepp_nepp 6:fb11b746ceb5 402 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 403 */
sepp_nepp 7:3a1115c2556b 404 VL53L0X_Error VL53L0X_get_reference_spads(
sepp_nepp 6:fb11b746ceb5 405 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 406
sepp_nepp 6:fb11b746ceb5 407 /**
sepp_nepp 6:fb11b746ceb5 408 * @brief Get part to part calibration offset
sepp_nepp 6:fb11b746ceb5 409 *
sepp_nepp 6:fb11b746ceb5 410 * @par Function Description
sepp_nepp 6:fb11b746ceb5 411 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
sepp_nepp 6:fb11b746ceb5 412 * device NVM value
sepp_nepp 6:fb11b746ceb5 413 *
sepp_nepp 6:fb11b746ceb5 414 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 415 *
sepp_nepp 6:fb11b746ceb5 416 * @param p_offset_calibration_data_micro_meter Return part to part
sepp_nepp 6:fb11b746ceb5 417 * calibration offset from device (microns)
sepp_nepp 6:fb11b746ceb5 418 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 419 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 420 */
sepp_nepp 7:3a1115c2556b 421 VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 422 int32_t *p_offset_calibration_data_micro_meter);
sepp_nepp 6:fb11b746ceb5 423 /**
sepp_nepp 6:fb11b746ceb5 424 * Set or over-hide part to part calibration offset
sepp_nepp 6:fb11b746ceb5 425 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter()
sepp_nepp 6:fb11b746ceb5 426 *
sepp_nepp 6:fb11b746ceb5 427 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 428 *
sepp_nepp 6:fb11b746ceb5 429 * @param p_offset_calibration_data_micro_meter Offset (microns)
sepp_nepp 6:fb11b746ceb5 430 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 431 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 432 */
sepp_nepp 7:3a1115c2556b 433 VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 434 int32_t offset_calibration_data_micro_meter);
sepp_nepp 6:fb11b746ceb5 435
sepp_nepp 7:3a1115c2556b 436 VL53L0X_Error VL53L0X_perform_offset_calibration(
sepp_nepp 6:fb11b746ceb5 437 FixPoint1616_t cal_distance_milli_meter,
sepp_nepp 6:fb11b746ceb5 438 int32_t *p_offset_micro_meter);
sepp_nepp 6:fb11b746ceb5 439
sepp_nepp 7:3a1115c2556b 440 VL53L0X_Error VL53L0X_perform_xtalk_calibration(
sepp_nepp 6:fb11b746ceb5 441 FixPoint1616_t xtalk_cal_distance,
sepp_nepp 6:fb11b746ceb5 442 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
sepp_nepp 6:fb11b746ceb5 443
sepp_nepp 6:fb11b746ceb5 444 /**
sepp_nepp 6:fb11b746ceb5 445 * @brief Perform XTalk Measurement
sepp_nepp 6:fb11b746ceb5 446 *
sepp_nepp 6:fb11b746ceb5 447 * @details Measures the current cross talk from glass in front
sepp_nepp 6:fb11b746ceb5 448 * of the sensor.
sepp_nepp 6:fb11b746ceb5 449 * This functions performs a histogram measurement and uses the results
sepp_nepp 6:fb11b746ceb5 450 * to measure the crosstalk. For the function to be successful, there
sepp_nepp 6:fb11b746ceb5 451 * must be no target in front of the sensor.
sepp_nepp 6:fb11b746ceb5 452 *
sepp_nepp 6:fb11b746ceb5 453 * @warning This function is a blocking function
sepp_nepp 6:fb11b746ceb5 454 *
sepp_nepp 6:fb11b746ceb5 455 * @warning This function is not supported when the final range
sepp_nepp 6:fb11b746ceb5 456 * vcsel clock period is set below 10 PCLKS.
sepp_nepp 6:fb11b746ceb5 457 *
sepp_nepp 6:fb11b746ceb5 458 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 459 *
sepp_nepp 7:3a1115c2556b 460 *
sepp_nepp 6:fb11b746ceb5 461 * @param timeout_ms Histogram measurement duration.
sepp_nepp 6:fb11b746ceb5 462 * @param p_xtalk_per_spad Output parameter containing the crosstalk
sepp_nepp 6:fb11b746ceb5 463 * measurement result, in MCPS/Spad.
sepp_nepp 6:fb11b746ceb5 464 * Format fixpoint 16:16.
sepp_nepp 6:fb11b746ceb5 465 * @param p_ambient_too_high Output parameter which indicate that
sepp_nepp 6:fb11b746ceb5 466 * pXtalkPerSpad is not good if the Ambient
sepp_nepp 6:fb11b746ceb5 467 * is too high.
sepp_nepp 6:fb11b746ceb5 468 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 469 * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported
sepp_nepp 6:fb11b746ceb5 470 * for this operation.
sepp_nepp 6:fb11b746ceb5 471 * Must not be less than 10PCLKS.
sepp_nepp 6:fb11b746ceb5 472 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 473 */
sepp_nepp 7:3a1115c2556b 474 VL53L0X_Error VL53L0X_perform_xtalk_measurement(
sepp_nepp 6:fb11b746ceb5 475 uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad,
sepp_nepp 6:fb11b746ceb5 476 uint8_t *p_ambient_too_high);
sepp_nepp 6:fb11b746ceb5 477
sepp_nepp 6:fb11b746ceb5 478 /**
sepp_nepp 6:fb11b746ceb5 479 * @brief Set Cross talk compensation rate
sepp_nepp 6:fb11b746ceb5 480 *
sepp_nepp 6:fb11b746ceb5 481 * @par Function Description
sepp_nepp 6:fb11b746ceb5 482 * Set Cross talk compensation rate.
sepp_nepp 6:fb11b746ceb5 483 *
sepp_nepp 6:fb11b746ceb5 484 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 485 *
sepp_nepp 6:fb11b746ceb5 486 * @param x_talk_compensation_rate_mega_cps Compensation rate in
sepp_nepp 6:fb11b746ceb5 487 * Mega counts per second
sepp_nepp 6:fb11b746ceb5 488 * (16.16 fix point) see
sepp_nepp 6:fb11b746ceb5 489 * datasheet for details
sepp_nepp 6:fb11b746ceb5 490 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 491 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 492 */
sepp_nepp 7:3a1115c2556b 493 VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps(
sepp_nepp 6:fb11b746ceb5 494 FixPoint1616_t x_talk_compensation_rate_mega_cps);
sepp_nepp 6:fb11b746ceb5 495
sepp_nepp 6:fb11b746ceb5 496 /**
sepp_nepp 6:fb11b746ceb5 497 * @brief Get Cross talk compensation rate
sepp_nepp 6:fb11b746ceb5 498 *
sepp_nepp 6:fb11b746ceb5 499 * @par Function Description
sepp_nepp 6:fb11b746ceb5 500 * Get Cross talk compensation rate.
sepp_nepp 6:fb11b746ceb5 501 *
sepp_nepp 6:fb11b746ceb5 502 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 503 *
sepp_nepp 6:fb11b746ceb5 504 * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate
sepp_nepp 6:fb11b746ceb5 505 * in Mega counts per second
sepp_nepp 6:fb11b746ceb5 506 * (16.16 fix point) see
sepp_nepp 6:fb11b746ceb5 507 * datasheet for details
sepp_nepp 6:fb11b746ceb5 508 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 509 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 510 */
sepp_nepp 7:3a1115c2556b 511 VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps(
sepp_nepp 6:fb11b746ceb5 512 FixPoint1616_t *p_xtalk_compensation_rate_mega_cps);
sepp_nepp 6:fb11b746ceb5 513
sepp_nepp 6:fb11b746ceb5 514 /**
sepp_nepp 7:3a1115c2556b 515 * @brief Get Cross talk enable
sepp_nepp 7:3a1115c2556b 516 *
sepp_nepp 7:3a1115c2556b 517 * Enable/Disable Cross Talk by set to zero the Cross Talk value by
sepp_nepp 7:3a1115c2556b 518 * using @a VL53L0X_SetXTalkCompensationRateMegaCps().
sepp_nepp 7:3a1115c2556b 519 *
sepp_nepp 7:3a1115c2556b 520 * @param dev Device Handle
sepp_nepp 7:3a1115c2556b 521 * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation
sepp_nepp 7:3a1115c2556b 522 * state 0=disabled or 1 = enabled
sepp_nepp 7:3a1115c2556b 523 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 7:3a1115c2556b 524 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 7:3a1115c2556b 525 */
sepp_nepp 7:3a1115c2556b 526 VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(uint8_t *p_x_talk_compensation_enable);
sepp_nepp 7:3a1115c2556b 527
sepp_nepp 7:3a1115c2556b 528 /**
sepp_nepp 6:fb11b746ceb5 529 * @brief Set a new device mode
sepp_nepp 6:fb11b746ceb5 530 * @par Function Description
sepp_nepp 6:fb11b746ceb5 531 * Set device to a new mode (ranging, histogram ...)
sepp_nepp 6:fb11b746ceb5 532 *
sepp_nepp 6:fb11b746ceb5 533 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 534 *
sepp_nepp 7:3a1115c2556b 535 *
sepp_nepp 6:fb11b746ceb5 536 * @param device_mode New device mode to apply
sepp_nepp 6:fb11b746ceb5 537 * Valid values are:
sepp_nepp 6:fb11b746ceb5 538 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 539 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
sepp_nepp 6:fb11b746ceb5 540 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 541 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
sepp_nepp 6:fb11b746ceb5 542 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
sepp_nepp 6:fb11b746ceb5 543 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
sepp_nepp 6:fb11b746ceb5 544 * VL53L0X_HISTOGRAMMODE_BOTH
sepp_nepp 6:fb11b746ceb5 545 *
sepp_nepp 6:fb11b746ceb5 546 *
sepp_nepp 6:fb11b746ceb5 547 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 548 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 549 * DeviceMode is not in the
sepp_nepp 6:fb11b746ceb5 550 * supported list
sepp_nepp 6:fb11b746ceb5 551 */
sepp_nepp 7:3a1115c2556b 552 VL53L0X_Error VL53L0X_set_device_mode( VL53L0X_DeviceModes device_mode);
sepp_nepp 6:fb11b746ceb5 553
sepp_nepp 6:fb11b746ceb5 554 /**
sepp_nepp 6:fb11b746ceb5 555 * @brief Get current new device mode
sepp_nepp 6:fb11b746ceb5 556 * @par Function Description
sepp_nepp 6:fb11b746ceb5 557 * Get actual mode of the device(ranging, histogram ...)
sepp_nepp 6:fb11b746ceb5 558 *
sepp_nepp 6:fb11b746ceb5 559 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 560 *
sepp_nepp 7:3a1115c2556b 561 *
sepp_nepp 6:fb11b746ceb5 562 * @param p_device_mode Pointer to current apply mode value
sepp_nepp 6:fb11b746ceb5 563 * Valid values are:
sepp_nepp 6:fb11b746ceb5 564 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 565 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
sepp_nepp 6:fb11b746ceb5 566 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 567 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
sepp_nepp 6:fb11b746ceb5 568 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
sepp_nepp 6:fb11b746ceb5 569 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
sepp_nepp 6:fb11b746ceb5 570 * VL53L0X_HISTOGRAMMODE_BOTH
sepp_nepp 6:fb11b746ceb5 571 *
sepp_nepp 6:fb11b746ceb5 572 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 573 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 574 * DeviceMode is not in the
sepp_nepp 6:fb11b746ceb5 575 * supported list
sepp_nepp 6:fb11b746ceb5 576 */
sepp_nepp 7:3a1115c2556b 577 VL53L0X_Error VL53L0X_get_device_mode(
sepp_nepp 6:fb11b746ceb5 578 VL53L0X_DeviceModes *p_device_mode);
sepp_nepp 6:fb11b746ceb5 579
sepp_nepp 6:fb11b746ceb5 580 /**
sepp_nepp 6:fb11b746ceb5 581 * @brief Get current configuration for GPIO pin for a given device
sepp_nepp 6:fb11b746ceb5 582 *
sepp_nepp 6:fb11b746ceb5 583 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 584 *
sepp_nepp 7:3a1115c2556b 585 *
sepp_nepp 6:fb11b746ceb5 586 * @param pin ID of the GPIO Pin
sepp_nepp 6:fb11b746ceb5 587 * @param p_device_mode Pointer to Device Mode associated to the Gpio.
sepp_nepp 6:fb11b746ceb5 588 * @param p_functionality Pointer to Pin functionality.
sepp_nepp 6:fb11b746ceb5 589 * Refer to ::VL53L0X_GpioFunctionality
sepp_nepp 6:fb11b746ceb5 590 * @param p_polarity Pointer to interrupt polarity.
sepp_nepp 6:fb11b746ceb5 591 * Active high or active low see
sepp_nepp 6:fb11b746ceb5 592 * ::VL53L0X_InterruptPolarity
sepp_nepp 6:fb11b746ceb5 593 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 594 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
sepp_nepp 6:fb11b746ceb5 595 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED
sepp_nepp 6:fb11b746ceb5 596 * This error occurs
sepp_nepp 6:fb11b746ceb5 597 * when Funcionality programmed is not in the supported list:
sepp_nepp 6:fb11b746ceb5 598 * Supported value are:
sepp_nepp 6:fb11b746ceb5 599 * VL53L0X_GPIOFUNCTIONALITY_OFF,
sepp_nepp 6:fb11b746ceb5 600 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
sepp_nepp 6:fb11b746ceb5 601 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
sepp_nepp 6:fb11b746ceb5 602 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
sepp_nepp 6:fb11b746ceb5 603 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
sepp_nepp 6:fb11b746ceb5 604 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 605 */
sepp_nepp 7:3a1115c2556b 606 VL53L0X_Error VL53L0X_get_gpio_config( uint8_t pin,
sepp_nepp 6:fb11b746ceb5 607 VL53L0X_DeviceModes *p_device_mode,
sepp_nepp 6:fb11b746ceb5 608 VL53L0X_GpioFunctionality *p_functionality,
sepp_nepp 6:fb11b746ceb5 609 VL53L0X_InterruptPolarity *p_polarity);
sepp_nepp 6:fb11b746ceb5 610
sepp_nepp 6:fb11b746ceb5 611 /**
sepp_nepp 6:fb11b746ceb5 612 * @brief Set the configuration of GPIO pin for a given device
sepp_nepp 6:fb11b746ceb5 613 *
sepp_nepp 6:fb11b746ceb5 614 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 615 *
sepp_nepp 7:3a1115c2556b 616 *
sepp_nepp 6:fb11b746ceb5 617 * @param pin ID of the GPIO Pin
sepp_nepp 6:fb11b746ceb5 618 * @param functionality Select Pin functionality.
sepp_nepp 6:fb11b746ceb5 619 * Refer to ::VL53L0X_GpioFunctionality
sepp_nepp 6:fb11b746ceb5 620 * @param device_mode Device Mode associated to the Gpio.
sepp_nepp 6:fb11b746ceb5 621 * @param polarity Set interrupt polarity. Active high
sepp_nepp 6:fb11b746ceb5 622 * or active low see ::VL53L0X_InterruptPolarity
sepp_nepp 6:fb11b746ceb5 623 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 624 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
sepp_nepp 6:fb11b746ceb5 625 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs
sepp_nepp 6:fb11b746ceb5 626 * when Functionality programmed is not in the supported list:
sepp_nepp 6:fb11b746ceb5 627 * Supported value are:
sepp_nepp 6:fb11b746ceb5 628 * VL53L0X_GPIOFUNCTIONALITY_OFF,
sepp_nepp 6:fb11b746ceb5 629 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
sepp_nepp 6:fb11b746ceb5 630 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
sepp_nepp 6:fb11b746ceb5 631 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
sepp_nepp 6:fb11b746ceb5 632 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
sepp_nepp 6:fb11b746ceb5 633 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 634 */
sepp_nepp 7:3a1115c2556b 635 VL53L0X_Error VL53L0X_set_gpio_config( uint8_t pin,
sepp_nepp 6:fb11b746ceb5 636 VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality,
sepp_nepp 6:fb11b746ceb5 637 VL53L0X_InterruptPolarity polarity);
sepp_nepp 6:fb11b746ceb5 638
sepp_nepp 6:fb11b746ceb5 639 /**
sepp_nepp 6:fb11b746ceb5 640 * @brief Start device measurement
sepp_nepp 6:fb11b746ceb5 641 *
sepp_nepp 6:fb11b746ceb5 642 * @details Started measurement will depend on device parameters set through
sepp_nepp 6:fb11b746ceb5 643 * @a VL53L0X_SetParameters()
sepp_nepp 6:fb11b746ceb5 644 * This is a non-blocking function.
sepp_nepp 6:fb11b746ceb5 645 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to
sepp_nepp 6:fb11b746ceb5 646 * VL53L0X_STATE_RUNNING.
sepp_nepp 6:fb11b746ceb5 647 *
sepp_nepp 6:fb11b746ceb5 648 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 649 *
sepp_nepp 6:fb11b746ceb5 650
sepp_nepp 7:3a1115c2556b 651 *
sepp_nepp 6:fb11b746ceb5 652 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 653 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 654 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported
sepp_nepp 6:fb11b746ceb5 655 * list:
sepp_nepp 6:fb11b746ceb5 656 * Supported mode are:
sepp_nepp 6:fb11b746ceb5 657 * VL53L0X_DEVICEMODE_SINGLE_RANGING,
sepp_nepp 6:fb11b746ceb5 658 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING,
sepp_nepp 6:fb11b746ceb5 659 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 660 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement
sepp_nepp 6:fb11b746ceb5 661 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 662 */
sepp_nepp 7:3a1115c2556b 663 VL53L0X_Error VL53L0X_start_measurement(void);
sepp_nepp 6:fb11b746ceb5 664
sepp_nepp 6:fb11b746ceb5 665 /**
sepp_nepp 6:fb11b746ceb5 666 * @brief Stop device measurement
sepp_nepp 6:fb11b746ceb5 667 *
sepp_nepp 6:fb11b746ceb5 668 * @details Will set the device in standby mode at end of current measurement\n
sepp_nepp 6:fb11b746ceb5 669 * Not necessary in single mode as device shall return automatically
sepp_nepp 6:fb11b746ceb5 670 * in standby mode at end of measurement.
sepp_nepp 6:fb11b746ceb5 671 * This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING
sepp_nepp 6:fb11b746ceb5 672 * to VL53L0X_STATE_IDLE.
sepp_nepp 6:fb11b746ceb5 673 *
sepp_nepp 6:fb11b746ceb5 674 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 675 *
sepp_nepp 7:3a1115c2556b 676 *
sepp_nepp 6:fb11b746ceb5 677 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 678 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 679 */
sepp_nepp 7:3a1115c2556b 680 VL53L0X_Error VL53L0X_stop_measurement(void);
sepp_nepp 6:fb11b746ceb5 681
sepp_nepp 6:fb11b746ceb5 682 /**
sepp_nepp 6:fb11b746ceb5 683 * @brief Return device stop completion status
sepp_nepp 6:fb11b746ceb5 684 *
sepp_nepp 6:fb11b746ceb5 685 * @par Function Description
sepp_nepp 6:fb11b746ceb5 686 * Returns stop completiob status.
sepp_nepp 6:fb11b746ceb5 687 * User shall call this function after a stop command
sepp_nepp 6:fb11b746ceb5 688 *
sepp_nepp 6:fb11b746ceb5 689 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 690 *
sepp_nepp 7:3a1115c2556b 691 *
sepp_nepp 6:fb11b746ceb5 692 * @param p_stop_status Pointer to status variable to update
sepp_nepp 6:fb11b746ceb5 693 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 694 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 695 */
sepp_nepp 7:3a1115c2556b 696 VL53L0X_Error VL53L0X_get_stop_completed_status(
sepp_nepp 6:fb11b746ceb5 697 uint32_t *p_stop_status);
sepp_nepp 6:fb11b746ceb5 698
sepp_nepp 6:fb11b746ceb5 699 /**
sepp_nepp 6:fb11b746ceb5 700 * @brief Return Measurement Data Ready
sepp_nepp 6:fb11b746ceb5 701 *
sepp_nepp 6:fb11b746ceb5 702 * @par Function Description
sepp_nepp 6:fb11b746ceb5 703 * This function indicate that a measurement data is ready.
sepp_nepp 6:fb11b746ceb5 704 * This function check if interrupt mode is used then check is done accordingly.
sepp_nepp 6:fb11b746ceb5 705 * If perform function clear the interrupt, this function will not work,
sepp_nepp 6:fb11b746ceb5 706 * like in case of @a VL53L0X_PerformSingleRangingMeasurement().
sepp_nepp 6:fb11b746ceb5 707 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady
sepp_nepp 6:fb11b746ceb5 708 * is used for non-blocking capture.
sepp_nepp 6:fb11b746ceb5 709 *
sepp_nepp 6:fb11b746ceb5 710 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 711 *
sepp_nepp 7:3a1115c2556b 712 *
sepp_nepp 6:fb11b746ceb5 713 * @param p_measurement_data_ready Pointer to Measurement Data Ready.
sepp_nepp 6:fb11b746ceb5 714 * 0=data not ready, 1 = data ready
sepp_nepp 6:fb11b746ceb5 715 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 716 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 717 */
sepp_nepp 7:3a1115c2556b 718 VL53L0X_Error VL53L0X_get_measurement_data_ready(
sepp_nepp 6:fb11b746ceb5 719 uint8_t *p_measurement_data_ready);
sepp_nepp 6:fb11b746ceb5 720
sepp_nepp 6:fb11b746ceb5 721 /**
sepp_nepp 6:fb11b746ceb5 722 * @brief Retrieve the measurements from device for a given setup
sepp_nepp 6:fb11b746ceb5 723 *
sepp_nepp 6:fb11b746ceb5 724 * @par Function Description
sepp_nepp 6:fb11b746ceb5 725 * Get data from last successful Ranging measurement
sepp_nepp 6:fb11b746ceb5 726 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
sepp_nepp 6:fb11b746ceb5 727 * before get data.
sepp_nepp 6:fb11b746ceb5 728 * PAL will fill a NumberOfROIZones times the corresponding data
sepp_nepp 6:fb11b746ceb5 729 * structure used in the measurement function.
sepp_nepp 6:fb11b746ceb5 730 *
sepp_nepp 6:fb11b746ceb5 731 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 732 *
sepp_nepp 7:3a1115c2556b 733 *
sepp_nepp 6:fb11b746ceb5 734 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
sepp_nepp 6:fb11b746ceb5 735 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 736 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 737 */
sepp_nepp 7:3a1115c2556b 738 VL53L0X_Error VL53L0X_get_ranging_measurement_data(
sepp_nepp 6:fb11b746ceb5 739 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
sepp_nepp 6:fb11b746ceb5 740
sepp_nepp 6:fb11b746ceb5 741 /**
sepp_nepp 6:fb11b746ceb5 742 * @brief Clear given system interrupt condition
sepp_nepp 6:fb11b746ceb5 743 *
sepp_nepp 6:fb11b746ceb5 744 * @par Function Description
sepp_nepp 6:fb11b746ceb5 745 * Clear given interrupt(s).
sepp_nepp 6:fb11b746ceb5 746 *
sepp_nepp 6:fb11b746ceb5 747 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 748 *
sepp_nepp 7:3a1115c2556b 749 *
sepp_nepp 6:fb11b746ceb5 750 * @param interrupt_mask Mask of interrupts to clear
sepp_nepp 6:fb11b746ceb5 751 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 752 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts
sepp_nepp 6:fb11b746ceb5 753 *
sepp_nepp 6:fb11b746ceb5 754 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 755 */
sepp_nepp 7:3a1115c2556b 756 VL53L0X_Error VL53L0X_clear_interrupt_mask( uint32_t interrupt_mask);
sepp_nepp 6:fb11b746ceb5 757
sepp_nepp 6:fb11b746ceb5 758 /**
sepp_nepp 6:fb11b746ceb5 759 * @brief Return device interrupt status
sepp_nepp 6:fb11b746ceb5 760 *
sepp_nepp 6:fb11b746ceb5 761 * @par Function Description
sepp_nepp 6:fb11b746ceb5 762 * Returns currently raised interrupts by the device.
sepp_nepp 6:fb11b746ceb5 763 * User shall be able to activate/deactivate interrupts through
sepp_nepp 6:fb11b746ceb5 764 * @a VL53L0X_SetGpioConfig()
sepp_nepp 6:fb11b746ceb5 765 *
sepp_nepp 6:fb11b746ceb5 766 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 767 *
sepp_nepp 7:3a1115c2556b 768 *
sepp_nepp 6:fb11b746ceb5 769 * @param p_interrupt_mask_status Pointer to status variable to update
sepp_nepp 6:fb11b746ceb5 770 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 771 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 772 */
sepp_nepp 7:3a1115c2556b 773 VL53L0X_Error VL53L0X_get_interrupt_mask_status(
sepp_nepp 6:fb11b746ceb5 774 uint32_t *p_interrupt_mask_status);
sepp_nepp 6:fb11b746ceb5 775
sepp_nepp 6:fb11b746ceb5 776 /**
sepp_nepp 6:fb11b746ceb5 777 * @brief Performs a single ranging measurement and retrieve the ranging
sepp_nepp 6:fb11b746ceb5 778 * measurement data
sepp_nepp 6:fb11b746ceb5 779 *
sepp_nepp 6:fb11b746ceb5 780 * @par Function Description
sepp_nepp 6:fb11b746ceb5 781 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 782 * with @a VL53L0X_SetDeviceMode(),
sepp_nepp 6:fb11b746ceb5 783 * It performs measurement with @a VL53L0X_PerformSingleMeasurement()
sepp_nepp 6:fb11b746ceb5 784 * It get data from last successful Ranging measurement with
sepp_nepp 6:fb11b746ceb5 785 * @a VL53L0X_GetRangingMeasurementData.
sepp_nepp 6:fb11b746ceb5 786 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask().
sepp_nepp 6:fb11b746ceb5 787 *
sepp_nepp 6:fb11b746ceb5 788 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 789 *
sepp_nepp 6:fb11b746ceb5 790 * @note This function change the device mode to
sepp_nepp 6:fb11b746ceb5 791 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 792 *
sepp_nepp 7:3a1115c2556b 793 *
sepp_nepp 6:fb11b746ceb5 794 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
sepp_nepp 6:fb11b746ceb5 795 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 796 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 797 */
sepp_nepp 7:3a1115c2556b 798 VL53L0X_Error VL53L0X_perform_single_ranging_measurement(
sepp_nepp 6:fb11b746ceb5 799 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
sepp_nepp 6:fb11b746ceb5 800
sepp_nepp 6:fb11b746ceb5 801 /**
sepp_nepp 6:fb11b746ceb5 802 * @brief Single shot measurement.
sepp_nepp 6:fb11b746ceb5 803 *
sepp_nepp 6:fb11b746ceb5 804 * @par Function Description
sepp_nepp 6:fb11b746ceb5 805 * Perform simple measurement sequence (Start measure, Wait measure to end,
sepp_nepp 6:fb11b746ceb5 806 * and returns when measurement is done).
sepp_nepp 6:fb11b746ceb5 807 * Once function returns, user can get valid data by calling
sepp_nepp 6:fb11b746ceb5 808 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement
sepp_nepp 6:fb11b746ceb5 809 * depending on defined measurement mode
sepp_nepp 6:fb11b746ceb5 810 * User should Clear the interrupt in case this are enabled by using the
sepp_nepp 6:fb11b746ceb5 811 * function VL53L0X_ClearInterruptMask().
sepp_nepp 6:fb11b746ceb5 812 *
sepp_nepp 6:fb11b746ceb5 813 * @warning This function is a blocking function
sepp_nepp 6:fb11b746ceb5 814 *
sepp_nepp 6:fb11b746ceb5 815 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 816 *
sepp_nepp 7:3a1115c2556b 817 *
sepp_nepp 6:fb11b746ceb5 818 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 819 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 820 */
sepp_nepp 7:3a1115c2556b 821 VL53L0X_Error VL53L0X_perform_single_measurement(void);
sepp_nepp 6:fb11b746ceb5 822
sepp_nepp 6:fb11b746ceb5 823 /**
sepp_nepp 6:fb11b746ceb5 824 * @brief Read current status of the error register for the selected device
sepp_nepp 6:fb11b746ceb5 825 *
sepp_nepp 6:fb11b746ceb5 826 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 827 *
sepp_nepp 7:3a1115c2556b 828 *
sepp_nepp 6:fb11b746ceb5 829 * @param p_device_error_status Pointer to current error code of the device
sepp_nepp 6:fb11b746ceb5 830 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 831 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 832 */
sepp_nepp 7:3a1115c2556b 833 VL53L0X_Error VL53L0X_get_device_error_status(
sepp_nepp 6:fb11b746ceb5 834 VL53L0X_DeviceError *p_device_error_status);
sepp_nepp 6:fb11b746ceb5 835
sepp_nepp 6:fb11b746ceb5 836 /**
sepp_nepp 6:fb11b746ceb5 837 * @brief Human readable error string for a given Error Code
sepp_nepp 6:fb11b746ceb5 838 *
sepp_nepp 6:fb11b746ceb5 839 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 840 *
sepp_nepp 6:fb11b746ceb5 841 * @param error_code The error code as stored on ::VL53L0X_DeviceError
sepp_nepp 6:fb11b746ceb5 842 * @param p_device_error_string The error string corresponding to the ErrorCode
sepp_nepp 6:fb11b746ceb5 843 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 844 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 845 */
sepp_nepp 6:fb11b746ceb5 846 VL53L0X_Error VL53L0X_get_device_error_string(
sepp_nepp 6:fb11b746ceb5 847 VL53L0X_DeviceError error_code, char *p_device_error_string);
sepp_nepp 6:fb11b746ceb5 848
sepp_nepp 6:fb11b746ceb5 849 /**
sepp_nepp 6:fb11b746ceb5 850 * @brief Human readable Range Status string for a given RangeStatus
sepp_nepp 6:fb11b746ceb5 851 *
sepp_nepp 6:fb11b746ceb5 852 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 853 *
sepp_nepp 6:fb11b746ceb5 854 * @param range_status The RangeStatus code as stored on
sepp_nepp 6:fb11b746ceb5 855 * @a VL53L0X_RangingMeasurementData_t
sepp_nepp 6:fb11b746ceb5 856 * @param p_range_status_string The returned RangeStatus string.
sepp_nepp 6:fb11b746ceb5 857 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 858 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 859 */
sepp_nepp 6:fb11b746ceb5 860 VL53L0X_Error VL53L0X_get_range_status_string(uint8_t range_status,
sepp_nepp 6:fb11b746ceb5 861 char *p_range_status_string);
sepp_nepp 6:fb11b746ceb5 862
sepp_nepp 7:3a1115c2556b 863 VL53L0X_Error VL53L0X_get_total_signal_rate(
sepp_nepp 6:fb11b746ceb5 864 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 865 FixPoint1616_t *p_total_signal_rate_mcps);
sepp_nepp 6:fb11b746ceb5 866
sepp_nepp 7:3a1115c2556b 867 VL53L0X_Error VL53L0X_get_total_xtalk_rate(
sepp_nepp 6:fb11b746ceb5 868 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 869 FixPoint1616_t *p_total_xtalk_rate_mcps);
sepp_nepp 6:fb11b746ceb5 870
sepp_nepp 6:fb11b746ceb5 871 /**
sepp_nepp 6:fb11b746ceb5 872 * @brief Get Ranging Timing Budget in microseconds
sepp_nepp 6:fb11b746ceb5 873 *
sepp_nepp 6:fb11b746ceb5 874 * @par Function Description
sepp_nepp 6:fb11b746ceb5 875 * Returns the programmed the maximum time allowed by the user to the
sepp_nepp 6:fb11b746ceb5 876 * device to run a full ranging sequence for the current mode
sepp_nepp 6:fb11b746ceb5 877 * (ranging, histogram, ASL ...)
sepp_nepp 6:fb11b746ceb5 878 *
sepp_nepp 6:fb11b746ceb5 879 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 880 *
sepp_nepp 7:3a1115c2556b 881 *
sepp_nepp 6:fb11b746ceb5 882 * @param p_measurement_timing_budget_micro_seconds Max measurement time in
sepp_nepp 6:fb11b746ceb5 883 * microseconds.
sepp_nepp 6:fb11b746ceb5 884 * Valid values are:
sepp_nepp 6:fb11b746ceb5 885 * >= 17000 microsecs when wraparound enabled
sepp_nepp 6:fb11b746ceb5 886 * >= 12000 microsecs when wraparound disabled
sepp_nepp 6:fb11b746ceb5 887 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 888 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 889 */
sepp_nepp 7:3a1115c2556b 890 VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds(
sepp_nepp 6:fb11b746ceb5 891 uint32_t *p_measurement_timing_budget_micro_seconds);
sepp_nepp 6:fb11b746ceb5 892
sepp_nepp 6:fb11b746ceb5 893 /**
sepp_nepp 6:fb11b746ceb5 894 * @brief Set Ranging Timing Budget in microseconds
sepp_nepp 6:fb11b746ceb5 895 *
sepp_nepp 6:fb11b746ceb5 896 * @par Function Description
sepp_nepp 6:fb11b746ceb5 897 * Defines the maximum time allowed by the user to the device to run a
sepp_nepp 6:fb11b746ceb5 898 * full ranging sequence for the current mode (ranging, histogram, ASL ...)
sepp_nepp 6:fb11b746ceb5 899 *
sepp_nepp 6:fb11b746ceb5 900 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 901 *
sepp_nepp 7:3a1115c2556b 902 *
sepp_nepp 6:fb11b746ceb5 903 * @param measurement_timing_budget_micro_seconds Max measurement time in
sepp_nepp 6:fb11b746ceb5 904 * microseconds.
sepp_nepp 6:fb11b746ceb5 905 * Valid values are:
sepp_nepp 6:fb11b746ceb5 906 * >= 17000 microsecs when wraparound enabled
sepp_nepp 6:fb11b746ceb5 907 * >= 12000 microsecs when wraparound disabled
sepp_nepp 6:fb11b746ceb5 908 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 909 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
sepp_nepp 6:fb11b746ceb5 910 MeasurementTimingBudgetMicroSeconds out of range
sepp_nepp 6:fb11b746ceb5 911 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 912 */
sepp_nepp 7:3a1115c2556b 913 VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds(
sepp_nepp 6:fb11b746ceb5 914 uint32_t measurement_timing_budget_micro_seconds);
sepp_nepp 6:fb11b746ceb5 915
sepp_nepp 6:fb11b746ceb5 916 /**
sepp_nepp 6:fb11b746ceb5 917 * @brief Get specific limit check enable state
sepp_nepp 6:fb11b746ceb5 918 *
sepp_nepp 6:fb11b746ceb5 919 * @par Function Description
sepp_nepp 6:fb11b746ceb5 920 * This function get the enable state of a specific limit check.
sepp_nepp 6:fb11b746ceb5 921 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 922 *
sepp_nepp 6:fb11b746ceb5 923 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 924 *
sepp_nepp 7:3a1115c2556b 925 *
sepp_nepp 6:fb11b746ceb5 926 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 927 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 928 * @param p_limit_check_enable Pointer to the check limit enable
sepp_nepp 6:fb11b746ceb5 929 * value.
sepp_nepp 6:fb11b746ceb5 930 * if 1 the check limit
sepp_nepp 6:fb11b746ceb5 931 * corresponding to LimitCheckId is Enabled
sepp_nepp 6:fb11b746ceb5 932 * if 0 the check limit
sepp_nepp 6:fb11b746ceb5 933 * corresponding to LimitCheckId is disabled
sepp_nepp 6:fb11b746ceb5 934 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 935 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 936 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 937 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 938 */
sepp_nepp 7:3a1115c2556b 939 VL53L0X_Error VL53L0X_get_limit_check_enable( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 940 uint8_t *p_limit_check_enable);
sepp_nepp 6:fb11b746ceb5 941
sepp_nepp 6:fb11b746ceb5 942 /**
sepp_nepp 6:fb11b746ceb5 943 * @brief Enable/Disable a specific limit check
sepp_nepp 6:fb11b746ceb5 944 *
sepp_nepp 6:fb11b746ceb5 945 * @par Function Description
sepp_nepp 6:fb11b746ceb5 946 * This function Enable/Disable a specific limit check.
sepp_nepp 6:fb11b746ceb5 947 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 948 *
sepp_nepp 6:fb11b746ceb5 949 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 950 *
sepp_nepp 7:3a1115c2556b 951 *
sepp_nepp 6:fb11b746ceb5 952 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 953 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 954 * @param limit_check_enable if 1 the check limit
sepp_nepp 6:fb11b746ceb5 955 * corresponding to LimitCheckId is Enabled
sepp_nepp 6:fb11b746ceb5 956 * if 0 the check limit
sepp_nepp 6:fb11b746ceb5 957 * corresponding to LimitCheckId is disabled
sepp_nepp 6:fb11b746ceb5 958 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 959 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 960 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 961 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 962 */
sepp_nepp 7:3a1115c2556b 963 VL53L0X_Error VL53L0X_set_limit_check_enable( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 964 uint8_t limit_check_enable);
sepp_nepp 6:fb11b746ceb5 965
sepp_nepp 6:fb11b746ceb5 966 /**
sepp_nepp 6:fb11b746ceb5 967 * @brief Get a specific limit check value
sepp_nepp 6:fb11b746ceb5 968 *
sepp_nepp 6:fb11b746ceb5 969 * @par Function Description
sepp_nepp 6:fb11b746ceb5 970 * This function get a specific limit check value from device then it updates
sepp_nepp 6:fb11b746ceb5 971 * internal values and check enables.
sepp_nepp 6:fb11b746ceb5 972 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 973 *
sepp_nepp 6:fb11b746ceb5 974 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 975 *
sepp_nepp 7:3a1115c2556b 976 *
sepp_nepp 6:fb11b746ceb5 977 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 978 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 979 * @param p_limit_check_value Pointer to Limit
sepp_nepp 6:fb11b746ceb5 980 * check Value for a given LimitCheckId.
sepp_nepp 6:fb11b746ceb5 981 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 982 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 983 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 984 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 985 */
sepp_nepp 7:3a1115c2556b 986 VL53L0X_Error VL53L0X_get_limit_check_value( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 987 FixPoint1616_t *p_limit_check_value);
sepp_nepp 6:fb11b746ceb5 988
sepp_nepp 6:fb11b746ceb5 989 /**
sepp_nepp 6:fb11b746ceb5 990 * @brief Set a specific limit check value
sepp_nepp 6:fb11b746ceb5 991 *
sepp_nepp 6:fb11b746ceb5 992 * @par Function Description
sepp_nepp 6:fb11b746ceb5 993 * This function set a specific limit check value.
sepp_nepp 6:fb11b746ceb5 994 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 995 *
sepp_nepp 6:fb11b746ceb5 996 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 997 *
sepp_nepp 7:3a1115c2556b 998 *
sepp_nepp 6:fb11b746ceb5 999 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 1000 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 1001 * @param limit_check_value Limit check Value for a given
sepp_nepp 6:fb11b746ceb5 1002 * LimitCheckId
sepp_nepp 6:fb11b746ceb5 1003 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1004 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when either
sepp_nepp 6:fb11b746ceb5 1005 * LimitCheckId or LimitCheckValue value is out of range.
sepp_nepp 6:fb11b746ceb5 1006 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1007 */
sepp_nepp 7:3a1115c2556b 1008 VL53L0X_Error VL53L0X_set_limit_check_value( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 1009 FixPoint1616_t limit_check_value);
sepp_nepp 6:fb11b746ceb5 1010
sepp_nepp 6:fb11b746ceb5 1011 /**
sepp_nepp 6:fb11b746ceb5 1012 * @brief Get the current value of the signal used for the limit check
sepp_nepp 6:fb11b746ceb5 1013 *
sepp_nepp 6:fb11b746ceb5 1014 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1015 * This function get a the current value of the signal used for the limit check.
sepp_nepp 6:fb11b746ceb5 1016 * To obtain the latest value you should run a ranging before.
sepp_nepp 6:fb11b746ceb5 1017 * The value reported is linked to the limit check identified with the
sepp_nepp 6:fb11b746ceb5 1018 * LimitCheckId.
sepp_nepp 6:fb11b746ceb5 1019 *
sepp_nepp 6:fb11b746ceb5 1020 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1021 *
sepp_nepp 7:3a1115c2556b 1022 *
sepp_nepp 6:fb11b746ceb5 1023 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 1024 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 1025 * @param p_limit_check_current Pointer to current Value for a
sepp_nepp 6:fb11b746ceb5 1026 * given LimitCheckId.
sepp_nepp 6:fb11b746ceb5 1027 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1028 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when
sepp_nepp 6:fb11b746ceb5 1029 * LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 1030 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1031 */
sepp_nepp 7:3a1115c2556b 1032 VL53L0X_Error VL53L0X_get_limit_check_current( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 1033 FixPoint1616_t *p_limit_check_current);
sepp_nepp 6:fb11b746ceb5 1034
sepp_nepp 6:fb11b746ceb5 1035 /**
sepp_nepp 6:fb11b746ceb5 1036 * @brief Return a the Status of the specified check limit
sepp_nepp 6:fb11b746ceb5 1037 *
sepp_nepp 6:fb11b746ceb5 1038 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1039 * This function returns the Status of the specified check limit.
sepp_nepp 6:fb11b746ceb5 1040 * The value indicate if the check is fail or not.
sepp_nepp 6:fb11b746ceb5 1041 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 1042 *
sepp_nepp 6:fb11b746ceb5 1043 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1044 *
sepp_nepp 7:3a1115c2556b 1045 *
sepp_nepp 6:fb11b746ceb5 1046 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 1047 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 1048 * @param p_limit_check_status Pointer to the
sepp_nepp 6:fb11b746ceb5 1049 Limit Check Status of the given check limit.
sepp_nepp 6:fb11b746ceb5 1050 * LimitCheckStatus :
sepp_nepp 6:fb11b746ceb5 1051 * 0 the check is not fail
sepp_nepp 6:fb11b746ceb5 1052 * 1 the check if fail or not enabled
sepp_nepp 6:fb11b746ceb5 1053 *
sepp_nepp 6:fb11b746ceb5 1054 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1055 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
sepp_nepp 6:fb11b746ceb5 1056 returned when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 1057 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1058 */
sepp_nepp 7:3a1115c2556b 1059 VL53L0X_Error VL53L0X_get_limit_check_status(
sepp_nepp 6:fb11b746ceb5 1060 uint16_t limit_check_id, uint8_t *p_limit_check_status);
sepp_nepp 6:fb11b746ceb5 1061
sepp_nepp 6:fb11b746ceb5 1062 /**
sepp_nepp 6:fb11b746ceb5 1063 * Get continuous mode Inter-Measurement period in milliseconds
sepp_nepp 6:fb11b746ceb5 1064 *
sepp_nepp 6:fb11b746ceb5 1065 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1066 * When trying to set too short time return INVALID_PARAMS minimal value
sepp_nepp 6:fb11b746ceb5 1067 *
sepp_nepp 6:fb11b746ceb5 1068 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1069 *
sepp_nepp 7:3a1115c2556b 1070 *
sepp_nepp 6:fb11b746ceb5 1071 * @param p_inter_measurement_period_milli_seconds Pointer to programmed
sepp_nepp 6:fb11b746ceb5 1072 * Inter-Measurement Period in milliseconds.
sepp_nepp 6:fb11b746ceb5 1073 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1074 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1075 */
sepp_nepp 7:3a1115c2556b 1076 VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds(
sepp_nepp 6:fb11b746ceb5 1077 uint32_t *p_inter_measurement_period_milli_seconds);
sepp_nepp 6:fb11b746ceb5 1078
sepp_nepp 6:fb11b746ceb5 1079 /**
sepp_nepp 6:fb11b746ceb5 1080 * Program continuous mode Inter-Measurement period in milliseconds
sepp_nepp 6:fb11b746ceb5 1081 *
sepp_nepp 6:fb11b746ceb5 1082 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1083 * When trying to set too short time return INVALID_PARAMS minimal value
sepp_nepp 6:fb11b746ceb5 1084 *
sepp_nepp 6:fb11b746ceb5 1085 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1086 *
sepp_nepp 7:3a1115c2556b 1087 *
sepp_nepp 6:fb11b746ceb5 1088 * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms.
sepp_nepp 6:fb11b746ceb5 1089 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1090 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1091 */
sepp_nepp 6:fb11b746ceb5 1092 VL53L0X_Error VL53L0X_set_inter_measurement_period_milli_seconds(
sepp_nepp 7:3a1115c2556b 1093 uint32_t inter_measurement_period_milli_seconds);
sepp_nepp 6:fb11b746ceb5 1094
sepp_nepp 6:fb11b746ceb5 1095 /**
sepp_nepp 6:fb11b746ceb5 1096 * @brief Set new device address
sepp_nepp 6:fb11b746ceb5 1097 *
sepp_nepp 6:fb11b746ceb5 1098 * After completion the device will answer to the new address programmed.
sepp_nepp 6:fb11b746ceb5 1099 * This function should be called when several devices are used in parallel
sepp_nepp 6:fb11b746ceb5 1100 * before start programming the sensor.
sepp_nepp 6:fb11b746ceb5 1101 * When a single device us used, there is no need to call this function.
sepp_nepp 6:fb11b746ceb5 1102 *
sepp_nepp 6:fb11b746ceb5 1103 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1104 *
sepp_nepp 7:3a1115c2556b 1105 *
sepp_nepp 6:fb11b746ceb5 1106 * @param device_address The new Device address
sepp_nepp 6:fb11b746ceb5 1107 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1108 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1109 */
sepp_nepp 7:3a1115c2556b 1110 VL53L0X_Error VL53L0X_set_device_address( uint8_t device_address);
sepp_nepp 6:fb11b746ceb5 1111
sepp_nepp 6:fb11b746ceb5 1112 /**
sepp_nepp 6:fb11b746ceb5 1113 * @brief Do an hard reset or soft reset (depending on implementation) of the
sepp_nepp 6:fb11b746ceb5 1114 * device \nAfter call of this function, device must be in same state as right
sepp_nepp 6:fb11b746ceb5 1115 * after a power-up sequence.This function will change the VL53L0X_State to
sepp_nepp 6:fb11b746ceb5 1116 * VL53L0X_STATE_POWERDOWN.
sepp_nepp 6:fb11b746ceb5 1117 *
sepp_nepp 6:fb11b746ceb5 1118 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1119 *
sepp_nepp 7:3a1115c2556b 1120 *
sepp_nepp 6:fb11b746ceb5 1121 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1122 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1123 */
sepp_nepp 7:3a1115c2556b 1124 VL53L0X_Error VL53L0X_reset_device(void);
sepp_nepp 6:fb11b746ceb5 1125
sepp_nepp 6:fb11b746ceb5 1126 /**
sepp_nepp 6:fb11b746ceb5 1127 * @brief Get setup of Wrap around Check
sepp_nepp 6:fb11b746ceb5 1128 *
sepp_nepp 6:fb11b746ceb5 1129 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1130 * This function get the wrapAround check enable parameters
sepp_nepp 6:fb11b746ceb5 1131 *
sepp_nepp 6:fb11b746ceb5 1132 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1133 *
sepp_nepp 7:3a1115c2556b 1134 *
sepp_nepp 6:fb11b746ceb5 1135 * @param p_wrap_around_check_enable Pointer to the Wrap around Check state
sepp_nepp 6:fb11b746ceb5 1136 * 0=disabled or 1 = enabled
sepp_nepp 6:fb11b746ceb5 1137 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1138 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1139 */
sepp_nepp 7:3a1115c2556b 1140 VL53L0X_Error VL53L0X_get_wrap_around_check_enable(
sepp_nepp 6:fb11b746ceb5 1141 uint8_t *p_wrap_around_check_enable);
sepp_nepp 6:fb11b746ceb5 1142
sepp_nepp 6:fb11b746ceb5 1143 /**
sepp_nepp 6:fb11b746ceb5 1144 * @brief Enable (or disable) Wrap around Check
sepp_nepp 6:fb11b746ceb5 1145 *
sepp_nepp 6:fb11b746ceb5 1146 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1147 *
sepp_nepp 7:3a1115c2556b 1148 *
sepp_nepp 6:fb11b746ceb5 1149 * @param wrap_around_check_enable Wrap around Check to be set
sepp_nepp 6:fb11b746ceb5 1150 * 0=disabled, other = enabled
sepp_nepp 6:fb11b746ceb5 1151 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1152 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1153 */
sepp_nepp 7:3a1115c2556b 1154 VL53L0X_Error VL53L0X_set_wrap_around_check_enable(
sepp_nepp 6:fb11b746ceb5 1155 uint8_t wrap_around_check_enable);
sepp_nepp 6:fb11b746ceb5 1156
sepp_nepp 6:fb11b746ceb5 1157 /**
sepp_nepp 6:fb11b746ceb5 1158 * @brief Gets the VCSEL pulse period.
sepp_nepp 6:fb11b746ceb5 1159 *
sepp_nepp 6:fb11b746ceb5 1160 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1161 * This function retrieves the VCSEL pulse period for the given period type.
sepp_nepp 6:fb11b746ceb5 1162 *
sepp_nepp 6:fb11b746ceb5 1163 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1164 *
sepp_nepp 7:3a1115c2556b 1165 *
sepp_nepp 6:fb11b746ceb5 1166 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
sepp_nepp 6:fb11b746ceb5 1167 * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value.
sepp_nepp 6:fb11b746ceb5 1168 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1169 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
sepp_nepp 6:fb11b746ceb5 1170 * supported.
sepp_nepp 6:fb11b746ceb5 1171 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1172 */
sepp_nepp 7:3a1115c2556b 1173 VL53L0X_Error VL53L0X_get_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1174 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1175
sepp_nepp 6:fb11b746ceb5 1176 /**
sepp_nepp 6:fb11b746ceb5 1177 * @brief Sets the VCSEL pulse period.
sepp_nepp 6:fb11b746ceb5 1178 *
sepp_nepp 6:fb11b746ceb5 1179 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1180 * This function retrieves the VCSEL pulse period for the given period type.
sepp_nepp 6:fb11b746ceb5 1181 *
sepp_nepp 6:fb11b746ceb5 1182 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1183 *
sepp_nepp 7:3a1115c2556b 1184 *
sepp_nepp 6:fb11b746ceb5 1185 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
sepp_nepp 6:fb11b746ceb5 1186 * @param vcsel_pulse_period VCSEL period value
sepp_nepp 6:fb11b746ceb5 1187 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1188 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
sepp_nepp 6:fb11b746ceb5 1189 * supported.
sepp_nepp 6:fb11b746ceb5 1190 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1191 */
sepp_nepp 7:3a1115c2556b 1192 VL53L0X_Error VL53L0X_set_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1193 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period);
sepp_nepp 6:fb11b746ceb5 1194
sepp_nepp 6:fb11b746ceb5 1195 /**
sepp_nepp 6:fb11b746ceb5 1196 * @brief Set low and high Interrupt thresholds for a given mode
sepp_nepp 6:fb11b746ceb5 1197 * (ranging, ALS, ...) for a given device
sepp_nepp 6:fb11b746ceb5 1198 *
sepp_nepp 6:fb11b746ceb5 1199 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1200 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...)
sepp_nepp 6:fb11b746ceb5 1201 * for a given device
sepp_nepp 6:fb11b746ceb5 1202 *
sepp_nepp 6:fb11b746ceb5 1203 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1204 *
sepp_nepp 6:fb11b746ceb5 1205 * @note DeviceMode is ignored for the current device
sepp_nepp 6:fb11b746ceb5 1206 *
sepp_nepp 7:3a1115c2556b 1207 *
sepp_nepp 6:fb11b746ceb5 1208 * @param device_mode Device Mode for which change thresholds
sepp_nepp 6:fb11b746ceb5 1209 * @param threshold_low Low threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1210 * @param threshold_high High threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1211 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1212 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1213 */
sepp_nepp 7:3a1115c2556b 1214 VL53L0X_Error VL53L0X_set_interrupt_thresholds(
sepp_nepp 6:fb11b746ceb5 1215 VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low,
sepp_nepp 6:fb11b746ceb5 1216 FixPoint1616_t threshold_high);
sepp_nepp 6:fb11b746ceb5 1217
sepp_nepp 6:fb11b746ceb5 1218 /**
sepp_nepp 6:fb11b746ceb5 1219 * @brief Get high and low Interrupt thresholds for a given mode
sepp_nepp 6:fb11b746ceb5 1220 * (ranging, ALS, ...) for a given device
sepp_nepp 6:fb11b746ceb5 1221 *
sepp_nepp 6:fb11b746ceb5 1222 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1223 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...)
sepp_nepp 6:fb11b746ceb5 1224 * for a given device
sepp_nepp 6:fb11b746ceb5 1225 *
sepp_nepp 6:fb11b746ceb5 1226 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1227 *
sepp_nepp 6:fb11b746ceb5 1228 * @note DeviceMode is ignored for the current device
sepp_nepp 6:fb11b746ceb5 1229 *
sepp_nepp 7:3a1115c2556b 1230 *
sepp_nepp 6:fb11b746ceb5 1231 * @param device_mode Device Mode from which read thresholds
sepp_nepp 6:fb11b746ceb5 1232 * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1233 * @param p_threshold_high High threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1234 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1235 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1236 */
sepp_nepp 7:3a1115c2556b 1237 VL53L0X_Error VL53L0X_get_interrupt_thresholds(
sepp_nepp 6:fb11b746ceb5 1238 VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low,
sepp_nepp 6:fb11b746ceb5 1239 FixPoint1616_t *p_threshold_high);
sepp_nepp 6:fb11b746ceb5 1240
sepp_nepp 6:fb11b746ceb5 1241 /**
sepp_nepp 6:fb11b746ceb5 1242 * @brief Reads the Device information for given Device
sepp_nepp 6:fb11b746ceb5 1243 *
sepp_nepp 6:fb11b746ceb5 1244 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1245 *
sepp_nepp 7:3a1115c2556b 1246 *
sepp_nepp 6:fb11b746ceb5 1247 * @param p_VL53L0X_device_info Pointer to current device info for a given
sepp_nepp 6:fb11b746ceb5 1248 * Device
sepp_nepp 6:fb11b746ceb5 1249 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1250 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1251 */
sepp_nepp 7:3a1115c2556b 1252 VL53L0X_Error VL53L0X_get_device_info(
sepp_nepp 6:fb11b746ceb5 1253 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
sepp_nepp 6:fb11b746ceb5 1254
sepp_nepp 6:fb11b746ceb5 1255 /**
sepp_nepp 6:fb11b746ceb5 1256 * @brief Gets the (on/off) state of all sequence steps.
sepp_nepp 6:fb11b746ceb5 1257 *
sepp_nepp 6:fb11b746ceb5 1258 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1259 * This function retrieves the state of all sequence step in the scheduler.
sepp_nepp 6:fb11b746ceb5 1260 *
sepp_nepp 6:fb11b746ceb5 1261 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1262 *
sepp_nepp 7:3a1115c2556b 1263 *
sepp_nepp 6:fb11b746ceb5 1264 * @param p_scheduler_sequence_steps Pointer to struct containing result.
sepp_nepp 6:fb11b746ceb5 1265 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1266 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1267 */
sepp_nepp 7:3a1115c2556b 1268 VL53L0X_Error VL53L0X_get_sequence_step_enables(
sepp_nepp 6:fb11b746ceb5 1269 VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps);
sepp_nepp 6:fb11b746ceb5 1270
sepp_nepp 6:fb11b746ceb5 1271 /**
sepp_nepp 6:fb11b746ceb5 1272 * @brief Sets the (on/off) state of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1273 *
sepp_nepp 6:fb11b746ceb5 1274 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1275 * This function enables/disables a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1276 *
sepp_nepp 6:fb11b746ceb5 1277 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1278 *
sepp_nepp 7:3a1115c2556b 1279 *
sepp_nepp 6:fb11b746ceb5 1280 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1281 * @param sequence_step_enabled Demanded state {0=Off,1=On}
sepp_nepp 6:fb11b746ceb5 1282 * is enabled.
sepp_nepp 6:fb11b746ceb5 1283 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1284 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 1285 * supported.
sepp_nepp 6:fb11b746ceb5 1286 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1287 */
sepp_nepp 7:3a1115c2556b 1288 VL53L0X_Error VL53L0X_set_sequence_step_enable(
sepp_nepp 6:fb11b746ceb5 1289 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 1290
sepp_nepp 6:fb11b746ceb5 1291 /**
sepp_nepp 6:fb11b746ceb5 1292 * @brief Gets the fraction enable parameter indicating the resolution of
sepp_nepp 6:fb11b746ceb5 1293 * range measurements.
sepp_nepp 6:fb11b746ceb5 1294 *
sepp_nepp 6:fb11b746ceb5 1295 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1296 * Gets the fraction enable state, which translates to the resolution of
sepp_nepp 6:fb11b746ceb5 1297 * range measurements as follows :Enabled:=0.25mm resolution,
sepp_nepp 6:fb11b746ceb5 1298 * Not Enabled:=1mm resolution.
sepp_nepp 6:fb11b746ceb5 1299 *
sepp_nepp 6:fb11b746ceb5 1300 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1301 *
sepp_nepp 7:3a1115c2556b 1302 *
sepp_nepp 6:fb11b746ceb5 1303 * @param p_enabled Output Parameter reporting the fraction enable state.
sepp_nepp 6:fb11b746ceb5 1304 *
sepp_nepp 6:fb11b746ceb5 1305 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1306 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1307 */
sepp_nepp 7:3a1115c2556b 1308 VL53L0X_Error VL53L0X_get_fraction_enable( uint8_t *p_enabled);
sepp_nepp 6:fb11b746ceb5 1309
sepp_nepp 6:fb11b746ceb5 1310 /**
sepp_nepp 6:fb11b746ceb5 1311 * @brief Sets the resolution of range measurements.
sepp_nepp 6:fb11b746ceb5 1312 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1313 * Set resolution of range measurements to either 0.25mm if
sepp_nepp 6:fb11b746ceb5 1314 * fraction enabled or 1mm if not enabled.
sepp_nepp 6:fb11b746ceb5 1315 *
sepp_nepp 6:fb11b746ceb5 1316 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1317 *
sepp_nepp 7:3a1115c2556b 1318 *
sepp_nepp 6:fb11b746ceb5 1319 * @param enable Enable high resolution
sepp_nepp 6:fb11b746ceb5 1320 *
sepp_nepp 6:fb11b746ceb5 1321 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1322 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1323 */
sepp_nepp 7:3a1115c2556b 1324 VL53L0X_Error VL53L0X_set_range_fraction_enable(
sepp_nepp 6:fb11b746ceb5 1325 uint8_t enable);
sepp_nepp 6:fb11b746ceb5 1326
sepp_nepp 6:fb11b746ceb5 1327 /**
sepp_nepp 6:fb11b746ceb5 1328 * @brief Return the VL53L0X PAL Implementation Version
sepp_nepp 6:fb11b746ceb5 1329 *
sepp_nepp 6:fb11b746ceb5 1330 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 1331 *
sepp_nepp 6:fb11b746ceb5 1332 * @param p_version Pointer to current PAL Implementation Version
sepp_nepp 6:fb11b746ceb5 1333 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1334 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1335 */
sepp_nepp 6:fb11b746ceb5 1336 VL53L0X_Error VL53L0X_get_version(VL53L0X_Version_t *p_version);
sepp_nepp 6:fb11b746ceb5 1337
sepp_nepp 6:fb11b746ceb5 1338 /**
sepp_nepp 6:fb11b746ceb5 1339 * @brief Reads the Product Revision for a for given Device
sepp_nepp 6:fb11b746ceb5 1340 * This function can be used to distinguish cut1.0 from cut1.1.
sepp_nepp 6:fb11b746ceb5 1341 *
sepp_nepp 6:fb11b746ceb5 1342 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1343 *
sepp_nepp 7:3a1115c2556b 1344 *
sepp_nepp 6:fb11b746ceb5 1345 * @param p_product_revision_major Pointer to Product Revision Major
sepp_nepp 6:fb11b746ceb5 1346 * for a given Device
sepp_nepp 6:fb11b746ceb5 1347 * @param p_product_revision_minor Pointer to Product Revision Minor
sepp_nepp 6:fb11b746ceb5 1348 * for a given Device
sepp_nepp 6:fb11b746ceb5 1349 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1350 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1351 */
sepp_nepp 7:3a1115c2556b 1352 VL53L0X_Error VL53L0X_get_product_revision(
sepp_nepp 6:fb11b746ceb5 1353 uint8_t *p_product_revision_major, uint8_t *p_product_revision_minor);
sepp_nepp 6:fb11b746ceb5 1354
sepp_nepp 6:fb11b746ceb5 1355 /**
sepp_nepp 6:fb11b746ceb5 1356 * @brief Retrieve current device parameters
sepp_nepp 6:fb11b746ceb5 1357 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1358 * Get actual parameters of the device
sepp_nepp 6:fb11b746ceb5 1359 * @li Then start ranging operation.
sepp_nepp 6:fb11b746ceb5 1360 *
sepp_nepp 6:fb11b746ceb5 1361 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1362 *
sepp_nepp 7:3a1115c2556b 1363 *
sepp_nepp 6:fb11b746ceb5 1364 * @param p_device_parameters Pointer to store current device parameters.
sepp_nepp 6:fb11b746ceb5 1365 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1366 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1367 */
sepp_nepp 7:3a1115c2556b 1368 VL53L0X_Error VL53L0X_get_device_parameters(
sepp_nepp 6:fb11b746ceb5 1369 VL53L0X_DeviceParameters_t *p_device_parameters);
sepp_nepp 6:fb11b746ceb5 1370
sepp_nepp 6:fb11b746ceb5 1371 /**
sepp_nepp 6:fb11b746ceb5 1372 * @brief Human readable error string for current PAL error status
sepp_nepp 6:fb11b746ceb5 1373 *
sepp_nepp 6:fb11b746ceb5 1374 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 1375 *
sepp_nepp 6:fb11b746ceb5 1376 * @param pal_error_code The error code as stored on @a VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1377 * @param p_pal_error_string The error string corresponding to the
sepp_nepp 6:fb11b746ceb5 1378 * PalErrorCode
sepp_nepp 6:fb11b746ceb5 1379 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1380 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1381 */
sepp_nepp 6:fb11b746ceb5 1382 VL53L0X_Error VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code,
sepp_nepp 6:fb11b746ceb5 1383 char *p_pal_error_string);
sepp_nepp 6:fb11b746ceb5 1384
sepp_nepp 6:fb11b746ceb5 1385 /**
sepp_nepp 6:fb11b746ceb5 1386 * @brief Return the PAL Specification Version used for the current
sepp_nepp 6:fb11b746ceb5 1387 * implementation.
sepp_nepp 6:fb11b746ceb5 1388 *
sepp_nepp 6:fb11b746ceb5 1389 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 1390 *
sepp_nepp 6:fb11b746ceb5 1391 * @param p_pal_spec_version Pointer to current PAL Specification Version
sepp_nepp 6:fb11b746ceb5 1392 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1393 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1394 */
sepp_nepp 6:fb11b746ceb5 1395 VL53L0X_Error VL53L0X_get_pal_spec_version(
sepp_nepp 6:fb11b746ceb5 1396 VL53L0X_Version_t *p_pal_spec_version);
sepp_nepp 6:fb11b746ceb5 1397
sepp_nepp 6:fb11b746ceb5 1398 /**
sepp_nepp 6:fb11b746ceb5 1399 * @brief Reads the internal state of the PAL for a given Device
sepp_nepp 6:fb11b746ceb5 1400 *
sepp_nepp 6:fb11b746ceb5 1401 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 1402 *
sepp_nepp 7:3a1115c2556b 1403 *
sepp_nepp 6:fb11b746ceb5 1404 * @param p_pal_state Pointer to current state of the PAL for a
sepp_nepp 6:fb11b746ceb5 1405 * given Device
sepp_nepp 6:fb11b746ceb5 1406 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1407 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1408 */
sepp_nepp 7:3a1115c2556b 1409 VL53L0X_Error VL53L0X_get_pal_state(
sepp_nepp 6:fb11b746ceb5 1410 VL53L0X_State *p_pal_state);
sepp_nepp 6:fb11b746ceb5 1411
sepp_nepp 6:fb11b746ceb5 1412 /**
sepp_nepp 6:fb11b746ceb5 1413 * @brief Human readable PAL State string
sepp_nepp 6:fb11b746ceb5 1414 *
sepp_nepp 6:fb11b746ceb5 1415 * @note This function doesn't access to the device
sepp_nepp 6:fb11b746ceb5 1416 *
sepp_nepp 6:fb11b746ceb5 1417 * @param pal_state_code The State code as stored on @a VL53L0X_State
sepp_nepp 6:fb11b746ceb5 1418 * @param p_pal_state_string The State string corresponding to the
sepp_nepp 6:fb11b746ceb5 1419 * PalStateCode
sepp_nepp 6:fb11b746ceb5 1420 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1421 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1422 */
sepp_nepp 6:fb11b746ceb5 1423 VL53L0X_Error VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code,
sepp_nepp 6:fb11b746ceb5 1424 char *p_pal_state_string);
sepp_nepp 6:fb11b746ceb5 1425
sepp_nepp 6:fb11b746ceb5 1426 /*** End High level API ***/
sepp_nepp 6:fb11b746ceb5 1427 public:
sepp_nepp 6:fb11b746ceb5 1428 /* api.h functions */
sepp_nepp 6:fb11b746ceb5 1429
sepp_nepp 7:3a1115c2556b 1430 VL53L0X_Error sequence_step_enabled(VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config,
sepp_nepp 6:fb11b746ceb5 1431 uint8_t *p_sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 1432
sepp_nepp 7:3a1115c2556b 1433 VL53L0X_Error VL53L0X_check_and_load_interrupt_settings(
sepp_nepp 6:fb11b746ceb5 1434 uint8_t start_not_stopflag);
sepp_nepp 6:fb11b746ceb5 1435
sepp_nepp 6:fb11b746ceb5 1436
sepp_nepp 6:fb11b746ceb5 1437 /* api_core.h functions */
sepp_nepp 6:fb11b746ceb5 1438
sepp_nepp 7:3a1115c2556b 1439 VL53L0X_Error VL53L0X_get_info_from_device( uint8_t option);
sepp_nepp 6:fb11b746ceb5 1440
sepp_nepp 7:3a1115c2556b 1441 VL53L0X_Error VL53L0X_device_read_strobe(void);
sepp_nepp 6:fb11b746ceb5 1442
sepp_nepp 7:3a1115c2556b 1443 VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds(
sepp_nepp 6:fb11b746ceb5 1444 uint32_t *p_measurement_timing_budget_micro_seconds);
sepp_nepp 6:fb11b746ceb5 1445
sepp_nepp 7:3a1115c2556b 1446 VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1447 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1448
sepp_nepp 6:fb11b746ceb5 1449 uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
sepp_nepp 6:fb11b746ceb5 1450
sepp_nepp 6:fb11b746ceb5 1451 uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
sepp_nepp 6:fb11b746ceb5 1452
sepp_nepp 7:3a1115c2556b 1453 uint32_t VL53L0X_calc_timeout_us(
sepp_nepp 6:fb11b746ceb5 1454 uint16_t timeout_period_mclks,
sepp_nepp 6:fb11b746ceb5 1455 uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1456
sepp_nepp 7:3a1115c2556b 1457 uint32_t VL53L0X_calc_macro_period_ps( uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1458
sepp_nepp 7:3a1115c2556b 1459 VL53L0X_Error VL53L0X_measurement_poll_for_completion(void);
sepp_nepp 6:fb11b746ceb5 1460
sepp_nepp 7:3a1115c2556b 1461 VL53L0X_Error VL53L0X_load_tuning_settings(
sepp_nepp 6:fb11b746ceb5 1462 uint8_t *p_tuning_setting_buffer);
sepp_nepp 6:fb11b746ceb5 1463
sepp_nepp 7:3a1115c2556b 1464 VL53L0X_Error VL53L0X_get_pal_range_status(
sepp_nepp 6:fb11b746ceb5 1465 uint8_t device_range_status,
sepp_nepp 6:fb11b746ceb5 1466 FixPoint1616_t signal_rate,
sepp_nepp 6:fb11b746ceb5 1467 uint16_t effective_spad_rtn_count,
sepp_nepp 6:fb11b746ceb5 1468 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 1469 uint8_t *p_pal_range_status);
sepp_nepp 7:3a1115c2556b 1470 VL53L0X_Error VL53L0X_calc_sigma_estimate(
sepp_nepp 6:fb11b746ceb5 1471 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 1472 FixPoint1616_t *p_sigma_estimate,
sepp_nepp 6:fb11b746ceb5 1473 uint32_t *p_dmax_mm);
sepp_nepp 7:3a1115c2556b 1474 uint32_t VL53L0X_calc_timeout_mclks(
sepp_nepp 6:fb11b746ceb5 1475 uint32_t timeout_period_us,
sepp_nepp 6:fb11b746ceb5 1476 uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1477 uint32_t VL53L0X_isqrt(uint32_t num);
sepp_nepp 6:fb11b746ceb5 1478
sepp_nepp 6:fb11b746ceb5 1479 uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b);
sepp_nepp 6:fb11b746ceb5 1480
sepp_nepp 6:fb11b746ceb5 1481 VL53L0X_Error VL53L0X_calc_dmax(
sepp_nepp 7:3a1115c2556b 1482
sepp_nepp 6:fb11b746ceb5 1483 FixPoint1616_t total_signal_rate_mcps,
sepp_nepp 6:fb11b746ceb5 1484 FixPoint1616_t total_corr_signal_rate_mcps,
sepp_nepp 6:fb11b746ceb5 1485 FixPoint1616_t pw_mult,
sepp_nepp 6:fb11b746ceb5 1486 uint32_t sigma_estimate_p1,
sepp_nepp 6:fb11b746ceb5 1487 FixPoint1616_t sigma_estimate_p2,
sepp_nepp 6:fb11b746ceb5 1488 uint32_t peak_vcsel_duration_us,
sepp_nepp 6:fb11b746ceb5 1489 uint32_t *pd_max_mm);
sepp_nepp 7:3a1115c2556b 1490 VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds(
sepp_nepp 6:fb11b746ceb5 1491 uint32_t measurement_timing_budget_micro_seconds);
sepp_nepp 7:3a1115c2556b 1492 VL53L0X_Error get_sequence_step_timeout(
sepp_nepp 6:fb11b746ceb5 1493 VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1494 uint32_t *p_time_out_micro_secs);
sepp_nepp 7:3a1115c2556b 1495 VL53L0X_Error set_sequence_step_timeout(
sepp_nepp 6:fb11b746ceb5 1496 VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1497 uint32_t timeout_micro_secs);
sepp_nepp 6:fb11b746ceb5 1498 uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks);
sepp_nepp 7:3a1115c2556b 1499 VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1500 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1501 uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1502
sepp_nepp 6:fb11b746ceb5 1503 /* api_calibration.h functions */
sepp_nepp 7:3a1115c2556b 1504 VL53L0X_Error VL53L0X_apply_offset_adjustment(void);
sepp_nepp 7:3a1115c2556b 1505 VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 1506 int32_t *p_offset_calibration_data_micro_meter);
sepp_nepp 7:3a1115c2556b 1507 VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 1508 int32_t offset_calibration_data_micro_meter);
sepp_nepp 7:3a1115c2556b 1509 VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management(
sepp_nepp 6:fb11b746ceb5 1510 uint32_t *ref_spad_count,
sepp_nepp 6:fb11b746ceb5 1511 uint8_t *is_aperture_spads);
sepp_nepp 7:3a1115c2556b 1512 VL53L0X_Error VL53L0X_perform_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1513 uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable);
sepp_nepp 7:3a1115c2556b 1514 VL53L0X_Error VL53L0X_perform_vhv_calibration(
sepp_nepp 6:fb11b746ceb5 1515 uint8_t *p_vhv_settings, const uint8_t get_data_enable,
sepp_nepp 6:fb11b746ceb5 1516 const uint8_t restore_config);
sepp_nepp 7:3a1115c2556b 1517 VL53L0X_Error VL53L0X_perform_single_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1518 uint8_t vhv_init_byte);
sepp_nepp 7:3a1115c2556b 1519 VL53L0X_Error VL53L0X_ref_calibration_io( uint8_t read_not_write,
sepp_nepp 6:fb11b746ceb5 1520 uint8_t vhv_settings, uint8_t phase_cal,
sepp_nepp 6:fb11b746ceb5 1521 uint8_t *p_vhv_settings, uint8_t *p_phase_cal,
sepp_nepp 6:fb11b746ceb5 1522 const uint8_t vhv_enable, const uint8_t phase_enable);
sepp_nepp 7:3a1115c2556b 1523 VL53L0X_Error VL53L0X_perform_phase_calibration(
sepp_nepp 6:fb11b746ceb5 1524 uint8_t *p_phase_cal, const uint8_t get_data_enable,
sepp_nepp 6:fb11b746ceb5 1525 const uint8_t restore_config);
sepp_nepp 7:3a1115c2556b 1526 VL53L0X_Error enable_ref_spads(
sepp_nepp 6:fb11b746ceb5 1527 uint8_t aperture_spads,
sepp_nepp 6:fb11b746ceb5 1528 uint8_t good_spad_array[],
sepp_nepp 6:fb11b746ceb5 1529 uint8_t spad_array[],
sepp_nepp 6:fb11b746ceb5 1530 uint32_t size,
sepp_nepp 6:fb11b746ceb5 1531 uint32_t start,
sepp_nepp 6:fb11b746ceb5 1532 uint32_t offset,
sepp_nepp 6:fb11b746ceb5 1533 uint32_t spad_count,
sepp_nepp 6:fb11b746ceb5 1534 uint32_t *p_last_spad);
sepp_nepp 6:fb11b746ceb5 1535 void get_next_good_spad(uint8_t good_spad_array[], uint32_t size,
sepp_nepp 6:fb11b746ceb5 1536 uint32_t curr, int32_t *p_next);
sepp_nepp 6:fb11b746ceb5 1537 uint8_t is_aperture(uint32_t spad_index);
sepp_nepp 6:fb11b746ceb5 1538 VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size,
sepp_nepp 6:fb11b746ceb5 1539 uint32_t spad_index);
sepp_nepp 7:3a1115c2556b 1540 VL53L0X_Error set_ref_spad_map( uint8_t *p_ref_spad_array);
sepp_nepp 7:3a1115c2556b 1541 VL53L0X_Error get_ref_spad_map( uint8_t *p_ref_spad_array);
sepp_nepp 7:3a1115c2556b 1542 VL53L0X_Error perform_ref_signal_measurement(
sepp_nepp 6:fb11b746ceb5 1543 uint16_t *p_ref_signal_rate);
sepp_nepp 7:3a1115c2556b 1544 VL53L0X_Error wrapped_VL53L0X_set_reference_spads(
sepp_nepp 6:fb11b746ceb5 1545 uint32_t count, uint8_t is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 1546
sepp_nepp 6:fb11b746ceb5 1547 /* api_strings.h functions */
sepp_nepp 7:3a1115c2556b 1548 VL53L0X_Error wrapped_VL53L0X_get_device_info(
sepp_nepp 6:fb11b746ceb5 1549 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
sepp_nepp 7:3a1115c2556b 1550 VL53L0X_Error VL53L0X_check_part_used(
sepp_nepp 6:fb11b746ceb5 1551 uint8_t *revision,
sepp_nepp 6:fb11b746ceb5 1552 VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
sepp_nepp 6:fb11b746ceb5 1553
sepp_nepp 6:fb11b746ceb5 1554 /* Read function of the ID device */
sepp_nepp 6:fb11b746ceb5 1555 // virtual int read_id();
sepp_nepp 6:fb11b746ceb5 1556 virtual int read_id(uint8_t *id);
sepp_nepp 6:fb11b746ceb5 1557
sepp_nepp 7:3a1115c2556b 1558 VL53L0X_Error wait_measurement_data_ready(void);
sepp_nepp 6:fb11b746ceb5 1559
sepp_nepp 7:3a1115c2556b 1560 VL53L0X_Error wait_stop_completed(void);
sepp_nepp 6:fb11b746ceb5 1561
sepp_nepp 6:fb11b746ceb5 1562 /* Write and read functions from I2C */
sepp_nepp 6:fb11b746ceb5 1563 /**
sepp_nepp 6:fb11b746ceb5 1564 * Write single byte register
sepp_nepp 7:3a1115c2556b 1565 *
sepp_nepp 6:fb11b746ceb5 1566 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1567 * @param data 8 bit register data
sepp_nepp 6:fb11b746ceb5 1568 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1569 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1570 */
sepp_nepp 7:3a1115c2556b 1571 VL53L0X_Error VL53L0X_write_byte( uint8_t index, uint8_t data);
sepp_nepp 6:fb11b746ceb5 1572 /**
sepp_nepp 6:fb11b746ceb5 1573 * Write word register
sepp_nepp 7:3a1115c2556b 1574 *
sepp_nepp 6:fb11b746ceb5 1575 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1576 * @param data 16 bit register data
sepp_nepp 6:fb11b746ceb5 1577 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1578 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1579 */
sepp_nepp 7:3a1115c2556b 1580 VL53L0X_Error VL53L0X_write_word( uint8_t index, uint16_t data);
sepp_nepp 6:fb11b746ceb5 1581 /**
sepp_nepp 6:fb11b746ceb5 1582 * Write double word (4 byte) register
sepp_nepp 7:3a1115c2556b 1583 *
sepp_nepp 6:fb11b746ceb5 1584 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1585 * @param data 32 bit register data
sepp_nepp 6:fb11b746ceb5 1586 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1587 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1588 */
sepp_nepp 7:3a1115c2556b 1589 VL53L0X_Error VL53L0X_write_dword( uint8_t index, uint32_t data);
sepp_nepp 6:fb11b746ceb5 1590 /**
sepp_nepp 6:fb11b746ceb5 1591 * Read single byte register
sepp_nepp 7:3a1115c2556b 1592 *
sepp_nepp 6:fb11b746ceb5 1593 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1594 * @param data pointer to 8 bit data
sepp_nepp 6:fb11b746ceb5 1595 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1596 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1597 */
sepp_nepp 7:3a1115c2556b 1598 VL53L0X_Error VL53L0X_read_byte( uint8_t index, uint8_t *p_data);
sepp_nepp 6:fb11b746ceb5 1599 /**
sepp_nepp 6:fb11b746ceb5 1600 * Read word (2byte) register
sepp_nepp 7:3a1115c2556b 1601 *
sepp_nepp 6:fb11b746ceb5 1602 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1603 * @param data pointer to 16 bit data
sepp_nepp 6:fb11b746ceb5 1604 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1605 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1606 */
sepp_nepp 7:3a1115c2556b 1607 VL53L0X_Error VL53L0X_read_word( uint8_t index, uint16_t *p_data);
sepp_nepp 6:fb11b746ceb5 1608 /**
sepp_nepp 6:fb11b746ceb5 1609 * Read dword (4byte) register
sepp_nepp 7:3a1115c2556b 1610 *
sepp_nepp 6:fb11b746ceb5 1611 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1612 * @param data pointer to 32 bit data
sepp_nepp 6:fb11b746ceb5 1613 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1614 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1615 */
sepp_nepp 7:3a1115c2556b 1616 VL53L0X_Error VL53L0X_read_dword( uint8_t index, uint32_t *p_data);
sepp_nepp 6:fb11b746ceb5 1617 /**
sepp_nepp 6:fb11b746ceb5 1618 * Threat safe Update (read/modify/write) single byte register
sepp_nepp 6:fb11b746ceb5 1619 *
sepp_nepp 6:fb11b746ceb5 1620 * Final_reg = (Initial_reg & and_data) |or_data
sepp_nepp 6:fb11b746ceb5 1621 *
sepp_nepp 7:3a1115c2556b 1622 *
sepp_nepp 6:fb11b746ceb5 1623 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1624 * @param and_data 8 bit and data
sepp_nepp 6:fb11b746ceb5 1625 * @param or_data 8 bit or data
sepp_nepp 6:fb11b746ceb5 1626 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1627 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1628 */
sepp_nepp 7:3a1115c2556b 1629 VL53L0X_Error VL53L0X_update_byte( uint8_t index, uint8_t and_data, uint8_t or_data);
sepp_nepp 6:fb11b746ceb5 1630 /**
sepp_nepp 6:fb11b746ceb5 1631 * Writes the supplied byte buffer to the device
sepp_nepp 7:3a1115c2556b 1632 *
sepp_nepp 6:fb11b746ceb5 1633 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1634 * @param p_data Pointer to uint8_t buffer containing the data to be written
sepp_nepp 6:fb11b746ceb5 1635 * @param count Number of bytes in the supplied byte buffer
sepp_nepp 6:fb11b746ceb5 1636 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1637 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1638 */
sepp_nepp 7:3a1115c2556b 1639 VL53L0X_Error VL53L0X_write_multi( uint8_t index, uint8_t *p_data, uint32_t count);
sepp_nepp 6:fb11b746ceb5 1640 /**
sepp_nepp 6:fb11b746ceb5 1641 * Reads the requested number of bytes from the device
sepp_nepp 7:3a1115c2556b 1642 *
sepp_nepp 6:fb11b746ceb5 1643 * @param index The register index
sepp_nepp 6:fb11b746ceb5 1644 * @param p_data Pointer to the uint8_t buffer to store read data
sepp_nepp 6:fb11b746ceb5 1645 * @param count Number of uint8_t's to read
sepp_nepp 6:fb11b746ceb5 1646 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1647 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1648 */
sepp_nepp 7:3a1115c2556b 1649 VL53L0X_Error VL53L0X_read_multi( uint8_t index, uint8_t *p_data, uint32_t count);
sepp_nepp 6:fb11b746ceb5 1650
sepp_nepp 6:fb11b746ceb5 1651 /**
sepp_nepp 6:fb11b746ceb5 1652 * @brief Writes a buffer towards the I2C peripheral device.
sepp_nepp 7:3a1115c2556b 1653 *
sepp_nepp 6:fb11b746ceb5 1654 * @param p_data pointer to the byte-array data to send
sepp_nepp 6:fb11b746ceb5 1655 * @param number_of_bytes number of bytes to be written.
sepp_nepp 6:fb11b746ceb5 1656 * @retval 0 if ok,
sepp_nepp 6:fb11b746ceb5 1657 * @retval -1 if an I2C error has occured
sepp_nepp 6:fb11b746ceb5 1658 * @note On some devices if NumByteToWrite is greater
sepp_nepp 6:fb11b746ceb5 1659 * than one, the RegisterAddr must be masked correctly!
sepp_nepp 6:fb11b746ceb5 1660 */
sepp_nepp 7:3a1115c2556b 1661 VL53L0X_Error VL53L0X_i2c_write(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
sepp_nepp 6:fb11b746ceb5 1662
sepp_nepp 6:fb11b746ceb5 1663 /**
sepp_nepp 6:fb11b746ceb5 1664 * @brief Reads a buffer from the I2C peripheral device.
sepp_nepp 7:3a1115c2556b 1665 *
sepp_nepp 6:fb11b746ceb5 1666 * @param p_data pointer to the byte-array to read data in to
sepp_nepp 6:fb11b746ceb5 1667 * @param number_of_bytes number of bytes to be read.
sepp_nepp 6:fb11b746ceb5 1668 * @retval 0 if ok,
sepp_nepp 6:fb11b746ceb5 1669 * @retval -1 if an I2C error has occured
sepp_nepp 6:fb11b746ceb5 1670 * @note On some devices if NumByteToWrite is greater
sepp_nepp 6:fb11b746ceb5 1671 * than one, the RegisterAddr must be masked correctly!
sepp_nepp 6:fb11b746ceb5 1672 */
sepp_nepp 7:3a1115c2556b 1673 VL53L0X_Error VL53L0X_i2c_read(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
sepp_nepp 6:fb11b746ceb5 1674
sepp_nepp 6:fb11b746ceb5 1675 /**
sepp_nepp 6:fb11b746ceb5 1676 * @brief execute delay in all polling API call
sepp_nepp 6:fb11b746ceb5 1677 *
sepp_nepp 6:fb11b746ceb5 1678 * A typical multi-thread or RTOs implementation is to sleep the task for some 5ms (with 100Hz max rate faster polling is not needed)
sepp_nepp 6:fb11b746ceb5 1679 * if nothing specific is need you can define it as an empty/void macro
sepp_nepp 6:fb11b746ceb5 1680 * @code
sepp_nepp 6:fb11b746ceb5 1681 * #define VL53L0X_PollingDelay(...) (void)0
sepp_nepp 6:fb11b746ceb5 1682 * @endcode
sepp_nepp 7:3a1115c2556b 1683 *
sepp_nepp 6:fb11b746ceb5 1684 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1685 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1686 */
sepp_nepp 7:3a1115c2556b 1687 VL53L0X_Error VL53L0X_polling_delay(void); /* usually best implemented as a real function */
sepp_nepp 6:fb11b746ceb5 1688
sepp_nepp 6:fb11b746ceb5 1689 ///////////////////////////////////////////////////////////////////////////////////////////////////////
sepp_nepp 6:fb11b746ceb5 1690 //Added functions //
sepp_nepp 6:fb11b746ceb5 1691 ///////////////////////////////////////////////////////////////////////////////////////////////////////
sepp_nepp 6:fb11b746ceb5 1692
sepp_nepp 6:fb11b746ceb5 1693 /**
sepp_nepp 6:fb11b746ceb5 1694 * @brief Cycle Power to Device
sepp_nepp 6:fb11b746ceb5 1695 *
sepp_nepp 6:fb11b746ceb5 1696 * @return status - status 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1697 *
sepp_nepp 6:fb11b746ceb5 1698 */
sepp_nepp 6:fb11b746ceb5 1699 int32_t VL53L0X_cycle_power(void);
sepp_nepp 6:fb11b746ceb5 1700
sepp_nepp 6:fb11b746ceb5 1701 uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1702
sepp_nepp 6:fb11b746ceb5 1703 VL53L0X_Error wrapped_VL53L0X_get_device_error_string(VL53L0X_DeviceError error_code,
sepp_nepp 6:fb11b746ceb5 1704 char *p_device_error_string);
sepp_nepp 6:fb11b746ceb5 1705
sepp_nepp 7:3a1115c2556b 1706 VL53L0X_Error wrapped_VL53L0X_get_limit_check_info( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 1707 char *p_limit_check_string);
sepp_nepp 6:fb11b746ceb5 1708
sepp_nepp 6:fb11b746ceb5 1709 VL53L0X_Error wrapped_VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code,
sepp_nepp 6:fb11b746ceb5 1710 char *p_pal_error_string);
sepp_nepp 6:fb11b746ceb5 1711
sepp_nepp 6:fb11b746ceb5 1712 VL53L0X_Error wrapped_VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code,
sepp_nepp 6:fb11b746ceb5 1713 char *p_pal_state_string);
sepp_nepp 6:fb11b746ceb5 1714
sepp_nepp 6:fb11b746ceb5 1715 VL53L0X_Error wrapped_VL53L0X_get_range_status_string(uint8_t range_status,
sepp_nepp 6:fb11b746ceb5 1716 char *p_range_status_string);
sepp_nepp 6:fb11b746ceb5 1717
sepp_nepp 7:3a1115c2556b 1718 VL53L0X_Error wrapped_VL53L0X_get_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1719 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 1720
sepp_nepp 6:fb11b746ceb5 1721
sepp_nepp 6:fb11b746ceb5 1722 VL53L0X_Error count_enabled_spads(uint8_t spad_array[],
sepp_nepp 6:fb11b746ceb5 1723 uint32_t byte_count, uint32_t max_spads,
sepp_nepp 6:fb11b746ceb5 1724 uint32_t *p_total_spads_enabled, uint8_t *p_is_aperture);
sepp_nepp 6:fb11b746ceb5 1725
sepp_nepp 6:fb11b746ceb5 1726 VL53L0X_Error wrapped_VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1727 char *p_sequence_steps_string);
sepp_nepp 6:fb11b746ceb5 1728
sepp_nepp 6:fb11b746ceb5 1729
sepp_nepp 6:fb11b746ceb5 1730 /**
sepp_nepp 6:fb11b746ceb5 1731 * @brief Gets the name of a given sequence step.
sepp_nepp 6:fb11b746ceb5 1732 *
sepp_nepp 6:fb11b746ceb5 1733 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1734 * This function retrieves the name of sequence steps corresponding to
sepp_nepp 6:fb11b746ceb5 1735 * SequenceStepId.
sepp_nepp 6:fb11b746ceb5 1736 *
sepp_nepp 6:fb11b746ceb5 1737 * @note This function doesn't Accesses the device
sepp_nepp 6:fb11b746ceb5 1738 *
sepp_nepp 6:fb11b746ceb5 1739 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1740 * @param p_sequence_steps_string Pointer to Info string
sepp_nepp 6:fb11b746ceb5 1741 *
sepp_nepp 6:fb11b746ceb5 1742 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1743 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1744 */
sepp_nepp 6:fb11b746ceb5 1745 VL53L0X_Error VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1746 char *p_sequence_steps_string);
sepp_nepp 6:fb11b746ceb5 1747
sepp_nepp 6:fb11b746ceb5 1748 /**
sepp_nepp 6:fb11b746ceb5 1749 * @brief Get the frequency of the timer used for ranging results time stamps
sepp_nepp 6:fb11b746ceb5 1750 *
sepp_nepp 6:fb11b746ceb5 1751 * @param[out] p_timer_freq_hz : pointer for timer frequency
sepp_nepp 6:fb11b746ceb5 1752 *
sepp_nepp 6:fb11b746ceb5 1753 * @return status : 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1754 *
sepp_nepp 6:fb11b746ceb5 1755 */
sepp_nepp 6:fb11b746ceb5 1756 int32_t VL53L0X_get_timer_frequency(int32_t *p_timer_freq_hz);
sepp_nepp 6:fb11b746ceb5 1757
sepp_nepp 6:fb11b746ceb5 1758 /**
sepp_nepp 6:fb11b746ceb5 1759 * @brief Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency())
sepp_nepp 6:fb11b746ceb5 1760 *
sepp_nepp 6:fb11b746ceb5 1761 * @param[out] p_timer_count : pointer for timer count value
sepp_nepp 6:fb11b746ceb5 1762 *
sepp_nepp 6:fb11b746ceb5 1763 * @return status : 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1764 *
sepp_nepp 6:fb11b746ceb5 1765 */
sepp_nepp 6:fb11b746ceb5 1766 int32_t VL53L0X_get_timer_value(int32_t *p_timer_count);
sepp_nepp 6:fb11b746ceb5 1767
sepp_nepp 6:fb11b746ceb5 1768 /**
sepp_nepp 6:fb11b746ceb5 1769 * @brief Get Dmax Calibration Parameters for a given device
sepp_nepp 6:fb11b746ceb5 1770 *
sepp_nepp 6:fb11b746ceb5 1771 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1772 *
sepp_nepp 6:fb11b746ceb5 1773 * @param p_range_milli_meter Pointer to Calibration Distance
sepp_nepp 6:fb11b746ceb5 1774 * @param p_signal_rate_rtn_mega_cps Pointer to Signal rate return
sepp_nepp 6:fb11b746ceb5 1775 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1776 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1777 */
sepp_nepp 7:3a1115c2556b 1778 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(
sepp_nepp 6:fb11b746ceb5 1779 uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps);
sepp_nepp 6:fb11b746ceb5 1780
sepp_nepp 6:fb11b746ceb5 1781 /**
sepp_nepp 6:fb11b746ceb5 1782 * @brief Set Dmax Calibration Parameters for a given device
sepp_nepp 6:fb11b746ceb5 1783 * When one of the parameter is zero, this function will get parameter
sepp_nepp 6:fb11b746ceb5 1784 * from NVM.
sepp_nepp 6:fb11b746ceb5 1785 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1786 *
sepp_nepp 7:3a1115c2556b 1787 *
sepp_nepp 6:fb11b746ceb5 1788 * @param range_milli_meter Calibration Distance
sepp_nepp 6:fb11b746ceb5 1789 * @param signal_rate_rtn_mega_cps Signal rate return read at CalDistance
sepp_nepp 6:fb11b746ceb5 1790 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1791 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1792 */
sepp_nepp 7:3a1115c2556b 1793 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(
sepp_nepp 6:fb11b746ceb5 1794 uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps);
sepp_nepp 6:fb11b746ceb5 1795
sepp_nepp 6:fb11b746ceb5 1796 /**
sepp_nepp 6:fb11b746ceb5 1797 * @brief Get current new device mode
sepp_nepp 6:fb11b746ceb5 1798 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1799 * Get current Histogram mode of a Device
sepp_nepp 6:fb11b746ceb5 1800 *
sepp_nepp 6:fb11b746ceb5 1801 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1802 *
sepp_nepp 6:fb11b746ceb5 1803 * @param p_histogram_mode Pointer to current Histogram Mode value
sepp_nepp 6:fb11b746ceb5 1804 * Valid values are:
sepp_nepp 6:fb11b746ceb5 1805 * VL53L0X_HISTOGRAMMODE_DISABLED
sepp_nepp 6:fb11b746ceb5 1806 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
sepp_nepp 6:fb11b746ceb5 1807 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
sepp_nepp 6:fb11b746ceb5 1808 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
sepp_nepp 6:fb11b746ceb5 1809 * VL53L0X_HISTOGRAMMODE_BOTH
sepp_nepp 6:fb11b746ceb5 1810 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1811 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1812 */
sepp_nepp 7:3a1115c2556b 1813 VL53L0X_Error VL53L0X_get_histogram_mode(
sepp_nepp 6:fb11b746ceb5 1814 VL53L0X_HistogramModes *p_histogram_mode);
sepp_nepp 6:fb11b746ceb5 1815
sepp_nepp 6:fb11b746ceb5 1816 /**
sepp_nepp 6:fb11b746ceb5 1817 * @brief Set a new Histogram mode
sepp_nepp 6:fb11b746ceb5 1818 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1819 * Set device to a new Histogram mode
sepp_nepp 6:fb11b746ceb5 1820 *
sepp_nepp 6:fb11b746ceb5 1821 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1822 *
sepp_nepp 7:3a1115c2556b 1823 *
sepp_nepp 6:fb11b746ceb5 1824 * @param histogram_mode New device mode to apply
sepp_nepp 6:fb11b746ceb5 1825 * Valid values are:
sepp_nepp 6:fb11b746ceb5 1826 * VL53L0X_HISTOGRAMMODE_DISABLED
sepp_nepp 6:fb11b746ceb5 1827 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
sepp_nepp 6:fb11b746ceb5 1828 * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
sepp_nepp 6:fb11b746ceb5 1829 * VL53L0X_HISTOGRAMMODE_RETURN_ONLY
sepp_nepp 6:fb11b746ceb5 1830 * VL53L0X_HISTOGRAMMODE_BOTH
sepp_nepp 6:fb11b746ceb5 1831 *
sepp_nepp 6:fb11b746ceb5 1832 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1833 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 1834 * HistogramMode is not in the supported list
sepp_nepp 6:fb11b746ceb5 1835 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1836 */
sepp_nepp 7:3a1115c2556b 1837 VL53L0X_Error VL53L0X_set_histogram_mode(
sepp_nepp 6:fb11b746ceb5 1838 VL53L0X_HistogramModes histogram_mode);
sepp_nepp 6:fb11b746ceb5 1839
sepp_nepp 6:fb11b746ceb5 1840 /**
sepp_nepp 6:fb11b746ceb5 1841 * @brief Return a description string for a given limit check number
sepp_nepp 6:fb11b746ceb5 1842 *
sepp_nepp 6:fb11b746ceb5 1843 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1844 * This function returns a description string for a given limit check number.
sepp_nepp 6:fb11b746ceb5 1845 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 1846 *
sepp_nepp 6:fb11b746ceb5 1847 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1848 *
sepp_nepp 7:3a1115c2556b 1849 *
sepp_nepp 6:fb11b746ceb5 1850 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 1851 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 1852 * @param p_limit_check_string Pointer to the
sepp_nepp 6:fb11b746ceb5 1853 description string of the given check limit.
sepp_nepp 6:fb11b746ceb5 1854 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1855 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
sepp_nepp 6:fb11b746ceb5 1856 returned when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 1857 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1858 */
sepp_nepp 7:3a1115c2556b 1859 VL53L0X_Error VL53L0X_get_limit_check_info(
sepp_nepp 6:fb11b746ceb5 1860 uint16_t limit_check_id, char *p_limit_check_string);
sepp_nepp 6:fb11b746ceb5 1861
sepp_nepp 6:fb11b746ceb5 1862 /**
sepp_nepp 6:fb11b746ceb5 1863 * @brief Get the linearity corrective gain
sepp_nepp 6:fb11b746ceb5 1864 *
sepp_nepp 6:fb11b746ceb5 1865 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1866 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
sepp_nepp 6:fb11b746ceb5 1867 * device NVM value
sepp_nepp 6:fb11b746ceb5 1868 *
sepp_nepp 6:fb11b746ceb5 1869 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1870 *
sepp_nepp 7:3a1115c2556b 1871 *
sepp_nepp 6:fb11b746ceb5 1872 * @param p_linearity_corrective_gain Pointer to the linearity
sepp_nepp 6:fb11b746ceb5 1873 * corrective gain in x1000
sepp_nepp 6:fb11b746ceb5 1874 * if value is 1000 then no modification is applied.
sepp_nepp 6:fb11b746ceb5 1875 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1876 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1877 */
sepp_nepp 7:3a1115c2556b 1878 VL53L0X_Error VL53L0X_get_linearity_corrective_gain(
sepp_nepp 6:fb11b746ceb5 1879 uint16_t *p_linearity_corrective_gain);
sepp_nepp 6:fb11b746ceb5 1880
sepp_nepp 6:fb11b746ceb5 1881 /**
sepp_nepp 6:fb11b746ceb5 1882 * Set the linearity corrective gain
sepp_nepp 6:fb11b746ceb5 1883 *
sepp_nepp 6:fb11b746ceb5 1884 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1885 *
sepp_nepp 7:3a1115c2556b 1886 *
sepp_nepp 6:fb11b746ceb5 1887 * @param linearity_corrective_gain Linearity corrective
sepp_nepp 6:fb11b746ceb5 1888 * gain in x1000
sepp_nepp 6:fb11b746ceb5 1889 * if value is 1000 then no modification is applied.
sepp_nepp 6:fb11b746ceb5 1890 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1891 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1892 */
sepp_nepp 7:3a1115c2556b 1893 VL53L0X_Error VL53L0X_set_linearity_corrective_gain(
sepp_nepp 6:fb11b746ceb5 1894 int16_t linearity_corrective_gain);
sepp_nepp 6:fb11b746ceb5 1895
sepp_nepp 6:fb11b746ceb5 1896 /**
sepp_nepp 6:fb11b746ceb5 1897 * @brief Get the Maximum number of ROI Zones managed by the Device
sepp_nepp 6:fb11b746ceb5 1898 *
sepp_nepp 6:fb11b746ceb5 1899 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1900 * Get Maximum number of ROI Zones managed by the Device.
sepp_nepp 6:fb11b746ceb5 1901 *
sepp_nepp 6:fb11b746ceb5 1902 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1903 *
sepp_nepp 7:3a1115c2556b 1904 *
sepp_nepp 6:fb11b746ceb5 1905 * @param p_max_number_of_roi_zones Pointer to the Maximum Number
sepp_nepp 6:fb11b746ceb5 1906 * of ROI Zones value.
sepp_nepp 6:fb11b746ceb5 1907 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1908 */
sepp_nepp 7:3a1115c2556b 1909 VL53L0X_Error VL53L0X_get_max_number_of_roi_zones(
sepp_nepp 6:fb11b746ceb5 1910 uint8_t *p_max_number_of_roi_zones);
sepp_nepp 6:fb11b746ceb5 1911
sepp_nepp 6:fb11b746ceb5 1912 /**
sepp_nepp 6:fb11b746ceb5 1913 * @brief Retrieve the Reference Signal after a measurements
sepp_nepp 6:fb11b746ceb5 1914 *
sepp_nepp 6:fb11b746ceb5 1915 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1916 * Get Reference Signal from last successful Ranging measurement
sepp_nepp 6:fb11b746ceb5 1917 * This function return a valid value after that you call the
sepp_nepp 6:fb11b746ceb5 1918 * @a VL53L0X_GetRangingMeasurementData().
sepp_nepp 6:fb11b746ceb5 1919 *
sepp_nepp 6:fb11b746ceb5 1920 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1921 *
sepp_nepp 7:3a1115c2556b 1922 *
sepp_nepp 6:fb11b746ceb5 1923 * @param p_measurement_ref_signal Pointer to the Ref Signal to fill up.
sepp_nepp 6:fb11b746ceb5 1924 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1925 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1926 */
sepp_nepp 7:3a1115c2556b 1927 VL53L0X_Error VL53L0X_get_measurement_ref_signal(
sepp_nepp 6:fb11b746ceb5 1928 FixPoint1616_t *p_measurement_ref_signal);
sepp_nepp 6:fb11b746ceb5 1929
sepp_nepp 6:fb11b746ceb5 1930 /**
sepp_nepp 6:fb11b746ceb5 1931 * @brief Get the number of the check limit managed by a given Device
sepp_nepp 6:fb11b746ceb5 1932 *
sepp_nepp 6:fb11b746ceb5 1933 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1934 * This function give the number of the check limit managed by the Device
sepp_nepp 6:fb11b746ceb5 1935 *
sepp_nepp 6:fb11b746ceb5 1936 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1937 *
sepp_nepp 6:fb11b746ceb5 1938 * @param p_number_of_limit_check Pointer to the number of check limit.
sepp_nepp 6:fb11b746ceb5 1939 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1940 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1941 */
sepp_nepp 6:fb11b746ceb5 1942 VL53L0X_Error VL53L0X_get_number_of_limit_check(
sepp_nepp 6:fb11b746ceb5 1943 uint16_t *p_number_of_limit_check);
sepp_nepp 6:fb11b746ceb5 1944
sepp_nepp 6:fb11b746ceb5 1945 /**
sepp_nepp 6:fb11b746ceb5 1946 * @brief Get the number of ROI Zones managed by the Device
sepp_nepp 6:fb11b746ceb5 1947 *
sepp_nepp 6:fb11b746ceb5 1948 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1949 * Get number of ROI Zones managed by the Device
sepp_nepp 6:fb11b746ceb5 1950 * USER should take care about @a VL53L0X_GetNumberOfROIZones()
sepp_nepp 6:fb11b746ceb5 1951 * before get data after a perform measurement.
sepp_nepp 6:fb11b746ceb5 1952 * PAL will fill a NumberOfROIZones times the corresponding data
sepp_nepp 6:fb11b746ceb5 1953 * structure used in the measurement function.
sepp_nepp 6:fb11b746ceb5 1954 *
sepp_nepp 6:fb11b746ceb5 1955 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1956 *
sepp_nepp 7:3a1115c2556b 1957 *
sepp_nepp 6:fb11b746ceb5 1958 * @param p_number_of_roi_zones Pointer to the Number of ROI Zones value.
sepp_nepp 6:fb11b746ceb5 1959 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1960 */
sepp_nepp 7:3a1115c2556b 1961 VL53L0X_Error VL53L0X_get_number_of_roi_zones(
sepp_nepp 6:fb11b746ceb5 1962 uint8_t *p_number_of_roi_zones);
sepp_nepp 6:fb11b746ceb5 1963
sepp_nepp 6:fb11b746ceb5 1964 /**
sepp_nepp 6:fb11b746ceb5 1965 * @brief Set the number of ROI Zones to be used for a specific Device
sepp_nepp 6:fb11b746ceb5 1966 *
sepp_nepp 6:fb11b746ceb5 1967 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1968 * Set the number of ROI Zones to be used for a specific Device.
sepp_nepp 6:fb11b746ceb5 1969 * The programmed value should be less than the max number of ROI Zones given
sepp_nepp 6:fb11b746ceb5 1970 * with @a VL53L0X_GetMaxNumberOfROIZones().
sepp_nepp 6:fb11b746ceb5 1971 * This version of API manage only one zone.
sepp_nepp 6:fb11b746ceb5 1972 *
sepp_nepp 7:3a1115c2556b 1973 *
sepp_nepp 6:fb11b746ceb5 1974 * @param number_of_roi_zones Number of ROI Zones to be used for a
sepp_nepp 6:fb11b746ceb5 1975 * specific Device.
sepp_nepp 6:fb11b746ceb5 1976 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1977 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
sepp_nepp 6:fb11b746ceb5 1978 * NumberOfROIZones != 1
sepp_nepp 6:fb11b746ceb5 1979 */
sepp_nepp 7:3a1115c2556b 1980 VL53L0X_Error VL53L0X_set_number_of_roi_zones(
sepp_nepp 6:fb11b746ceb5 1981 uint8_t number_of_roi_zones);
sepp_nepp 6:fb11b746ceb5 1982
sepp_nepp 6:fb11b746ceb5 1983 /**
sepp_nepp 6:fb11b746ceb5 1984 * @brief Gets number of sequence steps managed by the API.
sepp_nepp 6:fb11b746ceb5 1985 *
sepp_nepp 6:fb11b746ceb5 1986 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1987 * This function retrieves the number of sequence steps currently managed
sepp_nepp 6:fb11b746ceb5 1988 * by the API
sepp_nepp 6:fb11b746ceb5 1989 *
sepp_nepp 6:fb11b746ceb5 1990 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1991 *
sepp_nepp 7:3a1115c2556b 1992 *
sepp_nepp 6:fb11b746ceb5 1993 * @param p_number_of_sequence_steps Out parameter reporting the number of
sepp_nepp 6:fb11b746ceb5 1994 * sequence steps.
sepp_nepp 6:fb11b746ceb5 1995 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1996 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1997 */
sepp_nepp 7:3a1115c2556b 1998 VL53L0X_Error VL53L0X_get_number_of_sequence_steps(
sepp_nepp 6:fb11b746ceb5 1999 uint8_t *p_number_of_sequence_steps);
sepp_nepp 6:fb11b746ceb5 2000 /**
sepp_nepp 6:fb11b746ceb5 2001 * @brief Get the power mode for a given Device
sepp_nepp 6:fb11b746ceb5 2002 *
sepp_nepp 6:fb11b746ceb5 2003 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2004 *
sepp_nepp 7:3a1115c2556b 2005 *
sepp_nepp 6:fb11b746ceb5 2006 * @param p_power_mode Pointer to the current value of the power
sepp_nepp 6:fb11b746ceb5 2007 * mode. see ::VL53L0X_PowerModes
sepp_nepp 6:fb11b746ceb5 2008 * Valid values are:
sepp_nepp 6:fb11b746ceb5 2009 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
sepp_nepp 6:fb11b746ceb5 2010 * VL53L0X_POWERMODE_IDLE_LEVEL1
sepp_nepp 6:fb11b746ceb5 2011 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2012 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2013 */
sepp_nepp 7:3a1115c2556b 2014 VL53L0X_Error VL53L0X_get_power_mode(
sepp_nepp 6:fb11b746ceb5 2015 VL53L0X_PowerModes *p_power_mode);
sepp_nepp 6:fb11b746ceb5 2016
sepp_nepp 6:fb11b746ceb5 2017 /**
sepp_nepp 6:fb11b746ceb5 2018 * @brief Set the power mode for a given Device
sepp_nepp 6:fb11b746ceb5 2019 * The power mode can be Standby or Idle. Different level of both Standby and
sepp_nepp 6:fb11b746ceb5 2020 * Idle can exists.
sepp_nepp 6:fb11b746ceb5 2021 * This function should not be used when device is in Ranging state.
sepp_nepp 6:fb11b746ceb5 2022 *
sepp_nepp 6:fb11b746ceb5 2023 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2024 *
sepp_nepp 7:3a1115c2556b 2025 *
sepp_nepp 6:fb11b746ceb5 2026 * @param power_mode The value of the power mode to set.
sepp_nepp 6:fb11b746ceb5 2027 * see ::VL53L0X_PowerModes
sepp_nepp 6:fb11b746ceb5 2028 * Valid values are:
sepp_nepp 6:fb11b746ceb5 2029 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
sepp_nepp 6:fb11b746ceb5 2030 * VL53L0X_POWERMODE_IDLE_LEVEL1
sepp_nepp 6:fb11b746ceb5 2031 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2032 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when PowerMode
sepp_nepp 6:fb11b746ceb5 2033 * is not in the supported list
sepp_nepp 6:fb11b746ceb5 2034 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2035 */
sepp_nepp 7:3a1115c2556b 2036 VL53L0X_Error VL53L0X_set_power_mode(
sepp_nepp 6:fb11b746ceb5 2037 VL53L0X_PowerModes power_mode);
sepp_nepp 6:fb11b746ceb5 2038
sepp_nepp 6:fb11b746ceb5 2039 /**
sepp_nepp 6:fb11b746ceb5 2040 * @brief Retrieves SPAD configuration
sepp_nepp 6:fb11b746ceb5 2041 *
sepp_nepp 6:fb11b746ceb5 2042 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2043 * This function retrieves the current number of applied reference spads
sepp_nepp 6:fb11b746ceb5 2044 * and also their type : Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 2045 *
sepp_nepp 6:fb11b746ceb5 2046 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2047 *
sepp_nepp 7:3a1115c2556b 2048 *
sepp_nepp 6:fb11b746ceb5 2049 * @param p_spad_count Number ref Spad Count
sepp_nepp 6:fb11b746ceb5 2050 * @param p_is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 2051 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 2052 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 2053 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2054 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 2055 * spad configuration.
sepp_nepp 6:fb11b746ceb5 2056 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2057 */
sepp_nepp 7:3a1115c2556b 2058 VL53L0X_Error wrapped_VL53L0X_get_reference_spads(
sepp_nepp 6:fb11b746ceb5 2059 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 2060
sepp_nepp 6:fb11b746ceb5 2061 /**
sepp_nepp 6:fb11b746ceb5 2062 * @brief Gets the (on/off) state of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 2063 *
sepp_nepp 6:fb11b746ceb5 2064 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2065 * This function retrieves the state of a requested sequence step, i.e. on/off.
sepp_nepp 6:fb11b746ceb5 2066 *
sepp_nepp 6:fb11b746ceb5 2067 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 2068 *
sepp_nepp 7:3a1115c2556b 2069 *
sepp_nepp 6:fb11b746ceb5 2070 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 2071 * @param p_sequence_step_enabled Out parameter reporting if the sequence step
sepp_nepp 6:fb11b746ceb5 2072 * is enabled {0=Off,1=On}.
sepp_nepp 6:fb11b746ceb5 2073 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2074 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 2075 * supported.
sepp_nepp 6:fb11b746ceb5 2076 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2077 */
sepp_nepp 7:3a1115c2556b 2078 VL53L0X_Error VL53L0X_get_sequence_step_enable(
sepp_nepp 6:fb11b746ceb5 2079 VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 2080
sepp_nepp 6:fb11b746ceb5 2081
sepp_nepp 6:fb11b746ceb5 2082 /**
sepp_nepp 6:fb11b746ceb5 2083 * @brief Gets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 2084 *
sepp_nepp 6:fb11b746ceb5 2085 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2086 * This function retrieves the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 2087 *
sepp_nepp 6:fb11b746ceb5 2088 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 2089 *
sepp_nepp 7:3a1115c2556b 2090 *
sepp_nepp 6:fb11b746ceb5 2091 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 2092 * @param p_time_out_milli_secs Timeout value.
sepp_nepp 6:fb11b746ceb5 2093 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2094 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 2095 * supported.
sepp_nepp 6:fb11b746ceb5 2096 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2097 */
sepp_nepp 7:3a1115c2556b 2098 VL53L0X_Error VL53L0X_get_sequence_step_timeout(
sepp_nepp 6:fb11b746ceb5 2099 VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 2100 FixPoint1616_t *p_time_out_milli_secs);
sepp_nepp 6:fb11b746ceb5 2101
sepp_nepp 6:fb11b746ceb5 2102 /**
sepp_nepp 6:fb11b746ceb5 2103 * @brief Sets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 2104 *
sepp_nepp 6:fb11b746ceb5 2105 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2106 * This function sets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 2107 *
sepp_nepp 6:fb11b746ceb5 2108 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 2109 *
sepp_nepp 7:3a1115c2556b 2110 *
sepp_nepp 6:fb11b746ceb5 2111 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 2112 * @param time_out_milli_secs Demanded timeout
sepp_nepp 6:fb11b746ceb5 2113 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2114 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 2115 * supported.
sepp_nepp 6:fb11b746ceb5 2116 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2117 */
sepp_nepp 7:3a1115c2556b 2118 VL53L0X_Error VL53L0X_set_sequence_step_timeout(
sepp_nepp 6:fb11b746ceb5 2119 VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs);
sepp_nepp 6:fb11b746ceb5 2120
sepp_nepp 6:fb11b746ceb5 2121 /**
sepp_nepp 6:fb11b746ceb5 2122 * @brief Get the current SPAD Ambient Damper Factor value
sepp_nepp 6:fb11b746ceb5 2123 *
sepp_nepp 6:fb11b746ceb5 2124 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2125 * This function get the SPAD Ambient Damper Factor value
sepp_nepp 6:fb11b746ceb5 2126 *
sepp_nepp 6:fb11b746ceb5 2127 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2128 *
sepp_nepp 7:3a1115c2556b 2129 *
sepp_nepp 6:fb11b746ceb5 2130 * @param p_spad_ambient_damper_factor Pointer to programmed SPAD Ambient
sepp_nepp 6:fb11b746ceb5 2131 * Damper Factor value
sepp_nepp 6:fb11b746ceb5 2132 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2133 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2134 */
sepp_nepp 7:3a1115c2556b 2135 VL53L0X_Error VL53L0X_get_spad_ambient_damper_factor(
sepp_nepp 6:fb11b746ceb5 2136 uint16_t *p_spad_ambient_damper_factor);
sepp_nepp 6:fb11b746ceb5 2137 /**
sepp_nepp 6:fb11b746ceb5 2138 * @brief Set the SPAD Ambient Damper Factor value
sepp_nepp 6:fb11b746ceb5 2139 *
sepp_nepp 6:fb11b746ceb5 2140 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2141 * This function set the SPAD Ambient Damper Factor value
sepp_nepp 6:fb11b746ceb5 2142 *
sepp_nepp 6:fb11b746ceb5 2143 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2144 *
sepp_nepp 7:3a1115c2556b 2145 *
sepp_nepp 6:fb11b746ceb5 2146 * @param spad_ambient_damper_factor SPAD Ambient Damper Factor value
sepp_nepp 6:fb11b746ceb5 2147 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2148 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2149 */
sepp_nepp 7:3a1115c2556b 2150 VL53L0X_Error VL53L0X_set_spad_ambient_damper_factor(
sepp_nepp 6:fb11b746ceb5 2151 uint16_t spad_ambient_damper_factor);
sepp_nepp 6:fb11b746ceb5 2152
sepp_nepp 6:fb11b746ceb5 2153 /**
sepp_nepp 6:fb11b746ceb5 2154 * @brief Get the current SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2155 *
sepp_nepp 6:fb11b746ceb5 2156 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2157 * This function get the SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2158 *
sepp_nepp 6:fb11b746ceb5 2159 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2160 *
sepp_nepp 7:3a1115c2556b 2161 *
sepp_nepp 6:fb11b746ceb5 2162 * @param p_spad_ambient_damper_threshold Pointer to programmed
sepp_nepp 6:fb11b746ceb5 2163 * SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2164 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2165 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2166 */
sepp_nepp 7:3a1115c2556b 2167 VL53L0X_Error VL53L0X_get_spad_ambient_damper_threshold(
sepp_nepp 6:fb11b746ceb5 2168 uint16_t *p_spad_ambient_damper_threshold);
sepp_nepp 6:fb11b746ceb5 2169
sepp_nepp 6:fb11b746ceb5 2170 /**
sepp_nepp 6:fb11b746ceb5 2171 * @brief Set the SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2172 *
sepp_nepp 6:fb11b746ceb5 2173 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2174 * This function set the SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2175 *
sepp_nepp 6:fb11b746ceb5 2176 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2177 *
sepp_nepp 7:3a1115c2556b 2178 *
sepp_nepp 6:fb11b746ceb5 2179 * @param spad_ambient_damper_threshold SPAD Ambient Damper Threshold value
sepp_nepp 6:fb11b746ceb5 2180 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2181 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2182 */
sepp_nepp 7:3a1115c2556b 2183 VL53L0X_Error VL53L0X_set_spad_ambient_damper_threshold(
sepp_nepp 6:fb11b746ceb5 2184 uint16_t spad_ambient_damper_threshold);
sepp_nepp 6:fb11b746ceb5 2185
sepp_nepp 6:fb11b746ceb5 2186
sepp_nepp 6:fb11b746ceb5 2187 /**
sepp_nepp 6:fb11b746ceb5 2188 * @brief Get the tuning settings pointer and the internal external switch
sepp_nepp 6:fb11b746ceb5 2189 * value.
sepp_nepp 6:fb11b746ceb5 2190 *
sepp_nepp 6:fb11b746ceb5 2191 * This function is used to get the Tuning settings buffer pointer and the
sepp_nepp 6:fb11b746ceb5 2192 * value.
sepp_nepp 6:fb11b746ceb5 2193 * of the switch to select either external or internal tuning settings.
sepp_nepp 6:fb11b746ceb5 2194 *
sepp_nepp 6:fb11b746ceb5 2195 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2196 *
sepp_nepp 7:3a1115c2556b 2197 *
sepp_nepp 6:fb11b746ceb5 2198 * @param pp_tuning_setting_buffer Pointer to tuning settings buffer.
sepp_nepp 6:fb11b746ceb5 2199 * @param p_use_internal_tuning_settings Pointer to store Use internal tuning
sepp_nepp 6:fb11b746ceb5 2200 * settings value.
sepp_nepp 6:fb11b746ceb5 2201 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2202 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2203 */
sepp_nepp 7:3a1115c2556b 2204 VL53L0X_Error VL53L0X_get_tuning_setting_buffer(
sepp_nepp 6:fb11b746ceb5 2205 uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings);
sepp_nepp 6:fb11b746ceb5 2206
sepp_nepp 6:fb11b746ceb5 2207 /**
sepp_nepp 6:fb11b746ceb5 2208 * @brief Set the tuning settings pointer
sepp_nepp 6:fb11b746ceb5 2209 *
sepp_nepp 6:fb11b746ceb5 2210 * This function is used to specify the Tuning settings buffer to be used
sepp_nepp 6:fb11b746ceb5 2211 * for a given device. The buffer contains all the necessary data to permit
sepp_nepp 6:fb11b746ceb5 2212 * the API to write tuning settings.
sepp_nepp 6:fb11b746ceb5 2213 * This function permit to force the usage of either external or internal
sepp_nepp 6:fb11b746ceb5 2214 * tuning settings.
sepp_nepp 6:fb11b746ceb5 2215 *
sepp_nepp 6:fb11b746ceb5 2216 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2217 *
sepp_nepp 7:3a1115c2556b 2218 *
sepp_nepp 6:fb11b746ceb5 2219 * @param p_tuning_setting_buffer Pointer to tuning settings buffer.
sepp_nepp 6:fb11b746ceb5 2220 * @param use_internal_tuning_settings Use internal tuning settings value.
sepp_nepp 6:fb11b746ceb5 2221 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2222 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2223 */
sepp_nepp 7:3a1115c2556b 2224 VL53L0X_Error VL53L0X_set_tuning_setting_buffer(
sepp_nepp 6:fb11b746ceb5 2225 uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings);
sepp_nepp 6:fb11b746ceb5 2226
sepp_nepp 6:fb11b746ceb5 2227 /**
sepp_nepp 6:fb11b746ceb5 2228 * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions
sepp_nepp 6:fb11b746ceb5 2229 * @brief PAL Register Access Functions
sepp_nepp 6:fb11b746ceb5 2230 * @{
sepp_nepp 6:fb11b746ceb5 2231 */
sepp_nepp 6:fb11b746ceb5 2232
sepp_nepp 6:fb11b746ceb5 2233 /**
sepp_nepp 6:fb11b746ceb5 2234 * Lock comms interface to serialize all commands to a shared I2C interface for a specific device
sepp_nepp 7:3a1115c2556b 2235 *
sepp_nepp 6:fb11b746ceb5 2236 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2237 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2238 */
sepp_nepp 7:3a1115c2556b 2239 VL53L0X_Error VL53L0X_lock_sequence_access(void);
sepp_nepp 6:fb11b746ceb5 2240
sepp_nepp 6:fb11b746ceb5 2241 /**
sepp_nepp 6:fb11b746ceb5 2242 * Unlock comms interface to serialize all commands to a shared I2C interface for a specific device
sepp_nepp 7:3a1115c2556b 2243 *
sepp_nepp 6:fb11b746ceb5 2244 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2245 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2246 */
sepp_nepp 7:3a1115c2556b 2247 VL53L0X_Error VL53L0X_unlock_sequence_access(void);
sepp_nepp 6:fb11b746ceb5 2248
sepp_nepp 6:fb11b746ceb5 2249 /**
sepp_nepp 6:fb11b746ceb5 2250 * @brief Prepare device for operation
sepp_nepp 6:fb11b746ceb5 2251 * @par Function Description
sepp_nepp 6:fb11b746ceb5 2252 * Update device with provided parameters
sepp_nepp 6:fb11b746ceb5 2253 * @li Then start ranging operation.
sepp_nepp 6:fb11b746ceb5 2254 *
sepp_nepp 6:fb11b746ceb5 2255 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 2256 *
sepp_nepp 7:3a1115c2556b 2257 *
sepp_nepp 6:fb11b746ceb5 2258 * @param pDeviceParameters Pointer to store current device parameters.
sepp_nepp 6:fb11b746ceb5 2259 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 2260 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 2261 */
sepp_nepp 7:3a1115c2556b 2262 VL53L0X_Error vl53L0x_set_device_parameters(
sepp_nepp 6:fb11b746ceb5 2263 const VL53L0X_DeviceParameters_t *pDeviceParameters);
sepp_nepp 6:fb11b746ceb5 2264
sepp_nepp 6:fb11b746ceb5 2265 VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
sepp_nepp 6:fb11b746ceb5 2266
sepp_nepp 6:fb11b746ceb5 2267 int range_meas_int_continuous_mode(void (*fptr)(void));
sepp_nepp 6:fb11b746ceb5 2268
sepp_nepp 6:fb11b746ceb5 2269 VL53L0X_DeviceInfo_t _device_info;
sepp_nepp 6:fb11b746ceb5 2270
sepp_nepp 6:fb11b746ceb5 2271 /* IO Device */
sepp_nepp 6:fb11b746ceb5 2272 I2C *_dev_i2c;
sepp_nepp 6:fb11b746ceb5 2273 /* Digital out pin */
sepp_nepp 6:fb11b746ceb5 2274 DigitalOut *_gpio0;
sepp_nepp 6:fb11b746ceb5 2275 /* Measure detection IRQ */
sepp_nepp 6:fb11b746ceb5 2276 InterruptIn *_gpio1Int;
sepp_nepp 6:fb11b746ceb5 2277 /* Device data */
sepp_nepp 7:3a1115c2556b 2278 VL53L0X_DevData_t Data; /*!< embed ST Ewok Dev data as "Data"*/
sepp_nepp 7:3a1115c2556b 2279 uint8_t I2cDevAddr; /*!< i2c device address user specific field */
sepp_nepp 7:3a1115c2556b 2280 uint8_t comms_type; /*!< Type of comms : VL53L0X_COMMS_I2C or VL53L0X_COMMS_SPI */
sepp_nepp 7:3a1115c2556b 2281 uint16_t comms_speed_khz; /*!< Comms speed [kHz] : typically 400kHz for I2C */
sepp_nepp 6:fb11b746ceb5 2282 private:
sepp_nepp 6:fb11b746ceb5 2283 /** @brief Writes a buffer towards the I2C peripheral device.
sepp_nepp 6:fb11b746ceb5 2284 * @param pBuffer pointer to the byte-array data to send
sepp_nepp 6:fb11b746ceb5 2285 * @param DeviceAddr specifies the peripheral device slave address.
sepp_nepp 6:fb11b746ceb5 2286 * @param RegisterAddr specifies the internal address register
sepp_nepp 6:fb11b746ceb5 2287 * where to start writing to (must be correctly masked).
sepp_nepp 6:fb11b746ceb5 2288 * @param NumByteToWrite number of bytes to be written.
sepp_nepp 6:fb11b746ceb5 2289 * @retval 0 if ok,
sepp_nepp 6:fb11b746ceb5 2290 * @retval -1 if an I2C error has occured, or
sepp_nepp 6:fb11b746ceb5 2291 * @retval -2 on temporary buffer overflow (i.e. NumByteToWrite was too high)
sepp_nepp 6:fb11b746ceb5 2292 * @note On some devices if NumByteToWrite is greater
sepp_nepp 6:fb11b746ceb5 2293 * than one, the RegisterAddr must be masked correctly!
sepp_nepp 6:fb11b746ceb5 2294 */
sepp_nepp 6:fb11b746ceb5 2295 int i2c_write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
sepp_nepp 6:fb11b746ceb5 2296 uint16_t NumByteToWrite);
sepp_nepp 6:fb11b746ceb5 2297
sepp_nepp 6:fb11b746ceb5 2298 /** @brief Reads a buffer from the I2C peripheral device.
sepp_nepp 6:fb11b746ceb5 2299 * @param pBuffer pointer to the byte-array to read data in to
sepp_nepp 6:fb11b746ceb5 2300 * @param DeviceAddr specifies the peripheral device slave address.
sepp_nepp 6:fb11b746ceb5 2301 * @param RegisterAddr specifies the internal address register
sepp_nepp 6:fb11b746ceb5 2302 * where to start reading from (must be correctly masked).
sepp_nepp 6:fb11b746ceb5 2303 * @param NumByteToRead number of bytes to be read.
sepp_nepp 6:fb11b746ceb5 2304 * @retval 0 if ok,
sepp_nepp 6:fb11b746ceb5 2305 * @retval -1 if an I2C error has occured
sepp_nepp 6:fb11b746ceb5 2306 * @note On some devices if NumByteToWrite is greater
sepp_nepp 6:fb11b746ceb5 2307 * than one, the RegisterAddr must be masked correctly!
sepp_nepp 6:fb11b746ceb5 2308 */
sepp_nepp 6:fb11b746ceb5 2309 int i2c_read(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
sepp_nepp 6:fb11b746ceb5 2310 uint16_t NumByteToRead);
sepp_nepp 6:fb11b746ceb5 2311 };
sepp_nepp 6:fb11b746ceb5 2312
sepp_nepp 6:fb11b746ceb5 2313
sepp_nepp 6:fb11b746ceb5 2314 #endif /* _VL53L0X_CLASS_H_ */