This commit is contained in:
2026-04-08 07:38:46 +08:00
parent a9ec02dc93
commit fda081c1f0
51 changed files with 51337 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_api_core.h
*
* @brief EwokPlus25 low level API function definitions
*/
#ifndef _VL53L1_API_CALIBRATION_H_
#define _VL53L1_API_CALIBRATION_H_
#include "vl53l1_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Run Reference Array SPAD Characterisation.
*
* This function finds the required number of reference SPAD
* to meet the input required peak reference rate.
*
* The algorithm first tries the non apertured reference SPAD's,
* if the rate is too high for the minimum allowed SPAD count (5)
* then the algo switches to 5x apertured SPAD's and if the rate
* is still to high then the 10x apertured SPAD are selected.
*
* The function reads the following results from the device and
* both caches the values in the pdev->customer structure and
* writes the data into the G02 customer register group.
*
* - num_ref_spads
* - ref_location
* - DCR SPAD enables for selected reference location
*
* Note power force is enabled as the function needs to read
* data from the Patch RAM.
*
* Should only be called once per part with coverglass attached to
* generate the required num of SPAD, Ref location and DCR SPAD enable
* data
*
* @param[in] Dev : Device Handle
* @param[out] pcal_status : Pointer to unfiltered calibration status
*
* @return VL53L1_ERROR_NONE Success
* @return VL53L1_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS
* Less than 5 Good SPAD available, output not valid
* @return VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH
* At end of search reference rate > 40.0 Mcps
* Offset stability may be degraded.
* @return VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW
* At end of search reference rate < 10.0 Mcps
* Offset stability may be degraded.
*
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_run_ref_spad_char(VL53L1_DEV Dev, VL53L1_Error *pcal_status);
#endif
/**
* @brief Runs the input Device Test
*
* Calls
*
* - VL53L1_enable_powerforce()
* - VL53L1_start_test()
* - VL53L1_poll_for_range_completion()
*
* @param[in] Dev : Device handle
* @param[in] device_test_mode : Device test mode register value
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_run_device_test(
VL53L1_DEV Dev,
VL53L1_DeviceTestMode device_test_mode);
#endif
/**
* @brief Runs SPAD rate map
*
* Output structure contains SPAD rate data in SPAD number order
*
* @param[in] Dev : Device handle
* @param[in] device_test_mode : Device test mode register value.
* Valid options: \n
* - VL53L1_DEVICETESTMODE_LCR_VCSEL_OFF \n
* - VL53L1_DEVICETESTMODE_LCR_VCSEL_ON
* @param[in] array_select : Device SPAD array select
* Valid options: \n
* - VL53L1_DEVICESSCARRAY_RTN \n
* - VL53L1_DEVICESSCARRAY_REF
* @param[in] ssc_config_timeout_us : SSC timeout in [us] e.g 36000us
* @param[out] pspad_rate_data : pointer to output rates structure
* 1.15 format for LCR_VCSEL_OFF
* 9.7 format for LCR_VCSEL_ON
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_run_spad_rate_map(
VL53L1_DEV Dev,
VL53L1_DeviceTestMode device_test_mode,
VL53L1_DeviceSscArray array_select,
uint32_t ssc_config_timeout_us,
VL53L1_spad_rate_data_t *pspad_rate_data);
#endif
/**
* @brief Run offset calibration
*
* Runs the standard ranging MM1 and MM2 calibration presets
* to generate the MM1 and MM2 range offset data
*
* The range config timeout is used for both MM1 and MM2 so that
* the sigma delta settling is the same as for the 'real' range
*
* Places results into VL53L1_customer_nvm_managed_t within pdev
*
* Use VL53L1_get_part_to_part_data() to get the offset calibration
* results
*
* Current FMT settings:
*
* - offset_calibration_mode = VL53L1_OFFSETCALIBRATIONMODE__STANDARD_RANGING
* - dss_config__target_total_rate_mcps = 0x0A00 (20.0Mcps) to 0x1400 (40.0Mcps)
* - phasecal_config_timeout_us = 1000
* - range_config_timeout_us = 13000
* - pre_num_of_samples = 32
* - mm1_num_of_samples = 100
* - mm2_range_num_of_samples = 64
* - target_distance_mm = 140 mm
* - target reflectance = 5%
*
* Note: function parms simplified as part of Patch_CalFunctionSimplification_11791
*
* @param[in] Dev : Device handle
* @param[in] cal_distance_mm : Distance to target in [mm] - the ground truth
* @param[out] pcal_status : Pointer to unfiltered calibration status
*
* @return VL53L1_ERROR_NONE Success
* @return VL53L1_WARNING_OFFSET_CAL_INSUFFICIENT_MM1_SPADS
* Effective MM1 SPAD count too low (<5.0).
* Out with recommended calibration condition.
* Accuracy of offset calibration may be degraded.
* @return VL53L1_WARNING_OFFSET_CAL_PRE_RANGE_RATE_TOO_HIGH
* Pre range too high (>40.0) in pile up region.
* Out with recommended calibration condition.
* Accuracy of offset calibration may be degraded.
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_run_offset_calibration(
VL53L1_DEV Dev,
int16_t cal_distance_mm,
VL53L1_Error *pcal_status);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_API_CALIBRATION_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,354 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_api_debug.h
*
* @brief EwokPlus25 low level API function definitions
*/
#ifndef _VL53L1_API_DEBUG_H_
#define _VL53L1_API_DEBUG_H_
#include "vl53l1_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Start Patch_AdditionalDebugData_11823 */
/**
* @brief Gets the current LL Driver configuration parameters and the last
* set of histogram data for debug
*
* @param[in] Dev : Device Handle
* @param[out] pdata : pointer to VL53L1_additional_data_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_additional_data(
VL53L1_DEV Dev,
VL53L1_additional_data_t *pdata);
/* End Patch_AdditionalDebugData_11823 */
#ifdef VL53L1_LOG_ENABLE
/**
* @brief Implements an sprintf function for signed fixed point numbers
*
* @param[in] fp_value : input signed fixed point number
* @param[in] frac_bits : number of fixed point fractional bits
* @param[in] buf_size : size of supplied text buffer
* @param[out] pbuffer : pointer to text buffer
*
*/
void VL53L1_signed_fixed_point_sprintf(
int32_t fp_value,
uint8_t frac_bits,
uint16_t buf_size,
char *pbuffer);
/**
* @brief Convenience function to print out VL53L1_static_nvm_managed_t for debug
*
* @param[in] pdata : pointer to VL53L1_static_nvm_managed_t
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_static_nvm_managed(
VL53L1_static_nvm_managed_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out VL53L1_customer_nvm_managed_t for debug
*
* @param[in] pdata : pointer to VL53L1_customer_nvm_managed_t
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_customer_nvm_managed(
VL53L1_customer_nvm_managed_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out VL53L1_nvm_copy_data_t for debug
*
* @param[in] pdata : pointer to VL53L1_nvm_copy_data_t
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_nvm_copy_data(
VL53L1_nvm_copy_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the Range Results structure for debug
*
* @param[in] pdata : pointer to a VL53L1_range_results_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_range_results(
VL53L1_range_results_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the Range Data structure for debug
*
* @param[in] pdata : pointer to a VL53L1_range_data_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_range_data(
VL53L1_range_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the offset range results structure for debug
*
* @param[in] pdata : pointer to a VL53L1_offset_range_results_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_offset_range_results(
VL53L1_offset_range_results_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the offset range data structure for debug
*
* @param[in] pdata : pointer to a VL53L1_offset_range_data_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_offset_range_data(
VL53L1_offset_range_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the peak rate map calibration data structure
*
* @param[in] pdata : pointer to a VL53L1_cal_peak_rate_map_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_cal_peak_rate_map(
VL53L1_cal_peak_rate_map_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the additional offset calibration data structure
*
* @param[in] pdata : pointer to a VL53L1_additional_offset_cal_data_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_additional_offset_cal_data(
VL53L1_additional_offset_cal_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the additional data structure
*
* @param[in] pdata : pointer to a VL53L1_additional_data_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_additional_data(
VL53L1_additional_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the LL driver gain calibration data structure
*
* @param[in] pdata : pointer to a VL53L1_gain_calibration_data_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_gain_calibration_data(
VL53L1_gain_calibration_data_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the xtalk configuration data for debug
*
* @param[in] pdata : pointer to a VL53L1_xtalk_config_t Structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_xtalk_config(
VL53L1_xtalk_config_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the Optical Centre structure for debug
*
* @param[in] pdata : pointer to a VL53L1_optical_centre_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_optical_centre(
VL53L1_optical_centre_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function to print out the contents of
* the User Zone (ROI) structure for debug
*
* @param[in] pdata : pointer to a VL53L1_user_zone_t structure
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_user_zone(
VL53L1_user_zone_t *pdata,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function for printing out VL53L1_spad_rate_data_t
*
* @param[in] pspad_rates : pointer to VL53L1_spad_rate_data_t
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_spad_rate_data(
VL53L1_spad_rate_data_t *pspad_rates,
char *pprefix,
uint32_t trace_flags);
/**
* @brief Convenience function for printing out VL53L1_spad_rate_map_t
*
* @param[in] pspad_rates : pointer to VL53L1_spad_rate_map_t
* @param[in] pprefix : pointer to name prefix string
* @param[in] trace_flags : logging module enable bit flags
*/
void VL53L1_print_spad_rate_map(
VL53L1_spad_rate_data_t *pspad_rates,
char *pprefix,
uint32_t trace_flags);
#endif /* VL53L1_LOG_ENABLE */
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_API_DEBUG_H_ */

View File

@@ -0,0 +1,471 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_api_preset_modes.h
*
* @brief EwokPlus25 API core function definition
*/
#ifndef _VL53L1_API_PRESET_MODES_H_
#define _VL53L1_API_PRESET_MODES_H_
#include "vl53l1_ll_def.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initializes Ref SPAD Char Configuration Parameters
*
* @param[out] pdata : pointer to VL53L1_refspadchar_config_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_init_refspadchar_config_struct(
VL53L1_refspadchar_config_t *pdata);
#endif
/**
* @brief Initializes SPAD Self Check (SSC) Configuration Parameters
*
* @param[out] pdata : pointer to VL53L1_ssc_config_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_init_ssc_config_struct(
VL53L1_ssc_config_t *pdata);
/**
* @brief Initializes Xtalk Configuration Parameters
*
* @param[in] pnvm : pointer to VL53L1_customer_nvm_managed_t data structure
* @param[out] pdata : pointer to VL53L1_xtalk_config_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_init_xtalk_config_struct(
VL53L1_customer_nvm_managed_t *pnvm,
VL53L1_xtalk_config_t *pdata);
/**
* @brief Initializes Offset Calibration Configuration Parameters
*
* @param[out] pdata : pointer to VL53L1_offsetcal_config_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_init_offset_cal_config_struct(
VL53L1_offsetcal_config_t *pdata);
#endif
/**
* @brief Initializes Tuning Parameter Storage Values
*
* @param[out] pdata : pointer to VL53L1_tuning_parm_storage_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_init_tuning_parm_storage_struct(
VL53L1_tuning_parm_storage_t *pdata);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_standard_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_SHORT_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_LONG_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM1_CAL
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_preset_mode_standard_ranging_mm1_cal(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
#endif
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM2_CAL
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
#ifndef VL53L1_NOCALIB
VL53L1_Error VL53L1_preset_mode_standard_ranging_mm2_cal(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
#endif
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_timed_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING_SHORT_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_TIMED_RANGING_LONG_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_MEDIUM_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
* @param[out] plpadata : pointer to VL53L1_low_power_auto_data_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_low_power_auto_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms,
VL53L1_low_power_auto_data_t *plpadata);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_SHORT_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
* @param[out] plpadata : pointer to VL53L1_low_power_auto_data_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_low_power_auto_short_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms,
VL53L1_low_power_auto_data_t *plpadata);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_LONG_RANGE
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
* @param[out] plpadata : pointer to VL53L1_low_power_auto_data_t data structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_low_power_auto_long_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms,
VL53L1_low_power_auto_data_t *plpadata);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_OLT
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_olt(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
/**
* @brief Initializes static and dynamic configuration settings for
* preset mode VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING
*
* @param[out] pstatic : pointer to VL53L1_static_config_t data structure
* @param[out] pgeneral : pointer to VL53L1_general_config_t data structure
* @param[out] ptiming : pointer to VL53L1_timing_config_t data structure
* @param[out] pdynamic : pointer to VL53L1_dynamic_config_t data structure
* @param[out] psystem : pointer to VL53L1_system_control_t data structure
* @param[out] ptuning_parms : pointer to VL53L1_tuning_parms_storage_t structure
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_preset_mode_singleshot_ranging(
VL53L1_static_config_t *pstatic,
VL53L1_general_config_t *pgeneral,
VL53L1_timing_config_t *ptiming,
VL53L1_dynamic_config_t *pdynamic,
VL53L1_system_control_t *psystem,
VL53L1_tuning_parm_storage_t *ptuning_parms);
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_API_CORE_H_ */

View File

