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

Committer:
sepp_nepp
Date:
Tue Jul 02 12:38:07 2019 +0000
Revision:
11:d8dbe3b87f9f
Parent:
10:cd1758e186a4
Child:
12:81f37e50f8f8
Demo Version for TOF_Synth

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
sepp_nepp 6:fb11b746ceb5 39 /* Classes -------------------------------------------------------------------*/
sepp_nepp 6:fb11b746ceb5 40 /** Class representing a VL53L0 sensor component
sepp_nepp 6:fb11b746ceb5 41 */
sepp_nepp 6:fb11b746ceb5 42 class VL53L0X
sepp_nepp 6:fb11b746ceb5 43 {
sepp_nepp 6:fb11b746ceb5 44 public:
sepp_nepp 6:fb11b746ceb5 45 /** Constructor
sepp_nepp 6:fb11b746ceb5 46 * @param[in] &i2c device I2C to be used for communication
sepp_nepp 6:fb11b746ceb5 47 * @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
sepp_nepp 6:fb11b746ceb5 48 * @param[in] dev_addr device address, 0x29 by default
sepp_nepp 6:fb11b746ceb5 49 */
sepp_nepp 8:2fd7cb217068 50 VL53L0X(I2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _gpio0(pin), _dev_i2c(i2c)
sepp_nepp 8:2fd7cb217068 51 { I2cDevAddr = dev_addr;
sepp_nepp 7:3a1115c2556b 52 comms_type = 1; // VL53L0X_COMMS_I2C
sepp_nepp 7:3a1115c2556b 53 comms_speed_khz = 400;
sepp_nepp 7:3a1115c2556b 54 if (pin_gpio1 != NC) { _gpio1Int = new InterruptIn(pin_gpio1); }
sepp_nepp 7:3a1115c2556b 55 else { _gpio1Int = NULL; }
sepp_nepp 6:fb11b746ceb5 56 }
sepp_nepp 6:fb11b746ceb5 57
sepp_nepp 6:fb11b746ceb5 58 /** Destructor
sepp_nepp 6:fb11b746ceb5 59 */
sepp_nepp 6:fb11b746ceb5 60 virtual ~VL53L0X()
sepp_nepp 8:2fd7cb217068 61 { if (_gpio1Int != NULL) { delete _gpio1Int; } }
sepp_nepp 6:fb11b746ceb5 62
sepp_nepp 8:2fd7cb217068 63 /*** Interface Methods High level API ***/
sepp_nepp 6:fb11b746ceb5 64 /**
sepp_nepp 6:fb11b746ceb5 65 * @brief PowerOn the sensor
sepp_nepp 6:fb11b746ceb5 66 * @return void
sepp_nepp 6:fb11b746ceb5 67 */
sepp_nepp 6:fb11b746ceb5 68 /* turns on the sensor */
sepp_nepp 6:fb11b746ceb5 69 void VL53L0X_on(void)
sepp_nepp 6:fb11b746ceb5 70 {
sepp_nepp 6:fb11b746ceb5 71 if (_gpio0) { *_gpio0 = 1; }
sepp_nepp 6:fb11b746ceb5 72 wait_ms(10);
sepp_nepp 6:fb11b746ceb5 73 }
sepp_nepp 6:fb11b746ceb5 74
sepp_nepp 6:fb11b746ceb5 75 /**
sepp_nepp 6:fb11b746ceb5 76 * @brief PowerOff the sensor
sepp_nepp 6:fb11b746ceb5 77 * @return void
sepp_nepp 6:fb11b746ceb5 78 */
sepp_nepp 6:fb11b746ceb5 79 /* turns off the sensor */
sepp_nepp 6:fb11b746ceb5 80 void VL53L0X_off(void)
sepp_nepp 6:fb11b746ceb5 81 {
sepp_nepp 6:fb11b746ceb5 82 if (_gpio0) { *_gpio0 = 0; }
sepp_nepp 6:fb11b746ceb5 83 wait_ms(10);
sepp_nepp 6:fb11b746ceb5 84 }
sepp_nepp 6:fb11b746ceb5 85
sepp_nepp 6:fb11b746ceb5 86
sepp_nepp 6:fb11b746ceb5 87 /**
sepp_nepp 6:fb11b746ceb5 88 * @brief Initialize the sensor with default values
sepp_nepp 6:fb11b746ceb5 89 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 90 */
sepp_nepp 6:fb11b746ceb5 91 int init_sensor(uint8_t new_addr = VL53L0X_DEFAULT_ADDRESS);
sepp_nepp 6:fb11b746ceb5 92
sepp_nepp 6:fb11b746ceb5 93 /**
sepp_nepp 6:fb11b746ceb5 94 * @brief Start the measure indicated by operating mode
sepp_nepp 6:fb11b746ceb5 95 * @param[in] operating_mode specifies requested measure
sepp_nepp 6:fb11b746ceb5 96 * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure
sepp_nepp 6:fb11b746ceb5 97 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 98 */
sepp_nepp 6:fb11b746ceb5 99 int start_measurement(OperatingMode operating_mode, void (*fptr)(void),
sepp_nepp 6:fb11b746ceb5 100 VL53L0X_RangingConfig rangingConfig = Range_Config_DEFAULT);
sepp_nepp 6:fb11b746ceb5 101
sepp_nepp 6:fb11b746ceb5 102 /**
sepp_nepp 6:fb11b746ceb5 103 * @brief Get results for the measure indicated by operating mode
sepp_nepp 6:fb11b746ceb5 104 * @param[in] operating_mode specifies requested measure results
sepp_nepp 6:fb11b746ceb5 105 * @param[out] p_data pointer to the MeasureData_t structure to read data in to
sepp_nepp 6:fb11b746ceb5 106 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 107 */
sepp_nepp 6:fb11b746ceb5 108 int get_measurement(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *p_data);
sepp_nepp 6:fb11b746ceb5 109
sepp_nepp 6:fb11b746ceb5 110 /**
sepp_nepp 6:fb11b746ceb5 111 * @brief Stop the currently running measure indicate by operating_mode
sepp_nepp 6:fb11b746ceb5 112 * @param[in] operating_mode specifies requested measure to stop
sepp_nepp 6:fb11b746ceb5 113 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 114 */
sepp_nepp 6:fb11b746ceb5 115 int stop_measurement(OperatingMode operating_mode);
sepp_nepp 6:fb11b746ceb5 116
sepp_nepp 6:fb11b746ceb5 117 /**
sepp_nepp 6:fb11b746ceb5 118 * @brief Interrupt handling func to be called by user after an INT is occourred
sepp_nepp 6:fb11b746ceb5 119 * @param[in] opeating_mode indicating the in progress measure
sepp_nepp 6:fb11b746ceb5 120 * @param[out] Data pointer to the MeasureData_t structure to read data in to
sepp_nepp 6:fb11b746ceb5 121 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 122 */
sepp_nepp 6:fb11b746ceb5 123 int handle_irq(OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *data);
sepp_nepp 6:fb11b746ceb5 124
sepp_nepp 6:fb11b746ceb5 125 /**
sepp_nepp 6:fb11b746ceb5 126 * @brief Enable interrupt measure IRQ
sepp_nepp 6:fb11b746ceb5 127 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 128 */
sepp_nepp 6:fb11b746ceb5 129 void enable_interrupt_measure_detection_irq(void)
sepp_nepp 8:2fd7cb217068 130 { if (_gpio1Int != NULL) { _gpio1Int->enable_irq();} }
sepp_nepp 6:fb11b746ceb5 131
sepp_nepp 6:fb11b746ceb5 132 /**
sepp_nepp 6:fb11b746ceb5 133 * @brief Disable interrupt measure IRQ
sepp_nepp 6:fb11b746ceb5 134 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 135 */
sepp_nepp 6:fb11b746ceb5 136 void disable_interrupt_measure_detection_irq(void)
sepp_nepp 8:2fd7cb217068 137 { if (_gpio1Int != NULL) { _gpio1Int->disable_irq(); } }
sepp_nepp 6:fb11b746ceb5 138
sepp_nepp 6:fb11b746ceb5 139 /**
sepp_nepp 6:fb11b746ceb5 140 * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
sepp_nepp 6:fb11b746ceb5 141 * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
sepp_nepp 6:fb11b746ceb5 142 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 143 */
sepp_nepp 6:fb11b746ceb5 144 void attach_interrupt_measure_detection_irq(void (*fptr)(void))
sepp_nepp 8:2fd7cb217068 145 { if (_gpio1Int != NULL) { _gpio1Int->rise(fptr); } }
sepp_nepp 6:fb11b746ceb5 146
sepp_nepp 6:fb11b746ceb5 147 /** Wrapper functions */
sepp_nepp 6:fb11b746ceb5 148 /** @defgroup api_init Init functions
sepp_nepp 6:fb11b746ceb5 149 * @brief API init functions
sepp_nepp 6:fb11b746ceb5 150 * @ingroup api_hl
sepp_nepp 6:fb11b746ceb5 151 * @{
sepp_nepp 6:fb11b746ceb5 152 */
sepp_nepp 6:fb11b746ceb5 153
sepp_nepp 6:fb11b746ceb5 154 /**
sepp_nepp 6:fb11b746ceb5 155 * @brief Prepare device for operation
sepp_nepp 6:fb11b746ceb5 156 * @par Function Description
sepp_nepp 6:fb11b746ceb5 157 * Does static initialization and reprogram common default settings \n
sepp_nepp 6:fb11b746ceb5 158 * Device is prepared for new measure, ready single shot ranging or ALS typical polling operation\n
sepp_nepp 6:fb11b746ceb5 159 * After prepare user can : \n
sepp_nepp 6:fb11b746ceb5 160 * @li Call other API function to set other settings\n
sepp_nepp 6:fb11b746ceb5 161 * @li Configure the interrupt pins, etc... \n
sepp_nepp 6:fb11b746ceb5 162 * @li Then start ranging or ALS operations in single shot or continuous mode
sepp_nepp 6:fb11b746ceb5 163 *
sepp_nepp 6:fb11b746ceb5 164 * @param void
sepp_nepp 6:fb11b746ceb5 165 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 166 */
sepp_nepp 6:fb11b746ceb5 167 int prepare();
sepp_nepp 6:fb11b746ceb5 168
sepp_nepp 6:fb11b746ceb5 169 /**
sepp_nepp 6:fb11b746ceb5 170 * @brief Start continuous ranging mode
sepp_nepp 6:fb11b746ceb5 171 *
sepp_nepp 6:fb11b746ceb5 172 * @details End user should ensure device is in idle state and not already running
sepp_nepp 6:fb11b746ceb5 173 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 174 */
sepp_nepp 6:fb11b746ceb5 175 int range_start_continuous_mode();
sepp_nepp 6:fb11b746ceb5 176
sepp_nepp 6:fb11b746ceb5 177 /**
sepp_nepp 6:fb11b746ceb5 178 * @brief Get ranging result and only that
sepp_nepp 6:fb11b746ceb5 179 *
sepp_nepp 6:fb11b746ceb5 180 * @par Function Description
sepp_nepp 11:d8dbe3b87f9f 181 * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in _mm \n
sepp_nepp 6:fb11b746ceb5 182 * It does any required up-scale translation\n
sepp_nepp 6:fb11b746ceb5 183 * It can be called after success status polling or in interrupt mode \n
sepp_nepp 6:fb11b746ceb5 184 * @warning these function is not doing wrap around filtering \n
sepp_nepp 6:fb11b746ceb5 185 * This function doesn't perform any data ready check!
sepp_nepp 6:fb11b746ceb5 186 *
sepp_nepp 6:fb11b746ceb5 187 * @param p_data Pointer to range distance
sepp_nepp 6:fb11b746ceb5 188 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 189 */
sepp_nepp 8:2fd7cb217068 190 int get_distance(uint32_t *p_data);
sepp_nepp 6:fb11b746ceb5 191
sepp_nepp 6:fb11b746ceb5 192 /** @} */
sepp_nepp 6:fb11b746ceb5 193
sepp_nepp 8:2fd7cb217068 194 /** @brief Set new device i2c address
sepp_nepp 6:fb11b746ceb5 195 *
sepp_nepp 6:fb11b746ceb5 196 * After completion the device will answer to the new address programmed.
sepp_nepp 6:fb11b746ceb5 197 *
sepp_nepp 6:fb11b746ceb5 198 * @param new_addr The new i2c address (7bit)
sepp_nepp 6:fb11b746ceb5 199 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 200 */
sepp_nepp 6:fb11b746ceb5 201 int set_device_address(int new_addr)
sepp_nepp 6:fb11b746ceb5 202 {
sepp_nepp 6:fb11b746ceb5 203 int status;
sepp_nepp 6:fb11b746ceb5 204
sepp_nepp 7:3a1115c2556b 205 status = VL53L0X_set_device_address(new_addr);
sepp_nepp 7:3a1115c2556b 206 if (!status) { I2cDevAddr = new_addr; }
sepp_nepp 6:fb11b746ceb5 207 return status;
sepp_nepp 6:fb11b746ceb5 208 }
sepp_nepp 6:fb11b746ceb5 209
sepp_nepp 6:fb11b746ceb5 210 /**
sepp_nepp 6:fb11b746ceb5 211 * @brief Clear given system interrupt condition
sepp_nepp 6:fb11b746ceb5 212 *
sepp_nepp 6:fb11b746ceb5 213 * @par Function Description
sepp_nepp 6:fb11b746ceb5 214 * Clear given interrupt cause by writing into register #SYSTEM_INTERRUPT_CLEAR register.
sepp_nepp 7:3a1115c2556b 215 * @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 216 * @return "0" on success
sepp_nepp 6:fb11b746ceb5 217 */
sepp_nepp 6:fb11b746ceb5 218 int clear_interrupt(uint8_t int_clear)
sepp_nepp 7:3a1115c2556b 219 { return VL53L0X_clear_interrupt_mask(int_clear); }
sepp_nepp 6:fb11b746ceb5 220
sepp_nepp 8:2fd7cb217068 221 /** @brief One time device initialization
sepp_nepp 6:fb11b746ceb5 222 *
sepp_nepp 6:fb11b746ceb5 223 * To be called once and only once after device is brought out of reset
sepp_nepp 6:fb11b746ceb5 224 * (Chip enable) and booted see @a VL53L0X_WaitDeviceBooted()
sepp_nepp 6:fb11b746ceb5 225 *
sepp_nepp 6:fb11b746ceb5 226 * @par Function Description
sepp_nepp 6:fb11b746ceb5 227 * When not used after a fresh device "power up" or reset, it may return
sepp_nepp 6:fb11b746ceb5 228 * @a #VL53L0X_ERROR_CALIBRATION_WARNING meaning wrong calibration data
sepp_nepp 6:fb11b746ceb5 229 * may have been fetched from device that can result in ranging offset error\n
sepp_nepp 6:fb11b746ceb5 230 * If application cannot execute device reset or need to run VL53L0X_DataInit
sepp_nepp 6:fb11b746ceb5 231 * multiple time then it must ensure proper offset calibration saving and
sepp_nepp 6:fb11b746ceb5 232 * restore on its own by using @a VL53L0X_GetOffsetCalibrationData() on first
sepp_nepp 6:fb11b746ceb5 233 * power up and then @a VL53L0X_SetOffsetCalibrationData() in all subsequent init
sepp_nepp 6:fb11b746ceb5 234 * This function will change the VL53L0X_State from VL53L0X_STATE_POWERDOWN to
sepp_nepp 6:fb11b746ceb5 235 * VL53L0X_STATE_WAIT_STATICINIT.
sepp_nepp 6:fb11b746ceb5 236 *
sepp_nepp 6:fb11b746ceb5 237 * @note This function accesses to the device
sepp_nepp 6:fb11b746ceb5 238 *
sepp_nepp 6:fb11b746ceb5 239 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 240 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 241 */
sepp_nepp 7:3a1115c2556b 242 VL53L0X_Error VL53L0X_data_init(void);
sepp_nepp 6:fb11b746ceb5 243
sepp_nepp 6:fb11b746ceb5 244 /**
sepp_nepp 6:fb11b746ceb5 245 * @brief Do basic device init (and eventually patch loading)
sepp_nepp 6:fb11b746ceb5 246 * This function will change the VL53L0X_State from
sepp_nepp 6:fb11b746ceb5 247 * VL53L0X_STATE_WAIT_STATICINIT to VL53L0X_STATE_IDLE.
sepp_nepp 6:fb11b746ceb5 248 * In this stage all default setting will be applied.
sepp_nepp 6:fb11b746ceb5 249 *
sepp_nepp 6:fb11b746ceb5 250 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 251 *
sepp_nepp 7:3a1115c2556b 252 *
sepp_nepp 6:fb11b746ceb5 253 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 254 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 255 */
sepp_nepp 7:3a1115c2556b 256 VL53L0X_Error VL53L0X_static_init(void);
sepp_nepp 6:fb11b746ceb5 257
sepp_nepp 6:fb11b746ceb5 258 /**
sepp_nepp 6:fb11b746ceb5 259 * @brief Perform Reference Calibration
sepp_nepp 6:fb11b746ceb5 260 *
sepp_nepp 6:fb11b746ceb5 261 * @details Perform a reference calibration of the Device.
sepp_nepp 6:fb11b746ceb5 262 * This function should be run from time to time before doing
sepp_nepp 6:fb11b746ceb5 263 * a ranging measurement.
sepp_nepp 6:fb11b746ceb5 264 * This function will launch a special ranging measurement, so
sepp_nepp 6:fb11b746ceb5 265 * if interrupt are enable an interrupt will be done.
sepp_nepp 6:fb11b746ceb5 266 * This function will clear the interrupt generated automatically.
sepp_nepp 6:fb11b746ceb5 267 *
sepp_nepp 6:fb11b746ceb5 268 * @warning This function is a blocking function
sepp_nepp 6:fb11b746ceb5 269 *
sepp_nepp 6:fb11b746ceb5 270 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 271 *
sepp_nepp 7:3a1115c2556b 272 *
sepp_nepp 6:fb11b746ceb5 273 * @param p_vhv_settings Pointer to vhv settings parameter.
sepp_nepp 6:fb11b746ceb5 274 * @param p_phase_cal Pointer to PhaseCal parameter.
sepp_nepp 6:fb11b746ceb5 275 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 276 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 277 */
sepp_nepp 7:3a1115c2556b 278 VL53L0X_Error VL53L0X_perform_ref_calibration( uint8_t *p_vhv_settings,
sepp_nepp 6:fb11b746ceb5 279 uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 280
sepp_nepp 6:fb11b746ceb5 281 /**
sepp_nepp 6:fb11b746ceb5 282 * @brief Get Reference Calibration Parameters
sepp_nepp 6:fb11b746ceb5 283 *
sepp_nepp 6:fb11b746ceb5 284 * @par Function Description
sepp_nepp 6:fb11b746ceb5 285 * Get Reference Calibration Parameters.
sepp_nepp 6:fb11b746ceb5 286 *
sepp_nepp 6:fb11b746ceb5 287 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 288 *
sepp_nepp 7:3a1115c2556b 289 *
sepp_nepp 6:fb11b746ceb5 290 * @param p_vhv_settings Pointer to VHV parameter
sepp_nepp 6:fb11b746ceb5 291 * @param p_phase_cal Pointer to PhaseCal Parameter
sepp_nepp 6:fb11b746ceb5 292 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 293 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 294 */
sepp_nepp 7:3a1115c2556b 295 VL53L0X_Error VL53L0X_get_ref_calibration(
sepp_nepp 6:fb11b746ceb5 296 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 297
sepp_nepp 7:3a1115c2556b 298 VL53L0X_Error VL53L0X_set_ref_calibration(
sepp_nepp 6:fb11b746ceb5 299 uint8_t vhv_settings, uint8_t phase_cal);
sepp_nepp 6:fb11b746ceb5 300
sepp_nepp 6:fb11b746ceb5 301 /**
sepp_nepp 6:fb11b746ceb5 302 * @brief Performs Reference Spad Management
sepp_nepp 6:fb11b746ceb5 303 *
sepp_nepp 6:fb11b746ceb5 304 * @par Function Description
sepp_nepp 6:fb11b746ceb5 305 * The reference SPAD initialization procedure determines the minimum amount
sepp_nepp 6:fb11b746ceb5 306 * of reference spads to be enables to achieve a target reference signal rate
sepp_nepp 6:fb11b746ceb5 307 * and should be performed once during initialization.
sepp_nepp 6:fb11b746ceb5 308 *
sepp_nepp 6:fb11b746ceb5 309 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 310 *
sepp_nepp 11:d8dbe3b87f9f 311 * @note This function change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 7:3a1115c2556b 312 *
sepp_nepp 6:fb11b746ceb5 313 * @param ref_spad_count Reports ref Spad Count
sepp_nepp 6:fb11b746ceb5 314 * @param is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 315 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 316 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 317 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 318 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the Ref Spad procedure.
sepp_nepp 6:fb11b746ceb5 319 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 320 */
sepp_nepp 7:3a1115c2556b 321 VL53L0X_Error VL53L0X_perform_ref_spad_management(
sepp_nepp 6:fb11b746ceb5 322 uint32_t *ref_spad_count, uint8_t *is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 323
sepp_nepp 6:fb11b746ceb5 324 /**
sepp_nepp 6:fb11b746ceb5 325 * @brief Applies Reference SPAD configuration
sepp_nepp 6:fb11b746ceb5 326 *
sepp_nepp 6:fb11b746ceb5 327 * @par Function Description
sepp_nepp 6:fb11b746ceb5 328 * This function applies a given number of reference spads, identified as
sepp_nepp 6:fb11b746ceb5 329 * either Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 330 * The requested spad count and type are stored within the device specific
sepp_nepp 6:fb11b746ceb5 331 * parameters data for access by the host.
sepp_nepp 6:fb11b746ceb5 332 *
sepp_nepp 6:fb11b746ceb5 333 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 334 *
sepp_nepp 7:3a1115c2556b 335 *
sepp_nepp 6:fb11b746ceb5 336 * @param refSpadCount Number of ref spads.
sepp_nepp 6:fb11b746ceb5 337 * @param is_aperture_spads Defines if spads are of type
sepp_nepp 6:fb11b746ceb5 338 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 339 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 340 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 341 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 342 * spad configuration.
sepp_nepp 6:fb11b746ceb5 343 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 344 */
sepp_nepp 7:3a1115c2556b 345 VL53L0X_Error VL53L0X_set_reference_spads(
sepp_nepp 6:fb11b746ceb5 346 uint32_t refSpadCount, uint8_t is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 347
sepp_nepp 6:fb11b746ceb5 348 /**
sepp_nepp 6:fb11b746ceb5 349 * @brief Retrieves SPAD configuration
sepp_nepp 6:fb11b746ceb5 350 *
sepp_nepp 6:fb11b746ceb5 351 * @par Function Description
sepp_nepp 6:fb11b746ceb5 352 * This function retrieves the current number of applied reference spads
sepp_nepp 6:fb11b746ceb5 353 * and also their type : Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 354 *
sepp_nepp 6:fb11b746ceb5 355 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 356 *
sepp_nepp 7:3a1115c2556b 357 *
sepp_nepp 6:fb11b746ceb5 358 * @param p_spad_count Number ref Spad Count
sepp_nepp 6:fb11b746ceb5 359 * @param p_is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 360 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 361 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 362 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 363 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 364 * spad configuration.
sepp_nepp 6:fb11b746ceb5 365 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 366 */
sepp_nepp 7:3a1115c2556b 367 VL53L0X_Error VL53L0X_get_reference_spads(
sepp_nepp 6:fb11b746ceb5 368 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 369
sepp_nepp 6:fb11b746ceb5 370 /**
sepp_nepp 6:fb11b746ceb5 371 * @brief Get part to part calibration offset
sepp_nepp 6:fb11b746ceb5 372 *
sepp_nepp 6:fb11b746ceb5 373 * @par Function Description
sepp_nepp 6:fb11b746ceb5 374 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
sepp_nepp 6:fb11b746ceb5 375 * device NVM value
sepp_nepp 6:fb11b746ceb5 376 *
sepp_nepp 6:fb11b746ceb5 377 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 378 *
sepp_nepp 6:fb11b746ceb5 379 * @param p_offset_calibration_data_micro_meter Return part to part
sepp_nepp 6:fb11b746ceb5 380 * calibration offset from device (microns)
sepp_nepp 6:fb11b746ceb5 381 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 382 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 383 */
sepp_nepp 7:3a1115c2556b 384 VL53L0X_Error VL53L0X_get_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 385 int32_t *p_offset_calibration_data_micro_meter);
sepp_nepp 6:fb11b746ceb5 386 /**
sepp_nepp 6:fb11b746ceb5 387 * Set or over-hide part to part calibration offset
sepp_nepp 11:d8dbe3b87f9f 388 * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationData_um()
sepp_nepp 6:fb11b746ceb5 389 *
sepp_nepp 6:fb11b746ceb5 390 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 391 *
sepp_nepp 6:fb11b746ceb5 392 * @param p_offset_calibration_data_micro_meter Offset (microns)
sepp_nepp 6:fb11b746ceb5 393 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 394 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 395 */
sepp_nepp 7:3a1115c2556b 396 VL53L0X_Error VL53L0X_set_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 397 int32_t offset_calibration_data_micro_meter);
sepp_nepp 6:fb11b746ceb5 398
sepp_nepp 7:3a1115c2556b 399 VL53L0X_Error VL53L0X_perform_offset_calibration(
sepp_nepp 6:fb11b746ceb5 400 FixPoint1616_t cal_distance_milli_meter,
sepp_nepp 6:fb11b746ceb5 401 int32_t *p_offset_micro_meter);
sepp_nepp 6:fb11b746ceb5 402
sepp_nepp 7:3a1115c2556b 403 VL53L0X_Error VL53L0X_perform_xtalk_calibration(
sepp_nepp 6:fb11b746ceb5 404 FixPoint1616_t xtalk_cal_distance,
sepp_nepp 11:d8dbe3b87f9f 405 FixPoint1616_t *p_xtalk_compensation_rate_MHz);
sepp_nepp 6:fb11b746ceb5 406
sepp_nepp 6:fb11b746ceb5 407 /**
sepp_nepp 6:fb11b746ceb5 408 * @brief Set Cross talk compensation rate
sepp_nepp 6:fb11b746ceb5 409 *
sepp_nepp 6:fb11b746ceb5 410 * @par Function Description
sepp_nepp 6:fb11b746ceb5 411 * Set Cross talk compensation rate.
sepp_nepp 6:fb11b746ceb5 412 *
sepp_nepp 6:fb11b746ceb5 413 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 414 *
sepp_nepp 11:d8dbe3b87f9f 415 * @param x_talk_compensation_rate_MHz Compensation rate in
sepp_nepp 6:fb11b746ceb5 416 * Mega counts per second
sepp_nepp 6:fb11b746ceb5 417 * (16.16 fix point) see
sepp_nepp 6:fb11b746ceb5 418 * datasheet for details
sepp_nepp 6:fb11b746ceb5 419 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 420 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 421 */
sepp_nepp 11:d8dbe3b87f9f 422 VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_MHz(
sepp_nepp 11:d8dbe3b87f9f 423 FixPoint1616_t x_talk_compensation_rate_MHz);
sepp_nepp 6:fb11b746ceb5 424
sepp_nepp 6:fb11b746ceb5 425 /**
sepp_nepp 6:fb11b746ceb5 426 * @brief Get Cross talk compensation rate
sepp_nepp 6:fb11b746ceb5 427 *
sepp_nepp 6:fb11b746ceb5 428 * @par Function Description
sepp_nepp 6:fb11b746ceb5 429 * Get Cross talk compensation rate.
sepp_nepp 6:fb11b746ceb5 430 *
sepp_nepp 6:fb11b746ceb5 431 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 432 *
sepp_nepp 11:d8dbe3b87f9f 433 * @param p_xtalk_compensation_rate_MHz Pointer to Compensation rate
sepp_nepp 6:fb11b746ceb5 434 * in Mega counts per second
sepp_nepp 6:fb11b746ceb5 435 * (16.16 fix point) see
sepp_nepp 6:fb11b746ceb5 436 * datasheet for details
sepp_nepp 6:fb11b746ceb5 437 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 438 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 439 */
sepp_nepp 11:d8dbe3b87f9f 440 VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_MHz(
sepp_nepp 11:d8dbe3b87f9f 441 FixPoint1616_t *p_xtalk_compensation_rate_MHz);
sepp_nepp 6:fb11b746ceb5 442
sepp_nepp 6:fb11b746ceb5 443 /**
sepp_nepp 7:3a1115c2556b 444 * @brief Get Cross talk enable
sepp_nepp 7:3a1115c2556b 445 *
sepp_nepp 7:3a1115c2556b 446 * Enable/Disable Cross Talk by set to zero the Cross Talk value by
sepp_nepp 11:d8dbe3b87f9f 447 * using @a VL53L0X_SetXTalkCompensationRate_MHz().
sepp_nepp 7:3a1115c2556b 448 *
sepp_nepp 7:3a1115c2556b 449 * @param dev Device Handle
sepp_nepp 7:3a1115c2556b 450 * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation
sepp_nepp 7:3a1115c2556b 451 * state 0=disabled or 1 = enabled
sepp_nepp 7:3a1115c2556b 452 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 7:3a1115c2556b 453 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 7:3a1115c2556b 454 */
sepp_nepp 7:3a1115c2556b 455 VL53L0X_Error VL53L0X_get_x_talk_compensation_enable(uint8_t *p_x_talk_compensation_enable);
sepp_nepp 7:3a1115c2556b 456
sepp_nepp 7:3a1115c2556b 457 /**
sepp_nepp 6:fb11b746ceb5 458 * @brief Set a new device mode
sepp_nepp 6:fb11b746ceb5 459 * @par Function Description
sepp_nepp 6:fb11b746ceb5 460 * Set device to a new mode (ranging, histogram ...)
sepp_nepp 6:fb11b746ceb5 461 *
sepp_nepp 6:fb11b746ceb5 462 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 463 *
sepp_nepp 6:fb11b746ceb5 464 * @param device_mode New device mode to apply
sepp_nepp 6:fb11b746ceb5 465 * Valid values are:
sepp_nepp 6:fb11b746ceb5 466 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 467 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
sepp_nepp 6:fb11b746ceb5 468 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 469 *
sepp_nepp 6:fb11b746ceb5 470 *
sepp_nepp 6:fb11b746ceb5 471 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 472 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 473 * DeviceMode is not in the
sepp_nepp 6:fb11b746ceb5 474 * supported list
sepp_nepp 6:fb11b746ceb5 475 */
sepp_nepp 7:3a1115c2556b 476 VL53L0X_Error VL53L0X_set_device_mode( VL53L0X_DeviceModes device_mode);
sepp_nepp 6:fb11b746ceb5 477
sepp_nepp 6:fb11b746ceb5 478 /**
sepp_nepp 6:fb11b746ceb5 479 * @brief Get current new device mode
sepp_nepp 6:fb11b746ceb5 480 * @par Function Description
sepp_nepp 6:fb11b746ceb5 481 * Get actual mode of the device(ranging, histogram ...)
sepp_nepp 6:fb11b746ceb5 482 *
sepp_nepp 6:fb11b746ceb5 483 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 484 *
sepp_nepp 6:fb11b746ceb5 485 * @param p_device_mode Pointer to current apply mode value
sepp_nepp 6:fb11b746ceb5 486 * Valid values are:
sepp_nepp 6:fb11b746ceb5 487 * VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 488 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING
sepp_nepp 6:fb11b746ceb5 489 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 490 * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
sepp_nepp 6:fb11b746ceb5 491 *
sepp_nepp 6:fb11b746ceb5 492 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 493 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 494 * DeviceMode is not in the
sepp_nepp 6:fb11b746ceb5 495 * supported list
sepp_nepp 6:fb11b746ceb5 496 */
sepp_nepp 8:2fd7cb217068 497 VL53L0X_Error VL53L0X_get_device_mode(VL53L0X_DeviceModes *p_device_mode);
sepp_nepp 6:fb11b746ceb5 498
sepp_nepp 6:fb11b746ceb5 499 /**
sepp_nepp 6:fb11b746ceb5 500 * @brief Get current configuration for GPIO pin for a given device
sepp_nepp 6:fb11b746ceb5 501 *
sepp_nepp 6:fb11b746ceb5 502 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 503 *
sepp_nepp 7:3a1115c2556b 504 *
sepp_nepp 6:fb11b746ceb5 505 * @param pin ID of the GPIO Pin
sepp_nepp 6:fb11b746ceb5 506 * @param p_device_mode Pointer to Device Mode associated to the Gpio.
sepp_nepp 6:fb11b746ceb5 507 * @param p_functionality Pointer to Pin functionality.
sepp_nepp 6:fb11b746ceb5 508 * Refer to ::VL53L0X_GpioFunctionality
sepp_nepp 6:fb11b746ceb5 509 * @param p_polarity Pointer to interrupt polarity.
sepp_nepp 6:fb11b746ceb5 510 * Active high or active low see
sepp_nepp 6:fb11b746ceb5 511 * ::VL53L0X_InterruptPolarity
sepp_nepp 6:fb11b746ceb5 512 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 513 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
sepp_nepp 6:fb11b746ceb5 514 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED
sepp_nepp 6:fb11b746ceb5 515 * This error occurs
sepp_nepp 6:fb11b746ceb5 516 * when Funcionality programmed is not in the supported list:
sepp_nepp 6:fb11b746ceb5 517 * Supported value are:
sepp_nepp 6:fb11b746ceb5 518 * VL53L0X_GPIOFUNCTIONALITY_OFF,
sepp_nepp 6:fb11b746ceb5 519 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
sepp_nepp 6:fb11b746ceb5 520 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
sepp_nepp 6:fb11b746ceb5 521 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
sepp_nepp 6:fb11b746ceb5 522 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
sepp_nepp 6:fb11b746ceb5 523 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 524 */
sepp_nepp 7:3a1115c2556b 525 VL53L0X_Error VL53L0X_get_gpio_config( uint8_t pin,
sepp_nepp 6:fb11b746ceb5 526 VL53L0X_DeviceModes *p_device_mode,
sepp_nepp 6:fb11b746ceb5 527 VL53L0X_GpioFunctionality *p_functionality,
sepp_nepp 6:fb11b746ceb5 528 VL53L0X_InterruptPolarity *p_polarity);
sepp_nepp 6:fb11b746ceb5 529
sepp_nepp 6:fb11b746ceb5 530 /**
sepp_nepp 6:fb11b746ceb5 531 * @brief Set the configuration of GPIO pin for a given device
sepp_nepp 6:fb11b746ceb5 532 *
sepp_nepp 6:fb11b746ceb5 533 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 534 *
sepp_nepp 6:fb11b746ceb5 535 * @param pin ID of the GPIO Pin
sepp_nepp 6:fb11b746ceb5 536 * @param functionality Select Pin functionality.
sepp_nepp 6:fb11b746ceb5 537 * Refer to ::VL53L0X_GpioFunctionality
sepp_nepp 6:fb11b746ceb5 538 * @param device_mode Device Mode associated to the Gpio.
sepp_nepp 6:fb11b746ceb5 539 * @param polarity Set interrupt polarity. Active high
sepp_nepp 6:fb11b746ceb5 540 * or active low see ::VL53L0X_InterruptPolarity
sepp_nepp 6:fb11b746ceb5 541 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 542 * @return VL53L0X_ERROR_GPIO_NOT_EXISTING Only Pin=0 is accepted.
sepp_nepp 6:fb11b746ceb5 543 * @return VL53L0X_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED This error occurs
sepp_nepp 6:fb11b746ceb5 544 * when Functionality programmed is not in the supported list:
sepp_nepp 6:fb11b746ceb5 545 * Supported value are:
sepp_nepp 6:fb11b746ceb5 546 * VL53L0X_GPIOFUNCTIONALITY_OFF,
sepp_nepp 6:fb11b746ceb5 547 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_LOW,
sepp_nepp 6:fb11b746ceb5 548 * VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_HIGH,
sepp_nepp 6:fb11b746ceb5 549 VL53L0X_GPIOFUNCTIONALITY_THRESHOLD_CROSSED_OUT,
sepp_nepp 6:fb11b746ceb5 550 * VL53L0X_GPIOFUNCTIONALITY_NEW_MEASURE_READY
sepp_nepp 6:fb11b746ceb5 551 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 552 */
sepp_nepp 7:3a1115c2556b 553 VL53L0X_Error VL53L0X_set_gpio_config( uint8_t pin,
sepp_nepp 6:fb11b746ceb5 554 VL53L0X_DeviceModes device_mode, VL53L0X_GpioFunctionality functionality,
sepp_nepp 6:fb11b746ceb5 555 VL53L0X_InterruptPolarity polarity);
sepp_nepp 6:fb11b746ceb5 556
sepp_nepp 6:fb11b746ceb5 557 /**
sepp_nepp 6:fb11b746ceb5 558 * @brief Start device measurement
sepp_nepp 6:fb11b746ceb5 559 *
sepp_nepp 6:fb11b746ceb5 560 * @details Started measurement will depend on device parameters set through
sepp_nepp 6:fb11b746ceb5 561 * @a VL53L0X_SetParameters()
sepp_nepp 6:fb11b746ceb5 562 * This is a non-blocking function.
sepp_nepp 6:fb11b746ceb5 563 * This function will change the VL53L0X_State from VL53L0X_STATE_IDLE to
sepp_nepp 6:fb11b746ceb5 564 * VL53L0X_STATE_RUNNING.
sepp_nepp 6:fb11b746ceb5 565 *
sepp_nepp 6:fb11b746ceb5 566 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 567 *
sepp_nepp 6:fb11b746ceb5 568 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 569 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when
sepp_nepp 6:fb11b746ceb5 570 * DeviceMode programmed with @a VL53L0X_SetDeviceMode is not in the supported
sepp_nepp 6:fb11b746ceb5 571 * list:
sepp_nepp 6:fb11b746ceb5 572 * Supported mode are:
sepp_nepp 6:fb11b746ceb5 573 * VL53L0X_DEVICEMODE_SINGLE_RANGING,
sepp_nepp 6:fb11b746ceb5 574 * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING,
sepp_nepp 6:fb11b746ceb5 575 * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING
sepp_nepp 6:fb11b746ceb5 576 * @return VL53L0X_ERROR_TIME_OUT Time out on start measurement
sepp_nepp 6:fb11b746ceb5 577 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 578 */
sepp_nepp 7:3a1115c2556b 579 VL53L0X_Error VL53L0X_start_measurement(void);
sepp_nepp 6:fb11b746ceb5 580
sepp_nepp 6:fb11b746ceb5 581 /**
sepp_nepp 6:fb11b746ceb5 582 * @brief Stop device measurement
sepp_nepp 6:fb11b746ceb5 583 *
sepp_nepp 6:fb11b746ceb5 584 * @details Will set the device in standby mode at end of current measurement\n
sepp_nepp 6:fb11b746ceb5 585 * Not necessary in single mode as device shall return automatically
sepp_nepp 6:fb11b746ceb5 586 * in standby mode at end of measurement.
sepp_nepp 6:fb11b746ceb5 587 * This function will change the VL53L0X_State from VL53L0X_STATE_RUNNING
sepp_nepp 6:fb11b746ceb5 588 * to VL53L0X_STATE_IDLE.
sepp_nepp 6:fb11b746ceb5 589 *
sepp_nepp 6:fb11b746ceb5 590 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 591 *
sepp_nepp 6:fb11b746ceb5 592 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 593 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 594 */
sepp_nepp 7:3a1115c2556b 595 VL53L0X_Error VL53L0X_stop_measurement(void);
sepp_nepp 6:fb11b746ceb5 596
sepp_nepp 6:fb11b746ceb5 597 /**
sepp_nepp 6:fb11b746ceb5 598 * @brief Return device stop completion status
sepp_nepp 6:fb11b746ceb5 599 *
sepp_nepp 6:fb11b746ceb5 600 * @par Function Description
sepp_nepp 6:fb11b746ceb5 601 * Returns stop completiob status.
sepp_nepp 6:fb11b746ceb5 602 * User shall call this function after a stop command
sepp_nepp 6:fb11b746ceb5 603 *
sepp_nepp 6:fb11b746ceb5 604 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 605 *
sepp_nepp 7:3a1115c2556b 606 *
sepp_nepp 6:fb11b746ceb5 607 * @param p_stop_status Pointer to status variable to update
sepp_nepp 6:fb11b746ceb5 608 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 609 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 610 */
sepp_nepp 7:3a1115c2556b 611 VL53L0X_Error VL53L0X_get_stop_completed_status(
sepp_nepp 6:fb11b746ceb5 612 uint32_t *p_stop_status);
sepp_nepp 6:fb11b746ceb5 613
sepp_nepp 6:fb11b746ceb5 614 /**
sepp_nepp 6:fb11b746ceb5 615 * @brief Return Measurement Data Ready
sepp_nepp 6:fb11b746ceb5 616 *
sepp_nepp 6:fb11b746ceb5 617 * @par Function Description
sepp_nepp 6:fb11b746ceb5 618 * This function indicate that a measurement data is ready.
sepp_nepp 6:fb11b746ceb5 619 * This function check if interrupt mode is used then check is done accordingly.
sepp_nepp 6:fb11b746ceb5 620 * If perform function clear the interrupt, this function will not work,
sepp_nepp 6:fb11b746ceb5 621 * like in case of @a VL53L0X_PerformSingleRangingMeasurement().
sepp_nepp 6:fb11b746ceb5 622 * The previous function is blocking function, VL53L0X_GetMeasurementDataReady
sepp_nepp 6:fb11b746ceb5 623 * is used for non-blocking capture.
sepp_nepp 6:fb11b746ceb5 624 *
sepp_nepp 6:fb11b746ceb5 625 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 626 *
sepp_nepp 7:3a1115c2556b 627 *
sepp_nepp 6:fb11b746ceb5 628 * @param p_measurement_data_ready Pointer to Measurement Data Ready.
sepp_nepp 6:fb11b746ceb5 629 * 0=data not ready, 1 = data ready
sepp_nepp 6:fb11b746ceb5 630 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 631 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 632 */
sepp_nepp 7:3a1115c2556b 633 VL53L0X_Error VL53L0X_get_measurement_data_ready(
sepp_nepp 6:fb11b746ceb5 634 uint8_t *p_measurement_data_ready);
sepp_nepp 6:fb11b746ceb5 635
sepp_nepp 6:fb11b746ceb5 636 /**
sepp_nepp 6:fb11b746ceb5 637 * @brief Retrieve the measurements from device for a given setup
sepp_nepp 6:fb11b746ceb5 638 *
sepp_nepp 6:fb11b746ceb5 639 * @par Function Description
sepp_nepp 6:fb11b746ceb5 640 * Get data from last successful Ranging measurement
sepp_nepp 6:fb11b746ceb5 641 * @warning USER should take care about @a VL53L0X_GetNumberOfROIZones()
sepp_nepp 6:fb11b746ceb5 642 * before get data.
sepp_nepp 6:fb11b746ceb5 643 * PAL will fill a NumberOfROIZones times the corresponding data
sepp_nepp 6:fb11b746ceb5 644 * structure used in the measurement function.
sepp_nepp 6:fb11b746ceb5 645 *
sepp_nepp 6:fb11b746ceb5 646 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 647 *
sepp_nepp 7:3a1115c2556b 648 *
sepp_nepp 6:fb11b746ceb5 649 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
sepp_nepp 6:fb11b746ceb5 650 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 651 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 652 */
sepp_nepp 7:3a1115c2556b 653 VL53L0X_Error VL53L0X_get_ranging_measurement_data(
sepp_nepp 6:fb11b746ceb5 654 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
sepp_nepp 6:fb11b746ceb5 655
sepp_nepp 6:fb11b746ceb5 656 /**
sepp_nepp 6:fb11b746ceb5 657 * @brief Clear given system interrupt condition
sepp_nepp 6:fb11b746ceb5 658 *
sepp_nepp 6:fb11b746ceb5 659 * @par Function Description
sepp_nepp 6:fb11b746ceb5 660 * Clear given interrupt(s).
sepp_nepp 6:fb11b746ceb5 661 *
sepp_nepp 6:fb11b746ceb5 662 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 663 *
sepp_nepp 7:3a1115c2556b 664 *
sepp_nepp 6:fb11b746ceb5 665 * @param interrupt_mask Mask of interrupts to clear
sepp_nepp 6:fb11b746ceb5 666 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 667 * @return VL53L0X_ERROR_INTERRUPT_NOT_CLEARED Cannot clear interrupts
sepp_nepp 6:fb11b746ceb5 668 *
sepp_nepp 6:fb11b746ceb5 669 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 670 */
sepp_nepp 7:3a1115c2556b 671 VL53L0X_Error VL53L0X_clear_interrupt_mask( uint32_t interrupt_mask);
sepp_nepp 6:fb11b746ceb5 672
sepp_nepp 6:fb11b746ceb5 673 /**
sepp_nepp 6:fb11b746ceb5 674 * @brief Return device interrupt status
sepp_nepp 6:fb11b746ceb5 675 *
sepp_nepp 6:fb11b746ceb5 676 * @par Function Description
sepp_nepp 6:fb11b746ceb5 677 * Returns currently raised interrupts by the device.
sepp_nepp 6:fb11b746ceb5 678 * User shall be able to activate/deactivate interrupts through
sepp_nepp 6:fb11b746ceb5 679 * @a VL53L0X_SetGpioConfig()
sepp_nepp 6:fb11b746ceb5 680 *
sepp_nepp 6:fb11b746ceb5 681 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 682 *
sepp_nepp 6:fb11b746ceb5 683 * @param p_interrupt_mask_status Pointer to status variable to update
sepp_nepp 6:fb11b746ceb5 684 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 685 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 686 */
sepp_nepp 7:3a1115c2556b 687 VL53L0X_Error VL53L0X_get_interrupt_mask_status(
sepp_nepp 6:fb11b746ceb5 688 uint32_t *p_interrupt_mask_status);
sepp_nepp 6:fb11b746ceb5 689
sepp_nepp 6:fb11b746ceb5 690 /**
sepp_nepp 6:fb11b746ceb5 691 * @brief Performs a single ranging measurement and retrieve the ranging
sepp_nepp 6:fb11b746ceb5 692 * measurement data
sepp_nepp 6:fb11b746ceb5 693 *
sepp_nepp 6:fb11b746ceb5 694 * @par Function Description
sepp_nepp 6:fb11b746ceb5 695 * This function will change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING
sepp_nepp 6:fb11b746ceb5 696 * with @a VL53L0X_SetDeviceMode(),
sepp_nepp 6:fb11b746ceb5 697 * It performs measurement with @a VL53L0X_PerformSingleMeasurement()
sepp_nepp 6:fb11b746ceb5 698 * It get data from last successful Ranging measurement with
sepp_nepp 6:fb11b746ceb5 699 * @a VL53L0X_GetRangingMeasurementData.
sepp_nepp 6:fb11b746ceb5 700 * Finally it clear the interrupt with @a VL53L0X_ClearInterruptMask().
sepp_nepp 6:fb11b746ceb5 701 *
sepp_nepp 6:fb11b746ceb5 702 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 703 *
sepp_nepp 6:fb11b746ceb5 704 * @param p_ranging_measurement_data Pointer to the data structure to fill up.
sepp_nepp 6:fb11b746ceb5 705 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 706 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 707 */
sepp_nepp 7:3a1115c2556b 708 VL53L0X_Error VL53L0X_perform_single_ranging_measurement(
sepp_nepp 6:fb11b746ceb5 709 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data);
sepp_nepp 6:fb11b746ceb5 710
sepp_nepp 6:fb11b746ceb5 711 /**
sepp_nepp 6:fb11b746ceb5 712 * @brief Single shot measurement.
sepp_nepp 6:fb11b746ceb5 713 *
sepp_nepp 6:fb11b746ceb5 714 * @par Function Description
sepp_nepp 6:fb11b746ceb5 715 * Perform simple measurement sequence (Start measure, Wait measure to end,
sepp_nepp 6:fb11b746ceb5 716 * and returns when measurement is done).
sepp_nepp 6:fb11b746ceb5 717 * Once function returns, user can get valid data by calling
sepp_nepp 6:fb11b746ceb5 718 * VL53L0X_GetRangingMeasurement or VL53L0X_GetHistogramMeasurement
sepp_nepp 6:fb11b746ceb5 719 * depending on defined measurement mode
sepp_nepp 6:fb11b746ceb5 720 * User should Clear the interrupt in case this are enabled by using the
sepp_nepp 6:fb11b746ceb5 721 * function VL53L0X_ClearInterruptMask().
sepp_nepp 6:fb11b746ceb5 722 *
sepp_nepp 6:fb11b746ceb5 723 * @warning This function is a blocking function
sepp_nepp 6:fb11b746ceb5 724 *
sepp_nepp 6:fb11b746ceb5 725 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 726 *
sepp_nepp 6:fb11b746ceb5 727 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 728 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 729 */
sepp_nepp 7:3a1115c2556b 730 VL53L0X_Error VL53L0X_perform_single_measurement(void);
sepp_nepp 6:fb11b746ceb5 731
sepp_nepp 7:3a1115c2556b 732 VL53L0X_Error VL53L0X_get_total_signal_rate(
sepp_nepp 6:fb11b746ceb5 733 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 11:d8dbe3b87f9f 734 FixPoint1616_t *p_total_signal_rate_MHz);
sepp_nepp 6:fb11b746ceb5 735
sepp_nepp 7:3a1115c2556b 736 VL53L0X_Error VL53L0X_get_total_xtalk_rate(
sepp_nepp 6:fb11b746ceb5 737 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 11:d8dbe3b87f9f 738 FixPoint1616_t *p_total_xtalk_rate_MHz);
sepp_nepp 6:fb11b746ceb5 739
sepp_nepp 6:fb11b746ceb5 740 /**
sepp_nepp 11:d8dbe3b87f9f 741 * @brief Get Ranging Timing Budget in us
sepp_nepp 6:fb11b746ceb5 742 *
sepp_nepp 6:fb11b746ceb5 743 * @par Function Description
sepp_nepp 6:fb11b746ceb5 744 * Returns the programmed the maximum time allowed by the user to the
sepp_nepp 6:fb11b746ceb5 745 * device to run a full ranging sequence for the current mode
sepp_nepp 6:fb11b746ceb5 746 * (ranging, histogram, ASL ...)
sepp_nepp 6:fb11b746ceb5 747 *
sepp_nepp 6:fb11b746ceb5 748 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 749 *
sepp_nepp 11:d8dbe3b87f9f 750 * @param p_measurement_timing_budget_us Max measurement time in
sepp_nepp 11:d8dbe3b87f9f 751 *us.
sepp_nepp 6:fb11b746ceb5 752 * Valid values are:
sepp_nepp 11:d8dbe3b87f9f 753 * >= 17000us when wraparound enabled
sepp_nepp 11:d8dbe3b87f9f 754 * >= 12000us when wraparound disabled
sepp_nepp 6:fb11b746ceb5 755 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 756 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 757 */
sepp_nepp 11:d8dbe3b87f9f 758 VL53L0X_Error VL53L0X_get_measurement_timing_budget_us(
sepp_nepp 11:d8dbe3b87f9f 759 uint32_t *p_measurement_timing_budget_us);
sepp_nepp 6:fb11b746ceb5 760
sepp_nepp 6:fb11b746ceb5 761 /**
sepp_nepp 11:d8dbe3b87f9f 762 * @brief Set Ranging Timing Budget in us
sepp_nepp 6:fb11b746ceb5 763 *
sepp_nepp 6:fb11b746ceb5 764 * @par Function Description
sepp_nepp 6:fb11b746ceb5 765 * Defines the maximum time allowed by the user to the device to run a
sepp_nepp 6:fb11b746ceb5 766 * full ranging sequence for the current mode (ranging, histogram, ASL ...)
sepp_nepp 6:fb11b746ceb5 767 *
sepp_nepp 6:fb11b746ceb5 768 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 769 *
sepp_nepp 11:d8dbe3b87f9f 770 * @param measurement_timing_budget_us Max measurement time in us.
sepp_nepp 6:fb11b746ceb5 771 * Valid values are:
sepp_nepp 11:d8dbe3b87f9f 772 * >= 17000us when wraparound enabled
sepp_nepp 11:d8dbe3b87f9f 773 * >= 12000us when wraparound disabled
sepp_nepp 6:fb11b746ceb5 774 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 775 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if
sepp_nepp 11:d8dbe3b87f9f 776 MeasurementTimingBudget_us out of range
sepp_nepp 6:fb11b746ceb5 777 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 778 */
sepp_nepp 11:d8dbe3b87f9f 779 VL53L0X_Error VL53L0X_set_measurement_timing_budget_us(
sepp_nepp 11:d8dbe3b87f9f 780 uint32_t measurement_timing_budget_us);
sepp_nepp 6:fb11b746ceb5 781
sepp_nepp 6:fb11b746ceb5 782 /**
sepp_nepp 6:fb11b746ceb5 783 * @brief Get specific limit check enable state
sepp_nepp 6:fb11b746ceb5 784 *
sepp_nepp 6:fb11b746ceb5 785 * @par Function Description
sepp_nepp 6:fb11b746ceb5 786 * This function get the enable state of a specific limit check.
sepp_nepp 6:fb11b746ceb5 787 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 788 *
sepp_nepp 6:fb11b746ceb5 789 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 790 *
sepp_nepp 7:3a1115c2556b 791 *
sepp_nepp 6:fb11b746ceb5 792 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 793 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 794 * @param p_limit_check_enable Pointer to the check limit enable
sepp_nepp 6:fb11b746ceb5 795 * value.
sepp_nepp 6:fb11b746ceb5 796 * if 1 the check limit
sepp_nepp 6:fb11b746ceb5 797 * corresponding to LimitCheckId is Enabled
sepp_nepp 6:fb11b746ceb5 798 * if 0 the check limit
sepp_nepp 6:fb11b746ceb5 799 * corresponding to LimitCheckId is disabled
sepp_nepp 6:fb11b746ceb5 800 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 801 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 802 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 803 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 804 */
sepp_nepp 7:3a1115c2556b 805 VL53L0X_Error VL53L0X_get_limit_check_enable( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 806 uint8_t *p_limit_check_enable);
sepp_nepp 6:fb11b746ceb5 807
sepp_nepp 6:fb11b746ceb5 808 /**
sepp_nepp 6:fb11b746ceb5 809 * @brief Enable/Disable a specific limit check
sepp_nepp 6:fb11b746ceb5 810 *
sepp_nepp 6:fb11b746ceb5 811 * @par Function Description
sepp_nepp 6:fb11b746ceb5 812 * This function Enable/Disable a specific limit check.
sepp_nepp 6:fb11b746ceb5 813 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 814 *
sepp_nepp 6:fb11b746ceb5 815 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 816 *
sepp_nepp 7:3a1115c2556b 817 *
sepp_nepp 6:fb11b746ceb5 818 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 819 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 820 * @param limit_check_enable if 1 the check limit
sepp_nepp 6:fb11b746ceb5 821 * corresponding to LimitCheckId is Enabled
sepp_nepp 6:fb11b746ceb5 822 * if 0 the check limit
sepp_nepp 6:fb11b746ceb5 823 * corresponding to LimitCheckId is disabled
sepp_nepp 6:fb11b746ceb5 824 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 825 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 826 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 827 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 828 */
sepp_nepp 7:3a1115c2556b 829 VL53L0X_Error VL53L0X_set_limit_check_enable( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 830 uint8_t limit_check_enable);
sepp_nepp 6:fb11b746ceb5 831
sepp_nepp 6:fb11b746ceb5 832 /**
sepp_nepp 6:fb11b746ceb5 833 * @brief Get a specific limit check value
sepp_nepp 6:fb11b746ceb5 834 *
sepp_nepp 6:fb11b746ceb5 835 * @par Function Description
sepp_nepp 6:fb11b746ceb5 836 * This function get a specific limit check value from device then it updates
sepp_nepp 6:fb11b746ceb5 837 * internal values and check enables.
sepp_nepp 6:fb11b746ceb5 838 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 839 *
sepp_nepp 6:fb11b746ceb5 840 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 841 *
sepp_nepp 7:3a1115c2556b 842 *
sepp_nepp 6:fb11b746ceb5 843 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 844 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 845 * @param p_limit_check_value Pointer to Limit
sepp_nepp 6:fb11b746ceb5 846 * check Value for a given LimitCheckId.
sepp_nepp 6:fb11b746ceb5 847 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 848 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned
sepp_nepp 6:fb11b746ceb5 849 * when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 850 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 851 */
sepp_nepp 7:3a1115c2556b 852 VL53L0X_Error VL53L0X_get_limit_check_value( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 853 FixPoint1616_t *p_limit_check_value);
sepp_nepp 6:fb11b746ceb5 854
sepp_nepp 6:fb11b746ceb5 855 /**
sepp_nepp 6:fb11b746ceb5 856 * @brief Set a specific limit check value
sepp_nepp 6:fb11b746ceb5 857 *
sepp_nepp 6:fb11b746ceb5 858 * @par Function Description
sepp_nepp 6:fb11b746ceb5 859 * This function set a specific limit check value.
sepp_nepp 6:fb11b746ceb5 860 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 861 *
sepp_nepp 6:fb11b746ceb5 862 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 863 *
sepp_nepp 7:3a1115c2556b 864 *
sepp_nepp 6:fb11b746ceb5 865 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 866 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 867 * @param limit_check_value Limit check Value for a given
sepp_nepp 6:fb11b746ceb5 868 * LimitCheckId
sepp_nepp 6:fb11b746ceb5 869 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 870 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when either
sepp_nepp 6:fb11b746ceb5 871 * LimitCheckId or LimitCheckValue value is out of range.
sepp_nepp 6:fb11b746ceb5 872 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 873 */
sepp_nepp 7:3a1115c2556b 874 VL53L0X_Error VL53L0X_set_limit_check_value( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 875 FixPoint1616_t limit_check_value);
sepp_nepp 6:fb11b746ceb5 876
sepp_nepp 6:fb11b746ceb5 877 /**
sepp_nepp 6:fb11b746ceb5 878 * @brief Get the current value of the signal used for the limit check
sepp_nepp 6:fb11b746ceb5 879 *
sepp_nepp 6:fb11b746ceb5 880 * @par Function Description
sepp_nepp 6:fb11b746ceb5 881 * This function get a the current value of the signal used for the limit check.
sepp_nepp 6:fb11b746ceb5 882 * To obtain the latest value you should run a ranging before.
sepp_nepp 6:fb11b746ceb5 883 * The value reported is linked to the limit check identified with the
sepp_nepp 6:fb11b746ceb5 884 * LimitCheckId.
sepp_nepp 6:fb11b746ceb5 885 *
sepp_nepp 6:fb11b746ceb5 886 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 887 *
sepp_nepp 7:3a1115c2556b 888 *
sepp_nepp 6:fb11b746ceb5 889 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 890 * (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 891 * @param p_limit_check_current Pointer to current Value for a
sepp_nepp 6:fb11b746ceb5 892 * given LimitCheckId.
sepp_nepp 6:fb11b746ceb5 893 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 894 * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned when
sepp_nepp 6:fb11b746ceb5 895 * LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 896 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 897 */
sepp_nepp 7:3a1115c2556b 898 VL53L0X_Error VL53L0X_get_limit_check_current( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 899 FixPoint1616_t *p_limit_check_current);
sepp_nepp 6:fb11b746ceb5 900
sepp_nepp 6:fb11b746ceb5 901 /**
sepp_nepp 6:fb11b746ceb5 902 * @brief Return a the Status of the specified check limit
sepp_nepp 6:fb11b746ceb5 903 *
sepp_nepp 6:fb11b746ceb5 904 * @par Function Description
sepp_nepp 6:fb11b746ceb5 905 * This function returns the Status of the specified check limit.
sepp_nepp 6:fb11b746ceb5 906 * The value indicate if the check is fail or not.
sepp_nepp 6:fb11b746ceb5 907 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 908 *
sepp_nepp 6:fb11b746ceb5 909 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 910 *
sepp_nepp 7:3a1115c2556b 911 *
sepp_nepp 6:fb11b746ceb5 912 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 913 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 914 * @param p_limit_check_status Pointer to the
sepp_nepp 6:fb11b746ceb5 915 Limit Check Status of the given check limit.
sepp_nepp 6:fb11b746ceb5 916 * LimitCheckStatus :
sepp_nepp 6:fb11b746ceb5 917 * 0 the check is not fail
sepp_nepp 6:fb11b746ceb5 918 * 1 the check if fail or not enabled
sepp_nepp 6:fb11b746ceb5 919 *
sepp_nepp 6:fb11b746ceb5 920 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 921 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
sepp_nepp 6:fb11b746ceb5 922 returned when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 923 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 924 */
sepp_nepp 7:3a1115c2556b 925 VL53L0X_Error VL53L0X_get_limit_check_status(
sepp_nepp 6:fb11b746ceb5 926 uint16_t limit_check_id, uint8_t *p_limit_check_status);
sepp_nepp 6:fb11b746ceb5 927
sepp_nepp 6:fb11b746ceb5 928 /**
sepp_nepp 11:d8dbe3b87f9f 929 * Get continuous mode Inter-Measurement period in _ms
sepp_nepp 6:fb11b746ceb5 930 *
sepp_nepp 6:fb11b746ceb5 931 * @par Function Description
sepp_nepp 6:fb11b746ceb5 932 * When trying to set too short time return INVALID_PARAMS minimal value
sepp_nepp 6:fb11b746ceb5 933 *
sepp_nepp 6:fb11b746ceb5 934 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 935 *
sepp_nepp 7:3a1115c2556b 936 *
sepp_nepp 11:d8dbe3b87f9f 937 * @param p_inter_measurement_period_ms Pointer to programmed
sepp_nepp 11:d8dbe3b87f9f 938 * Inter-Measurement Period in _ms.
sepp_nepp 6:fb11b746ceb5 939 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 940 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 941 */
sepp_nepp 11:d8dbe3b87f9f 942 VL53L0X_Error VL53L0X_get_inter_measurement_period_ms(
sepp_nepp 11:d8dbe3b87f9f 943 uint32_t *p_inter_measurement_period_ms);
sepp_nepp 6:fb11b746ceb5 944
sepp_nepp 6:fb11b746ceb5 945 /**
sepp_nepp 11:d8dbe3b87f9f 946 * Program continuous mode Inter-Measurement period in _ms
sepp_nepp 6:fb11b746ceb5 947 *
sepp_nepp 6:fb11b746ceb5 948 * @par Function Description
sepp_nepp 6:fb11b746ceb5 949 * When trying to set too short time return INVALID_PARAMS minimal value
sepp_nepp 6:fb11b746ceb5 950 *
sepp_nepp 6:fb11b746ceb5 951 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 952 *
sepp_nepp 7:3a1115c2556b 953 *
sepp_nepp 11:d8dbe3b87f9f 954 * @param inter_measurement_period_ms Inter-Measurement Period in ms.
sepp_nepp 6:fb11b746ceb5 955 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 956 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 957 */
sepp_nepp 11:d8dbe3b87f9f 958 VL53L0X_Error VL53L0X_set_inter_measurement_period_ms(
sepp_nepp 11:d8dbe3b87f9f 959 uint32_t inter_measurement_period_ms);
sepp_nepp 6:fb11b746ceb5 960
sepp_nepp 6:fb11b746ceb5 961 /**
sepp_nepp 6:fb11b746ceb5 962 * @brief Set new device address
sepp_nepp 6:fb11b746ceb5 963 *
sepp_nepp 6:fb11b746ceb5 964 * After completion the device will answer to the new address programmed.
sepp_nepp 6:fb11b746ceb5 965 * This function should be called when several devices are used in parallel
sepp_nepp 6:fb11b746ceb5 966 * before start programming the sensor.
sepp_nepp 6:fb11b746ceb5 967 * When a single device us used, there is no need to call this function.
sepp_nepp 6:fb11b746ceb5 968 *
sepp_nepp 6:fb11b746ceb5 969 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 970 *
sepp_nepp 7:3a1115c2556b 971 *
sepp_nepp 6:fb11b746ceb5 972 * @param device_address The new Device address
sepp_nepp 6:fb11b746ceb5 973 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 974 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 975 */
sepp_nepp 7:3a1115c2556b 976 VL53L0X_Error VL53L0X_set_device_address( uint8_t device_address);
sepp_nepp 6:fb11b746ceb5 977
sepp_nepp 6:fb11b746ceb5 978 /**
sepp_nepp 6:fb11b746ceb5 979 * @brief Do an hard reset or soft reset (depending on implementation) of the
sepp_nepp 6:fb11b746ceb5 980 * device \nAfter call of this function, device must be in same state as right
sepp_nepp 6:fb11b746ceb5 981 * after a power-up sequence.This function will change the VL53L0X_State to
sepp_nepp 6:fb11b746ceb5 982 * VL53L0X_STATE_POWERDOWN.
sepp_nepp 6:fb11b746ceb5 983 *
sepp_nepp 6:fb11b746ceb5 984 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 985 *
sepp_nepp 7:3a1115c2556b 986 *
sepp_nepp 6:fb11b746ceb5 987 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 988 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 989 */
sepp_nepp 7:3a1115c2556b 990 VL53L0X_Error VL53L0X_reset_device(void);
sepp_nepp 6:fb11b746ceb5 991
sepp_nepp 6:fb11b746ceb5 992 /**
sepp_nepp 6:fb11b746ceb5 993 * @brief Get setup of Wrap around Check
sepp_nepp 6:fb11b746ceb5 994 *
sepp_nepp 6:fb11b746ceb5 995 * @par Function Description
sepp_nepp 6:fb11b746ceb5 996 * This function get the wrapAround check enable parameters
sepp_nepp 6:fb11b746ceb5 997 *
sepp_nepp 6:fb11b746ceb5 998 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 999 *
sepp_nepp 7:3a1115c2556b 1000 *
sepp_nepp 6:fb11b746ceb5 1001 * @param p_wrap_around_check_enable Pointer to the Wrap around Check state
sepp_nepp 6:fb11b746ceb5 1002 * 0=disabled or 1 = enabled
sepp_nepp 6:fb11b746ceb5 1003 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1004 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1005 */
sepp_nepp 7:3a1115c2556b 1006 VL53L0X_Error VL53L0X_get_wrap_around_check_enable(
sepp_nepp 6:fb11b746ceb5 1007 uint8_t *p_wrap_around_check_enable);
sepp_nepp 6:fb11b746ceb5 1008
sepp_nepp 6:fb11b746ceb5 1009 /**
sepp_nepp 6:fb11b746ceb5 1010 * @brief Enable (or disable) Wrap around Check
sepp_nepp 6:fb11b746ceb5 1011 *
sepp_nepp 6:fb11b746ceb5 1012 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1013 *
sepp_nepp 7:3a1115c2556b 1014 *
sepp_nepp 6:fb11b746ceb5 1015 * @param wrap_around_check_enable Wrap around Check to be set
sepp_nepp 6:fb11b746ceb5 1016 * 0=disabled, other = enabled
sepp_nepp 6:fb11b746ceb5 1017 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1018 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1019 */
sepp_nepp 7:3a1115c2556b 1020 VL53L0X_Error VL53L0X_set_wrap_around_check_enable(
sepp_nepp 6:fb11b746ceb5 1021 uint8_t wrap_around_check_enable);
sepp_nepp 6:fb11b746ceb5 1022
sepp_nepp 6:fb11b746ceb5 1023 /**
sepp_nepp 6:fb11b746ceb5 1024 * @brief Gets the VCSEL pulse period.
sepp_nepp 6:fb11b746ceb5 1025 *
sepp_nepp 6:fb11b746ceb5 1026 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1027 * This function retrieves the VCSEL pulse period for the given period type.
sepp_nepp 6:fb11b746ceb5 1028 *
sepp_nepp 6:fb11b746ceb5 1029 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1030 *
sepp_nepp 7:3a1115c2556b 1031 *
sepp_nepp 6:fb11b746ceb5 1032 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
sepp_nepp 6:fb11b746ceb5 1033 * @param p_vcsel_pulse_period_pclk Pointer to VCSEL period value.
sepp_nepp 6:fb11b746ceb5 1034 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1035 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
sepp_nepp 6:fb11b746ceb5 1036 * supported.
sepp_nepp 6:fb11b746ceb5 1037 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1038 */
sepp_nepp 7:3a1115c2556b 1039 VL53L0X_Error VL53L0X_get_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1040 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1041
sepp_nepp 6:fb11b746ceb5 1042 /**
sepp_nepp 6:fb11b746ceb5 1043 * @brief Sets the VCSEL pulse period.
sepp_nepp 6:fb11b746ceb5 1044 *
sepp_nepp 6:fb11b746ceb5 1045 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1046 * This function retrieves the VCSEL pulse period for the given period type.
sepp_nepp 6:fb11b746ceb5 1047 *
sepp_nepp 6:fb11b746ceb5 1048 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1049 *
sepp_nepp 7:3a1115c2556b 1050 *
sepp_nepp 6:fb11b746ceb5 1051 * @param vcsel_period_type VCSEL period identifier (pre-range|final).
sepp_nepp 6:fb11b746ceb5 1052 * @param vcsel_pulse_period VCSEL period value
sepp_nepp 6:fb11b746ceb5 1053 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1054 * @return VL53L0X_ERROR_INVALID_PARAMS Error VcselPeriodType parameter not
sepp_nepp 6:fb11b746ceb5 1055 * supported.
sepp_nepp 6:fb11b746ceb5 1056 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1057 */
sepp_nepp 7:3a1115c2556b 1058 VL53L0X_Error VL53L0X_set_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1059 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period);
sepp_nepp 6:fb11b746ceb5 1060
sepp_nepp 6:fb11b746ceb5 1061 /**
sepp_nepp 6:fb11b746ceb5 1062 * @brief Set low and high Interrupt thresholds for a given mode
sepp_nepp 6:fb11b746ceb5 1063 * (ranging, ALS, ...) for a given device
sepp_nepp 6:fb11b746ceb5 1064 *
sepp_nepp 6:fb11b746ceb5 1065 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1066 * Set low and high Interrupt thresholds for a given mode (ranging, ALS, ...)
sepp_nepp 6:fb11b746ceb5 1067 * for a given device
sepp_nepp 6:fb11b746ceb5 1068 *
sepp_nepp 6:fb11b746ceb5 1069 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1070 *
sepp_nepp 6:fb11b746ceb5 1071 * @note DeviceMode is ignored for the current device
sepp_nepp 6:fb11b746ceb5 1072 *
sepp_nepp 7:3a1115c2556b 1073 *
sepp_nepp 6:fb11b746ceb5 1074 * @param device_mode Device Mode for which change thresholds
sepp_nepp 6:fb11b746ceb5 1075 * @param threshold_low Low threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1076 * @param threshold_high High threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1077 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1078 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1079 */
sepp_nepp 7:3a1115c2556b 1080 VL53L0X_Error VL53L0X_set_interrupt_thresholds(
sepp_nepp 6:fb11b746ceb5 1081 VL53L0X_DeviceModes device_mode, FixPoint1616_t threshold_low,
sepp_nepp 6:fb11b746ceb5 1082 FixPoint1616_t threshold_high);
sepp_nepp 6:fb11b746ceb5 1083
sepp_nepp 6:fb11b746ceb5 1084 /**
sepp_nepp 6:fb11b746ceb5 1085 * @brief Get high and low Interrupt thresholds for a given mode
sepp_nepp 6:fb11b746ceb5 1086 * (ranging, ALS, ...) for a given device
sepp_nepp 6:fb11b746ceb5 1087 *
sepp_nepp 6:fb11b746ceb5 1088 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1089 * Get high and low Interrupt thresholds for a given mode (ranging, ALS, ...)
sepp_nepp 6:fb11b746ceb5 1090 * for a given device
sepp_nepp 6:fb11b746ceb5 1091 *
sepp_nepp 6:fb11b746ceb5 1092 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1093 *
sepp_nepp 6:fb11b746ceb5 1094 * @note DeviceMode is ignored for the current device
sepp_nepp 6:fb11b746ceb5 1095 *
sepp_nepp 7:3a1115c2556b 1096 *
sepp_nepp 6:fb11b746ceb5 1097 * @param device_mode Device Mode from which read thresholds
sepp_nepp 6:fb11b746ceb5 1098 * @param p_threshold_low Low threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1099 * @param p_threshold_high High threshold (mm, lux ..., depending on the mode)
sepp_nepp 6:fb11b746ceb5 1100 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1101 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1102 */
sepp_nepp 7:3a1115c2556b 1103 VL53L0X_Error VL53L0X_get_interrupt_thresholds(
sepp_nepp 6:fb11b746ceb5 1104 VL53L0X_DeviceModes device_mode, FixPoint1616_t *p_threshold_low,
sepp_nepp 6:fb11b746ceb5 1105 FixPoint1616_t *p_threshold_high);
sepp_nepp 6:fb11b746ceb5 1106
sepp_nepp 6:fb11b746ceb5 1107 /**
sepp_nepp 6:fb11b746ceb5 1108 * @brief Reads the Device information for given Device
sepp_nepp 6:fb11b746ceb5 1109 *
sepp_nepp 6:fb11b746ceb5 1110 * @note This function Access to the device
sepp_nepp 10:cd1758e186a4 1111 * _device_info structure is directly filled
sepp_nepp 6:fb11b746ceb5 1112 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1113 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1114 */
sepp_nepp 10:cd1758e186a4 1115 VL53L0X_Error VL53L0X_get_device_info( );
sepp_nepp 6:fb11b746ceb5 1116
sepp_nepp 6:fb11b746ceb5 1117 /**
sepp_nepp 6:fb11b746ceb5 1118 * @brief Gets the (on/off) state of all sequence steps.
sepp_nepp 6:fb11b746ceb5 1119 *
sepp_nepp 6:fb11b746ceb5 1120 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1121 * This function retrieves the state of all sequence step in the scheduler.
sepp_nepp 6:fb11b746ceb5 1122 *
sepp_nepp 6:fb11b746ceb5 1123 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1124 *
sepp_nepp 7:3a1115c2556b 1125 *
sepp_nepp 6:fb11b746ceb5 1126 * @param p_scheduler_sequence_steps Pointer to struct containing result.
sepp_nepp 6:fb11b746ceb5 1127 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1128 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1129 */
sepp_nepp 7:3a1115c2556b 1130 VL53L0X_Error VL53L0X_get_sequence_step_enables(
sepp_nepp 6:fb11b746ceb5 1131 VL53L0X_SchedulerSequenceSteps_t *p_scheduler_sequence_steps);
sepp_nepp 6:fb11b746ceb5 1132
sepp_nepp 6:fb11b746ceb5 1133 /**
sepp_nepp 6:fb11b746ceb5 1134 * @brief Sets the (on/off) state of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1135 *
sepp_nepp 6:fb11b746ceb5 1136 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1137 * This function enables/disables a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1138 *
sepp_nepp 6:fb11b746ceb5 1139 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1140 *
sepp_nepp 7:3a1115c2556b 1141 *
sepp_nepp 6:fb11b746ceb5 1142 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1143 * @param sequence_step_enabled Demanded state {0=Off,1=On}
sepp_nepp 6:fb11b746ceb5 1144 * is enabled.
sepp_nepp 6:fb11b746ceb5 1145 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1146 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 1147 * supported.
sepp_nepp 6:fb11b746ceb5 1148 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1149 */
sepp_nepp 7:3a1115c2556b 1150 VL53L0X_Error VL53L0X_set_sequence_step_enable(
sepp_nepp 6:fb11b746ceb5 1151 VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 1152
sepp_nepp 6:fb11b746ceb5 1153 /**
sepp_nepp 6:fb11b746ceb5 1154 * @brief Gets the fraction enable parameter indicating the resolution of
sepp_nepp 6:fb11b746ceb5 1155 * range measurements.
sepp_nepp 6:fb11b746ceb5 1156 *
sepp_nepp 6:fb11b746ceb5 1157 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1158 * Gets the fraction enable state, which translates to the resolution of
sepp_nepp 6:fb11b746ceb5 1159 * range measurements as follows :Enabled:=0.25mm resolution,
sepp_nepp 6:fb11b746ceb5 1160 * Not Enabled:=1mm resolution.
sepp_nepp 6:fb11b746ceb5 1161 *
sepp_nepp 6:fb11b746ceb5 1162 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1163 *
sepp_nepp 7:3a1115c2556b 1164 *
sepp_nepp 6:fb11b746ceb5 1165 * @param p_enabled Output Parameter reporting the fraction enable state.
sepp_nepp 6:fb11b746ceb5 1166 *
sepp_nepp 6:fb11b746ceb5 1167 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1168 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1169 */
sepp_nepp 7:3a1115c2556b 1170 VL53L0X_Error VL53L0X_get_fraction_enable( uint8_t *p_enabled);
sepp_nepp 6:fb11b746ceb5 1171
sepp_nepp 6:fb11b746ceb5 1172 /**
sepp_nepp 6:fb11b746ceb5 1173 * @brief Sets the resolution of range measurements.
sepp_nepp 6:fb11b746ceb5 1174 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1175 * Set resolution of range measurements to either 0.25mm if
sepp_nepp 6:fb11b746ceb5 1176 * fraction enabled or 1mm if not enabled.
sepp_nepp 6:fb11b746ceb5 1177 *
sepp_nepp 6:fb11b746ceb5 1178 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1179 *
sepp_nepp 7:3a1115c2556b 1180 *
sepp_nepp 6:fb11b746ceb5 1181 * @param enable Enable high resolution
sepp_nepp 6:fb11b746ceb5 1182 *
sepp_nepp 6:fb11b746ceb5 1183 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1184 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1185 */
sepp_nepp 8:2fd7cb217068 1186 VL53L0X_Error VL53L0X_set_range_fraction_enable(uint8_t enable);
sepp_nepp 6:fb11b746ceb5 1187
sepp_nepp 6:fb11b746ceb5 1188 /**
sepp_nepp 6:fb11b746ceb5 1189 * @brief Retrieve current device parameters
sepp_nepp 6:fb11b746ceb5 1190 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1191 * Get actual parameters of the device
sepp_nepp 6:fb11b746ceb5 1192 * @li Then start ranging operation.
sepp_nepp 6:fb11b746ceb5 1193 *
sepp_nepp 6:fb11b746ceb5 1194 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1195 *
sepp_nepp 7:3a1115c2556b 1196 *
sepp_nepp 6:fb11b746ceb5 1197 * @param p_device_parameters Pointer to store current device parameters.
sepp_nepp 6:fb11b746ceb5 1198 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1199 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1200 */
sepp_nepp 7:3a1115c2556b 1201 VL53L0X_Error VL53L0X_get_device_parameters(
sepp_nepp 6:fb11b746ceb5 1202 VL53L0X_DeviceParameters_t *p_device_parameters);
sepp_nepp 6:fb11b746ceb5 1203
sepp_nepp 6:fb11b746ceb5 1204
sepp_nepp 6:fb11b746ceb5 1205 /*** End High level API ***/
sepp_nepp 6:fb11b746ceb5 1206 public:
sepp_nepp 6:fb11b746ceb5 1207 /* api.h functions */
sepp_nepp 6:fb11b746ceb5 1208
sepp_nepp 7:3a1115c2556b 1209 VL53L0X_Error sequence_step_enabled(VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config,
sepp_nepp 6:fb11b746ceb5 1210 uint8_t *p_sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 1211
sepp_nepp 7:3a1115c2556b 1212 VL53L0X_Error VL53L0X_check_and_load_interrupt_settings(
sepp_nepp 6:fb11b746ceb5 1213 uint8_t start_not_stopflag);
sepp_nepp 6:fb11b746ceb5 1214
sepp_nepp 6:fb11b746ceb5 1215
sepp_nepp 6:fb11b746ceb5 1216 /* api_core.h functions */
sepp_nepp 6:fb11b746ceb5 1217
sepp_nepp 7:3a1115c2556b 1218 VL53L0X_Error VL53L0X_get_info_from_device( uint8_t option);
sepp_nepp 6:fb11b746ceb5 1219
sepp_nepp 7:3a1115c2556b 1220 VL53L0X_Error VL53L0X_device_read_strobe(void);
sepp_nepp 6:fb11b746ceb5 1221
sepp_nepp 11:d8dbe3b87f9f 1222 VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_us(
sepp_nepp 11:d8dbe3b87f9f 1223 uint32_t *p_measurement_timing_budget_us);
sepp_nepp 6:fb11b746ceb5 1224
sepp_nepp 7:3a1115c2556b 1225 VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1226 VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1227
sepp_nepp 6:fb11b746ceb5 1228 uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
sepp_nepp 6:fb11b746ceb5 1229
sepp_nepp 6:fb11b746ceb5 1230 uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
sepp_nepp 6:fb11b746ceb5 1231
sepp_nepp 7:3a1115c2556b 1232 uint32_t VL53L0X_calc_timeout_us(
sepp_nepp 6:fb11b746ceb5 1233 uint16_t timeout_period_mclks,
sepp_nepp 6:fb11b746ceb5 1234 uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1235
sepp_nepp 7:3a1115c2556b 1236 uint32_t VL53L0X_calc_macro_period_ps( uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1237
sepp_nepp 7:3a1115c2556b 1238 VL53L0X_Error VL53L0X_measurement_poll_for_completion(void);
sepp_nepp 6:fb11b746ceb5 1239
sepp_nepp 7:3a1115c2556b 1240 VL53L0X_Error VL53L0X_load_tuning_settings(
sepp_nepp 6:fb11b746ceb5 1241 uint8_t *p_tuning_setting_buffer);
sepp_nepp 6:fb11b746ceb5 1242
sepp_nepp 8:2fd7cb217068 1243 VL53L0X_Error VL53L0X_get_pal_range_status( uint8_t device_range_status,
sepp_nepp 8:2fd7cb217068 1244 FixPoint1616_t signal_rate, uint16_t effective_spad_rtn_count,
sepp_nepp 6:fb11b746ceb5 1245 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 1246 uint8_t *p_pal_range_status);
sepp_nepp 7:3a1115c2556b 1247 VL53L0X_Error VL53L0X_calc_sigma_estimate(
sepp_nepp 6:fb11b746ceb5 1248 VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
sepp_nepp 6:fb11b746ceb5 1249 FixPoint1616_t *p_sigma_estimate,
sepp_nepp 6:fb11b746ceb5 1250 uint32_t *p_dmax_mm);
sepp_nepp 8:2fd7cb217068 1251 uint32_t VL53L0X_calc_timeout_mclks( uint32_t timeout_period_us,
sepp_nepp 6:fb11b746ceb5 1252 uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1253 uint32_t VL53L0X_isqrt(uint32_t num);
sepp_nepp 6:fb11b746ceb5 1254
sepp_nepp 6:fb11b746ceb5 1255 uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b);
sepp_nepp 6:fb11b746ceb5 1256
sepp_nepp 6:fb11b746ceb5 1257 VL53L0X_Error VL53L0X_calc_dmax(
sepp_nepp 11:d8dbe3b87f9f 1258 FixPoint1616_t total_signal_rate_MHz,
sepp_nepp 11:d8dbe3b87f9f 1259 FixPoint1616_t total_corr_signal_rate_MHz,
sepp_nepp 6:fb11b746ceb5 1260 FixPoint1616_t pw_mult,
sepp_nepp 6:fb11b746ceb5 1261 uint32_t sigma_estimate_p1,
sepp_nepp 6:fb11b746ceb5 1262 FixPoint1616_t sigma_estimate_p2,
sepp_nepp 6:fb11b746ceb5 1263 uint32_t peak_vcsel_duration_us,
sepp_nepp 6:fb11b746ceb5 1264 uint32_t *pd_max_mm);
sepp_nepp 11:d8dbe3b87f9f 1265 VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_us(
sepp_nepp 11:d8dbe3b87f9f 1266 uint32_t measurement_timing_budget_us);
sepp_nepp 8:2fd7cb217068 1267 VL53L0X_Error get_sequence_step_timeout(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1268 uint32_t *p_time_out_micro_secs);
sepp_nepp 8:2fd7cb217068 1269 VL53L0X_Error set_sequence_step_timeout(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1270 uint32_t timeout_micro_secs);
sepp_nepp 6:fb11b746ceb5 1271 uint16_t VL53L0X_encode_timeout(uint32_t timeout_macro_clks);
sepp_nepp 7:3a1115c2556b 1272 VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period(
sepp_nepp 6:fb11b746ceb5 1273 VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk);
sepp_nepp 6:fb11b746ceb5 1274 uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1275
sepp_nepp 6:fb11b746ceb5 1276 /* api_calibration.h functions */
sepp_nepp 7:3a1115c2556b 1277 VL53L0X_Error VL53L0X_apply_offset_adjustment(void);
sepp_nepp 7:3a1115c2556b 1278 VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 1279 int32_t *p_offset_calibration_data_micro_meter);
sepp_nepp 7:3a1115c2556b 1280 VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter(
sepp_nepp 6:fb11b746ceb5 1281 int32_t offset_calibration_data_micro_meter);
sepp_nepp 7:3a1115c2556b 1282 VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management(
sepp_nepp 6:fb11b746ceb5 1283 uint32_t *ref_spad_count,
sepp_nepp 6:fb11b746ceb5 1284 uint8_t *is_aperture_spads);
sepp_nepp 7:3a1115c2556b 1285 VL53L0X_Error VL53L0X_perform_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1286 uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable);
sepp_nepp 7:3a1115c2556b 1287 VL53L0X_Error VL53L0X_perform_vhv_calibration(
sepp_nepp 6:fb11b746ceb5 1288 uint8_t *p_vhv_settings, const uint8_t get_data_enable,
sepp_nepp 6:fb11b746ceb5 1289 const uint8_t restore_config);
sepp_nepp 7:3a1115c2556b 1290 VL53L0X_Error VL53L0X_perform_single_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1291 uint8_t vhv_init_byte);
sepp_nepp 7:3a1115c2556b 1292 VL53L0X_Error VL53L0X_ref_calibration_io( uint8_t read_not_write,
sepp_nepp 6:fb11b746ceb5 1293 uint8_t vhv_settings, uint8_t phase_cal,
sepp_nepp 6:fb11b746ceb5 1294 uint8_t *p_vhv_settings, uint8_t *p_phase_cal,
sepp_nepp 6:fb11b746ceb5 1295 const uint8_t vhv_enable, const uint8_t phase_enable);
sepp_nepp 7:3a1115c2556b 1296 VL53L0X_Error VL53L0X_perform_phase_calibration(
sepp_nepp 6:fb11b746ceb5 1297 uint8_t *p_phase_cal, const uint8_t get_data_enable,
sepp_nepp 6:fb11b746ceb5 1298 const uint8_t restore_config);
sepp_nepp 8:2fd7cb217068 1299 VL53L0X_Error enable_ref_spads(uint8_t aperture_spads,
sepp_nepp 6:fb11b746ceb5 1300 uint8_t good_spad_array[],
sepp_nepp 6:fb11b746ceb5 1301 uint8_t spad_array[],
sepp_nepp 6:fb11b746ceb5 1302 uint32_t size,
sepp_nepp 6:fb11b746ceb5 1303 uint32_t start,
sepp_nepp 6:fb11b746ceb5 1304 uint32_t offset,
sepp_nepp 6:fb11b746ceb5 1305 uint32_t spad_count,
sepp_nepp 6:fb11b746ceb5 1306 uint32_t *p_last_spad);
sepp_nepp 6:fb11b746ceb5 1307 void get_next_good_spad(uint8_t good_spad_array[], uint32_t size,
sepp_nepp 6:fb11b746ceb5 1308 uint32_t curr, int32_t *p_next);
sepp_nepp 6:fb11b746ceb5 1309 uint8_t is_aperture(uint32_t spad_index);
sepp_nepp 6:fb11b746ceb5 1310 VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size,
sepp_nepp 6:fb11b746ceb5 1311 uint32_t spad_index);
sepp_nepp 7:3a1115c2556b 1312 VL53L0X_Error set_ref_spad_map( uint8_t *p_ref_spad_array);
sepp_nepp 7:3a1115c2556b 1313 VL53L0X_Error get_ref_spad_map( uint8_t *p_ref_spad_array);
sepp_nepp 7:3a1115c2556b 1314 VL53L0X_Error perform_ref_signal_measurement(
sepp_nepp 6:fb11b746ceb5 1315 uint16_t *p_ref_signal_rate);
sepp_nepp 7:3a1115c2556b 1316 VL53L0X_Error wrapped_VL53L0X_set_reference_spads(
sepp_nepp 6:fb11b746ceb5 1317 uint32_t count, uint8_t is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 1318
sepp_nepp 6:fb11b746ceb5 1319 /* api_strings.h functions */
sepp_nepp 10:cd1758e186a4 1320 VL53L0X_Error VL53L0X_check_part_used(uint8_t *revision);
sepp_nepp 6:fb11b746ceb5 1321
sepp_nepp 6:fb11b746ceb5 1322 /* Read function of the ID device */
sepp_nepp 6:fb11b746ceb5 1323 // virtual int read_id();
sepp_nepp 6:fb11b746ceb5 1324 virtual int read_id(uint8_t *id);
sepp_nepp 6:fb11b746ceb5 1325
sepp_nepp 7:3a1115c2556b 1326 VL53L0X_Error wait_measurement_data_ready(void);
sepp_nepp 6:fb11b746ceb5 1327
sepp_nepp 7:3a1115c2556b 1328 VL53L0X_Error wait_stop_completed(void);
sepp_nepp 6:fb11b746ceb5 1329
sepp_nepp 6:fb11b746ceb5 1330
sepp_nepp 6:fb11b746ceb5 1331 /**
sepp_nepp 6:fb11b746ceb5 1332 * @brief execute delay in all polling API call
sepp_nepp 6:fb11b746ceb5 1333 *
sepp_nepp 6:fb11b746ceb5 1334 * 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 1335 * if nothing specific is need you can define it as an empty/void macro
sepp_nepp 6:fb11b746ceb5 1336 * @code
sepp_nepp 6:fb11b746ceb5 1337 * #define VL53L0X_PollingDelay(...) (void)0
sepp_nepp 6:fb11b746ceb5 1338 * @endcode
sepp_nepp 7:3a1115c2556b 1339 *
sepp_nepp 6:fb11b746ceb5 1340 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1341 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1342 */
sepp_nepp 7:3a1115c2556b 1343 VL53L0X_Error VL53L0X_polling_delay(void); /* usually best implemented as a real function */
sepp_nepp 6:fb11b746ceb5 1344
sepp_nepp 6:fb11b746ceb5 1345 ///////////////////////////////////////////////////////////////////////////////////////////////////////
sepp_nepp 6:fb11b746ceb5 1346 //Added functions //
sepp_nepp 6:fb11b746ceb5 1347 ///////////////////////////////////////////////////////////////////////////////////////////////////////
sepp_nepp 6:fb11b746ceb5 1348
sepp_nepp 6:fb11b746ceb5 1349 /**
sepp_nepp 6:fb11b746ceb5 1350 * @brief Cycle Power to Device
sepp_nepp 6:fb11b746ceb5 1351 *
sepp_nepp 6:fb11b746ceb5 1352 * @return status - status 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1353 *
sepp_nepp 6:fb11b746ceb5 1354 */
sepp_nepp 6:fb11b746ceb5 1355 int32_t VL53L0X_cycle_power(void);
sepp_nepp 6:fb11b746ceb5 1356
sepp_nepp 6:fb11b746ceb5 1357 uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
sepp_nepp 6:fb11b746ceb5 1358
sepp_nepp 7:3a1115c2556b 1359 VL53L0X_Error wrapped_VL53L0X_get_limit_check_info( uint16_t limit_check_id,
sepp_nepp 6:fb11b746ceb5 1360 char *p_limit_check_string);
sepp_nepp 6:fb11b746ceb5 1361
sepp_nepp 7:3a1115c2556b 1362 VL53L0X_Error wrapped_VL53L0X_get_ref_calibration(
sepp_nepp 6:fb11b746ceb5 1363 uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
sepp_nepp 6:fb11b746ceb5 1364
sepp_nepp 6:fb11b746ceb5 1365
sepp_nepp 6:fb11b746ceb5 1366 VL53L0X_Error count_enabled_spads(uint8_t spad_array[],
sepp_nepp 6:fb11b746ceb5 1367 uint32_t byte_count, uint32_t max_spads,
sepp_nepp 6:fb11b746ceb5 1368 uint32_t *p_total_spads_enabled, uint8_t *p_is_aperture);
sepp_nepp 6:fb11b746ceb5 1369
sepp_nepp 6:fb11b746ceb5 1370 VL53L0X_Error wrapped_VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1371 char *p_sequence_steps_string);
sepp_nepp 6:fb11b746ceb5 1372
sepp_nepp 6:fb11b746ceb5 1373
sepp_nepp 6:fb11b746ceb5 1374 /**
sepp_nepp 6:fb11b746ceb5 1375 * @brief Gets the name of a given sequence step.
sepp_nepp 6:fb11b746ceb5 1376 *
sepp_nepp 6:fb11b746ceb5 1377 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1378 * This function retrieves the name of sequence steps corresponding to
sepp_nepp 6:fb11b746ceb5 1379 * SequenceStepId.
sepp_nepp 6:fb11b746ceb5 1380 *
sepp_nepp 6:fb11b746ceb5 1381 * @note This function doesn't Accesses the device
sepp_nepp 6:fb11b746ceb5 1382 *
sepp_nepp 6:fb11b746ceb5 1383 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1384 * @param p_sequence_steps_string Pointer to Info string
sepp_nepp 6:fb11b746ceb5 1385 *
sepp_nepp 6:fb11b746ceb5 1386 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1387 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1388 */
sepp_nepp 6:fb11b746ceb5 1389 VL53L0X_Error VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1390 char *p_sequence_steps_string);
sepp_nepp 6:fb11b746ceb5 1391
sepp_nepp 6:fb11b746ceb5 1392 /**
sepp_nepp 6:fb11b746ceb5 1393 * @brief Get the frequency of the timer used for ranging results time stamps
sepp_nepp 6:fb11b746ceb5 1394 *
sepp_nepp 6:fb11b746ceb5 1395 * @param[out] p_timer_freq_hz : pointer for timer frequency
sepp_nepp 6:fb11b746ceb5 1396 *
sepp_nepp 6:fb11b746ceb5 1397 * @return status : 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1398 *
sepp_nepp 6:fb11b746ceb5 1399 */
sepp_nepp 6:fb11b746ceb5 1400 int32_t VL53L0X_get_timer_frequency(int32_t *p_timer_freq_hz);
sepp_nepp 6:fb11b746ceb5 1401
sepp_nepp 6:fb11b746ceb5 1402 /**
sepp_nepp 6:fb11b746ceb5 1403 * @brief Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency())
sepp_nepp 6:fb11b746ceb5 1404 *
sepp_nepp 6:fb11b746ceb5 1405 * @param[out] p_timer_count : pointer for timer count value
sepp_nepp 6:fb11b746ceb5 1406 *
sepp_nepp 6:fb11b746ceb5 1407 * @return status : 0 = ok, 1 = error
sepp_nepp 6:fb11b746ceb5 1408 *
sepp_nepp 6:fb11b746ceb5 1409 */
sepp_nepp 6:fb11b746ceb5 1410 int32_t VL53L0X_get_timer_value(int32_t *p_timer_count);
sepp_nepp 6:fb11b746ceb5 1411
sepp_nepp 6:fb11b746ceb5 1412 /**
sepp_nepp 6:fb11b746ceb5 1413 * @brief Get Dmax Calibration Parameters for a given device
sepp_nepp 6:fb11b746ceb5 1414 *
sepp_nepp 6:fb11b746ceb5 1415 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1416 *
sepp_nepp 6:fb11b746ceb5 1417 * @param p_range_milli_meter Pointer to Calibration Distance
sepp_nepp 11:d8dbe3b87f9f 1418 * @param p_signal_rate_rtn_MHz Pointer to Signal rate return
sepp_nepp 6:fb11b746ceb5 1419 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1420 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1421 */
sepp_nepp 7:3a1115c2556b 1422 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(
sepp_nepp 11:d8dbe3b87f9f 1423 uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_MHz);
sepp_nepp 6:fb11b746ceb5 1424
sepp_nepp 6:fb11b746ceb5 1425 /**
sepp_nepp 6:fb11b746ceb5 1426 * @brief Set Dmax Calibration Parameters for a given device
sepp_nepp 6:fb11b746ceb5 1427 * When one of the parameter is zero, this function will get parameter
sepp_nepp 6:fb11b746ceb5 1428 * from NVM.
sepp_nepp 6:fb11b746ceb5 1429 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1430 *
sepp_nepp 7:3a1115c2556b 1431 *
sepp_nepp 6:fb11b746ceb5 1432 * @param range_milli_meter Calibration Distance
sepp_nepp 11:d8dbe3b87f9f 1433 * @param signal_rate_rtn_MHz Signal rate return read at CalDistance
sepp_nepp 6:fb11b746ceb5 1434 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1435 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1436 */
sepp_nepp 7:3a1115c2556b 1437 VL53L0X_Error VL53L0X_get_dmax_cal_parameters(
sepp_nepp 11:d8dbe3b87f9f 1438 uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_MHz);
sepp_nepp 6:fb11b746ceb5 1439
sepp_nepp 11:d8dbe3b87f9f 1440
sepp_nepp 6:fb11b746ceb5 1441
sepp_nepp 6:fb11b746ceb5 1442 /**
sepp_nepp 6:fb11b746ceb5 1443 * @brief Return a description string for a given limit check number
sepp_nepp 6:fb11b746ceb5 1444 *
sepp_nepp 6:fb11b746ceb5 1445 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1446 * This function returns a description string for a given limit check number.
sepp_nepp 6:fb11b746ceb5 1447 * The limit check is identified with the LimitCheckId.
sepp_nepp 6:fb11b746ceb5 1448 *
sepp_nepp 6:fb11b746ceb5 1449 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1450 *
sepp_nepp 7:3a1115c2556b 1451 *
sepp_nepp 6:fb11b746ceb5 1452 * @param limit_check_id Limit Check ID
sepp_nepp 6:fb11b746ceb5 1453 (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
sepp_nepp 6:fb11b746ceb5 1454 * @param p_limit_check_string Pointer to the
sepp_nepp 6:fb11b746ceb5 1455 description string of the given check limit.
sepp_nepp 6:fb11b746ceb5 1456 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1457 * @return VL53L0X_ERROR_INVALID_PARAMS This error is
sepp_nepp 6:fb11b746ceb5 1458 returned when LimitCheckId value is out of range.
sepp_nepp 6:fb11b746ceb5 1459 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1460 */
sepp_nepp 7:3a1115c2556b 1461 VL53L0X_Error VL53L0X_get_limit_check_info(
sepp_nepp 6:fb11b746ceb5 1462 uint16_t limit_check_id, char *p_limit_check_string);
sepp_nepp 6:fb11b746ceb5 1463
sepp_nepp 6:fb11b746ceb5 1464 /**
sepp_nepp 6:fb11b746ceb5 1465 * @brief Get the linearity corrective gain
sepp_nepp 6:fb11b746ceb5 1466 *
sepp_nepp 6:fb11b746ceb5 1467 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1468 * Should only be used after a successful call to @a VL53L0X_DataInit to backup
sepp_nepp 6:fb11b746ceb5 1469 * device NVM value
sepp_nepp 6:fb11b746ceb5 1470 *
sepp_nepp 6:fb11b746ceb5 1471 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1472 *
sepp_nepp 7:3a1115c2556b 1473 *
sepp_nepp 6:fb11b746ceb5 1474 * @param p_linearity_corrective_gain Pointer to the linearity
sepp_nepp 6:fb11b746ceb5 1475 * corrective gain in x1000
sepp_nepp 6:fb11b746ceb5 1476 * if value is 1000 then no modification is applied.
sepp_nepp 6:fb11b746ceb5 1477 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1478 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1479 */
sepp_nepp 7:3a1115c2556b 1480 VL53L0X_Error VL53L0X_get_linearity_corrective_gain(
sepp_nepp 6:fb11b746ceb5 1481 uint16_t *p_linearity_corrective_gain);
sepp_nepp 6:fb11b746ceb5 1482
sepp_nepp 6:fb11b746ceb5 1483 /**
sepp_nepp 6:fb11b746ceb5 1484 * Set the linearity corrective gain
sepp_nepp 6:fb11b746ceb5 1485 *
sepp_nepp 6:fb11b746ceb5 1486 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1487 *
sepp_nepp 7:3a1115c2556b 1488 *
sepp_nepp 6:fb11b746ceb5 1489 * @param linearity_corrective_gain Linearity corrective
sepp_nepp 6:fb11b746ceb5 1490 * gain in x1000
sepp_nepp 6:fb11b746ceb5 1491 * if value is 1000 then no modification is applied.
sepp_nepp 6:fb11b746ceb5 1492 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1493 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1494 */
sepp_nepp 7:3a1115c2556b 1495 VL53L0X_Error VL53L0X_set_linearity_corrective_gain(
sepp_nepp 6:fb11b746ceb5 1496 int16_t linearity_corrective_gain);
sepp_nepp 6:fb11b746ceb5 1497
sepp_nepp 6:fb11b746ceb5 1498 /**
sepp_nepp 6:fb11b746ceb5 1499 * @brief Get the Maximum number of ROI Zones managed by the Device
sepp_nepp 6:fb11b746ceb5 1500 *
sepp_nepp 6:fb11b746ceb5 1501 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1502 * Get Maximum number of ROI Zones managed by the Device.
sepp_nepp 6:fb11b746ceb5 1503 *
sepp_nepp 6:fb11b746ceb5 1504 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1505 *
sepp_nepp 7:3a1115c2556b 1506 *
sepp_nepp 6:fb11b746ceb5 1507 * @param p_max_number_of_roi_zones Pointer to the Maximum Number
sepp_nepp 6:fb11b746ceb5 1508 * of ROI Zones value.
sepp_nepp 6:fb11b746ceb5 1509 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1510 */
sepp_nepp 7:3a1115c2556b 1511 VL53L0X_Error VL53L0X_get_max_number_of_roi_zones(
sepp_nepp 6:fb11b746ceb5 1512 uint8_t *p_max_number_of_roi_zones);
sepp_nepp 6:fb11b746ceb5 1513
sepp_nepp 6:fb11b746ceb5 1514 /**
sepp_nepp 6:fb11b746ceb5 1515 * @brief Retrieve the Reference Signal after a measurements
sepp_nepp 6:fb11b746ceb5 1516 *
sepp_nepp 6:fb11b746ceb5 1517 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1518 * Get Reference Signal from last successful Ranging measurement
sepp_nepp 6:fb11b746ceb5 1519 * This function return a valid value after that you call the
sepp_nepp 6:fb11b746ceb5 1520 * @a VL53L0X_GetRangingMeasurementData().
sepp_nepp 6:fb11b746ceb5 1521 *
sepp_nepp 6:fb11b746ceb5 1522 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1523 *
sepp_nepp 7:3a1115c2556b 1524 *
sepp_nepp 6:fb11b746ceb5 1525 * @param p_measurement_ref_signal Pointer to the Ref Signal to fill up.
sepp_nepp 6:fb11b746ceb5 1526 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1527 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1528 */
sepp_nepp 7:3a1115c2556b 1529 VL53L0X_Error VL53L0X_get_measurement_ref_signal(
sepp_nepp 6:fb11b746ceb5 1530 FixPoint1616_t *p_measurement_ref_signal);
sepp_nepp 6:fb11b746ceb5 1531
sepp_nepp 6:fb11b746ceb5 1532 /**
sepp_nepp 6:fb11b746ceb5 1533 * @brief Get the number of the check limit managed by a given Device
sepp_nepp 6:fb11b746ceb5 1534 *
sepp_nepp 6:fb11b746ceb5 1535 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1536 * This function give the number of the check limit managed by the Device
sepp_nepp 6:fb11b746ceb5 1537 *
sepp_nepp 6:fb11b746ceb5 1538 * @note This function doesn't Access to the device
sepp_nepp 6:fb11b746ceb5 1539 *
sepp_nepp 6:fb11b746ceb5 1540 * @param p_number_of_limit_check Pointer to the number of check limit.
sepp_nepp 6:fb11b746ceb5 1541 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1542 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1543 */
sepp_nepp 6:fb11b746ceb5 1544 VL53L0X_Error VL53L0X_get_number_of_limit_check(
sepp_nepp 6:fb11b746ceb5 1545 uint16_t *p_number_of_limit_check);
sepp_nepp 6:fb11b746ceb5 1546
sepp_nepp 6:fb11b746ceb5 1547 /**
sepp_nepp 6:fb11b746ceb5 1548 * @brief Gets number of sequence steps managed by the API.
sepp_nepp 6:fb11b746ceb5 1549 *
sepp_nepp 6:fb11b746ceb5 1550 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1551 * This function retrieves the number of sequence steps currently managed
sepp_nepp 6:fb11b746ceb5 1552 * by the API
sepp_nepp 6:fb11b746ceb5 1553 *
sepp_nepp 6:fb11b746ceb5 1554 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1555 *
sepp_nepp 6:fb11b746ceb5 1556 * @param p_number_of_sequence_steps Out parameter reporting the number of
sepp_nepp 6:fb11b746ceb5 1557 * sequence steps.
sepp_nepp 6:fb11b746ceb5 1558 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1559 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1560 */
sepp_nepp 7:3a1115c2556b 1561 VL53L0X_Error VL53L0X_get_number_of_sequence_steps(
sepp_nepp 6:fb11b746ceb5 1562 uint8_t *p_number_of_sequence_steps);
sepp_nepp 6:fb11b746ceb5 1563 /**
sepp_nepp 6:fb11b746ceb5 1564 * @brief Get the power mode for a given Device
sepp_nepp 6:fb11b746ceb5 1565 *
sepp_nepp 6:fb11b746ceb5 1566 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1567 *
sepp_nepp 7:3a1115c2556b 1568 *
sepp_nepp 6:fb11b746ceb5 1569 * @param p_power_mode Pointer to the current value of the power
sepp_nepp 6:fb11b746ceb5 1570 * mode. see ::VL53L0X_PowerModes
sepp_nepp 6:fb11b746ceb5 1571 * Valid values are:
sepp_nepp 6:fb11b746ceb5 1572 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
sepp_nepp 6:fb11b746ceb5 1573 * VL53L0X_POWERMODE_IDLE_LEVEL1
sepp_nepp 6:fb11b746ceb5 1574 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1575 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1576 */
sepp_nepp 7:3a1115c2556b 1577 VL53L0X_Error VL53L0X_get_power_mode(
sepp_nepp 6:fb11b746ceb5 1578 VL53L0X_PowerModes *p_power_mode);
sepp_nepp 6:fb11b746ceb5 1579
sepp_nepp 6:fb11b746ceb5 1580 /**
sepp_nepp 6:fb11b746ceb5 1581 * @brief Set the power mode for a given Device
sepp_nepp 6:fb11b746ceb5 1582 * The power mode can be Standby or Idle. Different level of both Standby and
sepp_nepp 6:fb11b746ceb5 1583 * Idle can exists.
sepp_nepp 6:fb11b746ceb5 1584 * This function should not be used when device is in Ranging state.
sepp_nepp 6:fb11b746ceb5 1585 *
sepp_nepp 6:fb11b746ceb5 1586 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1587 *
sepp_nepp 6:fb11b746ceb5 1588 * @param power_mode The value of the power mode to set.
sepp_nepp 6:fb11b746ceb5 1589 * see ::VL53L0X_PowerModes
sepp_nepp 6:fb11b746ceb5 1590 * Valid values are:
sepp_nepp 6:fb11b746ceb5 1591 * VL53L0X_POWERMODE_STANDBY_LEVEL1,
sepp_nepp 6:fb11b746ceb5 1592 * VL53L0X_POWERMODE_IDLE_LEVEL1
sepp_nepp 6:fb11b746ceb5 1593 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1594 * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when PowerMode
sepp_nepp 6:fb11b746ceb5 1595 * is not in the supported list
sepp_nepp 6:fb11b746ceb5 1596 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1597 */
sepp_nepp 8:2fd7cb217068 1598 VL53L0X_Error VL53L0X_set_power_mode(VL53L0X_PowerModes power_mode);
sepp_nepp 6:fb11b746ceb5 1599
sepp_nepp 6:fb11b746ceb5 1600 /**
sepp_nepp 6:fb11b746ceb5 1601 * @brief Retrieves SPAD configuration
sepp_nepp 6:fb11b746ceb5 1602 *
sepp_nepp 6:fb11b746ceb5 1603 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1604 * This function retrieves the current number of applied reference spads
sepp_nepp 6:fb11b746ceb5 1605 * and also their type : Aperture or Non-Aperture.
sepp_nepp 6:fb11b746ceb5 1606 *
sepp_nepp 6:fb11b746ceb5 1607 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1608 *
sepp_nepp 7:3a1115c2556b 1609 *
sepp_nepp 6:fb11b746ceb5 1610 * @param p_spad_count Number ref Spad Count
sepp_nepp 6:fb11b746ceb5 1611 * @param p_is_aperture_spads Reports if spads are of type
sepp_nepp 6:fb11b746ceb5 1612 * aperture or non-aperture.
sepp_nepp 6:fb11b746ceb5 1613 * 1:=aperture, 0:=Non-Aperture
sepp_nepp 6:fb11b746ceb5 1614 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1615 * @return VL53L0X_ERROR_REF_SPAD_INIT Error in the in the reference
sepp_nepp 6:fb11b746ceb5 1616 * spad configuration.
sepp_nepp 6:fb11b746ceb5 1617 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1618 */
sepp_nepp 7:3a1115c2556b 1619 VL53L0X_Error wrapped_VL53L0X_get_reference_spads(
sepp_nepp 6:fb11b746ceb5 1620 uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
sepp_nepp 6:fb11b746ceb5 1621
sepp_nepp 6:fb11b746ceb5 1622 /**
sepp_nepp 6:fb11b746ceb5 1623 * @brief Gets the (on/off) state of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1624 *
sepp_nepp 6:fb11b746ceb5 1625 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1626 * This function retrieves the state of a requested sequence step, i.e. on/off.
sepp_nepp 6:fb11b746ceb5 1627 *
sepp_nepp 6:fb11b746ceb5 1628 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1629 *
sepp_nepp 7:3a1115c2556b 1630 *
sepp_nepp 6:fb11b746ceb5 1631 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1632 * @param p_sequence_step_enabled Out parameter reporting if the sequence step
sepp_nepp 6:fb11b746ceb5 1633 * is enabled {0=Off,1=On}.
sepp_nepp 6:fb11b746ceb5 1634 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1635 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 1636 * supported.
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_get_sequence_step_enable(
sepp_nepp 6:fb11b746ceb5 1640 VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled);
sepp_nepp 6:fb11b746ceb5 1641
sepp_nepp 6:fb11b746ceb5 1642 /**
sepp_nepp 6:fb11b746ceb5 1643 * @brief Gets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1644 *
sepp_nepp 6:fb11b746ceb5 1645 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1646 * This function retrieves the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1647 *
sepp_nepp 6:fb11b746ceb5 1648 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1649 *
sepp_nepp 6:fb11b746ceb5 1650 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1651 * @param p_time_out_milli_secs Timeout value.
sepp_nepp 6:fb11b746ceb5 1652 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1653 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 1654 * supported.
sepp_nepp 6:fb11b746ceb5 1655 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1656 */
sepp_nepp 8:2fd7cb217068 1657 VL53L0X_Error VL53L0X_get_sequence_step_timeout(VL53L0X_SequenceStepId sequence_step_id,
sepp_nepp 6:fb11b746ceb5 1658 FixPoint1616_t *p_time_out_milli_secs);
sepp_nepp 6:fb11b746ceb5 1659
sepp_nepp 6:fb11b746ceb5 1660 /**
sepp_nepp 6:fb11b746ceb5 1661 * @brief Sets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1662 *
sepp_nepp 6:fb11b746ceb5 1663 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1664 * This function sets the timeout of a requested sequence step.
sepp_nepp 6:fb11b746ceb5 1665 *
sepp_nepp 6:fb11b746ceb5 1666 * @note This function Accesses the device
sepp_nepp 6:fb11b746ceb5 1667 *
sepp_nepp 7:3a1115c2556b 1668 *
sepp_nepp 6:fb11b746ceb5 1669 * @param sequence_step_id Sequence step identifier.
sepp_nepp 6:fb11b746ceb5 1670 * @param time_out_milli_secs Demanded timeout
sepp_nepp 6:fb11b746ceb5 1671 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1672 * @return VL53L0X_ERROR_INVALID_PARAMS Error SequenceStepId parameter not
sepp_nepp 6:fb11b746ceb5 1673 * supported.
sepp_nepp 6:fb11b746ceb5 1674 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1675 */
sepp_nepp 7:3a1115c2556b 1676 VL53L0X_Error VL53L0X_set_sequence_step_timeout(
sepp_nepp 6:fb11b746ceb5 1677 VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs);
sepp_nepp 6:fb11b746ceb5 1678
sepp_nepp 6:fb11b746ceb5 1679 /**
sepp_nepp 6:fb11b746ceb5 1680 * @brief Get the tuning settings pointer and the internal external switch
sepp_nepp 6:fb11b746ceb5 1681 * value.
sepp_nepp 6:fb11b746ceb5 1682 *
sepp_nepp 6:fb11b746ceb5 1683 * This function is used to get the Tuning settings buffer pointer and the
sepp_nepp 6:fb11b746ceb5 1684 * value.
sepp_nepp 6:fb11b746ceb5 1685 * of the switch to select either external or internal tuning settings.
sepp_nepp 6:fb11b746ceb5 1686 *
sepp_nepp 6:fb11b746ceb5 1687 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1688 *
sepp_nepp 7:3a1115c2556b 1689 *
sepp_nepp 6:fb11b746ceb5 1690 * @param pp_tuning_setting_buffer Pointer to tuning settings buffer.
sepp_nepp 6:fb11b746ceb5 1691 * @param p_use_internal_tuning_settings Pointer to store Use internal tuning
sepp_nepp 6:fb11b746ceb5 1692 * settings value.
sepp_nepp 6:fb11b746ceb5 1693 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1694 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1695 */
sepp_nepp 7:3a1115c2556b 1696 VL53L0X_Error VL53L0X_get_tuning_setting_buffer(
sepp_nepp 6:fb11b746ceb5 1697 uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings);
sepp_nepp 6:fb11b746ceb5 1698
sepp_nepp 6:fb11b746ceb5 1699 /**
sepp_nepp 6:fb11b746ceb5 1700 * @brief Set the tuning settings pointer
sepp_nepp 6:fb11b746ceb5 1701 *
sepp_nepp 6:fb11b746ceb5 1702 * This function is used to specify the Tuning settings buffer to be used
sepp_nepp 6:fb11b746ceb5 1703 * for a given device. The buffer contains all the necessary data to permit
sepp_nepp 6:fb11b746ceb5 1704 * the API to write tuning settings.
sepp_nepp 6:fb11b746ceb5 1705 * This function permit to force the usage of either external or internal
sepp_nepp 6:fb11b746ceb5 1706 * tuning settings.
sepp_nepp 6:fb11b746ceb5 1707 *
sepp_nepp 6:fb11b746ceb5 1708 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1709 *
sepp_nepp 7:3a1115c2556b 1710 *
sepp_nepp 6:fb11b746ceb5 1711 * @param p_tuning_setting_buffer Pointer to tuning settings buffer.
sepp_nepp 6:fb11b746ceb5 1712 * @param use_internal_tuning_settings Use internal tuning settings value.
sepp_nepp 6:fb11b746ceb5 1713 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1714 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1715 */
sepp_nepp 7:3a1115c2556b 1716 VL53L0X_Error VL53L0X_set_tuning_setting_buffer(
sepp_nepp 6:fb11b746ceb5 1717 uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings);
sepp_nepp 6:fb11b746ceb5 1718
sepp_nepp 6:fb11b746ceb5 1719 /**
sepp_nepp 6:fb11b746ceb5 1720 * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions
sepp_nepp 6:fb11b746ceb5 1721 * @brief PAL Register Access Functions
sepp_nepp 6:fb11b746ceb5 1722 * @{
sepp_nepp 6:fb11b746ceb5 1723 */
sepp_nepp 6:fb11b746ceb5 1724
sepp_nepp 6:fb11b746ceb5 1725 /**
sepp_nepp 6:fb11b746ceb5 1726 * @brief Prepare device for operation
sepp_nepp 6:fb11b746ceb5 1727 * @par Function Description
sepp_nepp 6:fb11b746ceb5 1728 * Update device with provided parameters
sepp_nepp 6:fb11b746ceb5 1729 * @li Then start ranging operation.
sepp_nepp 6:fb11b746ceb5 1730 *
sepp_nepp 6:fb11b746ceb5 1731 * @note This function Access to the device
sepp_nepp 6:fb11b746ceb5 1732 *
sepp_nepp 7:3a1115c2556b 1733 *
sepp_nepp 6:fb11b746ceb5 1734 * @param pDeviceParameters Pointer to store current device parameters.
sepp_nepp 6:fb11b746ceb5 1735 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 6:fb11b746ceb5 1736 * @return "Other error code" See ::VL53L0X_Error
sepp_nepp 6:fb11b746ceb5 1737 */
sepp_nepp 7:3a1115c2556b 1738 VL53L0X_Error vl53L0x_set_device_parameters(
sepp_nepp 6:fb11b746ceb5 1739 const VL53L0X_DeviceParameters_t *pDeviceParameters);
sepp_nepp 6:fb11b746ceb5 1740
sepp_nepp 6:fb11b746ceb5 1741 VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
sepp_nepp 6:fb11b746ceb5 1742
sepp_nepp 6:fb11b746ceb5 1743 int range_meas_int_continuous_mode(void (*fptr)(void));
sepp_nepp 6:fb11b746ceb5 1744
sepp_nepp 6:fb11b746ceb5 1745 /* Digital out pin */
sepp_nepp 6:fb11b746ceb5 1746 DigitalOut *_gpio0;
sepp_nepp 6:fb11b746ceb5 1747 /* Measure detection IRQ */
sepp_nepp 6:fb11b746ceb5 1748 InterruptIn *_gpio1Int;
sepp_nepp 8:2fd7cb217068 1749
sepp_nepp 8:2fd7cb217068 1750 VL53L0X_DevData_t Data;
sepp_nepp 10:cd1758e186a4 1751 VL53L0X_DeviceInfo_t Device_Info;
sepp_nepp 10:cd1758e186a4 1752 VL53L0X_DeviceParameters_t CurrentParameters; /*!< Current Device Parameter */
sepp_nepp 11:d8dbe3b87f9f 1753 VL53L0X_RangingMeasurementData_t LastRangeMeasure; /*!< Last Performed Ranging Data */
sepp_nepp 8:2fd7cb217068 1754
sepp_nepp 10:cd1758e186a4 1755 public:
sepp_nepp 8:2fd7cb217068 1756 /* IO Device */
sepp_nepp 8:2fd7cb217068 1757 I2C *_dev_i2c;
sepp_nepp 7:3a1115c2556b 1758 uint8_t I2cDevAddr; /*!< i2c device address user specific field */
sepp_nepp 7:3a1115c2556b 1759 uint8_t comms_type; /*!< Type of comms : VL53L0X_COMMS_I2C or VL53L0X_COMMS_SPI */
sepp_nepp 7:3a1115c2556b 1760 uint16_t comms_speed_khz; /*!< Comms speed [kHz] : typically 400kHz for I2C */
sepp_nepp 10:cd1758e186a4 1761
sepp_nepp 10:cd1758e186a4 1762 /* Write and read functions from I2C */
sepp_nepp 10:cd1758e186a4 1763 /** Write single byte register
sepp_nepp 10:cd1758e186a4 1764 *
sepp_nepp 10:cd1758e186a4 1765 * @param index The register index
sepp_nepp 10:cd1758e186a4 1766 * @param data 8 bit register data
sepp_nepp 10:cd1758e186a4 1767 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1768 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1769
sepp_nepp 10:cd1758e186a4 1770 VL53L0X_Error VL53L0X_write_byte( uint8_t index, uint8_t data);
sepp_nepp 10:cd1758e186a4 1771 /** Write word register
sepp_nepp 10:cd1758e186a4 1772 *
sepp_nepp 10:cd1758e186a4 1773 * @param index The register index
sepp_nepp 10:cd1758e186a4 1774 * @param data 16 bit register data
sepp_nepp 10:cd1758e186a4 1775 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1776 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1777
sepp_nepp 10:cd1758e186a4 1778 VL53L0X_Error VL53L0X_write_word( uint8_t index, uint16_t data);
sepp_nepp 10:cd1758e186a4 1779 /** Write double word (4 byte) register
sepp_nepp 10:cd1758e186a4 1780 *
sepp_nepp 10:cd1758e186a4 1781 * @param index The register index
sepp_nepp 10:cd1758e186a4 1782 * @param data 32 bit register data
sepp_nepp 10:cd1758e186a4 1783 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1784 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1785
sepp_nepp 10:cd1758e186a4 1786 VL53L0X_Error VL53L0X_write_dword( uint8_t index, uint32_t data);
sepp_nepp 10:cd1758e186a4 1787 /** Read single byte register
sepp_nepp 10:cd1758e186a4 1788 *
sepp_nepp 10:cd1758e186a4 1789 * @param index The register index
sepp_nepp 10:cd1758e186a4 1790 * @param data pointer to 8 bit data
sepp_nepp 10:cd1758e186a4 1791 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1792 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1793
sepp_nepp 10:cd1758e186a4 1794 VL53L0X_Error VL53L0X_read_byte( uint8_t index, uint8_t *p_data);
sepp_nepp 10:cd1758e186a4 1795 /** Read word (2byte) register
sepp_nepp 10:cd1758e186a4 1796 *
sepp_nepp 10:cd1758e186a4 1797 * @param index The register index
sepp_nepp 10:cd1758e186a4 1798 * @param data pointer to 16 bit data
sepp_nepp 10:cd1758e186a4 1799 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1800 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1801
sepp_nepp 10:cd1758e186a4 1802 VL53L0X_Error VL53L0X_read_word( uint8_t index, uint16_t *p_data);
sepp_nepp 10:cd1758e186a4 1803 /** Read dword (4byte) register
sepp_nepp 10:cd1758e186a4 1804 *
sepp_nepp 10:cd1758e186a4 1805 * @param index The register index
sepp_nepp 10:cd1758e186a4 1806 * @param data pointer to 32 bit data
sepp_nepp 10:cd1758e186a4 1807 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1808 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1809 VL53L0X_Error VL53L0X_read_dword( uint8_t index, uint32_t *p_data);
sepp_nepp 10:cd1758e186a4 1810
sepp_nepp 10:cd1758e186a4 1811 /** Thread safe Update (read/modify/write) single byte register
sepp_nepp 10:cd1758e186a4 1812 *
sepp_nepp 10:cd1758e186a4 1813 * Final_reg = (Initial_reg & and_data) |or_data
sepp_nepp 10:cd1758e186a4 1814 *
sepp_nepp 10:cd1758e186a4 1815 * @param index The register index
sepp_nepp 10:cd1758e186a4 1816 * @param and_data 8 bit and data
sepp_nepp 10:cd1758e186a4 1817 * @param or_data 8 bit or data
sepp_nepp 10:cd1758e186a4 1818 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1819 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1820 VL53L0X_Error VL53L0X_update_byte( uint8_t index, uint8_t and_data, uint8_t or_data);
sepp_nepp 10:cd1758e186a4 1821
sepp_nepp 10:cd1758e186a4 1822 /** Reads the requested number of bytes from the device
sepp_nepp 10:cd1758e186a4 1823 *
sepp_nepp 10:cd1758e186a4 1824 * @param index The register index
sepp_nepp 10:cd1758e186a4 1825 * @param p_data Pointer to the uint8_t buffer to store read data
sepp_nepp 10:cd1758e186a4 1826 * @param count Number of uint8_t's to read
sepp_nepp 10:cd1758e186a4 1827 * @return VL53L0X_ERROR_NONE Success
sepp_nepp 10:cd1758e186a4 1828 * @return "Other error code" See ::VL53L0X_Error */
sepp_nepp 10:cd1758e186a4 1829 VL53L0X_Error VL53L0X_read_multi( uint8_t index, uint8_t *p_data, uint32_t count);
sepp_nepp 10:cd1758e186a4 1830
sepp_nepp 10:cd1758e186a4 1831 /** @brief Writes a buffer towards the I2C peripheral device.
sepp_nepp 8:2fd7cb217068 1832 *
sepp_nepp 8:2fd7cb217068 1833 * @param p_data pointer to the byte-array data to send
sepp_nepp 8:2fd7cb217068 1834 * @param number_of_bytes number of bytes to be written.
sepp_nepp 6:fb11b746ceb5 1835 * @retval 0 if ok,
sepp_nepp 6:fb11b746ceb5 1836 * @retval -1 if an I2C error has occured
sepp_nepp 6:fb11b746ceb5 1837 * @note On some devices if NumByteToWrite is greater
sepp_nepp 10:cd1758e186a4 1838 * than one, the RegisterAddr must be masked correctly! */
sepp_nepp 8:2fd7cb217068 1839 VL53L0X_Error VL53L0X_i2c_write(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
sepp_nepp 8:2fd7cb217068 1840
sepp_nepp 10:cd1758e186a4 1841 /** @brief Reads a buffer from the I2C peripheral device.
sepp_nepp 8:2fd7cb217068 1842 *
sepp_nepp 8:2fd7cb217068 1843 * @param p_data pointer to the byte-array to read data in to
sepp_nepp 8:2fd7cb217068 1844 * @param number_of_bytes number of bytes to be read.
sepp_nepp 8:2fd7cb217068 1845 * @retval 0 if ok,
sepp_nepp 8:2fd7cb217068 1846 * @retval -1 if an I2C error has occured
sepp_nepp 8:2fd7cb217068 1847 * @note On some devices if NumByteToWrite is greater
sepp_nepp 10:cd1758e186a4 1848 * than one, the RegisterAddr must be masked correctly! */
sepp_nepp 8:2fd7cb217068 1849 VL53L0X_Error VL53L0X_i2c_read(uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
sepp_nepp 6:fb11b746ceb5 1850 };
sepp_nepp 6:fb11b746ceb5 1851
sepp_nepp 6:fb11b746ceb5 1852 #endif /* _VL53L0X_CLASS_H_ */