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

Committer:
sepp_nepp
Date:
Sat Jul 20 08:48:49 2019 +0000
Revision:
13:253cb4ea3fcc
Parent:
12:81f37e50f8f8
Proven to work with TOF-Synth-III

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