@@ -0,0 +1,159 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/******************************************************************************
* Copyright (c) 2020, STMicroelectronics - All Rights Reserved
This file is part of VL53L1 and is dual licensed,
either GPL-2.0+
or 'BSD 3-clause "New" or "Revised" License' , at your option.
******************************************************************************
*/
/**
* @file vl53l1_api_strings.h
* @brief VL53L1 API function declarations for decoding error codes to a
* text strings
*/
#ifndef VL53L1_API_STRINGS_H_
#define VL53L1_API_STRINGS_H_
#include "vl53l1_def.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Generates a string for the input device range status code
*
* @param[in] RangeStatus : Device Range AStatus Code
* @param[out] pRangeStatusString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_range_status_string(
uint8_t RangeStatus,
char *pRangeStatusString);
/**
* @brief Generates an error string for the input PAL error code
*
* @param[in] PalErrorCode : PAL Error Code
* @param[out] pPalErrorString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_pal_error_string(
VL53L1_Error PalErrorCode,
char *pPalErrorString);
/**
* @brief Generates a string for the input PAL State code
*
* @param[in] PalStateCode : PAL State Code
* @param[out] pPalStateString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_pal_state_string(
VL53L1_State PalStateCode,
char *pPalStateString);
/**
* @brief Generates a string for the sequence step Id
*
* @param[in] SequenceStepId : Sequence Step Id
* @param[out] pSequenceStepsString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_sequence_steps_info(
VL53L1_SequenceStepId SequenceStepId,
char *pSequenceStepsString);
/**
* @brief Generates a string for the limit check Id
*
* @param[in] LimitCheckId : Limit check Id
* @param[out] pLimitCheckString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_limit_check_info(uint16_t LimitCheckId,
char *pLimitCheckString);
#ifndef VL53L1_USE_EMPTY_STRING
#define VL53L1_STRING_DEVICE_INFO_NAME0 "VL53L1 cut1.0"
#define VL53L1_STRING_DEVICE_INFO_NAME1 "VL53L1 cut1.1"
#define VL53L1_STRING_DEVICE_INFO_TYPE "VL53L1"
/* Range Status */
#define VL53L1_STRING_RANGESTATUS_NONE "No Update"
#define VL53L1_STRING_RANGESTATUS_RANGEVALID "Range Valid"
#define VL53L1_STRING_RANGESTATUS_SIGMA "Sigma Fail"
#define VL53L1_STRING_RANGESTATUS_SIGNAL "Signal Fail"
#define VL53L1_STRING_RANGESTATUS_MINRANGE "Min Range Fail"
#define VL53L1_STRING_RANGESTATUS_PHASE "Phase Fail"
#define VL53L1_STRING_RANGESTATUS_HW "Hardware Fail"
/* Range Status */
#define VL53L1_STRING_STATE_POWERDOWN "POWERDOWN State"
#define VL53L1_STRING_STATE_WAIT_STATICINIT \
"Wait for staticinit State"
#define VL53L1_STRING_STATE_STANDBY "STANDBY State"
#define VL53L1_STRING_STATE_IDLE "IDLE State"
#define VL53L1_STRING_STATE_RUNNING "RUNNING State"
#define VL53L1_STRING_STATE_RESET "RESET State"
#define VL53L1_STRING_STATE_UNKNOWN "UNKNOWN State"
#define VL53L1_STRING_STATE_ERROR "ERROR State"
/* Check Enable */
#define VL53L1_STRING_CHECKENABLE_SIGMA_FINAL_RANGE \
"SIGMA FINAL RANGE"
#define VL53L1_STRING_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE \
"SIGNAL RATE FINAL RANGE"
#define VL53L1_STRING_CHECKENABLE_SIGNAL_MIN_CLIP \
"SIGNAL MIN CLIP"
#define VL53L1_STRING_CHECKENABLE_RANGE_IGNORE_THRESHOLD \
"RANGE IGNORE THRESHOLD"
#define VL53L1_STRING_CHECKENABLE_RANGE_PHASE_HIGH \
"RANGE PHASE HIGH"
#define VL53L1_STRING_CHECKENABLE_RANGE_PHASE_LOW \
"RANGE PHASE LOW"
#define VL53L1_STRING_CHECKENABLE_RANGE_PHASE_CONSISTENCY \
"RANGE PHASE CONSISTENCY"
/* Sequence Step */
#define VL53L1_STRING_SEQUENCESTEP_VHV "VHV"
#define VL53L1_STRING_SEQUENCESTEP_PHASECAL "PHASE CAL"
#define VL53L1_STRING_SEQUENCESTEP_REFPHASE "REF PHASE"
#define VL53L1_STRING_SEQUENCESTEP_DSS1 "DSS1"
#define VL53L1_STRING_SEQUENCESTEP_DSS2 "DSS2"
#define VL53L1_STRING_SEQUENCESTEP_MM1 "MM1"
#define VL53L1_STRING_SEQUENCESTEP_MM2 "MM2"
#define VL53L1_STRING_SEQUENCESTEP_RANGE "RANGE"
#endif /* VL53L1_USE_EMPTY_STRING */
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,222 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_core_support.h
*
* @brief EwokPlus25 core function definitions
*/
#ifndef _VL53L1_CORE_SUPPORT_H_
#define _VL53L1_CORE_SUPPORT_H_
#include "vl53l1_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Calculates the PLL period in [us] from the input
* fast_osc_frequency
*
* @param[in] fast_osc_frequency : fast oscillator frequency in 4.12 MHz format
*
* @return pll_period_us : PLL period in [us] 8.24 format
*/
uint32_t VL53L1_calc_pll_period_us(
uint16_t fast_osc_frequency);
#ifdef PAL_EXTENDED
/**
* @brief Calculates the ranging duration in ns using fixed point maths
* *
* Uses a temporary uint64_t variable internally
*
* @param[in] pll_period_us : PLL Period in [us] 0.25 format
* @param[in] vcsel_parm_pclks : period, width or WOI window in PLL clocks
* in 6.4 format.
* @param[in] window_vclks : ranging or ambient window duration in VCSEL clocks
* @param[in] periods_elapsed_mclks : elapsed time in macro clocks
*
* @return duration_us : uint32_t containing the duration time in us
*/
uint32_t VL53L1_duration_maths(
uint32_t pll_period_us,
uint32_t vcsel_parm_pclks,
uint32_t window_vclks,
uint32_t periods_elapsed_mclks);
/**
* @brief Calculates the square root of the input integer
*
* Reference : http://en.wikipedia.org/wiki/Methods_of_computing_square_roots
*
* @param[in] num : input integer
*
* @return res : square root result
*/
uint32_t VL53L1_isqrt(
uint32_t num);
/**
* @brief Calculates the count rate using fixed point maths
*
* Uses a temporary uint64_t variable internally
* Any negative negative rates are clipped to 0.
*
* @param[in] events : accumulated SPAD events
* @param[in] time_us : elapsed time in us
*
* @return rate_mcps : uint16_t count rate in 9.7 format
*/
uint16_t VL53L1_rate_maths(
int32_t events,
uint32_t time_us);
/**
* @brief Calculates the Rate per spad
*
* Uses a temporary uint32_t variable internally
* Any output rates larger than 16 bit are clipped to 0xFFFF.
*
* @param[in] frac_bits : required output fractional precision - 7 \
* due to inherent resolution of pk_rate
* @param[in] peak_count_rate : peak signal count rate in mcps
* @param[in] num_spads : actual effective spads in 8.8
* @param[in] max_output_value : User set value to clip output
*
* @return rate_per_spad : uint16_t count rate in variable fractional format
*/
uint16_t VL53L1_rate_per_spad_maths(
uint32_t frac_bits,
uint32_t peak_count_rate,
uint16_t num_spads,
uint32_t max_output_value);
/**
* @brief Calculates the range from the phase data
*
* Uses a temporary int64_t variable internally
*
* @param[in] fast_osc_frequency : Fast oscillator freq [MHz] 4.12 format
* @param[in] phase : phase in 5.11 format
* @param[in] zero_distance_phase : zero distance phase in 5.11 format
* @param[in] fractional_bits : valid options : 0, 1, 2
* @param[in] gain_factor : gain correction factor 1.11 format
* @param[in] range_offset_mm : range offset [mm] 14.2 format
* @return range_mm : signed range in [mm]
* format depends on fractional_bits input
*/
int32_t VL53L1_range_maths(
uint16_t fast_osc_frequency,
uint16_t phase,
uint16_t zero_distance_phase,
uint8_t fractional_bits,
int32_t gain_factor,
int32_t range_offset_mm);
#endif
/**
* @brief Decodes VCSEL period register value into the real period in PLL clocks
*
* @param[in] vcsel_period_reg : 8 -bit register value
*
* @return vcsel_period_pclks : 8-bit decoded value
*
*/
uint8_t VL53L1_decode_vcsel_period(
uint8_t vcsel_period_reg);
/**
* @brief Decodes the Byte.Bit coord encoding into an (x,y) coord value
*
* @param[in] spad_number : Coord location in Byte.Bit format
* @param[out] prow : Decoded row
* @param[out] pcol : Decoded column
*
*/
void VL53L1_decode_row_col(
uint8_t spad_number,
uint8_t *prow,
uint8_t *pcol);
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_CORE_SUPPORT_H_ */

View File

