Greatly simplified Architecture, Identical Functions Removed: Platform Interfaces, STP6001 interface
Diff: VL53L0X.h
- Revision:
- 11:d8dbe3b87f9f
- Parent:
- 10:cd1758e186a4
- Child:
- 12:81f37e50f8f8
--- a/VL53L0X.h Thu Jun 27 12:51:34 2019 +0000 +++ b/VL53L0X.h Tue Jul 02 12:38:07 2019 +0000 @@ -35,7 +35,6 @@ #include "pinmap.h" #include "PinNames.h" #include "VL53L0X_def.h" -#include "VL53L0X_tuning.h" /* Classes -------------------------------------------------------------------*/ /** Class representing a VL53L0 sensor component @@ -179,7 +178,7 @@ * @brief Get ranging result and only that * * @par Function Description - * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in millimeter \n + * Unlike @a VL53L0X_get_ranging_measurement_data() this function only retrieves the range in _mm \n * It does any required up-scale translation\n * It can be called after success status polling or in interrupt mode \n * @warning these function is not doing wrap around filtering \n @@ -237,7 +236,6 @@ * * @note This function accesses to the device * - * * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ @@ -310,9 +308,7 @@ * * @note This function Access to the device * - * @note This function change the device mode to - * VL53L0X_DEVICEMODE_SINGLE_RANGING - * + * @note This function change the device mode to VL53L0X_DEVICEMODE_SINGLE_RANGING * * @param ref_spad_count Reports ref Spad Count * @param is_aperture_spads Reports if spads are of type @@ -389,7 +385,7 @@ int32_t *p_offset_calibration_data_micro_meter); /** * Set or over-hide part to part calibration offset - * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationDataMicroMeter() + * \sa VL53L0X_DataInit() VL53L0X_GetOffsetCalibrationData_um() * * @note This function Access to the device * @@ -406,41 +402,7 @@ VL53L0X_Error VL53L0X_perform_xtalk_calibration( FixPoint1616_t xtalk_cal_distance, - FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); - - /** - * @brief Perform XTalk Measurement - * - * @details Measures the current cross talk from glass in front - * of the sensor. - * This functions performs a histogram measurement and uses the results - * to measure the crosstalk. For the function to be successful, there - * must be no target in front of the sensor. - * - * @warning This function is a blocking function - * - * @warning This function is not supported when the final range - * vcsel clock period is set below 10 PCLKS. - * - * @note This function Access to the device - * - * - * @param timeout_ms Histogram measurement duration. - * @param p_xtalk_per_spad Output parameter containing the crosstalk - * measurement result, in MCPS/Spad. - * Format fixpoint 16:16. - * @param p_ambient_too_high Output parameter which indicate that - * pXtalkPerSpad is not good if the Ambient - * is too high. - * @return VL53L0X_ERROR_NONE Success - * @return VL53L0X_ERROR_INVALID_PARAMS vcsel clock period not supported - * for this operation. - * Must not be less than 10PCLKS. - * @return "Other error code" See ::VL53L0X_Error - */ - VL53L0X_Error VL53L0X_perform_xtalk_measurement( - uint32_t timeout_ms, FixPoint1616_t *p_xtalk_per_spad, - uint8_t *p_ambient_too_high); + FixPoint1616_t *p_xtalk_compensation_rate_MHz); /** * @brief Set Cross talk compensation rate @@ -450,15 +412,15 @@ * * @note This function Access to the device * - * @param x_talk_compensation_rate_mega_cps Compensation rate in + * @param x_talk_compensation_rate_MHz Compensation rate in * Mega counts per second * (16.16 fix point) see * datasheet for details * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_mega_cps( - FixPoint1616_t x_talk_compensation_rate_mega_cps); + VL53L0X_Error VL53L0X_set_x_talk_compensation_rate_MHz( + FixPoint1616_t x_talk_compensation_rate_MHz); /** * @brief Get Cross talk compensation rate @@ -468,21 +430,21 @@ * * @note This function Access to the device * - * @param p_xtalk_compensation_rate_mega_cps Pointer to Compensation rate + * @param p_xtalk_compensation_rate_MHz Pointer to Compensation rate * in Mega counts per second * (16.16 fix point) see * datasheet for details * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_mega_cps( - FixPoint1616_t *p_xtalk_compensation_rate_mega_cps); + VL53L0X_Error VL53L0X_get_x_talk_compensation_rate_MHz( + FixPoint1616_t *p_xtalk_compensation_rate_MHz); /** * @brief Get Cross talk enable * * Enable/Disable Cross Talk by set to zero the Cross Talk value by - * using @a VL53L0X_SetXTalkCompensationRateMegaCps(). + * using @a VL53L0X_SetXTalkCompensationRate_MHz(). * * @param dev Device Handle * @param p_x_talk_compensation_enable Pointer to the Cross talk compensation @@ -504,10 +466,6 @@ * VL53L0X_DEVICEMODE_SINGLE_RANGING * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING - * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM - * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY - * VL53L0X_HISTOGRAMMODE_RETURN_ONLY - * VL53L0X_HISTOGRAMMODE_BOTH * * * @return VL53L0X_ERROR_NONE Success @@ -530,9 +488,6 @@ * VL53L0X_DEVICEMODE_CONTINUOUS_RANGING * VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM - * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY - * VL53L0X_HISTOGRAMMODE_RETURN_ONLY - * VL53L0X_HISTOGRAMMODE_BOTH * * @return VL53L0X_ERROR_NONE Success * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when @@ -746,10 +701,6 @@ * * @note This function Access to the device * - * @note This function change the device mode to - * VL53L0X_DEVICEMODE_SINGLE_RANGING - * - * * @param p_ranging_measurement_data Pointer to the data structure to fill up. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error @@ -780,14 +731,14 @@ VL53L0X_Error VL53L0X_get_total_signal_rate( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, - FixPoint1616_t *p_total_signal_rate_mcps); + FixPoint1616_t *p_total_signal_rate_MHz); VL53L0X_Error VL53L0X_get_total_xtalk_rate( VL53L0X_RangingMeasurementData_t *p_ranging_measurement_data, - FixPoint1616_t *p_total_xtalk_rate_mcps); + FixPoint1616_t *p_total_xtalk_rate_MHz); /** - * @brief Get Ranging Timing Budget in microseconds + * @brief Get Ranging Timing Budget in us * * @par Function Description * Returns the programmed the maximum time allowed by the user to the @@ -796,19 +747,19 @@ * * @note This function Access to the device * - * @param p_measurement_timing_budget_micro_seconds Max measurement time in - * microseconds. + * @param p_measurement_timing_budget_us Max measurement time in + *us. * Valid values are: - * >= 17000 microsecs when wraparound enabled - * >= 12000 microsecs when wraparound disabled + * >= 17000us when wraparound enabled + * >= 12000us when wraparound disabled * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_measurement_timing_budget_micro_seconds( - uint32_t *p_measurement_timing_budget_micro_seconds); + VL53L0X_Error VL53L0X_get_measurement_timing_budget_us( + uint32_t *p_measurement_timing_budget_us); /** - * @brief Set Ranging Timing Budget in microseconds + * @brief Set Ranging Timing Budget in us * * @par Function Description * Defines the maximum time allowed by the user to the device to run a @@ -816,18 +767,17 @@ * * @note This function Access to the device * - * @param measurement_timing_budget_micro_seconds Max measurement time in - * microseconds. + * @param measurement_timing_budget_us Max measurement time in us. * Valid values are: - * >= 17000 microsecs when wraparound enabled - * >= 12000 microsecs when wraparound disabled + * >= 17000us when wraparound enabled + * >= 12000us when wraparound disabled * @return VL53L0X_ERROR_NONE Success * @return VL53L0X_ERROR_INVALID_PARAMS This error is returned if - MeasurementTimingBudgetMicroSeconds out of range + MeasurementTimingBudget_us out of range * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_measurement_timing_budget_micro_seconds( - uint32_t measurement_timing_budget_micro_seconds); + VL53L0X_Error VL53L0X_set_measurement_timing_budget_us( + uint32_t measurement_timing_budget_us); /** * @brief Get specific limit check enable state @@ -976,7 +926,7 @@ uint16_t limit_check_id, uint8_t *p_limit_check_status); /** - * Get continuous mode Inter-Measurement period in milliseconds + * Get continuous mode Inter-Measurement period in _ms * * @par Function Description * When trying to set too short time return INVALID_PARAMS minimal value @@ -984,16 +934,16 @@ * @note This function Access to the device * * - * @param p_inter_measurement_period_milli_seconds Pointer to programmed - * Inter-Measurement Period in milliseconds. + * @param p_inter_measurement_period_ms Pointer to programmed + * Inter-Measurement Period in _ms. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_get_inter_measurement_period_milli_seconds( - uint32_t *p_inter_measurement_period_milli_seconds); + VL53L0X_Error VL53L0X_get_inter_measurement_period_ms( + uint32_t *p_inter_measurement_period_ms); /** - * Program continuous mode Inter-Measurement period in milliseconds + * Program continuous mode Inter-Measurement period in _ms * * @par Function Description * When trying to set too short time return INVALID_PARAMS minimal value @@ -1001,12 +951,12 @@ * @note This function Access to the device * * - * @param inter_measurement_period_milli_seconds Inter-Measurement Period in ms. + * @param inter_measurement_period_ms Inter-Measurement Period in ms. * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ - VL53L0X_Error VL53L0X_set_inter_measurement_period_milli_seconds( - uint32_t inter_measurement_period_milli_seconds); + VL53L0X_Error VL53L0X_set_inter_measurement_period_ms( + uint32_t inter_measurement_period_ms); /** * @brief Set new device address @@ -1269,8 +1219,8 @@ VL53L0X_Error VL53L0X_device_read_strobe(void); - VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_micro_seconds( - uint32_t *p_measurement_timing_budget_micro_seconds); + VL53L0X_Error wrapped_VL53L0X_get_measurement_timing_budget_us( + uint32_t *p_measurement_timing_budget_us); VL53L0X_Error wrapped_VL53L0X_get_vcsel_pulse_period( VL53L0X_VcselPeriod vcsel_period_type, uint8_t *p_vcsel_pulse_period_pclk); @@ -1305,15 +1255,15 @@ uint32_t VL53L0X_quadrature_sum(uint32_t a, uint32_t b); VL53L0X_Error VL53L0X_calc_dmax( - FixPoint1616_t total_signal_rate_mcps, - FixPoint1616_t total_corr_signal_rate_mcps, + FixPoint1616_t total_signal_rate_MHz, + FixPoint1616_t total_corr_signal_rate_MHz, FixPoint1616_t pw_mult, uint32_t sigma_estimate_p1, FixPoint1616_t sigma_estimate_p2, uint32_t peak_vcsel_duration_us, uint32_t *pd_max_mm); - VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_micro_seconds( - uint32_t measurement_timing_budget_micro_seconds); + VL53L0X_Error wrapped_VL53L0X_set_measurement_timing_budget_us( + uint32_t measurement_timing_budget_us); VL53L0X_Error get_sequence_step_timeout(VL53L0X_SequenceStepId sequence_step_id, uint32_t *p_time_out_micro_secs); VL53L0X_Error set_sequence_step_timeout(VL53L0X_SequenceStepId sequence_step_id, @@ -1465,12 +1415,12 @@ * @note This function Access to the device * * @param p_range_milli_meter Pointer to Calibration Distance - * @param p_signal_rate_rtn_mega_cps Pointer to Signal rate return + * @param p_signal_rate_rtn_MHz Pointer to Signal rate return * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_get_dmax_cal_parameters( - uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_mega_cps); + uint16_t *p_range_milli_meter, FixPoint1616_t *p_signal_rate_rtn_MHz); /** * @brief Set Dmax Calibration Parameters for a given device @@ -1480,56 +1430,14 @@ * * * @param range_milli_meter Calibration Distance - * @param signal_rate_rtn_mega_cps Signal rate return read at CalDistance + * @param signal_rate_rtn_MHz Signal rate return read at CalDistance * @return VL53L0X_ERROR_NONE Success * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_get_dmax_cal_parameters( - uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_mega_cps); - - /** - * @brief Get current new device mode - * @par Function Description - * Get current Histogram mode of a Device - * - * @note This function doesn't Access to the device - * - * @param p_histogram_mode Pointer to current Histogram Mode value - * Valid values are: - * VL53L0X_HISTOGRAMMODE_DISABLED - * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM - * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY - * VL53L0X_HISTOGRAMMODE_RETURN_ONLY - * VL53L0X_HISTOGRAMMODE_BOTH - * @return VL53L0X_ERROR_NONE Success - * @return "Other error code" See ::VL53L0X_Error - */ - VL53L0X_Error VL53L0X_get_histogram_mode( - VL53L0X_HistogramModes *p_histogram_mode); + uint16_t range_milli_meter, FixPoint1616_t signal_rate_rtn_MHz); - /** - * @brief Set a new Histogram mode - * @par Function Description - * Set device to a new Histogram mode - * - * @note This function doesn't Access to the device - * - * - * @param histogram_mode New device mode to apply - * Valid values are: - * VL53L0X_HISTOGRAMMODE_DISABLED - * VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM - * VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY - * VL53L0X_HISTOGRAMMODE_RETURN_ONLY - * VL53L0X_HISTOGRAMMODE_BOTH - * - * @return VL53L0X_ERROR_NONE Success - * @return VL53L0X_ERROR_MODE_NOT_SUPPORTED This error occurs when - * HistogramMode is not in the supported list - * @return "Other error code" See ::VL53L0X_Error - */ - VL53L0X_Error VL53L0X_set_histogram_mode( - VL53L0X_HistogramModes histogram_mode); + /** * @brief Return a description string for a given limit check number @@ -1842,6 +1750,7 @@ VL53L0X_DevData_t Data; VL53L0X_DeviceInfo_t Device_Info; VL53L0X_DeviceParameters_t CurrentParameters; /*!< Current Device Parameter */ + VL53L0X_RangingMeasurementData_t LastRangeMeasure; /*!< Last Performed Ranging Data */ public: /* IO Device */