Kenji Arai / VL53L0X_simple

Dependents:   Check_VL53L0X_simple_with_three_ToF Check_VL53L0X_simple_ToF_Sensor Check_VL53L0X_simple_with_three_ToF Check_VL53L0X_simple_ToF_Sensor ... more

Fork of VL53L0X by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers VL53L0X_3rd.h Source File

VL53L0X_3rd.h

00001 
00002     /* api.h functions */
00003 
00004     /**
00005      * @brief Wait for device booted after chip enable (hardware standby)
00006      * This function can be run only when VL53L0X_State is VL53L0X_STATE_POWERDOWN.
00007      *
00008      * @note This function is not Implemented
00009      *
00010      * @param   dev      Device Handle
00011      * @return  VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
00012      *
00013      */
00014     VL53L0X_Error VL53L0X_wait_device_booted(VL53L0X_DEV dev);
00015 
00016 
00017     VL53L0X_Error sequence_step_enabled(VL53L0X_DEV dev,
00018                                         VL53L0X_SequenceStepId sequence_step_id, uint8_t sequence_config,
00019                                         uint8_t *p_sequence_step_enabled);
00020 
00021     VL53L0X_Error VL53L0X_check_and_load_interrupt_settings(VL53L0X_DEV dev,
00022             uint8_t start_not_stopflag);
00023 
00024 
00025     /* api_core.h functions */
00026 
00027     VL53L0X_Error VL53L0X_get_info_from_device(VL53L0X_DEV dev, uint8_t option);
00028 
00029     VL53L0X_Error VL53L0X_device_read_strobe(VL53L0X_DEV dev);
00030 
00031     VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
00032             uint32_t *p_measurement_timing_budget_micro_seconds);
00033 
00034     VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period(VL53L0X_DEV dev,
00035             VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk);
00036 
00037     uint8_t VL53L0X_decode_vcsel_period(uint8_t vcsel_period_reg);
00038 
00039     uint32_t VL53L0X_decode_timeout(uint16_t encoded_timeout);
00040 
00041     uint32_t VL53L0X_calc_timeout_us(VL53L0X_DEV dev,
00042                                      uint16_t timeout_period_mclks,
00043                                      uint8_t vcsel_period_pclks);
00044 
00045     uint32_t VL53L0X_calc_macro_period_ps(VL53L0X_DEV dev, uint8_t vcsel_period_pclks);
00046 
00047     VL53L0X_Error VL53L0X_measurement_poll_for_completion(VL53L0X_DEV dev);
00048 
00049     VL53L0X_Error VL53L0X_load_tuning_settings(VL53L0X_DEV dev,
00050             uint8_t *p_tuning_setting_buffer);
00051 
00052     VL53L0X_Error VL53L0X_get_pal_range_status(VL53L0X_DEV dev,
00053             uint8_t device_range_status,
00054             FixPoint1616_t signal_rate,
00055             uint16_t effective_spad_rtn_count,
00056             VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
00057             uint8_t *p_pal_range_status);
00058     VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV dev,
00059             VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data,
00060             FixPoint1616_t *p_sigma_estimate,
00061             uint32_t *p_dmax_mm);
00062     uint32_t VL53L0X_calc_timeout_mclks(VL53L0X_DEV dev,
00063                                         uint32_t timeout_period_us,
00064                                         uint8_t vcsel_period_pclks);
00065     uint32_t VL53L0X_isqrt(uint32_t num);
00066 
00067     uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b);
00068 
00069     VL53L0X_Error VL53L0X_calc_dmax(
00070         VL53L0X_DEV dev,
00071         FixPoint1616_t total_signal_rate_mcps,
00072         FixPoint1616_t total_corr_signal_rate_mcps,
00073         FixPoint1616_t pw_mult,
00074         uint32_t sigma_estimate_p1,
00075         FixPoint1616_t sigma_estimate_p2,
00076         uint32_t peak_vcsel_duration_us,
00077         uint32_t *pd_max_mm);
00078     VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds(VL53L0X_DEV dev,
00079             uint32_t measurement_timing_budget_micro_seconds);
00080     VL53L0X_Error get_sequence_step_timeout(VL53L0X_DEV dev,
00081                                             VL53L0X_SequenceStepId sequence_step_id,
00082                                             uint32_t *p_time_out_micro_secs);
00083     VL53L0X_Error set_sequence_step_timeout(VL53L0X_DEV dev,
00084                                             VL53L0X_SequenceStepId sequence_step_id,
00085                                             uint32_t timeout_micro_secs);
00086     uint16_t VL53L0X_encode_timeout (uint32_t timeout_macro_clks);
00087     VL53L0X_Error wrapped_VL53L0X_set_vcsel_pulse_period(VL53L0X_DEV dev,
00088             VL53L0X_VcselPeriod vcsel_period_type, uint8_t vcsel_pulse_period_pclk);
00089     uint8_t lv53l0x_encode_vcsel_period(uint8_t vcsel_period_pclks);
00090 
00091     /* api_calibration.h functions */
00092     VL53L0X_Error VL53L0X_apply_offset_adjustment(VL53L0X_DEV dev);
00093     VL53L0X_Error wrapped_VL53L0X_get_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
00094             int32_t *p_offset_calibration_data_micro_meter);
00095     VL53L0X_Error wrapped_VL53L0X_set_offset_calibration_data_micro_meter(VL53L0X_DEV dev,
00096             int32_t offset_calibration_data_micro_meter);
00097     VL53L0X_Error wrapped_VL53L0X_perform_ref_spad_management(VL53L0X_DEV dev,
00098             uint32_t *ref_spad_count,
00099             uint8_t *is_aperture_spads);
00100     VL53L0X_Error VL53L0X_perform_ref_calibration(VL53L0X_DEV dev,
00101             uint8_t *p_vhv_settings, uint8_t *p_phase_cal, uint8_t get_data_enable);
00102     VL53L0X_Error VL53L0X_perform_vhv_calibration(VL53L0X_DEV dev,
00103             uint8_t *p_vhv_settings, const uint8_t get_data_enable,
00104             const uint8_t restore_config);
00105     VL53L0X_Error VL53L0X_perform_single_ref_calibration(VL53L0X_DEV dev,
00106             uint8_t vhv_init_byte);
00107     VL53L0X_Error VL53L0X_ref_calibration_io(VL53L0X_DEV dev, uint8_t read_not_write,
00108             uint8_t vhv_settings, uint8_t phase_cal,
00109             uint8_t *p_vhv_settings, uint8_t *p_phase_cal,
00110             const uint8_t vhv_enable, const uint8_t phase_enable);
00111     VL53L0X_Error VL53L0X_perform_phase_calibration(VL53L0X_DEV dev,
00112             uint8_t *p_phase_cal, const uint8_t get_data_enable,
00113             const uint8_t restore_config);
00114     VL53L0X_Error enable_ref_spads(VL53L0X_DEV dev,
00115                                    uint8_t aperture_spads,
00116                                    uint8_t good_spad_array[],
00117                                    uint8_t spad_array[],
00118                                    uint32_t size,
00119                                    uint32_t start,
00120                                    uint32_t offset,
00121                                    uint32_t spad_count,
00122                                    uint32_t *p_last_spad);
00123     void get_next_good_spad(uint8_t good_spad_array[], uint32_t size,
00124                             uint32_t curr, int32_t *p_next);
00125     uint8_t is_aperture(uint32_t spad_index);
00126     VL53L0X_Error enable_spad_bit(uint8_t spad_array[], uint32_t size,
00127                                   uint32_t spad_index);
00128     VL53L0X_Error set_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
00129     VL53L0X_Error get_ref_spad_map(VL53L0X_DEV dev, uint8_t *p_ref_spad_array);
00130     VL53L0X_Error perform_ref_signal_measurement(VL53L0X_DEV dev,
00131             uint16_t *p_ref_signal_rate);
00132     VL53L0X_Error wrapped_VL53L0X_set_reference_spads(VL53L0X_DEV dev,
00133             uint32_t count, uint8_t is_aperture_spads);
00134 
00135     /* api_strings.h functions */
00136     VL53L0X_Error wrapped_VL53L0X_get_device_info(VL53L0X_DEV dev,
00137             VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
00138     VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV dev,
00139                                           uint8_t *revision,
00140                                           VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
00141 
00142     /* Read function of the ID device */
00143     //   virtual int read_id();
00144     virtual int read_id(uint8_t *id);
00145 
00146     VL53L0X_Error wait_measurement_data_ready(VL53L0X_DEV dev);
00147 
00148     VL53L0X_Error wait_stop_completed(VL53L0X_DEV dev);
00149 
00150     /* Write and read functions from I2C */
00151     /**
00152      * Write single byte register
00153      * @param   dev       Device Handle
00154      * @param   index     The register index
00155      * @param   data      8 bit register data
00156      * @return  VL53L0X_ERROR_NONE        Success
00157      * @return  "Other error code"    See ::VL53L0X_Error
00158      */
00159     VL53L0X_Error VL53L0X_write_byte(VL53L0X_DEV dev, uint8_t index, uint8_t data);
00160     /**
00161      * Write word register
00162      * @param   dev       Device Handle
00163      * @param   index     The register index
00164      * @param   data      16 bit register data
00165      * @return  VL53L0X_ERROR_NONE        Success
00166      * @return  "Other error code"    See ::VL53L0X_Error
00167      */
00168     VL53L0X_Error VL53L0X_write_word(VL53L0X_DEV dev, uint8_t index, uint16_t data);
00169     /**
00170      * Write double word (4 byte) register
00171      * @param   dev       Device Handle
00172      * @param   index     The register index
00173      * @param   data      32 bit register data
00174      * @return  VL53L0X_ERROR_NONE        Success
00175      * @return  "Other error code"    See ::VL53L0X_Error
00176      */
00177     VL53L0X_Error VL53L0X_write_dword(VL53L0X_DEV dev, uint8_t index, uint32_t data);
00178     /**
00179      * Read single byte register
00180      * @param   dev       Device Handle
00181      * @param   index     The register index
00182      * @param   data      pointer to 8 bit data
00183      * @return  VL53L0X_ERROR_NONE        Success
00184      * @return  "Other error code"    See ::VL53L0X_Error
00185      */
00186     VL53L0X_Error VL53L0X_read_byte(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data);
00187     /**
00188      * Read word (2byte) register
00189      * @param   dev       Device Handle
00190      * @param   index     The register index
00191      * @param   data      pointer to 16 bit data
00192      * @return  VL53L0X_ERROR_NONE        Success
00193      * @return  "Other error code"    See ::VL53L0X_Error
00194      */
00195     VL53L0X_Error VL53L0X_read_word(VL53L0X_DEV dev, uint8_t index, uint16_t *p_data);
00196     /**
00197      * Read dword (4byte) register
00198      * @param   dev       Device Handle
00199      * @param   index     The register index
00200      * @param   data      pointer to 32 bit data
00201      * @return  VL53L0X_ERROR_NONE        Success
00202      * @return  "Other error code"    See ::VL53L0X_Error
00203      */
00204     VL53L0X_Error VL53L0X_read_dword(VL53L0X_DEV dev, uint8_t index, uint32_t *p_data);
00205     /**
00206      * Threat safe Update (read/modify/write) single byte register
00207      *
00208      * Final_reg = (Initial_reg & and_data) |or_data
00209      *
00210      * @param   dev        Device Handle
00211      * @param   index      The register index
00212      * @param   and_data    8 bit and data
00213      * @param   or_data     8 bit or data
00214      * @return  VL53L0X_ERROR_NONE        Success
00215      * @return  "Other error code"    See ::VL53L0X_Error
00216      */
00217     VL53L0X_Error VL53L0X_update_byte(VL53L0X_DEV dev, uint8_t index, uint8_t and_data, uint8_t or_data);
00218     /**
00219      * Writes the supplied byte buffer to the device
00220      * @param   dev       Device Handle
00221      * @param   index     The register index
00222      * @param   p_data     Pointer to uint8_t buffer containing the data to be written
00223      * @param   count     Number of bytes in the supplied byte buffer
00224      * @return  VL53L0X_ERROR_NONE        Success
00225      * @return  "Other error code"    See ::VL53L0X_Error
00226      */
00227     VL53L0X_Error VL53L0X_write_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
00228     /**
00229      * Reads the requested number of bytes from the device
00230      * @param   dev       Device Handle
00231      * @param   index     The register index
00232      * @param   p_data     Pointer to the uint8_t buffer to store read data
00233      * @param   count     Number of uint8_t's to read
00234      * @return  VL53L0X_ERROR_NONE        Success
00235      * @return  "Other error code"    See ::VL53L0X_Error
00236      */
00237     VL53L0X_Error VL53L0X_read_multi(VL53L0X_DEV dev, uint8_t index, uint8_t *p_data, uint32_t count);
00238 
00239     /**
00240      * @brief  Writes a buffer towards the I2C peripheral device.
00241      * @param  dev       Device Handle
00242      * @param  p_data pointer to the byte-array data to send
00243      * @param  number_of_bytes number of bytes to be written.
00244      * @retval 0 if ok,
00245      * @retval -1 if an I2C error has occured
00246      * @note   On some devices if NumByteToWrite is greater
00247      *         than one, the RegisterAddr must be masked correctly!
00248      */
00249     VL53L0X_Error VL53L0X_i2c_write(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
00250 
00251     /**
00252      * @brief  Reads a buffer from the I2C peripheral device.
00253      * @param  dev       Device Handle
00254      * @param  p_data pointer to the byte-array to read data in to
00255      * @param  number_of_bytes number of bytes to be read.
00256      * @retval 0 if ok,
00257      * @retval -1 if an I2C error has occured
00258      * @note   On some devices if NumByteToWrite is greater
00259      *         than one, the RegisterAddr must be masked correctly!
00260      */
00261     VL53L0X_Error VL53L0X_i2c_read(uint8_t dev, uint8_t index, uint8_t *p_data, uint16_t number_of_bytes);
00262 
00263     /**
00264      * @brief execute delay in all polling API call
00265      *
00266      * A typical multi-thread or RTOs implementation is to sleep the task for some 5ms (with 100Hz max rate faster polling is not needed)
00267      * if nothing specific is need you can define it as an empty/void macro
00268      * @code
00269      * #define VL53L0X_PollingDelay(...) (void)0
00270      * @endcode
00271      * @param dev       Device Handle
00272      * @return  VL53L0X_ERROR_NONE        Success
00273      * @return  "Other error code"    See ::VL53L0X_Error
00274      */
00275     VL53L0X_Error VL53L0X_polling_delay(VL53L0X_DEV dev);   /* usually best implemented as a real function */
00276 
00277     int is_present()
00278     {
00279         int status;
00280         uint8_t id = 0;
00281 
00282         status = read_id(&id);
00283         if (status) {
00284             VL53L0X_ErrLog("Failed to read ID device. Device not present!\n\r");
00285         }
00286         return status;
00287     }
00288 
00289     ///////////////////////////////////////////////////////////////////////////////////////////////////////
00290     //Added functions                                                                                    //
00291     ///////////////////////////////////////////////////////////////////////////////////////////////////////
00292 
00293     /**
00294      * @brief  Cycle Power to Device
00295      *
00296      * @return status - status 0 = ok, 1 = error
00297      *
00298      */
00299     int32_t VL53L0X_cycle_power(void);
00300 
00301     uint8_t VL53L0X_encode_vcsel_period(uint8_t vcsel_period_pclks);
00302 
00303     VL53L0X_Error wrapped_VL53L0X_get_device_error_string(VL53L0X_DeviceError error_code,
00304             char *p_device_error_string);
00305 
00306     VL53L0X_Error wrapped_VL53L0X_get_limit_check_info(VL53L0X_DEV dev, uint16_t limit_check_id,
00307             char *p_limit_check_string);
00308 
00309     VL53L0X_Error wrapped_VL53L0X_get_pal_error_string(VL53L0X_Error pal_error_code,
00310             char *p_pal_error_string);
00311 
00312     VL53L0X_Error wrapped_VL53L0X_get_pal_state_string(VL53L0X_State pal_state_code,
00313             char *p_pal_state_string);
00314 
00315     VL53L0X_Error wrapped_VL53L0X_get_range_status_string(uint8_t range_status,
00316             char *p_range_status_string);
00317 
00318     VL53L0X_Error wrapped_VL53L0X_get_ref_calibration(VL53L0X_DEV dev,
00319             uint8_t *p_vhv_settings, uint8_t *p_phase_cal);
00320 
00321 
00322     VL53L0X_Error count_enabled_spads(uint8_t spad_array[],
00323                                       uint32_t byte_count, uint32_t max_spads,
00324                                       uint32_t *p_total_spads_enabled, uint8_t *p_is_aperture);
00325 
00326     VL53L0X_Error wrapped_VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
00327             char *p_sequence_steps_string);
00328 
00329 
00330     /**
00331      * @brief Gets the name of a given sequence step.
00332      *
00333      * @par Function Description
00334      * This function retrieves the name of sequence steps corresponding to
00335      * SequenceStepId.
00336      *
00337      * @note This function doesn't Accesses the device
00338      *
00339      * @param   sequence_step_id               Sequence step identifier.
00340      * @param   p_sequence_steps_string         Pointer to Info string
00341      *
00342      * @return  VL53L0X_ERROR_NONE            Success
00343      * @return  "Other error code"           See ::VL53L0X_Error
00344      */
00345     VL53L0X_Error VL53L0X_get_sequence_steps_info(VL53L0X_SequenceStepId sequence_step_id,
00346             char *p_sequence_steps_string);
00347 
00348     /**
00349     * @brief Get the frequency of the timer used for ranging results time stamps
00350     *
00351     * @param[out] p_timer_freq_hz : pointer for timer frequency
00352     *
00353     * @return status : 0 = ok, 1 = error
00354     *
00355     */
00356     int32_t VL53L0X_get_timer_frequency(int32_t *p_timer_freq_hz);
00357 
00358     /**
00359     * @brief Get the timer value in units of timer_freq_hz (see VL53L0X_get_timestamp_frequency())
00360     *
00361     * @param[out] p_timer_count : pointer for timer count value
00362     *
00363     * @return status : 0 = ok, 1 = error
00364     *
00365     */
00366     int32_t VL53L0X_get_timer_value(int32_t *p_timer_count);
00367 
00368     /**
00369     * @brief Configure ranging interrupt reported to system
00370     *
00371     * @note This function is not Implemented
00372     *
00373     * @param   dev                  Device Handle
00374     * @param   interrupt_mask         Mask of interrupt to Enable/disable
00375     *  (0:interrupt disabled or 1: interrupt enabled)
00376     * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
00377     */
00378     VL53L0X_Error VL53L0X_enable_interrupt_mask(VL53L0X_DEV dev,
00379             uint32_t interrupt_mask);
00380 
00381     /**
00382      * @brief  Get Dmax Calibration Parameters for a given device
00383      *
00384      *
00385      * @note This function Access to the device
00386      *
00387      * @param   dev                     Device Handle
00388      * @param   p_range_milli_meter        Pointer to Calibration Distance
00389      * @param   p_signal_rate_rtn_mega_cps   Pointer to Signal rate return
00390      * @return  VL53L0X_ERROR_NONE       Success
00391      * @return  "Other error code"      See ::VL53L0X_Error
00392      */
00393     VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev,
00394             uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps);
00395 
00396     /**
00397     * @brief   Set Dmax Calibration Parameters for a given device
00398     * When one of the parameter is zero, this function will get parameter
00399     * from NVM.
00400     * @note This function doesn't Access to the device
00401     *
00402     * @param   dev                    Device Handle
00403     * @param   range_milli_meter        Calibration Distance
00404     * @param   signal_rate_rtn_mega_cps   Signal rate return read at CalDistance
00405     * @return  VL53L0X_ERROR_NONE      Success
00406     * @return  "Other error code"     See ::VL53L0X_Error
00407     */
00408     VL53L0X_Error VL53L0X_get_dmax_cal_parameters(VL53L0X_DEV dev,
00409             uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps);
00410 
00411     /**
00412     * @brief Retrieve the measurements from device for a given setup
00413     *
00414     * @par Function Description
00415     * Get data from last successful Histogram measurement
00416     * @warning USER should take care about  @a VL53L0X_GetNumberOfROIZones()
00417     * before get data.
00418     * PAL will fill a NumberOfROIZones times the corresponding data structure
00419     * used in the measurement function.
00420     *
00421     * @note This function is not Implemented
00422     *
00423     * @param   dev                         Device Handle
00424     * @param   p_histogram_measurement_data   Pointer to the histogram data structure.
00425     * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
00426     */
00427     VL53L0X_Error VL53L0X_get_histogram_measurement_data(VL53L0X_DEV dev,
00428             VL53L0X_HistogramMeasurementData_t *p_histogram_measurement_data);
00429 
00430     /**
00431     * @brief  Get current new device mode
00432     * @par Function Description
00433     * Get current Histogram mode of a Device
00434     *
00435     * @note This function doesn't Access to the device
00436     *
00437     * @param   dev                   Device Handle
00438     * @param   p_histogram_mode        Pointer to current Histogram Mode value
00439     *                                Valid values are:
00440     *                                VL53L0X_HISTOGRAMMODE_DISABLED
00441     *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
00442     *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
00443     *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
00444     *                                VL53L0X_HISTOGRAMMODE_BOTH
00445     * @return  VL53L0X_ERROR_NONE     Success
00446     * @return  "Other error code"    See ::VL53L0X_Error
00447     */
00448     VL53L0X_Error VL53L0X_get_histogram_mode(VL53L0X_DEV dev,
00449             VL53L0X_HistogramModes *p_histogram_mode);
00450 
00451     /**
00452      * @brief  Set a new Histogram mode
00453      * @par Function Description
00454      * Set device to a new Histogram mode
00455      *
00456      * @note This function doesn't Access to the device
00457      *
00458      * @param   dev                   Device Handle
00459      * @param   histogram_mode         New device mode to apply
00460      *                                Valid values are:
00461      *                                VL53L0X_HISTOGRAMMODE_DISABLED
00462      *                                VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM
00463      *                                VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY
00464      *                                VL53L0X_HISTOGRAMMODE_RETURN_ONLY
00465      *                                VL53L0X_HISTOGRAMMODE_BOTH
00466      *
00467      * @return  VL53L0X_ERROR_NONE                   Success
00468      * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED     This error occurs when
00469      * HistogramMode is not in the supported list
00470      * @return  "Other error code"    See ::VL53L0X_Error
00471      */
00472     VL53L0X_Error VL53L0X_set_histogram_mode(VL53L0X_DEV dev,
00473             VL53L0X_HistogramModes histogram_mode);
00474 
00475     /**
00476      * @brief  Return a description string for a given limit check number
00477      *
00478      * @par Function Description
00479      * This function returns a description string for a given limit check number.
00480      * The limit check is identified with the LimitCheckId.
00481      *
00482      * @note This function doesn't Access to the device
00483      *
00484      * @param   dev                           Device Handle
00485      * @param   limit_check_id                  Limit Check ID
00486      (0<= LimitCheckId < VL53L0X_GetNumberOfLimitCheck() ).
00487      * @param   p_limit_check_string             Pointer to the
00488      description string of the given check limit.
00489      * @return  VL53L0X_ERROR_NONE             Success
00490      * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is
00491      returned when LimitCheckId value is out of range.
00492      * @return  "Other error code"            See ::VL53L0X_Error
00493      */
00494     VL53L0X_Error VL53L0X_get_limit_check_info(VL53L0X_DEV dev,
00495             uint16_t limit_check_id, char *p_limit_check_string);
00496 
00497     /**
00498      * @brief Get the linearity corrective gain
00499      *
00500      * @par Function Description
00501      * Should only be used after a successful call to @a VL53L0X_DataInit to backup
00502      * device NVM value
00503      *
00504      * @note This function Access to the device
00505      *
00506      * @param   dev                                Device Handle
00507      * @param   p_linearity_corrective_gain           Pointer to the linearity
00508      * corrective gain in x1000
00509      * if value is 1000 then no modification is applied.
00510      * @return  VL53L0X_ERROR_NONE                  Success
00511      * @return  "Other error code"                 See ::VL53L0X_Error
00512      */
00513     VL53L0X_Error VL53L0X_get_linearity_corrective_gain(VL53L0X_DEV dev,
00514             uint16_t *p_linearity_corrective_gain);
00515 
00516     /**
00517      * Set the linearity corrective gain
00518      *
00519      * @note This function Access to the device
00520      *
00521      * @param   dev                                Device Handle
00522      * @param   linearity_corrective_gain            Linearity corrective
00523      * gain in x1000
00524      * if value is 1000 then no modification is applied.
00525      * @return  VL53L0X_ERROR_NONE                  Success
00526      * @return  "Other error code"                 See ::VL53L0X_Error
00527      */
00528     VL53L0X_Error VL53L0X_set_linearity_corrective_gain(VL53L0X_DEV dev,
00529             int16_t linearity_corrective_gain);
00530 
00531     /**
00532      * @brief Get the Maximum number of ROI Zones managed by the Device
00533      *
00534      * @par Function Description
00535      * Get Maximum number of ROI Zones managed by the Device.
00536      *
00537      * @note This function doesn't Access to the device
00538      *
00539      * @param   dev                    Device Handle
00540      * @param   p_max_number_of_roi_zones   Pointer to the Maximum Number
00541      *  of ROI Zones value.
00542      * @return  VL53L0X_ERROR_NONE      Success
00543      */
00544     VL53L0X_Error VL53L0X_get_max_number_of_roi_zones(VL53L0X_DEV dev,
00545             uint8_t *p_max_number_of_roi_zones);
00546 
00547     /**
00548      * @brief Retrieve the Reference Signal after a measurements
00549      *
00550      * @par Function Description
00551      * Get Reference Signal from last successful Ranging measurement
00552      * This function return a valid value after that you call the
00553      * @a VL53L0X_GetRangingMeasurementData().
00554      *
00555      * @note This function Access to the device
00556      *
00557      * @param   dev                      Device Handle
00558      * @param   p_measurement_ref_signal    Pointer to the Ref Signal to fill up.
00559      * @return  VL53L0X_ERROR_NONE        Success
00560      * @return  "Other error code"       See ::VL53L0X_Error
00561      */
00562     VL53L0X_Error VL53L0X_get_measurement_ref_signal(VL53L0X_DEV dev,
00563             FixPoint1616_t *p_measurement_ref_signal);
00564 
00565     /**
00566      * @brief  Get the number of the check limit managed by a given Device
00567      *
00568      * @par Function Description
00569      * This function give the number of the check limit managed by the Device
00570      *
00571      * @note This function doesn't Access to the device
00572      *
00573      * @param   p_number_of_limit_check           Pointer to the number of check limit.
00574      * @return  VL53L0X_ERROR_NONE             Success
00575      * @return  "Other error code"            See ::VL53L0X_Error
00576      */
00577     VL53L0X_Error VL53L0X_get_number_of_limit_check(
00578         uint16_t *p_number_of_limit_check);
00579 
00580     /**
00581      * @brief Get the number of ROI Zones managed by the Device
00582      *
00583      * @par Function Description
00584      * Get number of ROI Zones managed by the Device
00585      * USER should take care about  @a VL53L0X_GetNumberOfROIZones()
00586      * before get data after a perform measurement.
00587      * PAL will fill a NumberOfROIZones times the corresponding data
00588      * structure used in the measurement function.
00589      *
00590      * @note This function doesn't Access to the device
00591      *
00592      * @param   dev                   Device Handle
00593      * @param   p_number_of_roi_zones     Pointer to the Number of ROI Zones value.
00594      * @return  VL53L0X_ERROR_NONE     Success
00595      */
00596     VL53L0X_Error VL53L0X_get_number_of_roi_zones(VL53L0X_DEV dev,
00597             uint8_t *p_number_of_roi_zones);
00598 
00599     /**
00600      * @brief Set the number of ROI Zones to be used for a specific Device
00601      *
00602      * @par Function Description
00603      * Set the number of ROI Zones to be used for a specific Device.
00604      * The programmed value should be less than the max number of ROI Zones given
00605      * with @a VL53L0X_GetMaxNumberOfROIZones().
00606      * This version of API manage only one zone.
00607      *
00608      * @param   dev                           Device Handle
00609      * @param   number_of_roi_zones              Number of ROI Zones to be used for a
00610      *  specific Device.
00611      * @return  VL53L0X_ERROR_NONE             Success
00612      * @return  VL53L0X_ERROR_INVALID_PARAMS   This error is returned if
00613      * NumberOfROIZones != 1
00614      */
00615     VL53L0X_Error VL53L0X_set_number_of_roi_zones(VL53L0X_DEV dev,
00616             uint8_t number_of_roi_zones);
00617 
00618     /**
00619      * @brief Gets number of sequence steps managed by the API.
00620      *
00621      * @par Function Description
00622      * This function retrieves the number of sequence steps currently managed
00623      * by the API
00624      *
00625      * @note This function Accesses the device
00626      *
00627      * @param   dev                          Device Handle
00628      * @param   p_number_of_sequence_steps       Out parameter reporting the number of
00629      *                                       sequence steps.
00630      * @return  VL53L0X_ERROR_NONE            Success
00631      * @return  "Other error code"           See ::VL53L0X_Error
00632      */
00633     VL53L0X_Error VL53L0X_get_number_of_sequence_steps(VL53L0X_DEV dev,
00634             uint8_t *p_number_of_sequence_steps);
00635     /**
00636      * @brief Get the power mode for a given Device
00637      *
00638      * @note This function Access to the device
00639      *
00640      * @param   dev                   Device Handle
00641      * @param   p_power_mode            Pointer to the current value of the power
00642      * mode. see ::VL53L0X_PowerModes
00643      *                                Valid values are:
00644      *                                VL53L0X_POWERMODE_STANDBY_LEVEL1,
00645      *                                VL53L0X_POWERMODE_IDLE_LEVEL1
00646      * @return  VL53L0X_ERROR_NONE     Success
00647      * @return  "Other error code"    See ::VL53L0X_Error
00648      */
00649     VL53L0X_Error VL53L0X_get_power_mode(VL53L0X_DEV dev,
00650                                          VL53L0X_PowerModes *p_power_mode);
00651 
00652     /**
00653      * @brief Set the power mode for a given Device
00654      * The power mode can be Standby or Idle. Different level of both Standby and
00655      * Idle can exists.
00656      * This function should not be used when device is in Ranging state.
00657      *
00658      * @note This function Access to the device
00659      *
00660      * @param   dev                   Device Handle
00661      * @param   power_mode             The value of the power mode to set.
00662      * see ::VL53L0X_PowerModes
00663      *                                Valid values are:
00664      *                                VL53L0X_POWERMODE_STANDBY_LEVEL1,
00665      *                                VL53L0X_POWERMODE_IDLE_LEVEL1
00666      * @return  VL53L0X_ERROR_NONE                  Success
00667      * @return  VL53L0X_ERROR_MODE_NOT_SUPPORTED    This error occurs when PowerMode
00668      * is not in the supported list
00669      * @return  "Other error code"    See ::VL53L0X_Error
00670      */
00671     VL53L0X_Error VL53L0X_set_power_mode(VL53L0X_DEV dev,
00672                                          VL53L0X_PowerModes power_mode);
00673 
00674     /**
00675      * @brief Retrieves SPAD configuration
00676      *
00677      * @par Function Description
00678      * This function retrieves the current number of applied reference spads
00679      * and also their type : Aperture or Non-Aperture.
00680      *
00681      * @note This function Access to the device
00682      *
00683      * @param   dev                          Device Handle
00684      * @param   p_spad_count                 Number ref Spad Count
00685      * @param   p_is_aperture_spads              Reports if spads are of type
00686      *                                       aperture or non-aperture.
00687      *                                       1:=aperture, 0:=Non-Aperture
00688      * @return  VL53L0X_ERROR_NONE            Success
00689      * @return  VL53L0X_ERROR_REF_SPAD_INIT   Error in the in the reference
00690      *                                       spad configuration.
00691      * @return  "Other error code"           See ::VL53L0X_Error
00692      */
00693     VL53L0X_Error wrapped_VL53L0X_get_reference_spads(VL53L0X_DEV dev,
00694             uint32_t *p_spad_count, uint8_t *p_is_aperture_spads);
00695 
00696     /**
00697      * @brief Gets the (on/off) state of a requested sequence step.
00698      *
00699      * @par Function Description
00700      * This function retrieves the state of a requested sequence step, i.e. on/off.
00701      *
00702      * @note This function Accesses the device
00703      *
00704      * @param   dev                    Device Handle
00705      * @param   sequence_step_id         Sequence step identifier.
00706      * @param   p_sequence_step_enabled   Out parameter reporting if the sequence step
00707      *                                 is enabled {0=Off,1=On}.
00708      * @return  VL53L0X_ERROR_NONE            Success
00709      * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
00710      *                                       supported.
00711      * @return  "Other error code"           See ::VL53L0X_Error
00712      */
00713     VL53L0X_Error VL53L0X_get_sequence_step_enable(VL53L0X_DEV dev,
00714             VL53L0X_SequenceStepId sequence_step_id, uint8_t *p_sequence_step_enabled);
00715 
00716 
00717     /**
00718      * @brief Gets the timeout of a requested sequence step.
00719      *
00720      * @par Function Description
00721      * This function retrieves the timeout of a requested sequence step.
00722      *
00723      * @note This function Accesses the device
00724      *
00725      * @param   dev                          Device Handle
00726      * @param   sequence_step_id               Sequence step identifier.
00727      * @param   p_time_out_milli_secs            Timeout value.
00728      * @return  VL53L0X_ERROR_NONE            Success
00729      * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
00730      *                                       supported.
00731      * @return  "Other error code"           See ::VL53L0X_Error
00732      */
00733     VL53L0X_Error VL53L0X_get_sequence_step_timeout(VL53L0X_DEV dev,
00734             VL53L0X_SequenceStepId sequence_step_id,
00735             FixPoint1616_t *p_time_out_milli_secs);
00736 
00737     /**
00738      * @brief Sets the timeout of a requested sequence step.
00739      *
00740      * @par Function Description
00741      * This function sets the timeout of a requested sequence step.
00742      *
00743      * @note This function Accesses the device
00744      *
00745      * @param   dev                          Device Handle
00746      * @param   sequence_step_id               Sequence step identifier.
00747      * @param   time_out_milli_secs             Demanded timeout
00748      * @return  VL53L0X_ERROR_NONE            Success
00749      * @return  VL53L0X_ERROR_INVALID_PARAMS  Error SequenceStepId parameter not
00750      *                                       supported.
00751      * @return  "Other error code"           See ::VL53L0X_Error
00752      */
00753     VL53L0X_Error VL53L0X_set_sequence_step_timeout(VL53L0X_DEV dev,
00754             VL53L0X_SequenceStepId sequence_step_id, FixPoint1616_t time_out_milli_secs);
00755 
00756     /**
00757     * @brief  Get the current SPAD Ambient Damper Factor value
00758     *
00759     * @par Function Description
00760     * This function get the SPAD Ambient Damper Factor value
00761     *
00762     * @note This function Access to the device
00763     *
00764     * @param   dev                           Device Handle
00765     * @param   p_spad_ambient_damper_factor      Pointer to programmed SPAD Ambient
00766     * Damper Factor value
00767     * @return  VL53L0X_ERROR_NONE             Success
00768     * @return  "Other error code"            See ::VL53L0X_Error
00769     */
00770     VL53L0X_Error VL53L0X_get_spad_ambient_damper_factor(VL53L0X_DEV dev,
00771             uint16_t *p_spad_ambient_damper_factor);
00772     /**
00773     * @brief  Set the SPAD Ambient Damper Factor value
00774     *
00775     * @par Function Description
00776     * This function set the SPAD Ambient Damper Factor value
00777     *
00778     * @note This function Access to the device
00779     *
00780     * @param   dev                           Device Handle
00781     * @param   spad_ambient_damper_factor       SPAD Ambient Damper Factor value
00782     * @return  VL53L0X_ERROR_NONE             Success
00783     * @return  "Other error code"            See ::VL53L0X_Error
00784     */
00785     VL53L0X_Error VL53L0X_set_spad_ambient_damper_factor(VL53L0X_DEV dev,
00786             uint16_t spad_ambient_damper_factor);
00787 
00788     /**
00789      * @brief  Get the current SPAD Ambient Damper Threshold value
00790      *
00791      * @par Function Description
00792      * This function get the SPAD Ambient Damper Threshold value
00793      *
00794      * @note This function Access to the device
00795      *
00796      * @param   dev                           Device Handle
00797      * @param   p_spad_ambient_damper_threshold   Pointer to programmed
00798      *                                        SPAD Ambient Damper Threshold value
00799      * @return  VL53L0X_ERROR_NONE             Success
00800      * @return  "Other error code"            See ::VL53L0X_Error
00801      */
00802     VL53L0X_Error VL53L0X_get_spad_ambient_damper_threshold(VL53L0X_DEV dev,
00803             uint16_t *p_spad_ambient_damper_threshold);
00804 
00805     /**
00806      * @brief  Set the SPAD Ambient Damper Threshold value
00807      *
00808      * @par Function Description
00809      * This function set the SPAD Ambient Damper Threshold value
00810      *
00811      * @note This function Access to the device
00812      *
00813      * @param   dev                           Device Handle
00814      * @param   spad_ambient_damper_threshold    SPAD Ambient Damper Threshold value
00815      * @return  VL53L0X_ERROR_NONE             Success
00816      * @return  "Other error code"            See ::VL53L0X_Error
00817      */
00818     VL53L0X_Error VL53L0X_set_spad_ambient_damper_threshold(VL53L0X_DEV dev,
00819             uint16_t spad_ambient_damper_threshold);
00820 
00821     /**
00822      * @brief Get the maximal distance for actual setup
00823      * @par Function Description
00824      * Device must be initialized through @a VL53L0X_SetParameters() prior calling
00825      * this function.
00826      *
00827      * Any range value more than the value returned is to be considered as
00828      * "no target detected" or
00829      * "no target in detectable range"\n
00830      * @warning The maximal distance depends on the setup
00831      *
00832      * @note This function is not Implemented
00833      *
00834      * @param   dev      Device Handle
00835      * @param   p_upper_limit_milli_meter   The maximal range limit for actual setup
00836      * (in millimeter)
00837      * @return  VL53L0X_ERROR_NOT_IMPLEMENTED        Not implemented
00838      */
00839     VL53L0X_Error VL53L0X_get_upper_limit_milli_meter(VL53L0X_DEV dev,
00840             uint16_t *p_upper_limit_milli_meter);
00841 
00842     /**
00843     * @brief Get the tuning settings pointer and the internal external switch
00844     * value.
00845     *
00846     * This function is used to get the Tuning settings buffer pointer and the
00847     * value.
00848     * of the switch to select either external or internal tuning settings.
00849     *
00850     * @note This function Access to the device
00851     *
00852     * @param   dev                        Device Handle
00853     * @param   pp_tuning_setting_buffer      Pointer to tuning settings buffer.
00854     * @param   p_use_internal_tuning_settings Pointer to store Use internal tuning
00855     *                                     settings value.
00856     * @return  VL53L0X_ERROR_NONE          Success
00857     * @return  "Other error code"         See ::VL53L0X_Error
00858     */
00859     VL53L0X_Error VL53L0X_get_tuning_setting_buffer(VL53L0X_DEV dev,
00860             uint8_t **pp_tuning_setting_buffer, uint8_t *p_use_internal_tuning_settings);
00861 
00862     /**
00863      * @brief Set the tuning settings pointer
00864      *
00865      * This function is used to specify the Tuning settings buffer to be used
00866      * for a given device. The buffer contains all the necessary data to permit
00867      * the API to write tuning settings.
00868      * This function permit to force the usage of either external or internal
00869      * tuning settings.
00870      *
00871      * @note This function Access to the device
00872      *
00873      * @param   dev                             Device Handle
00874      * @param   p_tuning_setting_buffer            Pointer to tuning settings buffer.
00875      * @param   use_internal_tuning_settings       Use internal tuning settings value.
00876      * @return  VL53L0X_ERROR_NONE     Success
00877      * @return  "Other error code"    See ::VL53L0X_Error
00878      */
00879     VL53L0X_Error VL53L0X_set_tuning_setting_buffer(VL53L0X_DEV dev,
00880             uint8_t *p_tuning_setting_buffer, uint8_t use_internal_tuning_settings);
00881 
00882     /**
00883      * @defgroup VL53L0X_registerAccess_group PAL Register Access Functions
00884      * @brief    PAL Register Access Functions
00885      *  @{
00886      */
00887 
00888     /**
00889      * Lock comms interface to serialize all commands to a shared I2C interface for a specific device
00890      * @param   dev       Device Handle
00891      * @return  VL53L0X_ERROR_NONE        Success
00892      * @return  "Other error code"    See ::VL53L0X_Error
00893      */
00894     VL53L0X_Error VL53L0X_lock_sequence_access(VL53L0X_DEV dev);
00895 
00896     /**
00897      * Unlock comms interface to serialize all commands to a shared I2C interface for a specific device
00898      * @param   dev       Device Handle
00899      * @return  VL53L0X_ERROR_NONE        Success
00900      * @return  "Other error code"    See ::VL53L0X_Error
00901      */
00902     VL53L0X_Error VL53L0X_unlock_sequence_access(VL53L0X_DEV dev);
00903 
00904     /**
00905      * @brief  Prepare device for operation
00906      * @par Function Description
00907      * Update device with provided parameters
00908      * @li Then start ranging operation.
00909      *
00910      * @note This function Access to the device
00911      *
00912      * @param   Dev                   Device Handle
00913      * @param   pDeviceParameters     Pointer to store current device parameters.
00914      * @return  VL53L0X_ERROR_NONE     Success
00915      * @return  "Other error code"    See ::VL53L0X_Error
00916      */
00917     VL53L0X_Error vl53L0x_set_device_parameters(VL53L0X_DEV Dev,
00918             const VL53L0X_DeviceParameters_t *pDeviceParameters);
00919 
00920     /**
00921      * Set Group parameter Hold state
00922      *
00923      * @par Function Description
00924      * Set or remove device internal group parameter hold
00925      *
00926      * @note This function is not Implemented
00927      *
00928      * @param   dev      Device Handle
00929      * @param   group_param_hold   Group parameter Hold state to be set (on/off)
00930      * @return  VL53L0X_ERROR_NOT_IMPLEMENTED        Not implemented
00931      */
00932     VL53L0X_Error VL53L0X_set_group_param_hold(VL53L0X_DEV dev,
00933             uint8_t group_param_hold);
00934 
00935 
00936     /**
00937      * @brief Wait for device ready for a new measurement command.
00938      * Blocking function.
00939      *
00940      * @note This function is not Implemented
00941      *
00942      * @param   dev      Device Handle
00943      * @param   max_loop    Max Number of polling loop (timeout).
00944      * @return  VL53L0X_ERROR_NOT_IMPLEMENTED   Not implemented
00945      */
00946     VL53L0X_Error VL53L0X_wait_device_ready_for_new_measurement(VL53L0X_DEV dev,
00947             uint32_t max_loop);
00948 
00949     VL53L0X_Error VL53L0X_reverse_bytes(uint8_t *data, uint32_t size);
00950 
00951     int range_meas_int_continuous_mode(void (*fptr)(void));
00952