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