@@ -0,0 +1,603 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/******************************************************************************
* Copyright (c) 2020, STMicroelectronics - All Rights Reserved
This file is part of VL53L1 and is dual licensed,
either GPL-2.0+
or 'BSD 3-clause "New" or "Revised" License' , at your option.
******************************************************************************
*/
/**
* @file vl53l1_def.h
*
* @brief Type definitions for VL53L1 API.
*
*/
#ifndef _VL53L1_DEF_H_
#define _VL53L1_DEF_H_
#include "vl53l1_ll_def.h"
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup VL53L1_globaldefine_group VL53L1 Defines
* @brief VL53L1 Defines
* @{
*/
/** VL53L1 IMPLEMENTATION major version */
#define VL53L1_IMPLEMENTATION_VER_MAJOR 2
/** VL53L1 IMPLEMENTATION minor version */
#define VL53L1_IMPLEMENTATION_VER_MINOR 4
/** VL53L1 IMPLEMENTATION sub version */
#define VL53L1_IMPLEMENTATION_VER_SUB 5
/** VL53L1 IMPLEMENTATION sub version */
#define VL53L1_IMPLEMENTATION_VER_REVISION 2548
/****************************************
* PRIVATE define do not edit
****************************************/
/** @brief Defines the parameters of the Get Version Functions
*/
typedef struct {
uint32_t revision; /*!< revision number */
uint8_t major; /*!< major number */
uint8_t minor; /*!< minor number */
uint8_t build; /*!< build number */
} VL53L1_Version_t;
#define VL53L1_DEVINFO_STRLEN 32
/** @brief Defines the parameters of the Get Device Info Functions
*/
typedef struct {
char Name[VL53L1_DEVINFO_STRLEN];
/*!< Full Name of the Device e.g. VL53L1 cut1.1 */
char Type[VL53L1_DEVINFO_STRLEN];
/*!< Type of the Device e.g VL53L1 */
char ProductId[VL53L1_DEVINFO_STRLEN];
/*!< Product Identifier String
* @warning Not yet implemented
*/
uint8_t ProductType;
/*!< Product Type, VL53L1 = 0xCC, VL53L3 = 0xAA
* Stands as module_type in the datasheet
*/
uint8_t ProductRevisionMajor;
/*!< Product revision major */
uint8_t ProductRevisionMinor;
/*!< Product revision minor */
} VL53L1_DeviceInfo_t;
/** @defgroup VL53L1_define_PresetModes_group Defines Preset modes
* Defines all possible preset modes for the device
* @{
*/
typedef uint8_t VL53L1_PresetModes;
#define VL53L1_PRESETMODE_AUTONOMOUS ((VL53L1_PresetModes) 3)
#define VL53L1_PRESETMODE_LITE_RANGING ((VL53L1_PresetModes) 4)
#define VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS ((VL53L1_PresetModes) 8)
/* ... Modes to be added depending on device */
/** @} VL53L1_define_PresetModes_group */
/** @defgroup VL53L1_define_DistanceModes_group Defines Distance modes
* Defines all possible Distance modes for the device
* @{
*/
typedef uint8_t VL53L1_DistanceModes;
#define VL53L1_DISTANCEMODE_SHORT ((VL53L1_DistanceModes) 1)
#define VL53L1_DISTANCEMODE_MEDIUM ((VL53L1_DistanceModes) 2)
#define VL53L1_DISTANCEMODE_LONG ((VL53L1_DistanceModes) 3)
/** @} VL53L1_define_DistanceModes_group */
/** @defgroup VL53L1_define_XtalkCal_group Defines Xtalk Calibration modes
* Defines all possible Offset Calibration modes for the device
* @{
*/
typedef uint8_t VL53L1_XtalkCalibrationModes;
#define VL53L1_XTALKCALIBRATIONMODE_NO_TARGET \
((VL53L1_OffsetCalibrationModes) 0)
/*!< To perform Xtalk calibration with no target below 80 cm */
#define VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET \
((VL53L1_OffsetCalibrationModes) 1)
/*!< To perform Xtalk calibration with one target */
#define VL53L1_XTALKCALIBRATIONMODE_FULL_ROI \
((VL53L1_OffsetCalibrationModes) 2)
/*!< To perform Xtalk calibration based on histogram with full ROI */
/** @} VL53L1_define_XtalkCal_group */
/** @defgroup VL53L1_define_OffsetCal_group Defines Offset Calibration modes
* Defines all possible Offset Calibration modes for the device
* @{
*/
typedef uint8_t VL53L1_OffsetCalibrationModes;
#define VL53L1_OFFSETCALIBRATIONMODE_STANDARD \
((VL53L1_OffsetCalibrationModes) 1)
#define VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY \
((VL53L1_OffsetCalibrationModes) 2)
/** @} VL53L1_define_OffsetCal_group */
/** @defgroup VL53L1_CheckEnable_group Check Enable list
* @brief Check Enable code
*
* Define used to specify the LimitCheckId.
* Use @a VL53L1_GetLimitCheckInfo() to get the string.
* @{
*/
#define VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE 0
#define VL53L1_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE 1
#define VL53L1_CHECKENABLE_NUMBER_OF_CHECKS 2
/** @} end of VL53L1_CheckEnable_group */
/** @defgroup VL53L1_ThresholdMode_gropup Detection Functionality
* @brief Defines the different functionalities for the detection feature
* @{
*/
typedef uint8_t VL53L1_ThresholdMode;
#define VL53L1_THRESHOLD_CROSSED_LOW \
((VL53L1_ThresholdMode) 0)
/*!< Trigger interrupt if value < thresh_low */
#define VL53L1_THRESHOLD_CROSSED_HIGH \
((VL53L1_ThresholdMode) 1)
/*!< Trigger interrupt if value > thresh_high */
#define VL53L1_THRESHOLD_OUT_OF_WINDOW \
((VL53L1_ThresholdMode) 2)
/*!< Trigger interrupt if value < thresh_low OR value > thresh_high */
#define VL53L1_THRESHOLD_IN_WINDOW \
((VL53L1_ThresholdMode) 3)
/*!< Trigger interrupt if value > thresh_low AND value < thresh_high */
/** @} end of VL53L1_ThresholdMode_gropup */
/** @brief Defines parameters for Distance detection Thresholds configuration
*/
typedef struct {
VL53L1_ThresholdMode CrossMode;
uint16_t High; /*!< Distance threshold high limit in mm */
uint16_t Low; /*!< Distance threshold low limit in mm */
} VL53L1_DistanceThreshold_t;
/** @brief Defines parameters for Signal rate detection Thresholds configuration
*/
typedef struct {
VL53L1_ThresholdMode CrossMode;
FixPoint1616_t High; /*!< Signal rate threshold high limit */
FixPoint1616_t Low; /*!< Signal rate threshold low limit */
} VL53L1_RateThreshold_t;
/** @defgroup VL53L1_DetectionMode_group Gpio Functionality
* @brief Defines conditions leading to device's IT on GPIO
* @{
*/
typedef uint8_t VL53L1_DetectionMode;
#define VL53L1_DETECTION_NORMAL_RUN \
((VL53L1_DetectionMode) 0)
/*!< Trigger interrupt on new measurement regardless of threshold
* just like after a VL53L1_SetPresetMode() call
*/
#define VL53L1_DETECTION_DISTANCE_ONLY \
((VL53L1_DetectionMode) 1)
/*!< Trigger interrupt if "threshold event" occurs on distance */
#define VL53L1_DETECTION_RATE_ONLY \
((VL53L1_DetectionMode) 2)
/*!< Trigger interrupt if "threshold event" occurs on signal rate */
#define VL53L1_DETECTION_DISTANCE_AND_RATE \
((VL53L1_DetectionMode) 3)
/*!< Trigger interrupt if "threshold event" occurs on distance AND rate
*/
#define VL53L1_DETECTION_DISTANCE_OR_RATE \
((VL53L1_DetectionMode) 4)
/*!< Trigger interrupt if "threshold event" occurs on distance OR rate
*/
/** @} end of VL53L1_DetectionMode_group */
/** @brief Defines parameters for User/object Detection configuration
*/
typedef struct {
VL53L1_DetectionMode DetectionMode; /*!< See #VL53L1_DetectionMode*/
uint8_t IntrNoTarget; /*!< 1 to trigger IT in case of no target found */
VL53L1_DistanceThreshold_t Distance; /*!< limits in mm */
VL53L1_RateThreshold_t Rate;/*!< limits in FixPoint1616_t */
} VL53L1_DetectionConfig_t;
/** @brief Defines all parameters for the device
*/
typedef struct {
VL53L1_PresetModes PresetMode;
/*!< Defines the operating mode to be used for the next measure */
VL53L1_DistanceModes DistanceMode;
/*!< Defines the operating mode to be used for the next measure */
uint32_t MeasurementTimingBudgetMicroSeconds;
/*!< Defines the allowed total time for a single measurement */
uint8_t LimitChecksEnable[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
/*!< This Array store all the Limit Check enable for this device. */
uint8_t LimitChecksStatus[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
/*!< This Array stores all the Status of the check linked to last
* measurement.
*/
FixPoint1616_t LimitChecksValue[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
/*!< This Array stores all the Limit Check value for this device */
FixPoint1616_t LimitChecksCurrent[VL53L1_CHECKENABLE_NUMBER_OF_CHECKS];
/*!< This Array stores all the Limit Check current value from latest
* ranging
*/
} VL53L1_DeviceParameters_t;
/** @defgroup VL53L1_define_State_group Defines the current status of the device
* Defines the current status of the device
* @{
*/
typedef uint8_t VL53L1_State;
#define VL53L1_STATE_POWERDOWN ((VL53L1_State) 0)
/*!< Device is in HW reset */
#define VL53L1_STATE_WAIT_STATICINIT ((VL53L1_State) 1)
/*!< Device is initialized and wait for static initialization */
#define VL53L1_STATE_STANDBY ((VL53L1_State) 2)
/*!< Device is in Low power Standby mode */
#define VL53L1_STATE_IDLE ((VL53L1_State) 3)
/*!< Device has been initialized and ready to do measurements */
#define VL53L1_STATE_RUNNING ((VL53L1_State) 4)
/*!< Device is performing measurement */
#define VL53L1_STATE_RESET ((VL53L1_State) 5)
/*!< Soft reset has been run on Device */
#define VL53L1_STATE_UNKNOWN ((VL53L1_State) 98)
/*!< Device is in unknown state and need to be rebooted */
#define VL53L1_STATE_ERROR ((VL53L1_State) 99)
/*!< Device is in error state and need to be rebooted */
/** @} VL53L1_define_State_group */
/**
* @struct VL53L1_RangingMeasurementData_t
* @brief Single Range measurement data.
*/
typedef struct {
uint32_t TimeStamp;
/*!< 32-bit time stamp.
* @warning Not yet implemented
*/
uint8_t StreamCount;
/*!< 8-bit Stream Count. */
uint8_t RangeQualityLevel;
/*!< indicate a quality level in percentage from 0 to 100
* @warning Not yet implemented
*/
FixPoint1616_t SignalRateRtnMegaCps;
/*!< Return signal rate (MCPS)\n these is a 16.16 fix point
* value, which is effectively a measure of target
* reflectance.
*/
FixPoint1616_t AmbientRateRtnMegaCps;
/*!< Return ambient rate (MCPS)\n these is a 16.16 fix point
* value, which is effectively a measure of the ambient
* light.
*/
uint16_t EffectiveSpadRtnCount;
/*!< Return the effective SPAD count for the return signal.
* To obtain Real value it should be divided by 256
*/
FixPoint1616_t SigmaMilliMeter;
/*!< Return the Sigma value in millimeter */
int16_t RangeMilliMeter;
/*!< range distance in millimeter. This should be between
* RangeMinMilliMeter and RangeMaxMilliMeter
*/
uint8_t RangeFractionalPart;
/*!< Fractional part of range distance. Final value is a
* RangeMilliMeter + RangeFractionalPart/256.
* @warning Not yet implemented
*/
uint8_t RangeStatus;
/*!< Range Status for the current measurement. This is device
* dependent. Value = 0 means value is valid.
*/
} VL53L1_RangingMeasurementData_t;
/** @brief Defines User Zone(ROI) parameters
*
*/
typedef struct {
uint8_t TopLeftX; /*!< Top Left x coordinate: 0-15 range */
uint8_t TopLeftY; /*!< Top Left y coordinate: 0-15 range */
uint8_t BotRightX; /*!< Bot Right x coordinate: 0-15 range */
uint8_t BotRightY; /*!< Bot Right y coordinate: 0-15 range */
} VL53L1_UserRoi_t;
/** @brief Defines ROI configuration parameters
*
* Support up a max of 16 zones, Each Zone has the same size
*
*/
/**
* @struct VL53L1_CustomerNvmManaged_t
*
*/
typedef struct {
uint8_t global_config__spad_enables_ref_0;
uint8_t global_config__spad_enables_ref_1;
uint8_t global_config__spad_enables_ref_2;
uint8_t global_config__spad_enables_ref_3;
uint8_t global_config__spad_enables_ref_4;
uint8_t global_config__spad_enables_ref_5;
uint8_t global_config__ref_en_start_select;
uint8_t ref_spad_man__num_requested_ref_spads;
uint8_t ref_spad_man__ref_location;
uint32_t algo__crosstalk_compensation_plane_offset_kcps;
int16_t algo__crosstalk_compensation_x_plane_gradient_kcps;
int16_t algo__crosstalk_compensation_y_plane_gradient_kcps;
uint16_t ref_spad_char__total_rate_target_mcps;
int16_t algo__part_to_part_range_offset_mm;
int16_t mm_config__inner_offset_mm;
int16_t mm_config__outer_offset_mm;
} VL53L1_CustomerNvmManaged_t;
/**
* @struct VL53L1_CalibrationData_t
* @brief Structure for storing the Calibration Data
*
*/
typedef struct {
uint32_t struct_version;
VL53L1_CustomerNvmManaged_t customer;
VL53L1_additional_offset_cal_data_t add_off_cal_data;
VL53L1_optical_centre_t optical_centre;
VL53L1_gain_calibration_data_t gain_cal;
VL53L1_cal_peak_rate_map_t cal_peak_rate_map;
} VL53L1_CalibrationData_t;
#define VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION 0x20
/** VL53L1 additional Calibration Data struct version final struct version
* is given by adding it to VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION
*/
#define VL53L1_CALIBRATION_DATA_STRUCT_VERSION \
(VL53L1_LL_CALIBRATION_DATA_STRUCT_VERSION + \
VL53L1_ADDITIONAL_CALIBRATION_DATA_STRUCT_VERSION)
/* VL53L1 Calibration Data struct version */
/**
* @struct VL53L1_AdditionalData_t
* @brief Structure for storing the Additional Data
*
*/
typedef VL53L1_additional_data_t VL53L1_AdditionalData_t;
typedef uint8_t VL53L1_SequenceStepId;
#define VL53L1_SEQUENCESTEP_VHV ((VL53L1_SequenceStepId) 0)
/*!<VHV. */
#define VL53L1_SEQUENCESTEP_PHASECAL ((VL53L1_SequenceStepId) 1)
/*!<Phase Calibration. */
#define VL53L1_SEQUENCESTEP_REFPHASE ((VL53L1_SequenceStepId) 2)
/*!<Reference Phase. */
#define VL53L1_SEQUENCESTEP_DSS1 ((VL53L1_SequenceStepId) 3)
/*!<DSS1. */
#define VL53L1_SEQUENCESTEP_DSS2 ((VL53L1_SequenceStepId) 4)
/*!<DSS2. */
#define VL53L1_SEQUENCESTEP_MM1 ((VL53L1_SequenceStepId) 5)
/*!<Mode Mitigation 1. */
#define VL53L1_SEQUENCESTEP_MM2 ((VL53L1_SequenceStepId) 6)
/*!<Mode Mitigation 2. */
#define VL53L1_SEQUENCESTEP_RANGE ((VL53L1_SequenceStepId) 7)
/*!<Final Range step. */
#define VL53L1_SEQUENCESTEP_NUMBER_OF_ITEMS 8
/*!<Number of Sequence Step Managed by the API. */
/** @defgroup VL53L1_define_RangeStatus_group Defines the Range Status
* @{
*/
#define VL53L1_RANGESTATUS_RANGE_VALID 0
/*!<The Range is valid. */
#define VL53L1_RANGESTATUS_SIGMA_FAIL 1
/*!<Sigma Fail. */
#define VL53L1_RANGESTATUS_SIGNAL_FAIL 2
/*!<Signal fail. */
#define VL53L1_RANGESTATUS_RANGE_VALID_MIN_RANGE_CLIPPED 3
/*!<Target is below minimum detection threshold. */
#define VL53L1_RANGESTATUS_OUTOFBOUNDS_FAIL 4
/*!<Phase out of valid limits - different to a wrap exit. */
#define VL53L1_RANGESTATUS_HARDWARE_FAIL 5
/*!<Hardware fail. */
#define VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL 6
/*!<The Range is valid but the wraparound check has not been done. */
#define VL53L1_RANGESTATUS_WRAP_TARGET_FAIL 7
/*!<Wrapped target - no matching phase in other VCSEL period timing. */
#define VL53L1_RANGESTATUS_PROCESSING_FAIL 8
/*!<Internal algo underflow or overflow in lite ranging. */
#define VL53L1_RANGESTATUS_XTALK_SIGNAL_FAIL 9
/*!<Specific to lite ranging. */
#define VL53L1_RANGESTATUS_SYNCRONISATION_INT 10
/*!<1st interrupt when starting ranging in back to back mode. Ignore data. */
#define VL53L1_RANGESTATUS_RANGE_VALID_MERGED_PULSE 11
/*!<All Range ok but object is result of multiple pulses merging together.
* Used by RQL for merged pulse detection
*/
#define VL53L1_RANGESTATUS_TARGET_PRESENT_LACK_OF_SIGNAL 12
/*!<Used by RQL as different to phase fail. */
#define VL53L1_RANGESTATUS_MIN_RANGE_FAIL 13
/*!<User ROI input is not valid e.g. beyond SPAD Array.*/
#define VL53L1_RANGESTATUS_RANGE_INVALID 14
/*!<lld returned valid range but negative value ! */
#define VL53L1_RANGESTATUS_NONE 255
/*!<No Update. */
/** @} VL53L1_define_RangeStatus_group */
/** @brief Contains the Internal data of the Bare Driver
*/
typedef struct {
VL53L1_LLDriverData_t LLData;
/*!< Low Level Driver data structure */
VL53L1_LLDriverResults_t llresults;
/*!< Low Level Driver data structure */
VL53L1_State PalState; /* Store the pal state */
VL53L1_DeviceParameters_t CurrentParameters;
/*!< Current Device Parameter */
} VL53L1_DevData_t;
/* MACRO Definitions */
/** @defgroup VL53L1_define_GeneralMacro_group General Macro Defines
* General Macro Defines
* @{
*/
/* Defines */
#define VL53L1_SETPARAMETERFIELD(Dev, field, value) \
(VL53L1DevDataSet(Dev, CurrentParameters.field, value))
#define VL53L1_GETPARAMETERFIELD(Dev, field, variable) \
(variable = VL53L1DevDataGet(Dev, CurrentParameters).field)
#define VL53L1_SETARRAYPARAMETERFIELD(Dev, field, index, value) \
(VL53L1DevDataSet(Dev, CurrentParameters.field[index], value))
#define VL53L1_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \
(variable = VL53L1DevDataGet(Dev, CurrentParameters).field[index])
#define VL53L1_SETDEVICESPECIFICPARAMETER(Dev, field, value) \
(VL53L1DevDataSet(Dev, DeviceSpecificParameters.field, value))
#define VL53L1_GETDEVICESPECIFICPARAMETER(Dev, field) \
(VL53L1DevDataGet(Dev, DeviceSpecificParameters).field)
#define VL53L1_FIXPOINT1616TOFIXPOINT44(Value) \
(uint16_t)((Value>>12)&0xFFFF)
#define VL53L1_FIXPOINT44TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<12)
#define VL53L1_FIXPOINT1616TOFIXPOINT72(Value) \
(uint16_t)((Value>>14)&0xFFFF)
#define VL53L1_FIXPOINT72TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<14)
#define VL53L1_FIXPOINT1616TOFIXPOINT97(Value) \
(uint16_t)((Value>>9)&0xFFFF)
#define VL53L1_FIXPOINT97TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<9)
#define VL53L1_FIXPOINT1616TOFIXPOINT88(Value) \
(uint16_t)((Value>>8)&0xFFFF)
#define VL53L1_FIXPOINT88TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<8)
#define VL53L1_FIXPOINT1616TOFIXPOINT412(Value) \
(uint16_t)((Value>>4)&0xFFFF)
#define VL53L1_FIXPOINT412TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<4)
#define VL53L1_FIXPOINT1616TOFIXPOINT313(Value) \
(uint16_t)((Value>>3)&0xFFFF)
#define VL53L1_FIXPOINT313TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<3)
#define VL53L1_FIXPOINT1616TOFIXPOINT08(Value) \
(uint8_t)((Value>>8)&0x00FF)
#define VL53L1_FIXPOINT08TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<8)
#define VL53L1_FIXPOINT1616TOFIXPOINT53(Value) \
(uint8_t)((Value>>13)&0x00FF)
#define VL53L1_FIXPOINT53TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<13)
#define VL53L1_FIXPOINT1616TOFIXPOINT102(Value) \
(uint16_t)((Value>>14)&0x0FFF)
#define VL53L1_FIXPOINT102TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<14)
#define VL53L1_FIXPOINT1616TOFIXPOINT142(Value) \
(uint16_t)((Value>>14)&0xFFFF)
#define VL53L1_FIXPOINT142TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<14)
#define VL53L1_FIXPOINT1616TOFIXPOINT160(Value) \
(uint16_t)((Value>>16)&0xFFFF)
#define VL53L1_FIXPOINT160TOFIXPOINT1616(Value) \
(FixPoint1616_t)((uint32_t)Value<<16)
#define VL53L1_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \
(uint16_t)lsb)
#ifndef SUPPRESS_UNUSED_WARNING
#define SUPPRESS_UNUSED_WARNING(x) ((void) (x))
#endif
/** @} VL53L1_define_GeneralMacro_group */
/** @} VL53L1_globaldefine_group */
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_DEF_H_ */

View File

@@ -0,0 +1,253 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_error_codes.h
*
* @brief Error Code definitions for VL53L1 API.
*
*/
#ifndef _VL53L1_ERROR_CODES_H_
#define _VL53L1_ERROR_CODES_H_
#include "vl53l1_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/****************************************
* PRIVATE define do not edit
****************************************/
/** @defgroup VL53L1_define_Error_group Error and Warning code returned by API
* The following DEFINE are used to identify the PAL ERROR
* @{
*/
typedef int8_t VL53L1_Error;
#define VL53L1_ERROR_NONE ((VL53L1_Error) 0)
#define VL53L1_ERROR_CALIBRATION_WARNING ((VL53L1_Error) - 1)
/*!< Warning invalid calibration data may be in used
\a VL53L1_InitData()
\a VL53L1_GetOffsetCalibrationData
\a VL53L1_SetOffsetCalibrationData */
#define VL53L1_ERROR_MIN_CLIPPED ((VL53L1_Error) - 2)
/*!< Warning parameter passed was clipped to min before to be applied */
#define VL53L1_ERROR_UNDEFINED ((VL53L1_Error) - 3)
/*!< Unqualified error */
#define VL53L1_ERROR_INVALID_PARAMS ((VL53L1_Error) - 4)
/*!< Parameter passed is invalid or out of range */
#define VL53L1_ERROR_NOT_SUPPORTED ((VL53L1_Error) - 5)
/*!< Function is not supported in current mode or configuration */
#define VL53L1_ERROR_RANGE_ERROR ((VL53L1_Error) - 6)
/*!< Device report a ranging error interrupt status */
#define VL53L1_ERROR_TIME_OUT ((VL53L1_Error) - 7)
/*!< Aborted due to time out */
#define VL53L1_ERROR_MODE_NOT_SUPPORTED ((VL53L1_Error) - 8)
/*!< Asked mode is not supported by the device */
#define VL53L1_ERROR_BUFFER_TOO_SMALL ((VL53L1_Error) - 9)
/*!< ... */
#define VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL ((VL53L1_Error) - 10)
/*!< Supplied buffer is larger than I2C supports */
#define VL53L1_ERROR_GPIO_NOT_EXISTING ((VL53L1_Error) - 11)
/*!< User tried to setup a non-existing GPIO pin */
#define VL53L1_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED ((VL53L1_Error) - 12)
/*!< unsupported GPIO functionality */
#define VL53L1_ERROR_CONTROL_INTERFACE ((VL53L1_Error) - 13)
/*!< error reported from IO functions */
#define VL53L1_ERROR_INVALID_COMMAND ((VL53L1_Error) - 14)
/*!< The command is not allowed in the current device state
* (power down) */
#define VL53L1_ERROR_DIVISION_BY_ZERO ((VL53L1_Error) - 15)
/*!< In the function a division by zero occurs */
#define VL53L1_ERROR_REF_SPAD_INIT ((VL53L1_Error) - 16)
/*!< Error during reference SPAD initialization */
#define VL53L1_ERROR_GPH_SYNC_CHECK_FAIL ((VL53L1_Error) - 17)
/*!< GPH sync interrupt check fail - API out of sync with device*/
#define VL53L1_ERROR_STREAM_COUNT_CHECK_FAIL ((VL53L1_Error) - 18)
/*!< Stream count check fail - API out of sync with device */
#define VL53L1_ERROR_GPH_ID_CHECK_FAIL ((VL53L1_Error) - 19)
/*!< GPH ID check fail - API out of sync with device */
#define VL53L1_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL ((VL53L1_Error) - 20)
/*!< Zone dynamic config stream count check failed - API out of sync */
#define VL53L1_ERROR_ZONE_GPH_ID_CHECK_FAIL ((VL53L1_Error) - 21)
/*!< Zone dynamic config GPH ID check failed - API out of sync */
#define VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL ((VL53L1_Error) - 22)
/*!< Thrown when run_xtalk_extraction fn has 0 succesful samples
* when using the full array to sample the xtalk. In this case there is
* not enough information to generate new Xtalk parm info. The function
* will exit and leave the current xtalk parameters unaltered */
#define VL53L1_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL ((VL53L1_Error) - 23)
/*!< Thrown when run_xtalk_extraction fn has found that the
* avg sigma estimate of the full array xtalk sample is > than the
* maximal limit allowed. In this case the xtalk sample is too noisy for
* measurement. The function will exit and leave the current xtalk parameters
* unaltered. */
#define VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL ((VL53L1_Error) - 24)
/*!< Thrown if there one of stages has no valid offset calibration
* samples. A fatal error calibration not valid */
#define VL53L1_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL ((VL53L1_Error) - 25)
/*!< Thrown if there one of stages has zero effective SPADS
* Traps the case when MM1 SPADs is zero.
* A fatal error calibration not valid */
#define VL53L1_ERROR_ZONE_CAL_NO_SAMPLE_FAIL ((VL53L1_Error) - 26)
/*!< Thrown if then some of the zones have no valid samples
* A fatal error calibration not valid */
#define VL53L1_ERROR_TUNING_PARM_KEY_MISMATCH ((VL53L1_Error) - 27)
/*!< Thrown if the tuning file key table version does not match with
* expected value. The driver expects the key table version to match
* the compiled default version number in the define
* #VL53L1_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT
* */
#define VL53L1_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS ((VL53L1_Error) - 28)
/*!< Thrown if there are less than 5 good SPADs are available. */
#define VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH ((VL53L1_Error) - 29)
/*!< Thrown if the final reference rate is greater than
the upper reference rate limit - default is 40 Mcps.
Implies a minimum Q3 (x10) SPAD (5) selected */
#define VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW ((VL53L1_Error) - 30)
/*!< Thrown if the final reference rate is less than
the lower reference rate limit - default is 10 Mcps.
Implies maximum Q1 (x1) SPADs selected */
#define VL53L1_WARNING_OFFSET_CAL_MISSING_SAMPLES ((VL53L1_Error) - 31)
/*!< Thrown if there is less than the requested number of
* valid samples. */
#define VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH ((VL53L1_Error) - 32)
/*!< Thrown if the offset calibration range sigma estimate is greater
* than 8.0 mm. This is the recommended min value to yield a stable
* offset measurement */
#define VL53L1_WARNING_OFFSET_CAL_RATE_TOO_HIGH ((VL53L1_Error) - 33)
/*!< Thrown when VL53L1_run_offset_calibration() peak rate is greater
than that 50.0Mcps. This is the recommended max rate to avoid
pile-up influencing the offset measurement */
#define VL53L1_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW ((VL53L1_Error) - 34)
/*!< Thrown when VL53L1_run_offset_calibration() when one of stages
range has less that 5.0 effective SPADS. This is the recommended
min value to yield a stable offset */
#define VL53L1_WARNING_ZONE_CAL_MISSING_SAMPLES ((VL53L1_Error) - 35)
/*!< Thrown if one of more of the zones have less than
the requested number of valid samples */
#define VL53L1_WARNING_ZONE_CAL_SIGMA_TOO_HIGH ((VL53L1_Error) - 36)
/*!< Thrown if one or more zones have sigma estimate value greater
* than 8.0 mm. This is the recommended min value to yield a stable
* offset measurement */
#define VL53L1_WARNING_ZONE_CAL_RATE_TOO_HIGH ((VL53L1_Error) - 37)
/*!< Thrown if one of more zones have peak rate higher than
that 50.0Mcps. This is the recommended max rate to avoid
pile-up influencing the offset measurement */
#define VL53L1_WARNING_XTALK_MISSING_SAMPLES ((VL53L1_Error) - 38)
/*!< Thrown to notify that some of the xtalk samples did not yield
* valid ranging pulse data while attempting to measure
* the xtalk signal in vl53l1_run_xtalk_extract(). This can signify any of
* the zones are missing samples, for further debug information the
* xtalk_results struct should be referred to. This warning is for
* notification only, the xtalk pulse and shape have still been generated
*/
#define VL53L1_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT ((VL53L1_Error) - 39)
/*!< Thrown to notify that some of teh xtalk samples used for gradient
* generation did not yield valid ranging pulse data while attempting to
* measure the xtalk signal in vl53l1_run_xtalk_extract(). This can signify
* that any one of the zones 0-3 yielded no successful samples. The
* xtalk_results struct should be referred to for further debug info.
* This warning is for notification only, the xtalk pulse and shape
* have still been generated.
*/
#define VL53L1_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT ((VL53L1_Error) - 40)
/*!< Thrown to notify that some of the xtalk samples used for gradient
* generation did not pass the sigma limit check while attempting to
* measure the xtalk signal in vl53l1_run_xtalk_extract(). This can signify
* that any one of the zones 0-3 yielded an avg sigma_mm value > the limit.
* The xtalk_results struct should be referred to for further debug info.
* This warning is for notification only, the xtalk pulse and shape
* have still been generated.
*/
#define VL53L1_ERROR_NOT_IMPLEMENTED ((VL53L1_Error) - 41)
/*!< Tells requested functionality has not been implemented yet or
* not compatible with the device */
#define VL53L1_ERROR_PLATFORM_SPECIFIC_START ((VL53L1_Error) - 60)
/*!< Tells the starting code for platform */
/** @} VL53L1_define_Error_group */
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_ERROR_CODES_H_ */

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_error_exceptions.h
*
* @brief EwokPlus25 LL Driver definitions for control of error handling in LL driver
*/
#ifndef _VL53L1_ERROR_EXCEPTIONS_H_
#define _VL53L1_ERROR_EXCEPTIONS_H_
#define IGNORE_DIVISION_BY_ZERO 0
#define IGNORE_XTALK_EXTRACTION_NO_SAMPLE_FAIL 0
#define IGNORE_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL 0
#define IGNORE_XTALK_EXTRACTION_NO_SAMPLE_FOR_GRADIENT_WARN 0
#define IGNORE_XTALK_EXTRACTION_SIGMA_LIMIT_FOR_GRADIENT_WARN 0
#define IGNORE_XTALK_EXTRACTION_MISSING_SAMPLES_WARN 0
#define IGNORE_REF_SPAD_CHAR_NOT_ENOUGH_SPADS 0
#define IGNORE_REF_SPAD_CHAR_RATE_TOO_HIGH 0
#define IGNORE_REF_SPAD_CHAR_RATE_TOO_LOW 0
#define IGNORE_OFFSET_CAL_MISSING_SAMPLES 0
#define IGNORE_OFFSET_CAL_SIGMA_TOO_HIGH 0
#define IGNORE_OFFSET_CAL_RATE_TOO_HIGH 0
#define IGNORE_OFFSET_CAL_SPAD_COUNT_TOO_LOW 0
#define IGNORE_ZONE_CAL_MISSING_SAMPLES 0
#define IGNORE_ZONE_CAL_SIGMA_TOO_HIGH 0
#define IGNORE_ZONE_CAL_RATE_TOO_HIGH 0
#endif /* _VL53L1_ERROR_EXCEPTIONS_H_ */

View File

@@ -0,0 +1,209 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_error_strings.h
* @brief VL53L1 function declarations for decoding error codes to a
* text strings
*/
#ifndef VL53L1_ERROR_STRINGS_H_
#define VL53L1_ERROR_STRINGS_H_
#include "vl53l1_error_codes.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Generates an error string for the input PAL error code
*
* @param[in] PalErrorCode : PAL Error Code
* @param[out] pPalErrorString : pointer to character buffer
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_get_pal_error_string(
VL53L1_Error PalErrorCode,
char *pPalErrorString);
#ifndef VL53L1_USE_EMPTY_STRING
/* PAL ERROR strings */
#define VL53L1_STRING_ERROR_NONE \
"No Error"
#define VL53L1_STRING_ERROR_CALIBRATION_WARNING \
"Calibration Warning Error"
#define VL53L1_STRING_ERROR_MIN_CLIPPED \
"Min clipped error"
#define VL53L1_STRING_ERROR_UNDEFINED \
"Undefined error"
#define VL53L1_STRING_ERROR_INVALID_PARAMS \
"Invalid parameters error"
#define VL53L1_STRING_ERROR_NOT_SUPPORTED \
"Not supported error"
#define VL53L1_STRING_ERROR_RANGE_ERROR \
"Range error"
#define VL53L1_STRING_ERROR_TIME_OUT \
"Time out error"
#define VL53L1_STRING_ERROR_MODE_NOT_SUPPORTED \
"Mode not supported error"
#define VL53L1_STRING_ERROR_BUFFER_TOO_SMALL \
"Buffer too small"
#define VL53L1_STRING_ERROR_COMMS_BUFFER_TOO_SMALL \
"Comms Buffer too small"
#define VL53L1_STRING_ERROR_GPIO_NOT_EXISTING \
"GPIO not existing"
#define VL53L1_STRING_ERROR_GPIO_FUNCTIONALITY_NOT_SUPPORTED \
"GPIO funct not supported"
#define VL53L1_STRING_ERROR_CONTROL_INTERFACE \
"Control Interface Error"
#define VL53L1_STRING_ERROR_INVALID_COMMAND \
"Invalid Command Error"
#define VL53L1_STRING_ERROR_DIVISION_BY_ZERO \
"Division by zero Error"
#define VL53L1_STRING_ERROR_REF_SPAD_INIT \
"Reference Spad Init Error"
#define VL53L1_STRING_ERROR_GPH_SYNC_CHECK_FAIL \
"GPH Sync Check Fail - API out of sync"
#define VL53L1_STRING_ERROR_STREAM_COUNT_CHECK_FAIL \
"Stream Count Check Fail - API out of sync"
#define VL53L1_STRING_ERROR_GPH_ID_CHECK_FAIL \
"GPH ID Check Fail - API out of sync"
#define VL53L1_STRING_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL \
"Zone Stream Count Check Fail - API out of sync"
#define VL53L1_STRING_ERROR_ZONE_GPH_ID_CHECK_FAIL \
"Zone GPH ID Check Fail - API out of sync"
#define VL53L1_STRING_ERROR_XTALK_EXTRACTION_NO_SAMPLES_FAIL \
"No Xtalk using full array - Xtalk Extract Fail"
#define VL53L1_STRING_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL \
"Xtalk does not meet required sigma limit - Xtalk Extract Fail"
#define VL53L1_STRING_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL \
"Offset Cal - one of more stages with no valid samples - fatal"
#define VL53L1_STRING_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL \
"Offset Cal - one of more stages with no SPADS enables - fatal"
#define VL53L1_STRING_ERROR_ZONE_CAL_NO_SAMPLE_FAIL \
"Zone Cal - one of more zones with no valid samples - fatal"
#define VL53L1_STRING_WARNING_REF_SPAD_CHAR_NOT_ENOUGH_SPADS \
"Ref SPAD Char - Not Enough Good SPADs"
#define VL53L1_STRING_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH \
"Ref SPAD Char - Final Ref Rate too high"
#define VL53L1_STRING_WARNING_REF_SPAD_CHAR_RATE_TOO_LOW \
"Ref SPAD Char - Final Ref Rate too low"
#define VL53L1_STRING_WARNING_OFFSET_CAL_MISSING_SAMPLES \
"Offset Cal - Less than the requested number of valid samples"
#define VL53L1_STRING_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH \
"Offset Cal - Sigma estimate value too high - offset not stable"
#define VL53L1_STRING_WARNING_OFFSET_CAL_RATE_TOO_HIGH \
"Offset Cal - Rate too high - in pile up"
#define VL53L1_STRING_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW \
"Offset Cal - Insufficient SPADs - offset may not be stable"
#define VL53L1_STRING_WARNING_ZONE_CAL_MISSING_SAMPLES \
"Zone Cal - One or more zone with less than requested valid samples"
#define VL53L1_STRING_WARNING_ZONE_CAL_SIGMA_TOO_HIGH \
"Zone Cal - One of more zones the sigma estimate too high"
#define VL53L1_STRING_WARNING_ZONE_CAL_RATE_TOO_HIGH \
"Zone Cal - One of more zones with rate too high - in pile up"
#define VL53L1_STRING_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT \
"Xtalk - Gradient sample num = 0"
#define VL53L1_STRING_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT \
"Xtalk - Gradient Sigma > Limit"
#define VL53L1_STRING_WARNING_XTALK_MISSING_SAMPLES \
"Xtalk - Some missing and invalid samples"
#define VL53L1_STRING_ERROR_DEVICE_FIRMWARE_TOO_OLD \
"Device Firmware too old"
#define VL53L1_STRING_ERROR_DEVICE_FIRMWARE_TOO_NEW \
"Device Firmware too new"
#define VL53L1_STRING_ERROR_UNIT_TEST_FAIL \
"Unit Test Fail"
#define VL53L1_STRING_ERROR_FILE_READ_FAIL \
"File Read Fail"
#define VL53L1_STRING_ERROR_FILE_WRITE_FAIL \
"File Write Fail"
#define VL53L1_STRING_ERROR_NOT_IMPLEMENTED \
"Not implemented error"
#define VL53L1_STRING_UNKNOW_ERROR_CODE \
"Unknown Error Code"
#endif /* VL53L1_USE_EMPTY_STRING */
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,698 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_ll_device.h
*
* @brief LL Driver Device specific defines. To be adapted by implementer for the
* targeted device.
*/
#ifndef _VL53L1_LL_DEVICE_H_
#define _VL53L1_LL_DEVICE_H_
#include "vl53l1_types.h"
#include "vl53l1_platform_user_config.h"
#define VL53L1_I2C 0x01
#define VL53L1_SPI 0x00
/** @defgroup VL53L1_DevSpecDefines_group VL53L1 Device Specific Defines
* @brief VL53L1 cut1.0 Device Specific Defines
* @{
*/
/** @defgroup VL53L1_define_WaitMethod_group Defines Wait method used
* For example blocking versus non blocking
* @{
*/
typedef uint8_t VL53L1_WaitMethod;
#define VL53L1_WAIT_METHOD_BLOCKING ((VL53L1_WaitMethod) 0)
#define VL53L1_WAIT_METHOD_NON_BLOCKING ((VL53L1_WaitMethod) 1)
/** @} end of VL53L1_define_WaitMethod_group */
/** @defgroup VL53L1_define_DeviceState_group Device State
*
* @brief Defines all possible device states for the device
* @{
*/
typedef uint8_t VL53L1_DeviceState;
#define VL53L1_DEVICESTATE_POWERDOWN ((VL53L1_DeviceState) 0)
#define VL53L1_DEVICESTATE_HW_STANDBY ((VL53L1_DeviceState) 1)
#define VL53L1_DEVICESTATE_FW_COLDBOOT ((VL53L1_DeviceState) 2)
#define VL53L1_DEVICESTATE_SW_STANDBY ((VL53L1_DeviceState) 3)
#define VL53L1_DEVICESTATE_RANGING_DSS_AUTO ((VL53L1_DeviceState) 4)
#define VL53L1_DEVICESTATE_RANGING_DSS_MANUAL ((VL53L1_DeviceState) 5)
#define VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC ((VL53L1_DeviceState) 6)
#define VL53L1_DEVICESTATE_RANGING_GATHER_DATA ((VL53L1_DeviceState) 7)
#define VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA ((VL53L1_DeviceState) 8)
#define VL53L1_DEVICESTATE_UNKNOWN ((VL53L1_DeviceState) 98)
#define VL53L1_DEVICESTATE_ERROR ((VL53L1_DeviceState) 99)
/** @} end of VL53L1_define_DeviceState_group */
/** @defgroup VL53L1_define_DevicePresetModes_group Device Preset Modes
*
* @brief Defines all possible device preset modes. The integer values are
* kept the same as main EwokPlus driver branch
* @{
*/
typedef uint8_t VL53L1_DevicePresetModes;
#define VL53L1_DEVICEPRESETMODE_NONE ((VL53L1_DevicePresetModes) 0)
#define VL53L1_DEVICEPRESETMODE_STANDARD_RANGING ((VL53L1_DevicePresetModes) 1)
#define VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_SHORT_RANGE ((VL53L1_DevicePresetModes) 2)
#define VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_LONG_RANGE ((VL53L1_DevicePresetModes) 3)
#define VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM1_CAL ((VL53L1_DevicePresetModes) 4)
#define VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM2_CAL ((VL53L1_DevicePresetModes) 5)
#define VL53L1_DEVICEPRESETMODE_TIMED_RANGING ((VL53L1_DevicePresetModes) 6)
#define VL53L1_DEVICEPRESETMODE_TIMED_RANGING_SHORT_RANGE ((VL53L1_DevicePresetModes) 7)
#define VL53L1_DEVICEPRESETMODE_TIMED_RANGING_LONG_RANGE ((VL53L1_DevicePresetModes) 8)
#define VL53L1_DEVICEPRESETMODE_OLT ((VL53L1_DevicePresetModes) 17)
#define VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING ((VL53L1_DevicePresetModes) 18)
#define VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_SHORT_RANGE ((VL53L1_DevicePresetModes) 36)
#define VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_MEDIUM_RANGE ((VL53L1_DevicePresetModes) 37)
#define VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_LONG_RANGE ((VL53L1_DevicePresetModes) 38)
/** @} end of VL53L1_define_DevicePresetModes_group */
/** @defgroup VL53L1_define_DeviceMeasurementModes_group Device Measurement Modes
*
* @brief Defines all possible measurement modes for the device
* @{
*/
typedef uint8_t VL53L1_DeviceMeasurementModes;
#define VL53L1_DEVICEMEASUREMENTMODE_STOP ((VL53L1_DeviceMeasurementModes) 0x00)
#define VL53L1_DEVICEMEASUREMENTMODE_SINGLESHOT ((VL53L1_DeviceMeasurementModes) 0x10)
#define VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK ((VL53L1_DeviceMeasurementModes) 0x20)
#define VL53L1_DEVICEMEASUREMENTMODE_TIMED ((VL53L1_DeviceMeasurementModes) 0x40)
#define VL53L1_DEVICEMEASUREMENTMODE_ABORT ((VL53L1_DeviceMeasurementModes) 0x80)
/** @} VL53L1_define_DeviceMeasurementModes_group */
/** @defgroup VL53L1_define_OffsetCalibrationModes_group Device Offset Calibration Mode
*
* @brief Defines possible offset calibration modes for the device
* @{
*/
typedef uint8_t VL53L1_OffsetCalibrationMode;
#define VL53L1_OFFSETCALIBRATIONMODE__NONE ((VL53L1_OffsetCalibrationMode) 0)
#define VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__STANDARD ((VL53L1_OffsetCalibrationMode) 1)
#define VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__HISTOGRAM ((VL53L1_OffsetCalibrationMode) 2)
#define VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__STANDARD_PRE_RANGE_ONLY ((VL53L1_OffsetCalibrationMode) 3)
#define VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__HISTOGRAM_PRE_RANGE_ONLY ((VL53L1_OffsetCalibrationMode) 4)
#define VL53L1_OFFSETCALIBRATIONMODE__PER_ZONE ((VL53L1_OffsetCalibrationMode) 5)
/** @} VL53L1_define_OffsetCalibrationModes_group */
/** @defgroup VL53L1_define_OffsetCalibrationModes_group Device Offset Correction Mode
*
* @brief Defines all possible offset correction modes for the device
* @{
*/
typedef uint8_t VL53L1_OffsetCorrectionMode;
#define VL53L1_OFFSETCORRECTIONMODE__NONE ((VL53L1_OffsetCorrectionMode) 0)
#define VL53L1_OFFSETCORRECTIONMODE__MM1_MM2_OFFSETS ((VL53L1_OffsetCorrectionMode) 1)
#define VL53L1_OFFSETCORRECTIONMODE__PER_ZONE_OFFSETS ((VL53L1_OffsetCorrectionMode) 2)
/** @} VL53L1_define_OffsetCalibrationModes_group */
/** @defgroup VL53L1_DeviceSequenceConfig_group Device Sequence Config
*
* @brief Individual bit enables for each stage in the ranging scheduler
* The values below encode the bit shift for each bit
* @{
*/
typedef uint8_t VL53L1_DeviceSequenceConfig;
#define VL53L1_DEVICESEQUENCECONFIG_VHV ((VL53L1_DeviceSequenceConfig) 0)
#define VL53L1_DEVICESEQUENCECONFIG_PHASECAL ((VL53L1_DeviceSequenceConfig) 1)
#define VL53L1_DEVICESEQUENCECONFIG_REFERENCE_PHASE ((VL53L1_DeviceSequenceConfig) 2)
#define VL53L1_DEVICESEQUENCECONFIG_DSS1 ((VL53L1_DeviceSequenceConfig) 3)
#define VL53L1_DEVICESEQUENCECONFIG_DSS2 ((VL53L1_DeviceSequenceConfig) 4)
#define VL53L1_DEVICESEQUENCECONFIG_MM1 ((VL53L1_DeviceSequenceConfig) 5)
#define VL53L1_DEVICESEQUENCECONFIG_MM2 ((VL53L1_DeviceSequenceConfig) 6)
#define VL53L1_DEVICESEQUENCECONFIG_RANGE ((VL53L1_DeviceSequenceConfig) 7)
/** @} VL53L1_DeviceSequenceConfig_group */
/** @defgroup VL53L1_DeviceInterruptPolarity_group Device Interrupt Polarity
*
* @brief Device Interrupt Polarity
* @{
*/
typedef uint8_t VL53L1_DeviceInterruptPolarity;
#define VL53L1_DEVICEINTERRUPTPOLARITY_ACTIVE_HIGH ((VL53L1_DeviceInterruptPolarity) 0x00)
#define VL53L1_DEVICEINTERRUPTPOLARITY_ACTIVE_LOW ((VL53L1_DeviceInterruptPolarity) 0x10)
#define VL53L1_DEVICEINTERRUPTPOLARITY_BIT_MASK ((VL53L1_DeviceInterruptPolarity) 0x10)
#define VL53L1_DEVICEINTERRUPTPOLARITY_CLEAR_MASK ((VL53L1_DeviceInterruptPolarity) 0xEF)
/** @} VL53L1_DeviceInterruptPolarity_group */
/** @defgroup VL53L1_DeviceGpioMode_group Device GPIO Mode
*
* @brief Device Gpio Mode
* @{
*/
typedef uint8_t VL53L1_DeviceGpioMode;
#define VL53L1_DEVICEGPIOMODE_OUTPUT_CONSTANT_ZERO ((VL53L1_DeviceGpioMode) 0x00)
#define VL53L1_DEVICEGPIOMODE_OUTPUT_RANGE_AND_ERROR_INTERRUPTS ((VL53L1_DeviceGpioMode) 0x01)
#define VL53L1_DEVICEGPIOMODE_OUTPUT_TIMIER_INTERRUPTS ((VL53L1_DeviceGpioMode) 0x02)
#define VL53L1_DEVICEGPIOMODE_OUTPUT_RANGE_MODE_INTERRUPT_STATUS ((VL53L1_DeviceGpioMode) 0x03)
#define VL53L1_DEVICEGPIOMODE_OUTPUT_SLOW_OSCILLATOR_CLOCK ((VL53L1_DeviceGpioMode) 0x04)
#define VL53L1_DEVICEGPIOMODE_BIT_MASK ((VL53L1_DeviceGpioMode) 0x0F)
#define VL53L1_DEVICEGPIOMODE_CLEAR_MASK ((VL53L1_DeviceGpioMode) 0xF0)
/** @} VL53L1_DeviceGpioMode_group */
/** @defgroup VL53L1_DeviceError_group Device Error
*
* @brief Device Error code in the range status
*
* This enum is Device specific it should be updated in the implementation
* Use @a VL53L1_GetStatusErrorString() to get the string.
* It is related to Status Register of the Device.
* @{
*/
typedef uint8_t VL53L1_DeviceError;
#define VL53L1_DEVICEERROR_NOUPDATE ((VL53L1_DeviceError) 0)
/*!< 0 No Update */
#define VL53L1_DEVICEERROR_VCSELCONTINUITYTESTFAILURE ((VL53L1_DeviceError) 1)
#define VL53L1_DEVICEERROR_VCSELWATCHDOGTESTFAILURE ((VL53L1_DeviceError) 2)
#define VL53L1_DEVICEERROR_NOVHVVALUEFOUND ((VL53L1_DeviceError) 3)
#define VL53L1_DEVICEERROR_MSRCNOTARGET ((VL53L1_DeviceError) 4)
#define VL53L1_DEVICEERROR_RANGEPHASECHECK ((VL53L1_DeviceError) 5)
#define VL53L1_DEVICEERROR_SIGMATHRESHOLDCHECK ((VL53L1_DeviceError) 6)
#define VL53L1_DEVICEERROR_PHASECONSISTENCY ((VL53L1_DeviceError) 7)
#define VL53L1_DEVICEERROR_MINCLIP ((VL53L1_DeviceError) 8)
#define VL53L1_DEVICEERROR_RANGECOMPLETE ((VL53L1_DeviceError) 9)
#define VL53L1_DEVICEERROR_ALGOUNDERFLOW ((VL53L1_DeviceError) 10)
#define VL53L1_DEVICEERROR_ALGOOVERFLOW ((VL53L1_DeviceError) 11)
#define VL53L1_DEVICEERROR_RANGEIGNORETHRESHOLD ((VL53L1_DeviceError) 12)
#define VL53L1_DEVICEERROR_USERROICLIP ((VL53L1_DeviceError) 13)
#define VL53L1_DEVICEERROR_REFSPADCHARNOTENOUGHDPADS ((VL53L1_DeviceError) 14)
#define VL53L1_DEVICEERROR_REFSPADCHARMORETHANTARGET ((VL53L1_DeviceError) 15)
#define VL53L1_DEVICEERROR_REFSPADCHARLESSTHANTARGET ((VL53L1_DeviceError) 16)
#define VL53L1_DEVICEERROR_MULTCLIPFAIL ((VL53L1_DeviceError) 17)
#define VL53L1_DEVICEERROR_GPHSTREAMCOUNT0READY ((VL53L1_DeviceError) 18)
#define VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK ((VL53L1_DeviceError) 19)
#define VL53L1_DEVICEERROR_EVENTCONSISTENCY ((VL53L1_DeviceError) 20)
#define VL53L1_DEVICEERROR_MINSIGNALEVENTCHECK ((VL53L1_DeviceError) 21)
#define VL53L1_DEVICEERROR_RANGECOMPLETE_MERGED_PULSE ((VL53L1_DeviceError) 22)
/* Patch_NewDeviceErrorCodePrevRangeNoTargets_11786 */
#define VL53L1_DEVICEERROR_PREV_RANGE_NO_TARGETS ((VL53L1_DeviceError) 23)
/** @} end of VL53L1_DeviceError_group */
/** @defgroup VL53L1_DeviceReportStatus_group Device Report Status
* @brief Device Report Status code
*
* @{
*/
typedef uint8_t VL53L1_DeviceReportStatus;
#define VL53L1_DEVICEREPORTSTATUS_NOUPDATE ((VL53L1_DeviceReportStatus) 0)
/*!< 0 No Update */
#define VL53L1_DEVICEREPORTSTATUS_ROI_SETUP ((VL53L1_DeviceReportStatus) 1)
#define VL53L1_DEVICEREPORTSTATUS_VHV ((VL53L1_DeviceReportStatus) 2)
#define VL53L1_DEVICEREPORTSTATUS_PHASECAL ((VL53L1_DeviceReportStatus) 3)
#define VL53L1_DEVICEREPORTSTATUS_REFERENCE_PHASE ((VL53L1_DeviceReportStatus) 4)
#define VL53L1_DEVICEREPORTSTATUS_DSS1 ((VL53L1_DeviceReportStatus) 5)
#define VL53L1_DEVICEREPORTSTATUS_DSS2 ((VL53L1_DeviceReportStatus) 6)
#define VL53L1_DEVICEREPORTSTATUS_MM1 ((VL53L1_DeviceReportStatus) 7)
#define VL53L1_DEVICEREPORTSTATUS_MM2 ((VL53L1_DeviceReportStatus) 8)
#define VL53L1_DEVICEREPORTSTATUS_RANGE ((VL53L1_DeviceReportStatus) 9)
#define VL53L1_DEVICEREPORTSTATUS_HISTOGRAM ((VL53L1_DeviceReportStatus) 10)
/** @} end of VL53L1_DeviceReportStatus_group */
/** @defgroup VL53L1_DeviceDssMode_group Dynamic SPAD Selection Mode
* @brief Selects the device Dynamic SPAD Selection Mode
* @{
*/
typedef uint8_t VL53L1_DeviceDssMode;
#define VL53L1_DEVICEDSSMODE__DISABLED \
((VL53L1_DeviceDssMode) 0)
#define VL53L1_DEVICEDSSMODE__TARGET_RATE \
((VL53L1_DeviceDssMode) 1)
#define VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS \
((VL53L1_DeviceDssMode) 2)
#define VL53L1_DEVICEDSSMODE__BLOCK_SELECT \
((VL53L1_DeviceDssMode) 3)
/** @} end of VL53L1_DeviceDssMode_group */
/** @defgroup VL53L1_DeviceConfigLevel_group Device Config Level
*
* @brief Defines the contents of the config & start range I2C multi byte transaction
* @{
*/
typedef uint8_t VL53L1_DeviceConfigLevel;
#define VL53L1_DEVICECONFIGLEVEL_SYSTEM_CONTROL \
((VL53L1_DeviceConfigLevel) 0)
/*!< Configs system control & start range */
#define VL53L1_DEVICECONFIGLEVEL_DYNAMIC_ONWARDS \
((VL53L1_DeviceConfigLevel) 1)
/*!< Dynamic config onwards (dynamic_config, system_control) & start range */
#define VL53L1_DEVICECONFIGLEVEL_TIMING_ONWARDS \
((VL53L1_DeviceConfigLevel) 2)
/*!< Dynamic config onwards (timing config, dynamic_config, system_control) &
start range */
#define VL53L1_DEVICECONFIGLEVEL_GENERAL_ONWARDS \
((VL53L1_DeviceConfigLevel) 3)
/*!< General config onwards (general_config, timing config, dynamic_config,
system_control) & start range */
#define VL53L1_DEVICECONFIGLEVEL_STATIC_ONWARDS \
((VL53L1_DeviceConfigLevel) 4)
/*!< Static config onwards (static_config, general_config, timing_config,
dynamic_config, system_control) & start range */
#define VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS \
((VL53L1_DeviceConfigLevel) 5)
/*!< Full device config (customer_nvm_managed, static_config, general_config,
timing config, dynamic_config, system_control) & start range */
#define VL53L1_DEVICECONFIGLEVEL_FULL \
((VL53L1_DeviceConfigLevel) 6)
/*!< Full device config (static_nvm_managed, customer_nvm_managed, static_config,
general_config, timing config, dynamic_config, system_control) & start range */
/** @} end of VL53L1_DeviceConfigLevel_group */
/** @defgroup VL53L1_DeviceResultsLevel_group Device Results Level
*
* @brief Defines the contents of the read results I2C multi byte transaction
* @{
*/
typedef uint8_t VL53L1_DeviceResultsLevel;
#define VL53L1_DEVICERESULTSLEVEL_SYSTEM_RESULTS \
((VL53L1_DeviceResultsLevel) 0)
/*!< Read just system_results */
#define VL53L1_DEVICERESULTSLEVEL_UPTO_CORE \
((VL53L1_DeviceResultsLevel) 1)
/*!< Read both system and core results */
#define VL53L1_DEVICERESULTSLEVEL_FULL \
((VL53L1_DeviceResultsLevel) 2)
/*!< Read system, core and debug results */
/** @} end of VL53L1_DeviceResultsLevel_group */
/** @defgroup VL53L1_DeviceTestMode_group Device Test Mode
*
* @brief Values below match the the TEST_MODE__CTRL register
* do not change
* @{
*/
typedef uint8_t VL53L1_DeviceTestMode;
#define VL53L1_DEVICETESTMODE_NONE \
((VL53L1_DeviceTestMode) 0x00)
/*!< Idle */
#define VL53L1_DEVICETESTMODE_NVM_ZERO \
((VL53L1_DeviceTestMode) 0x01)
/*!< NVM zero */
#define VL53L1_DEVICETESTMODE_NVM_COPY \
((VL53L1_DeviceTestMode) 0x02)
/*!< NVM copy */
#define VL53L1_DEVICETESTMODE_PATCH \
((VL53L1_DeviceTestMode) 0x03)
/*!< Patch */
#define VL53L1_DEVICETESTMODE_DCR \
((VL53L1_DeviceTestMode) 0x04)
/*!< DCR - SPAD Self-Check (Pass if Count Rate is less than Threshold) */
#define VL53L1_DEVICETESTMODE_LCR_VCSEL_OFF \
((VL53L1_DeviceTestMode) 0x05)
/*!< LCR - SPAD Self-Check (Pass if Count Rate is greater than Threshold
and VCSEL off) */
#define VL53L1_DEVICETESTMODE_LCR_VCSEL_ON \
((VL53L1_DeviceTestMode) 0x06)
/*!< LCR - SPAD Self-Check (Pass if Count Rate is greater than Threshold
and VCSEL on) */
#define VL53L1_DEVICETESTMODE_SPOT_CENTRE_LOCATE \
((VL53L1_DeviceTestMode) 0x07)
/*!< Spot centre locate */
#define VL53L1_DEVICETESTMODE_REF_SPAD_CHAR_WITH_PRE_VHV \
((VL53L1_DeviceTestMode) 0x08)
/*!<Reference SPAD Characterisation with pre-VHV */
#define VL53L1_DEVICETESTMODE_REF_SPAD_CHAR_ONLY \
((VL53L1_DeviceTestMode) 0x09)
/*!< Reference SPAD Characterisation Only */
/** @} end of VL53L1_DeviceTestMode_group */
/** @defgroup VL53L1_DeviceSscArray_group Device Test Mode
*
* @{
*/
typedef uint8_t VL53L1_DeviceSscArray;
#define VL53L1_DEVICESSCARRAY_RTN ((VL53L1_DeviceSscArray) 0x00)
/*!<Return Array Rates */
#define VL53L1_DEVICETESTMODE_REF ((VL53L1_DeviceSscArray) 0x01)
/*!< Reference Array Rates Only */
/** @} end of VL53L1_DeviceSscArray_group */
/** @defgroup VL53L1_SpadArraySelection_group SPAD Array Selection Functionality
* @brief SPAD array selection definitions
* @{
*/
#define VL53L1_RETURN_ARRAY_ONLY 0x01
/*!< Return SPAD Array only */
#define VL53L1_REFERENCE_ARRAY_ONLY 0x10
/*!< Reference SPAD Array only */
#define VL53L1_BOTH_RETURN_AND_REFERENCE_ARRAYS 0x11
/*!< Both Return and Reference SPAD Arrays */
#define VL53L1_NEITHER_RETURN_AND_REFERENCE_ARRAYS 0x00
/*!< Neither Return or Reference SPAD Array */
/** @} end of VL53L1_SpadArraySelection_group */
/** @defgroup VL53L1_DeviceInterruptLevel_group Interrupt Level Functionality
* @brief Interrupt Output Level types
* @{
*/
#define VL53L1_DEVICEINTERRUPTLEVEL_ACTIVE_HIGH 0x00
/*!< Active High Interrupt */
#define VL53L1_DEVICEINTERRUPTLEVEL_ACTIVE_LOW 0x10
/*!< Active Low Interrupt */
#define VL53L1_DEVICEINTERRUPTLEVEL_ACTIVE_MASK 0x10
/*!< Active Bit Mask */
/** @} end of VL53L1_DeviceInterruptLevel_group */
/** @defgroup VL53L1_ApiCore_group Misc Functionality
* @brief API core specific definitions
* @{
*/
#define VL53L1_POLLING_DELAY_US 1000
/*!< 1000us delay for register polling */
#define VL53L1_SOFTWARE_RESET_DURATION_US 100
/*!< 100us software reset duration */
#define VL53L1_FIRMWARE_BOOT_TIME_US 1200
/*!< Duration of firmware boot time for which I2C
access is blocked. Real Device 1ms, FPGA 15ms */
#define VL53L1_ENABLE_POWERFORCE_SETTLING_TIME_US 250
/*!< After enabling power force a delay is required
to bring regulator, bandgap, oscillator time
to power up and settle */
#define VL53L1_SPAD_ARRAY_WIDTH 16
/*!< SPAD array width */
#define VL53L1_SPAD_ARRAY_HEIGHT 16
/*!< SPAD array height */
#define VL53L1_NVM_SIZE_IN_BYTES 512
/*!< NVM (OTP) size in bytes */
#define VL53L1_NO_OF_SPAD_ENABLES 256
/*!< Number of SPADs each SPAD array */
#define VL53L1_RTN_SPAD_BUFFER_SIZE 32
/*!< Number of Return SPAD enable registers (bytes) */
#define VL53L1_REF_SPAD_BUFFER_SIZE 6
/*!< Number of Reference SPAD enable registers (bytes) */
#define VL53L1_AMBIENT_WINDOW_VCSEL_PERIODS 256
/*!< Sigma Delta Ambient window in VCSEL Periods */
#define VL53L1_RANGING_WINDOW_VCSEL_PERIODS 2048
/*!< Sigma Delta Ranging window in VCSEL periods */
#define VL53L1_MACRO_PERIOD_VCSEL_PERIODS \
(VL53L1_AMBIENT_WINDOW_VCSEL_PERIODS + VL53L1_RANGING_WINDOW_VCSEL_PERIODS)
/*!< Macro Period in VCSEL periods */
#define VL53L1_MAX_ALLOWED_PHASE 0xFFFF
/*!< Maximum Allowed phase 0xFFFF means 31.999 PLL Clocks */
#define VL53L1_RTN_SPAD_UNITY_TRANSMISSION 0x0100
/*!< SPAD unity transmission value - 1.0 in 8.8 format */
#define VL53L1_RTN_SPAD_APERTURE_TRANSMISSION 0x0038
/*!< Apertured SPAD transmission value - 8.8 format
Nominal: 5x -> 0.200000 * 256 = 51 = 0x33
Measured: 4.6x -> 0.217391 * 256 = 56 = 0x38 */
#define VL53L1_SPAD_TOTAL_COUNT_MAX ((0x01 << 29) - 1)
/*!< Maximum SPAD count - 512Mcps * 1sec = 29bits) */
#define VL53L1_SPAD_TOTAL_COUNT_RES_THRES (0x01 << 24)
/*!< SPAD count threshold for reduced 3-bit fractional resolution */
#define VL53L1_COUNT_RATE_INTERNAL_MAX ((0x01 << 24) - 1)
/*!< Maximum internal count rate is a 17.7 (24-b) value */
#define VL53L1_SPEED_OF_LIGHT_IN_AIR 299704
/*!< Speed of light in air in mm/sec */
#define VL53L1_SPEED_OF_LIGHT_IN_AIR_DIV_8 (299704 >> 3)
/*!< Speed of light in air in divided by 8, 2 for round trip
and 4 as an additional scaling factor */
/** @} end of VL53L1_ApiCore_group */
/** @} end of VL53L1_DevSpecDefines_group */
/** @defgroup VL53L1_GPIO_Interrupt_Mode_group Interrupt modes
* @brief Selects between four interrupt modes
* @{
*/
typedef uint8_t VL53L1_GPIO_Interrupt_Mode;
#define VL53L1_GPIOINTMODE_LEVEL_LOW \
((VL53L1_GPIO_Interrupt_Mode) 0)
/*!< Trigger interupt if value < thresh_low */
#define VL53L1_GPIOINTMODE_LEVEL_HIGH \
((VL53L1_GPIO_Interrupt_Mode) 1)
/*!< Trigger interupt if value > thresh_high */
#define VL53L1_GPIOINTMODE_OUT_OF_WINDOW \
((VL53L1_GPIO_Interrupt_Mode) 2)
/*!< Trigger interupt if value < thresh_low OR value > thresh_high */
#define VL53L1_GPIOINTMODE_IN_WINDOW \
((VL53L1_GPIO_Interrupt_Mode) 3)
/*!< Trigger interupt if value > thresh_low AND value < thresh_high */
/** @} end of VL53L1_GPIO_Interrupt_Mode_group */
/** @defgroup VL53L1_TuningParms_group Tuning Parameters
* @brief Selects specific tuning parameter inputs to get/set \
* Added as part of Patch_AddedTuningParms_11761
* @{
*/
typedef uint16_t VL53L1_TuningParms;
#define VL53L1_TUNINGPARMS_LLD_PUBLIC_MIN_ADDRESS \
((VL53L1_TuningParms) VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS)
#define VL53L1_TUNINGPARMS_LLD_PUBLIC_MAX_ADDRESS \
((VL53L1_TuningParms) VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US)
#define VL53L1_TUNINGPARMS_LLD_PRIVATE_MIN_ADDRESS \
((VL53L1_TuningParms) VL53L1_TUNINGPARM_PRIVATE_PAGE_BASE_ADDRESS)
#define VL53L1_TUNINGPARMS_LLD_PRIVATE_MAX_ADDRESS \
((VL53L1_TuningParms) VL53L1_TUNINGPARMS_LLD_PRIVATE_MIN_ADDRESS)
#define VL53L1_TUNINGPARM_VERSION \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 0))
#define VL53L1_TUNINGPARM_KEY_TABLE_VERSION \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 1))
#define VL53L1_TUNINGPARM_LLD_VERSION \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 2))
#define VL53L1_TUNINGPARM_CONSISTENCY_LITE_PHASE_TOLERANCE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 3))
#define VL53L1_TUNINGPARM_PHASECAL_TARGET \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 4))
#define VL53L1_TUNINGPARM_LITE_CAL_REPEAT_RATE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 5))
#define VL53L1_TUNINGPARM_LITE_RANGING_GAIN_FACTOR \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 6))
#define VL53L1_TUNINGPARM_LITE_MIN_CLIP_MM \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 7))
#define VL53L1_TUNINGPARM_LITE_LONG_SIGMA_THRESH_MM \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 8))
#define VL53L1_TUNINGPARM_LITE_MED_SIGMA_THRESH_MM \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 9))
#define VL53L1_TUNINGPARM_LITE_SHORT_SIGMA_THRESH_MM \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 10))
#define VL53L1_TUNINGPARM_LITE_LONG_MIN_COUNT_RATE_RTN_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 11))
#define VL53L1_TUNINGPARM_LITE_MED_MIN_COUNT_RATE_RTN_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 12))
#define VL53L1_TUNINGPARM_LITE_SHORT_MIN_COUNT_RATE_RTN_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 13))
#define VL53L1_TUNINGPARM_LITE_SIGMA_EST_PULSE_WIDTH \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 14))
#define VL53L1_TUNINGPARM_LITE_SIGMA_EST_AMB_WIDTH_NS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 15))
#define VL53L1_TUNINGPARM_LITE_SIGMA_REF_MM \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 16))
#define VL53L1_TUNINGPARM_LITE_RIT_MULT \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 17))
#define VL53L1_TUNINGPARM_LITE_SEED_CONFIG \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 18))
#define VL53L1_TUNINGPARM_LITE_QUANTIFIER \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 19))
#define VL53L1_TUNINGPARM_LITE_FIRST_ORDER_SELECT \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 20))
#define VL53L1_TUNINGPARM_LITE_XTALK_MARGIN_KCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 21))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_LONG_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 22))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_MED_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 23))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_SHORT_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 24))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_LONG_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 25))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_MED_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 26))
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_SHORT_RANGE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 27))
#define VL53L1_TUNINGPARM_TIMED_SEED_CONFIG \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 28))
#define VL53L1_TUNINGPARM_VHV_LOOPBOUND \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 29))
#define VL53L1_TUNINGPARM_REFSPADCHAR_DEVICE_TEST_MODE \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 30))
#define VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 31))
#define VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 32))
#define VL53L1_TUNINGPARM_REFSPADCHAR_TARGET_COUNT_RATE_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 33))
#define VL53L1_TUNINGPARM_REFSPADCHAR_MIN_COUNTRATE_LIMIT_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 34))
#define VL53L1_TUNINGPARM_REFSPADCHAR_MAX_COUNTRATE_LIMIT_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 35))
#define VL53L1_TUNINGPARM_OFFSET_CAL_DSS_RATE_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 36))
#define VL53L1_TUNINGPARM_OFFSET_CAL_PHASECAL_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 37))
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 38))
#define VL53L1_TUNINGPARM_OFFSET_CAL_RANGE_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 39))
#define VL53L1_TUNINGPARM_OFFSET_CAL_PRE_SAMPLES \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 40))
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM1_SAMPLES \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 41))
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM2_SAMPLES \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 42))
#define VL53L1_TUNINGPARM_SPADMAP_VCSEL_PERIOD \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 43))
#define VL53L1_TUNINGPARM_SPADMAP_VCSEL_START \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 44))
#define VL53L1_TUNINGPARM_SPADMAP_RATE_LIMIT_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 45))
#define VL53L1_TUNINGPARM_LITE_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 46))
#define VL53L1_TUNINGPARM_TIMED_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 47))
#define VL53L1_TUNINGPARM_LITE_PHASECAL_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 48))
#define VL53L1_TUNINGPARM_TIMED_PHASECAL_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 49))
#define VL53L1_TUNINGPARM_LITE_MM_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 50))
#define VL53L1_TUNINGPARM_TIMED_MM_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 51))
#define VL53L1_TUNINGPARM_LITE_RANGE_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 52))
#define VL53L1_TUNINGPARM_TIMED_RANGE_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 53))
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_VHV_LOOP_BOUND \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 54))
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_MM_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 55))
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US \
((VL53L1_TuningParms) (VL53L1_TUNINGPARM_PUBLIC_PAGE_BASE_ADDRESS + 56))
/** @} end of VL53L1_TuningParms_group */
#endif
/* _VL53L1_DEVICE_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/******************************************************************************
* Copyright (c) 2020, STMicroelectronics - All Rights Reserved
This file is part of VL53L1 and is dual licensed,
either GPL-2.0+
or 'BSD 3-clause "New" or "Revised" License' , at your option.
******************************************************************************
*/
#ifndef _VL53L1_PRESET_SETUP_H_
#define _VL53L1_PRESET_SETUP_H_
#ifdef __cplusplus
extern "C"
{
#endif
/* indexes for the bare driver tuning setting API function */
enum VL53L1_Tuning_t {
VL53L1_TUNING_VERSION = 0,
VL53L1_TUNING_PROXY_MIN,
VL53L1_TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM,
VL53L1_TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER,
VL53L1_TUNING_MIN_AMBIENT_DMAX_VALID,
VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER,
VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM,
VL53L1_TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT,
VL53L1_TUNING_XTALK_FULL_ROI_BIN_SUM_MARGIN,
VL53L1_TUNING_XTALK_FULL_ROI_DEFAULT_OFFSET,
VL53L1_TUNING_ZERO_DISTANCE_OFFSET_NON_LINEAR_FACTOR,
VL53L1_TUNING_PHASECAL_PATCH_POWER,
VL53L1_TUNING_MAX_TUNABLE_KEY
};
/* default values for the tuning settings parameters */
#define TUNING_VERSION 0x0007
#define TUNING_PROXY_MIN -30 /* min distance in mm */
#define TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM 600
/* Target distance in mm for single target Xtalk */
#define TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER 50
/* Number of sample used for single target Xtalk */
#define TUNING_MIN_AMBIENT_DMAX_VALID 8
/* Minimum ambient level to state the Dmax returned by the device is valid */
#define TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER 50
/* Maximum loops to perform simple offset calibration */
#define TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM 600
/* Target distance in mm for target Xtalk from Bins method*/
#define TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT 1
/* Number of loops done during the simple offset calibration*/
#define TUNING_ZERO_DISTANCE_OFFSET_NON_LINEAR_FACTOR_DEFAULT 9
/* zero distance offset calibration non linear compensation default value */
/* The following settings are related to the fix for ticket EwokP #558410 */
#define TUNING_XTALK_FULL_ROI_BIN_SUM_MARGIN 24
/* Acceptance margin for the xtalk_shape bin_data sum computation */
#define TUNING_XTALK_FULL_ROI_DEFAULT_OFFSET 50
/* Recovery value for Xtalk compensation plane offset in kcps */
/* 50 stands for ~0.10 kcps cover glass in 7.9 format */
/* End of settings related to the fix for ticket EwokP #558410 */
#define TUNING_PHASECAL_PATCH_POWER 0
/* PhaseCal duration patch tuning param
* 0 default duration 15ms, 1 leads to 60ms, 2 for 240ms and 3 for 3580ms
*/
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_PRESET_SETUP_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,222 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_register_settings.h
*
* @brief Device register setting defines.
*/
#ifndef _VL53L1_REGISTER_SETTINGS_H_
#define _VL53L1_REGISTER_SETTINGS_H_
/** @defgroup VL53L1_RegisterSettings_group Functionality
* @brief Defines the register settings for key device
* configuration registers
* @{
*/
/** @defgroup VL53L1_DeviceSchedulerMode_group - Pseudo, Streaming & Hist
* @brief Values below match the bit positions in the SYSTEM__MODE_START
* register do not change
* @{
*/
#define VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO 0x00
#define VL53L1_DEVICESCHEDULERMODE_STREAMING 0x01
#define VL53L1_DEVICESCHEDULERMODE_HISTOGRAM 0x02
/** @} end of VL53L1_DeviceReadoutMode_group */
/** @defgroup VL53L1_DeviceReadoutMode_group - Single, Dual, Split & Manual
* @brief Values below match the bit positions in the SYSTEM__MODE_START
* register do not change
* @{
*/
#define VL53L1_DEVICEREADOUTMODE_SINGLE_SD (0x00 << 2)
#define VL53L1_DEVICEREADOUTMODE_DUAL_SD (0x01 << 2)
#define VL53L1_DEVICEREADOUTMODE_SPLIT_READOUT (0x02 << 2)
#define VL53L1_DEVICEREADOUTMODE_SPLIT_MANUAL (0x03 << 2)
/** @} end of VL53L1_DeviceReadoutMode_group */
/** @defgroup VL53L1_DeviceMeasurementMode_group - SingleShot, BackToBack & timed
* @brief Values below match the bit positions in the SYSTEM__MODE_START
* register do not change
* @{
*/
/*
#define VL53L1_DEVICEMEASUREMENTMODE_STOP 0x00
#define VL53L1_DEVICEMEASUREMENTMODE_SINGLESHOT 0x10
#define VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK 0x20
#define VL53L1_DEVICEMEASUREMENTMODE_TIMED 0x40
#define VL53L1_DEVICEMEASUREMENTMODE_ABORT 0x80
*/
#define VL53L1_DEVICEMEASUREMENTMODE_MODE_MASK 0xF0
#define VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK 0x0F
#define VL53L1_GROUPEDPARAMETERHOLD_ID_MASK 0x02
/** @} end of VL53L1_DeviceMeasurementMode_group */
#define VL53L1_EWOK_I2C_DEV_ADDR_DEFAULT 0x29
/*!< Device default 7-bit I2C address */
#define VL53L1_OSC_FREQUENCY 0x00
#define VL53L1_OSC_TRIM_DEFAULT 0x00
#define VL53L1_OSC_FREQ_SET_DEFAULT 0x00
#define VL53L1_RANGE_HISTOGRAM_REF 0x08
#define VL53L1_RANGE_HISTOGRAM_RET 0x10
#define VL53L1_RANGE_HISTOGRAM_BOTH 0x18
#define VL53L1_RANGE_HISTOGRAM_INIT 0x20
#define VL53L1_RANGE_VHV_INIT 0x40
/* Result Status */
#define VL53L1_RESULT_RANGE_STATUS 0x1F
/* */
#define VL53L1_SYSTEM__SEED_CONFIG__MANUAL 0x00
#define VL53L1_SYSTEM__SEED_CONFIG__STANDARD 0x01
#define VL53L1_SYSTEM__SEED_CONFIG__EVEN_UPDATE_ONLY 0x02
/* Interrupt Config */
#define VL53L1_INTERRUPT_CONFIG_LEVEL_LOW 0x00
#define VL53L1_INTERRUPT_CONFIG_LEVEL_HIGH 0x01
#define VL53L1_INTERRUPT_CONFIG_OUT_OF_WINDOW 0x02
#define VL53L1_INTERRUPT_CONFIG_IN_WINDOW 0x03
#define VL53L1_INTERRUPT_CONFIG_NEW_SAMPLE_READY 0x20
/* Interrupt Clear */
#define VL53L1_CLEAR_RANGE_INT 0x01
#define VL53L1_CLEAR_ERROR_INT 0x02
/* Sequence Config */
#define VL53L1_SEQUENCE_VHV_EN 0x01
#define VL53L1_SEQUENCE_PHASECAL_EN 0x02
#define VL53L1_SEQUENCE_REFERENCE_PHASE_EN 0x04
#define VL53L1_SEQUENCE_DSS1_EN 0x08
#define VL53L1_SEQUENCE_DSS2_EN 0x10
#define VL53L1_SEQUENCE_MM1_EN 0x20
#define VL53L1_SEQUENCE_MM2_EN 0x40
#define VL53L1_SEQUENCE_RANGE_EN 0x80
/* defines for DSS__ROI_CONTROL */
#define VL53L1_DSS_CONTROL__ROI_SUBTRACT 0x20
#define VL53L1_DSS_CONTROL__ROI_INTERSECT 0x10
#define VL53L1_DSS_CONTROL__MODE_DISABLED 0x00
#define VL53L1_DSS_CONTROL__MODE_TARGET_RATE 0x01
#define VL53L1_DSS_CONTROL__MODE_EFFSPADS 0x02
#define VL53L1_DSS_CONTROL__MODE_BLOCKSELECT 0x03
/* SPAD Readout defines
*
* 7:6 - SPAD_IN_SEL_REF
* 5:4 - SPAD_IN_SEL_RTN
* 2 - SPAD_PS_BYPASS
* 0 - SPAD_EN_PULSE_EXTENDER
*/
#define VL53L1_RANGING_CORE__SPAD_READOUT__STANDARD 0x45
#define VL53L1_RANGING_CORE__SPAD_READOUT__RETURN_ARRAY_ONLY 0x05
#define VL53L1_RANGING_CORE__SPAD_READOUT__REFERENCE_ARRAY_ONLY 0x55
#define VL53L1_RANGING_CORE__SPAD_READOUT__RETURN_SPLIT_ARRAY 0x25
#define VL53L1_RANGING_CORE__SPAD_READOUT__CALIB_PULSES 0xF5
#define VL53L1_LASER_SAFETY__KEY_VALUE 0x6C
/* Range Status defines
*
* 7 - GPH ID
* 6 - Min threshold hit
* 5 - Max threshold hit
* 4:0 - Range Status
*/
#define VL53L1_RANGE_STATUS__RANGE_STATUS_MASK 0x1F
#define VL53L1_RANGE_STATUS__MAX_THRESHOLD_HIT_MASK 0x20
#define VL53L1_RANGE_STATUS__MIN_THRESHOLD_HIT_MASK 0x40
#define VL53L1_RANGE_STATUS__GPH_ID_RANGE_STATUS_MASK 0x80
/* Interrupt Status defines
*
* 5 - GPH ID
* 4:3 - Interrupt Error Status
* 2:0 - Interrupt Status
*/
#define VL53L1_INTERRUPT_STATUS__INT_STATUS_MASK 0x07
#define VL53L1_INTERRUPT_STATUS__INT_ERROR_STATUS_MASK 0x18
#define VL53L1_INTERRUPT_STATUS__GPH_ID_INT_STATUS_MASK 0x20
/** @} end of VL53L1_RegisterSettings_group */
#endif
/* _VL53L1_REGISTER_SETTINGS_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_silicon_core.h
*
* @brief EwokPlus25 low level silicon specific API function definitions
*/
#ifndef _VL53L1_SILICON_CORE_H_
#define _VL53L1_SILICON_CORE_H_
#include "vl53l1_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Checks if the firmware is ready for ranging (Silicon variant)
*
* @param[in] Dev : Device Handle
* @param[out] pready : pointer to data ready flag \n
* 0 = firmware not ready \n
* 1 = firmware ready
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_is_firmware_ready_silicon(
VL53L1_DEV Dev,
uint8_t *pready);
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_SILICON_CORE_H_ */

View File

@@ -0,0 +1,210 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_tuning_parm_defaults.h
*
* @brief Define defaults for tuning parm list
*
* - Ensures coherence of internal defaults to tuning table
* - Allows reduction of tuning parm list to only changes from the
* standard settings defined below
*
*/
#ifndef _VL53L1_TUNING_PARM_DEFAULTS_H_
#define _VL53L1_TUNING_PARM_DEFAULTS_H_
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup VL53L1_tuningparmdefault_group VL53L1 Defines
* @brief VL53L1 Tuning Parm Default Values
* @{
*/
#define VL53L1_TUNINGPARM_VERSION_DEFAULT \
((uint16_t) 32771)
#define VL53L1_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT \
((uint16_t) 32769)
#define VL53L1_TUNINGPARM_LLD_VERSION_DEFAULT \
((uint16_t) 32833)
#define VL53L1_TUNINGPARM_CONSISTENCY_LITE_PHASE_TOLERANCE_DEFAULT \
((uint8_t) 2)
#define VL53L1_TUNINGPARM_PHASECAL_TARGET_DEFAULT \
((uint8_t) 33)
#define VL53L1_TUNINGPARM_LITE_CAL_REPEAT_RATE_DEFAULT \
((uint16_t) 0)
#define VL53L1_TUNINGPARM_LITE_RANGING_GAIN_FACTOR_DEFAULT \
((uint16_t) 2011)
#define VL53L1_TUNINGPARM_LITE_MIN_CLIP_MM_DEFAULT \
((uint8_t) 0)
#define VL53L1_TUNINGPARM_LITE_LONG_SIGMA_THRESH_MM_DEFAULT \
((uint16_t) 360)
#define VL53L1_TUNINGPARM_LITE_MED_SIGMA_THRESH_MM_DEFAULT \
((uint16_t) 360)
#define VL53L1_TUNINGPARM_LITE_SHORT_SIGMA_THRESH_MM_DEFAULT \
((uint16_t) 360)
#define VL53L1_TUNINGPARM_LITE_LONG_MIN_COUNT_RATE_RTN_MCPS_DEFAULT \
((uint16_t) 192)
#define VL53L1_TUNINGPARM_LITE_MED_MIN_COUNT_RATE_RTN_MCPS_DEFAULT \
((uint16_t) 192)
#define VL53L1_TUNINGPARM_LITE_SHORT_MIN_COUNT_RATE_RTN_MCPS_DEFAULT \
((uint16_t) 192)
#define VL53L1_TUNINGPARM_LITE_SIGMA_EST_PULSE_WIDTH_DEFAULT \
((uint8_t) 8)
#define VL53L1_TUNINGPARM_LITE_SIGMA_EST_AMB_WIDTH_NS_DEFAULT \
((uint8_t) 16)
#define VL53L1_TUNINGPARM_LITE_SIGMA_REF_MM_DEFAULT \
((uint8_t) 1)
#define VL53L1_TUNINGPARM_LITE_RIT_MULT_DEFAULT \
((uint8_t) 64)
#define VL53L1_TUNINGPARM_LITE_SEED_CONFIG_DEFAULT \
((uint8_t) 2)
#define VL53L1_TUNINGPARM_LITE_QUANTIFIER_DEFAULT \
((uint8_t) 2)
#define VL53L1_TUNINGPARM_LITE_FIRST_ORDER_SELECT_DEFAULT \
((uint8_t) 0)
#define VL53L1_TUNINGPARM_LITE_XTALK_MARGIN_KCPS_DEFAULT \
((int16_t) 0)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_LONG_RANGE_DEFAULT \
((uint8_t) 14)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_MED_RANGE_DEFAULT \
((uint8_t) 10)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_SHORT_RANGE_DEFAULT \
((uint8_t) 6)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_LONG_RANGE_DEFAULT \
((uint8_t) 14)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_MED_RANGE_DEFAULT \
((uint8_t) 10)
#define VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_SHORT_RANGE_DEFAULT \
((uint8_t) 6)
#define VL53L1_TUNINGPARM_TIMED_SEED_CONFIG_DEFAULT \
((uint8_t) 1)
#define VL53L1_TUNINGPARM_VHV_LOOPBOUND_DEFAULT \
((uint8_t) 32)
#define VL53L1_TUNINGPARM_REFSPADCHAR_DEVICE_TEST_MODE_DEFAULT \
((uint8_t) 8)
#define VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD_DEFAULT \
((uint8_t) 11)
#define VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US_DEFAULT \
((uint32_t) 1000)
#define VL53L1_TUNINGPARM_REFSPADCHAR_TARGET_COUNT_RATE_MCPS_DEFAULT \
((uint16_t) 2560)
#define VL53L1_TUNINGPARM_REFSPADCHAR_MIN_COUNTRATE_LIMIT_MCPS_DEFAULT \
((uint16_t) 1280)
#define VL53L1_TUNINGPARM_REFSPADCHAR_MAX_COUNTRATE_LIMIT_MCPS_DEFAULT \
((uint16_t) 5120)
#define VL53L1_TUNINGPARM_OFFSET_CAL_DSS_RATE_MCPS_DEFAULT \
((uint16_t) 2560)
#define VL53L1_TUNINGPARM_OFFSET_CAL_PHASECAL_TIMEOUT_US_DEFAULT \
((uint32_t) 1000)
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM_TIMEOUT_US_DEFAULT \
((uint32_t) 13000)
#define VL53L1_TUNINGPARM_OFFSET_CAL_RANGE_TIMEOUT_US_DEFAULT \
((uint32_t) 13000)
#define VL53L1_TUNINGPARM_OFFSET_CAL_PRE_SAMPLES_DEFAULT \
((uint8_t) 8)
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM1_SAMPLES_DEFAULT \
((uint8_t) 40)
#define VL53L1_TUNINGPARM_OFFSET_CAL_MM2_SAMPLES_DEFAULT \
((uint8_t) 9)
#define VL53L1_TUNINGPARM_SPADMAP_VCSEL_PERIOD_DEFAULT \
((uint8_t) 18)
#define VL53L1_TUNINGPARM_SPADMAP_VCSEL_START_DEFAULT \
((uint8_t) 15)
#define VL53L1_TUNINGPARM_SPADMAP_RATE_LIMIT_MCPS_DEFAULT \
((uint16_t) 12)
#define VL53L1_TUNINGPARM_LITE_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT \
((uint16_t) 2560)
#define VL53L1_TUNINGPARM_TIMED_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT \
((uint16_t) 2560)
#define VL53L1_TUNINGPARM_LITE_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 1000)
#define VL53L1_TUNINGPARM_TIMED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 1000)
#define VL53L1_TUNINGPARM_LITE_MM_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 2000)
#define VL53L1_TUNINGPARM_TIMED_MM_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 2000)
#define VL53L1_TUNINGPARM_LITE_RANGE_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 63000)
#define VL53L1_TUNINGPARM_TIMED_RANGE_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 13000)
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_VHV_LOOP_BOUND_DEFAULT \
((uint8_t) 3)
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_MM_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 700)
#define VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US_DEFAULT \
((uint32_t) 8000)
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_LL_DEF_H_ */

View File

@@ -0,0 +1,276 @@
/*
* Copyright (c) 2017, STMicroelectronics - All Rights Reserved
*
* This file is part of VL53L1 Core and is dual licensed,
* either 'STMicroelectronics
* Proprietary license'
* or 'BSD 3-clause "New" or "Revised" License' , at your option.
*
********************************************************************************
*
* 'STMicroelectronics Proprietary license'
*
********************************************************************************
*
* License terms: STMicroelectronics Proprietary in accordance with licensing
* terms at www.st.com/sla0081
*
* STMicroelectronics confidential
* Reproduction and Communication of this document is strictly prohibited unless
* specifically authorized in writing by STMicroelectronics.
*
*
********************************************************************************
*
* Alternatively, VL53L1 Core may be distributed under the terms of
* 'BSD 3-clause "New" or "Revised" License', in which case the following
* provisions apply instead of the ones mentioned above :
*
********************************************************************************
*
* License terms: BSD 3-clause "New" or "Revised" License.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
********************************************************************************
*
*/
/**
* @file vl53l1_wait.h
*
* @brief EwokPlus25 low level Driver wait function definitions
*/
#ifndef _VL53L1_WAIT_H_
#define _VL53L1_WAIT_H_
#include "vl53l1_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Wait for initial firmware boot to finish
*
* Calls VL53L1_poll_for_boot_completion()
*
* @param[in] Dev : Device handle
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_wait_for_boot_completion(
VL53L1_DEV Dev);
/**
* @brief Waits for initial firmware ready
*
* Only waits to see if the firmware is ready in timed and
* single shot modes.
*
* Calls VL53L1_poll_for_firmware_ready()
*
* @param[in] Dev : Device handle
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_wait_for_firmware_ready(
VL53L1_DEV Dev);
/**
* @brief Waits for the next ranging interrupt
*
* Calls VL53L1_poll_for_range_completion()
*
* @param[in] Dev : Device handle
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_wait_for_range_completion(
VL53L1_DEV Dev);
/**
* @brief Waits for a device test mode to complete.
* Calls VL53L1_poll_for_test_completion()
*
* @param[in] Dev : Device Handle
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_wait_for_test_completion(
VL53L1_DEV Dev);
/**
* @brief Reads FIRMWARE__SYSTEM_STATUS register to detect if the
* firmware was finished booting
*
* @param[in] Dev : Device handle
* @param[out] pready : pointer to data ready flag \n
* 0 = boot not complete \n
* 1 = boot complete
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_is_boot_complete(
VL53L1_DEV Dev,
uint8_t *pready);
/**
* @brief Reads FIRMWARE__SYSTEM_STATUS register to detect if the
* firmware is ready for ranging.
*
* @param[in] Dev : Device handle
* @param[out] pready : pointer to data ready flag \n
* 0 = firmware not ready \n
* 1 = firmware ready
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_is_firmware_ready(
VL53L1_DEV Dev,
uint8_t *pready);
/**
* @brief Reads bit 0 of VL53L1_GPIO__TIO_HV_STATUS register to determine
* if new range data is ready (available).
*
* Interrupt may be either active high or active low. The behaviour of bit 0
* of the VL53L1_GPIO__TIO_HV_STATUS register is the same as the interrupt
* signal generated on the GPIO pin.
*
* pdev->stat_cfg.gpio_hv_mux_ctrl bit 4 is used to select required check level
*
*
* @param[in] Dev : Device handle
* @param[out] pready : pointer to data ready flag \n
* 0 = data not ready \n
* 1 = new range data available
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_is_new_data_ready(
VL53L1_DEV Dev,
uint8_t *pready);
/**
* @brief Waits (polls) for initial firmware boot to finish
*
* After power on or a device reset via XSHUTDOWN EwokPlus25 firmware takes
* about 2ms to boot. During this boot sequence elected NVM data is copied
* to the device's Host & MCU G02 registers
*
* This function polls the FIRMWARE__SYSTEM_STATUS register to detect when
* firmware is ready.
*
* Polling is implemented using VL53L1_WaitValueMaskEx()
*
* @param[in] Dev : Device handle
* @param[in] timeout_ms : Wait timeout in [ms]
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_poll_for_boot_completion(
VL53L1_DEV Dev,
uint32_t timeout_ms);
/**
* @brief Waits (polls) for initial firmware ready
*
* Polling is implemented using VL53L1_WaitValueMaskEx()
*
* @param[in] Dev : Device handle
* @param[in] timeout_ms : Wait timeout in [ms]
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_poll_for_firmware_ready(
VL53L1_DEV Dev,
uint32_t timeout_ms);
/**
* @brief Polls bit 0 of VL53L1_GPIO__TIO_HV_STATUS register to determine
* the state of the GPIO (Interrupt) pin.
*
* Interrupt may be either active high or active low. The behaviour of bit 0
* of the VL53L1_GPIO__TIO_HV_STATUS register is the same as the interrupt
* signal generated on the GPIO pin.
*
* pdev->stat_cfg.gpio_hv_mux_ctrl bit 4 is used to select required check level
*
* Polling is implemented using VL53L1_WaitValueMaskEx()
*
* @param[in] Dev : Device handle
* @param[in] timeout_ms : Wait timeout in [ms]
*
* @return VL53L1_ERROR_NONE Success
* @return "Other error code" See ::VL53L1_Error
*/
VL53L1_Error VL53L1_poll_for_range_completion(
VL53L1_DEV Dev,
uint32_t timeout_ms);
#ifdef __cplusplus
}
#endif
#endif /* _VL53L1_WAIT_H_ */