From 4f6b53fba561ea90167d6553f166a3bb629f1c71 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Mon, 4 Feb 2019 18:02:57 -0200 Subject: [PATCH] Upgrade M3 release for TOF VL53L1 driver code from STM Maintenance 3 release. Modifications 1. Ambient level is now available in ranging data when no target is detected 2. When no target is detected the ranging data are set to fixed values and range status equals 255 3. New tuning parameter to choose number of measurement loops for the simple offset calibration 4. Support for new Xtalk calibration method(FullROI) 5. Code cleanup to comply with linux checkpatch(kernel version 4.14) 6. In Ranging/MultiZone mode, the input sub-system injecting data package format has to be compliant with requirements of QCOM Sensor Event data packing 7. In Lite/Autonomous mode, the input sub-system injecting is disabled temporarily 8. Support for Autonomous Low power mode in Linux driver 9. Deadlock fix (this was provided as a patch on Maint2 some time back) 10. Allow Tuning parameter update anytime Fixes: 11. Code optimization in histogram functions saved about 4Kbytes of stack size 12. Improved accuracy in offset calibration functions 13. Improved accuracy in inter measurement period used for TIMED modes Change-Id: I603d25d54a5f264eb415431ee3acecb74961a301 Signed-off-by: Ravi Vembu Reviewed-on: https://gerrit.mot.com/1304907 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Sumit Jamadar Submit-Approved: Jira Key --- drivers/input/misc/vl53L1/Android.mk | 9 - drivers/input/misc/vl53L1/Kbuild | 12 +- drivers/input/misc/vl53L1/Makefile | 16 +- drivers/input/misc/vl53L1/inc/vl53l1_api.h | 218 +- .../misc/vl53L1/inc/vl53l1_api_calibration.h | 312 +- .../input/misc/vl53L1/inc/vl53l1_api_core.h | 132 +- .../input/misc/vl53L1/inc/vl53l1_api_debug.h | 120 +- .../misc/vl53L1/inc/vl53l1_api_preset_modes.h | 313 +- .../misc/vl53L1/inc/vl53l1_api_strings.h | 122 +- drivers/input/misc/vl53L1/inc/vl53l1_core.h | 245 +- .../misc/vl53L1/inc/vl53l1_core_support.h | 120 +- drivers/input/misc/vl53L1/inc/vl53l1_def.h | 215 +- .../misc/vl53L1/inc/vl53l1_dmax_structs.h | 117 +- .../misc/vl53L1/inc/vl53l1_error_codes.h | 180 +- .../misc/vl53L1/inc/vl53l1_error_exceptions.h | 112 +- .../misc/vl53L1/inc/vl53l1_error_strings.h | 116 +- .../input/misc/vl53L1/inc/vl53l1_fpga_core.h | 134 - .../input/misc/vl53L1/inc/vl53l1_hist_char.h | 112 +- .../input/misc/vl53L1/inc/vl53l1_hist_map.h | 115 +- .../misc/vl53L1/inc/vl53l1_hist_structs.h | 144 +- drivers/input/misc/vl53L1/inc/vl53l1_ll_def.h | 322 ++- .../input/misc/vl53L1/inc/vl53l1_ll_device.h | 492 ++-- drivers/input/misc/vl53L1/inc/vl53l1_nvm.h | 112 +- .../input/misc/vl53L1/inc/vl53l1_nvm_debug.h | 112 +- .../input/misc/vl53L1/inc/vl53l1_nvm_map.h | 514 ++-- .../misc/vl53L1/inc/vl53l1_nvm_structs.h | 117 +- .../misc/vl53L1/inc/vl53l1_preset_setup.h | 142 +- .../misc/vl53L1/inc/vl53l1_register_funcs.h | 112 +- .../misc/vl53L1/inc/vl53l1_register_map.h | 2513 +++++++++-------- .../vl53L1/inc/vl53l1_register_settings.h | 112 +- .../misc/vl53L1/inc/vl53l1_register_structs.h | 181 +- .../misc/vl53L1/inc/vl53l1_silicon_core.h | 112 +- .../vl53L1/inc/vl53l1_tuning_parm_defaults.h | 116 +- drivers/input/misc/vl53L1/inc/vl53l1_wait.h | 112 +- .../misc/vl53L1/inc/vl53l1_zone_presets.h | 112 +- drivers/input/misc/vl53L1/ipp/ipp_linux.c | 64 +- drivers/input/misc/vl53L1/src/vl53l1_api.c | 768 +++-- .../misc/vl53L1/src/vl53l1_api_calibration.c | 1944 ++++++------- .../input/misc/vl53L1/src/vl53l1_api_core.c | 1743 ++++++------ .../input/misc/vl53L1/src/vl53l1_api_debug.c | 310 +- .../misc/vl53L1/src/vl53l1_api_preset_modes.c | 1068 +++---- .../misc/vl53L1/src/vl53l1_api_strings.c | 112 +- drivers/input/misc/vl53L1/src/vl53l1_core.c | 1853 ++++++++---- .../misc/vl53L1/src/vl53l1_core_support.c | 304 +- .../misc/vl53L1/src/vl53l1_error_strings.c | 130 +- .../input/misc/vl53L1/src/vl53l1_fpga_core.c | 167 -- .../input/misc/vl53L1/src/vl53l1_hist_char.c | 123 +- drivers/input/misc/vl53L1/src/vl53l1_nvm.c | 364 +-- .../input/misc/vl53L1/src/vl53l1_nvm_debug.c | 169 +- .../misc/vl53L1/src/vl53l1_register_funcs.c | 245 +- .../misc/vl53L1/src/vl53l1_silicon_core.c | 176 +- drivers/input/misc/vl53L1/src/vl53l1_wait.c | 121 +- .../misc/vl53L1/src/vl53l1_zone_presets.c | 129 +- drivers/input/misc/vl53L1/stmvl53l1-i2c.h | 82 +- drivers/input/misc/vl53L1/stmvl53l1.h | 110 +- drivers/input/misc/vl53L1/stmvl53l1_i2c.c | 169 +- drivers/input/misc/vl53L1/stmvl53l1_if.h | 151 +- .../input/misc/vl53L1/stmvl53l1_internal_if.h | 83 +- drivers/input/misc/vl53L1/stmvl53l1_ipp.h | 64 +- drivers/input/misc/vl53L1/stmvl53l1_ipp_nl.c | 65 +- drivers/input/misc/vl53L1/stmvl53l1_log.c | 60 +- .../input/misc/vl53L1/stmvl53l1_module-i2c.c | 192 +- drivers/input/misc/vl53L1/stmvl53l1_module.c | 1188 +++----- drivers/input/misc/vl53L1/stmvl53l1_tunings.h | 64 +- drivers/input/misc/vl53L1/vl53l1_platform.h | 82 +- .../input/misc/vl53L1/vl53l1_platform_ipp.h | 60 +- .../misc/vl53L1/vl53l1_platform_ipp_imports.h | 60 +- .../input/misc/vl53L1/vl53l1_platform_log.h | 60 +- .../misc/vl53L1/vl53l1_platform_user_config.h | 60 +- .../misc/vl53L1/vl53l1_platform_user_data.h | 69 +- .../vl53L1/vl53l1_platform_user_defines.h | 60 +- drivers/input/misc/vl53L1/vl53l1_types.h | 60 +- 72 files changed, 10603 insertions(+), 9971 deletions(-) delete mode 100644 drivers/input/misc/vl53L1/Android.mk delete mode 100644 drivers/input/misc/vl53L1/inc/vl53l1_fpga_core.h delete mode 100644 drivers/input/misc/vl53L1/src/vl53l1_fpga_core.c diff --git a/drivers/input/misc/vl53L1/Android.mk b/drivers/input/misc/vl53L1/Android.mk deleted file mode 100644 index 970b45287012..000000000000 --- a/drivers/input/misc/vl53L1/Android.mk +++ /dev/null @@ -1,9 +0,0 @@ -DLKM_DIR := motorola/kernel/modules -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := stmvl53l1.ko -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT) -include $(DLKM_DIR)/AndroidKernelModule.mk - diff --git a/drivers/input/misc/vl53L1/Kbuild b/drivers/input/misc/vl53L1/Kbuild index 690f179fbbb3..4ff325692b67 100644 --- a/drivers/input/misc/vl53L1/Kbuild +++ b/drivers/input/misc/vl53L1/Kbuild @@ -2,21 +2,19 @@ # Kbuild for the vl53L1 drivers. # -EXTRA_CFLAGS += -Wall -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/inc -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1/ipp -I$(TOP)/motorola/kernel/modules/drivers/input/misc/vl53L1 +ccflags-y += -I$(src)/inc -I$(src)/ipp -I$(src) # define this environment variable if you want to compile driver for an old # kernel ifdef OLD_NETLINK_API -EXTRA_CFLAGS += -DOLD_NETLINK_API +ccflags-y += -DOLD_NETLINK_API endif ifdef VL53L1_LOG_ENABLE -EXTRA_CFLAGS += -DVL53L1_LOG_ENABLE +ccflags-y += -DVL53L1_LOG_ENABLE endif -obj-m += stmvl53l1.o +obj-$(CONFIG_STMVL53L1) += stmvl53l1.o stmvl53l1-objs := stmvl53l1_module.o stmvl53l1_module-i2c.o stmvl53l1-objs += stmvl53l1_i2c.o stmvl53l1_ipp_nl.o stmvl53l1_log.o stmvl53l1-objs += src/vl53l1_api.o src/vl53l1_api_core.o @@ -24,7 +22,7 @@ stmvl53l1-objs += src/vl53l1_api_strings.o src/vl53l1_error_strings.o stmvl53l1-objs += src/vl53l1_core.o src/vl53l1_register_funcs.o stmvl53l1-objs += src/vl53l1_api_preset_modes.o stmvl53l1-objs += src/vl53l1_api_calibration.o -stmvl53l1-objs += src/vl53l1_fpga_core.o src/vl53l1_silicon_core.o +stmvl53l1-objs += src/vl53l1_silicon_core.o stmvl53l1-objs += src/vl53l1_zone_presets.o src/vl53l1_nvm.o stmvl53l1-objs += src/vl53l1_api_debug.o src/vl53l1_core_support.o stmvl53l1-objs += src/vl53l1_wait.o ipp/ipp_linux.o diff --git a/drivers/input/misc/vl53L1/Makefile b/drivers/input/misc/vl53L1/Makefile index 4191dea22679..4dd06f8d49f8 100644 --- a/drivers/input/misc/vl53L1/Makefile +++ b/drivers/input/misc/vl53L1/Makefile @@ -1,10 +1,12 @@ -KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build +ifneq ($(KERNELRELEASE),) +include Kbuild -all: - $(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS) - -modules_install: - $(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install +else +KDIR ?= /lib/modules/`uname -r`/build +default: + CONFIG_STMVL53L1=m $(MAKE) -C $(KDIR) M=$$PWD clean: - $(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean + CONFIG_STMVL53L1=m $(MAKE) -C $(KDIR) M=$$PWD clean + +endif \ No newline at end of file diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api.h b/drivers/input/misc/vl53L1/inc/vl53l1_api.h index 9f86fd290eca..9440886cb870 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api.h @@ -1,64 +1,64 @@ -/* -* 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ + +/****************************************************************************** + * 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. + + + ******************************************************************************* + */ #ifndef _VL53L1_API_H_ #define _VL53L1_API_H_ @@ -71,6 +71,16 @@ extern "C" { #endif +#if !defined(VL53L1DevDataGet) +#warning "PALDevDataGet is deprecated define VL53L1DevDataGet instead" +#define VL53L1DevDataGet(Dev, field) (Dev->Data.field) +#endif + +#if !defined(VL53L1DevDataSet) +#warning "PALDevDataSet is deprecated define VL53L1DevDataSet instead" +#define VL53L1DevDataSet(Dev, field, data) ((Dev->Data.field) = (data)) +#endif + /** @defgroup VL53L1_cut11_group VL53L1 cut1.1 Function Definition * @brief VL53L1 cut1.1 Function Definition * @{ @@ -195,6 +205,9 @@ VL53L1_Error VL53L1_GetPalState(VL53L1_DEV Dev, * before start programming the sensor. * When a single device us used, there is no need to call this function. * + * When it is requested for multi devices system this function MUST be called + * prior to VL53L1_DataInit() + * * @note This function Access to the device * * @param Dev Device Handle @@ -209,17 +222,17 @@ VL53L1_Error VL53L1_SetDeviceAddress(VL53L1_DEV Dev, * * @brief One time device initialization * - * To be called once and only once after device is brought out of reset - * (Chip enable) and booted see @a VL53L1_WaitDeviceBooted() + * To be called after device has been powered on and booted + * see @a VL53L1_WaitDeviceBooted() * * @par Function Description - * When not used after a fresh device "power up" or reset, it may return + * When not used after a fresh device "power up", it may return * @a #VL53L1_ERROR_CALIBRATION_WARNING meaning wrong calibration data * may have been fetched from device that can result in ranging offset error\n - * If application cannot execute device reset or need to run VL53L1_DataInit - * multiple time then it must ensure proper offset calibration saving and - * restore on its own by using @a VL53L1_GetOffsetCalibrationData() on first - * power up and then @a VL53L1_SetOffsetCalibrationData() in all subsequent init + * If VL53L1_DataInit is called several times then the application must restore + * calibration calling @a VL53L1_SetOffsetCalibrationData() + * It implies application has gathered calibration data thanks to + * @a VL53L1_GetOffsetCalibrationData() after an initial calibration stage. * This function will change the VL53L1_State from VL53L1_STATE_POWERDOWN to * VL53L1_STATE_WAIT_STATICINIT. * @@ -368,9 +381,9 @@ VL53L1_Error VL53L1_GetDistanceMode(VL53L1_DEV Dev, * Set the output mode to be used for the next ranging. The output mode is used * to select, in case of multiple objects, which one will be used in * function @a VL53L1_GetRangingMeasurementData(). - * VL53L1_SetOutputMode also sets the object used by automatic - * distance mode algorithm when @a VL53L1_SetDistanceMode() is - * set to automatic mode. + * VL53L1_SetOutputMode also sets the object used by automatic + * distance mode algorithm when @a VL53L1_SetDistanceMode() is + * set to automatic mode. * * @note This function doesn't Access to the device * @@ -451,6 +464,9 @@ VL53L1_Error VL53L1_GetMeasurementTimingBudgetMicroSeconds( * * @param Dev Device Handle * @param InterMeasurementPeriodMilliSeconds Inter-Measurement Period in ms. + * this value should be greater than the duration set in + * @a VL53L1_SetMeasurementTimingBudgetMicroSeconds() to ensure smooth ranging + * operation. * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error */ @@ -523,7 +539,7 @@ VL53L1_Error VL53L1_SetDmaxMode(VL53L1_DEV Dev, * * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error - */ + */ VL53L1_Error VL53L1_GetDmaxMode(VL53L1_DEV Dev, VL53L1_DeviceDmaxModes *pDmaxMode); @@ -559,7 +575,7 @@ VL53L1_Error VL53L1_GetNumberOfLimitCheck( * The limit check is identified with the LimitCheckId. * * @param LimitCheckId Limit Check ID - (0<= LimitCheckId < VL53L1_GetNumberOfLimitCheck() ). + * (0<= LimitCheckId < VL53L1_GetNumberOfLimitCheck() ). * @param pLimitCheckString Pointer to the description string of * the given check limit. Shall be defined as char buf[VL53L1_MAX_STRING_LENGTH] * @return VL53L1_ERROR_NONE Success @@ -886,8 +902,12 @@ VL53L1_Error VL53L1_GetSequenceStepEnable(VL53L1_DEV Dev, * @return VL53L1_ERROR_NONE Success * @return VL53L1_ERROR_MODE_NOT_SUPPORTED This error occurs when * PresetMode programmed with @a VL53L1_SetPresetMode - * * @return VL53L1_ERROR_TIME_OUT Time out on start measurement + * @return VL53L1_ERROR_INVALID_PARAMS This error might occur in timed mode + * when inter measurement period is smaller or too close to the timing budget. + * In such case measurements are not started and user must correct the timings + * passed to @a VL53L1_SetMeasurementTimingBudgetMicroSeconds() and + * @a VL53L1_SetInterMeasurementPeriodMilliSeconds() functions. * @return "Other error code" See ::VL53L1_Error */ VL53L1_Error VL53L1_StartMeasurement(VL53L1_DEV Dev); @@ -1028,8 +1048,8 @@ VL53L1_Error VL53L1_GetMultiRangingData(VL53L1_DEV Dev, * VL53L1_ClearInterruptAndStartMeasurement(). Depending on the PresetMode * currently set parts of the returned data structure may be not relevant. * - * @param Dev Device Handle - * @param VL53L1_AdditionalData_t Pointer to Additional data + * @param Dev Device Handle + * @param pAdditionalData Pointer to Additional data * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error */ @@ -1110,7 +1130,7 @@ VL53L1_Error VL53L1_PerformRefSpadManagement(VL53L1_DEV Dev); * See ::VL53L1_SmudgeCorrectionModes * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error -*/ + */ VL53L1_Error VL53L1_SmudgeCorrectionEnable(VL53L1_DEV Dev, VL53L1_SmudgeCorrectionModes Mode); @@ -1124,7 +1144,7 @@ VL53L1_Error VL53L1_SmudgeCorrectionEnable(VL53L1_DEV Dev, * to be set 0 = disabled or 1 = enabled. * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error -*/ + */ VL53L1_Error VL53L1_SetXTalkCompensationEnable(VL53L1_DEV Dev, uint8_t XTalkCompensationEnable); @@ -1161,9 +1181,6 @@ VL53L1_Error VL53L1_GetXTalkCompensationEnable(VL53L1_DEV Dev, * * @param Dev Device Handle * @param CalibrationOption Select the Calibration to be run : - * @param VL53L1_XTALKCALIBRATIONMODE_NO_TARGET the - * calibration works on its own and changes the current preset mode so user - * must call again @a VL53L1_SetPresetMode() after the calibration * @param CalibrationOption * @li VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET the calibration uses current * preset and distance mode without altering them.
@@ -1175,6 +1192,15 @@ VL53L1_Error VL53L1_GetXTalkCompensationEnable(VL53L1_DEV Dev, * User must call @a VL53L1_SetPresetMode() again after calibration to set the * desired one. during this calibration mode no object must be put below a 80cm * distance from the target + * @li VL53L1_XTALKCALIBRATIONMODE_FULL_ROI the calibration sets appropriate + * preset and distance mode and thus override existing ones
+ * User must call @a VL53L1_SetPresetMode() again after calibration to set the + * desired one. + * The ROI settings must define a single 16x16 ROI before to launch this + * function. + * The calibration uses a target which should be located at least @60cm from the + * device. The actual location of the target shall be passed + * through the bare driver tuning parameters table * * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error @@ -1192,11 +1218,7 @@ VL53L1_Error VL53L1_PerformXTalkCalibration(VL53L1_DEV Dev, * @param OffsetCalibrationMode Offset Calibration Mode valid values are: * @li VL53L1_OFFSETCALIBRATIONMODE_STANDARD * @li VL53L1_OFFSETCALIBRATIONMODE_PRERANGE_ONLY - */ -/** * @li VL53L1_OFFSETCALIBRATIONMODE_MULTI_ZONE - */ -/** * * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error @@ -1357,9 +1379,9 @@ VL53L1_Error VL53L1_GetZoneCalibrationData(VL53L1_DEV Dev, * @note This function doesn't Accesses the device * * @param Dev Device Handle - * @param *pOpticalCentreX pointer to the X position of center + * @param pOpticalCenterX pointer to the X position of center * in 16.16 fix point - * @param *pOpticalCentreY pointer to the Y position of center + * @param pOpticalCenterY pointer to the Y position of center * in 16.16 fix point * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error @@ -1377,22 +1399,22 @@ VL53L1_Error VL53L1_GetOpticalCenter(VL53L1_DEV Dev, */ /** -* @brief Configure the interrupt config, from the given structure -* -* @param[in] Dev : Device Handle -* @param[in] pConfig : pointer to configuration structure -*/ + * @brief Configure the interrupt config, from the given structure + * + * @param[in] Dev : Device Handle + * @param[in] pConfig : pointer to configuration structure + */ VL53L1_Error VL53L1_SetThresholdConfig(VL53L1_DEV Dev, VL53L1_DetectionConfig_t *pConfig); /** -* @brief Retrieves the interrupt config structure currently programmed -* into the API -* -* @param[in] Dev : Device Handle -* @param[out] pConfig : pointer to configuration structure -*/ + * @brief Retrieves the interrupt config structure currently programmed + * into the API + * + * @param[in] Dev : Device Handle + * @param[out] pConfig : pointer to configuration structure + */ VL53L1_Error VL53L1_GetThresholdConfig(VL53L1_DEV Dev, VL53L1_DetectionConfig_t *pConfig); diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api_calibration.h b/drivers/input/misc/vl53L1/inc/vl53l1_api_calibration.h index aae327e760c1..01c9aeb2b8a2 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api_calibration.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api_calibration.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -149,7 +149,8 @@ extern "C" { -VL53L1_Error VL53L1_run_ref_spad_char(VL53L1_DEV Dev, VL53L1_Error *pcal_status); +VL53L1_Error VL53L1_run_ref_spad_char(VL53L1_DEV Dev, + VL53L1_Error * pcal_status); @@ -283,6 +284,11 @@ VL53L1_Error VL53L1_run_spad_rate_map( + + + + + @@ -317,61 +323,6 @@ VL53L1_Error VL53L1_run_xtalk_extraction( - - - - - - - - - - - - - - - - - - - - - - - -VL53L1_Error VL53L1_run_xtalk_extraction_dual_reflectance( - VL53L1_DEV Dev, - uint16_t dss_config__target_total_rate_mcps, - uint32_t phasecal_config_timeout_us, - uint32_t mm_config_timeout_us, - uint32_t range_config_timeout_us, - uint8_t num_of_samples, - uint8_t calc_parms, - uint8_t higher_reflectance, - uint16_t expected_target_distance_mm, - uint16_t xtalk_filter_thresh_mm, - VL53L1_Error *pcal_status); - - - - - - - - - - - - - - - - - - - - @@ -411,37 +362,6 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( -VL53L1_Error VL53L1_get_and_avg_all_xtalk_samples( - VL53L1_DEV Dev, - uint8_t num_of_samples, - uint8_t measurement_mode, - int16_t xtalk_filter_thresh_mm, - VL53L1_xtalk_range_results_t *pxtalk_results, - VL53L1_histogram_bin_data_t *pavg_histo_z0, - VL53L1_histogram_bin_data_t *pavg_histo_z1, - VL53L1_histogram_bin_data_t *pavg_histo_z2, - VL53L1_histogram_bin_data_t *pavg_histo_z3, - VL53L1_histogram_bin_data_t *pavg_histo_z4); - - - - - - - - - - - - - - - - - - - - @@ -493,6 +413,7 @@ VL53L1_Error VL53L1_run_offset_calibration( + VL53L1_Error VL53L1_run_phasecal_average( @@ -540,6 +461,16 @@ VL53L1_Error VL53L1_run_phasecal_average( + + + + + + + + + + @@ -561,6 +492,101 @@ VL53L1_Error VL53L1_run_zone_calibration( VL53L1_Error *pcal_status); + + + + + + + + + + +void VL53L1_hist_xtalk_extract_data_init( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data); + + + + + + + + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_extract_update( + int16_t target_distance_mm, + uint16_t target_width_oversize, + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data); + + + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_extract_fini( + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data, + VL53L1_xtalk_calibration_results_t *pxtalk_cal, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +VL53L1_Error VL53L1_run_hist_xtalk_extraction( + VL53L1_DEV Dev, + int16_t cal_distance_mm, + VL53L1_Error *pcal_status); + + #ifdef __cplusplus } #endif diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api_core.h b/drivers/input/misc/vl53L1/inc/vl53l1_api_core.h index d402e0d84237..eb3122cb0516 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api_core.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api_core.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -281,6 +281,8 @@ VL53L1_Error VL53L1_set_inter_measurement_period_ms( + + VL53L1_Error VL53L1_get_inter_measurement_period_ms( VL53L1_DEV Dev, uint32_t *pinter_measurement_period_ms); @@ -301,6 +303,9 @@ VL53L1_Error VL53L1_get_inter_measurement_period_ms( + + + VL53L1_Error VL53L1_set_timeouts_us( VL53L1_DEV Dev, @@ -350,6 +355,7 @@ VL53L1_Error VL53L1_get_timeouts_us( + VL53L1_Error VL53L1_set_calibration_repeat_period( @@ -368,6 +374,7 @@ VL53L1_Error VL53L1_set_calibration_repeat_period( + VL53L1_Error VL53L1_get_calibration_repeat_period( VL53L1_DEV Dev, uint16_t *pcal_config__repeat_period); @@ -559,6 +566,7 @@ VL53L1_Error VL53L1_get_user_zone( + VL53L1_Error VL53L1_get_mode_mitigation_roi( VL53L1_DEV Dev, VL53L1_user_zone_t *pmm_roi); @@ -627,6 +635,12 @@ VL53L1_Error VL53L1_get_zone_config( + + + + + + @@ -775,6 +789,7 @@ void VL53L1_get_xtalk_compensation_enable( + VL53L1_Error VL53L1_init_and_start_range( @@ -929,6 +944,7 @@ void VL53L1_copy_sys_and_core_results_to_range_results( + VL53L1_Error VL53L1_set_zone_dss_config( VL53L1_DEV Dev, VL53L1_zone_private_dyn_cfg_t *pzone_dyn_cfg); @@ -1178,6 +1194,7 @@ VL53L1_Error VL53L1_get_offset_correction_mode( + VL53L1_Error VL53L1_set_zone_calibration_data( VL53L1_DEV Dev, VL53L1_zone_calibration_results_t *pzone_cal); @@ -1194,6 +1211,7 @@ VL53L1_Error VL53L1_set_zone_calibration_data( + VL53L1_Error VL53L1_get_zone_calibration_data( VL53L1_DEV Dev, VL53L1_zone_calibration_results_t *pzone_cal); @@ -1596,6 +1614,7 @@ VL53L1_Error VL53L1_set_dmax_reflectance_values( + VL53L1_Error VL53L1_get_dmax_reflectance_values( VL53L1_DEV Dev, VL53L1_dmax_reflectance_array_t *pdmax_reflectances); @@ -1912,6 +1931,7 @@ VL53L1_Error VL53L1_set_current_xtalk_settings( VL53L1_xtalk_calibration_results_t *pxtalk ); + #ifdef __cplusplus } #endif diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api_debug.h b/drivers/input/misc/vl53L1/inc/vl53l1_api_debug.h index 925467bc10cd..46239a784864 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api_debug.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api_debug.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -121,6 +121,7 @@ extern "C" { + VL53L1_Error VL53L1_decode_calibration_data_buffer( uint16_t buf_size, uint8_t *pbuffer, @@ -155,6 +156,7 @@ VL53L1_Error VL53L1_get_nvm_debug_data( + VL53L1_Error VL53L1_get_histogram_debug_data( VL53L1_DEV Dev, VL53L1_histogram_bin_data_t *pdata); @@ -243,6 +245,7 @@ void VL53L1_signed_fixed_point_sprintf( + void VL53L1_print_static_nvm_managed( VL53L1_static_nvm_managed_t *pdata, char *pprefix, @@ -258,6 +261,7 @@ void VL53L1_print_static_nvm_managed( + void VL53L1_print_customer_nvm_managed( VL53L1_customer_nvm_managed_t *pdata, char *pprefix, @@ -368,6 +372,7 @@ void VL53L1_print_range_data( + void VL53L1_print_offset_range_results( VL53L1_offset_range_results_t *pdata, char *pprefix, @@ -416,6 +421,7 @@ void VL53L1_print_cal_peak_rate_map( + void VL53L1_print_additional_offset_cal_data( VL53L1_additional_offset_cal_data_t *pdata, char *pprefix, @@ -447,6 +453,7 @@ void VL53L1_print_additional_data( + void VL53L1_print_gain_calibration_data( VL53L1_gain_calibration_data_t *pdata, char *pprefix, @@ -529,6 +536,7 @@ void VL53L1_print_xtalk_range_data( + void VL53L1_print_xtalk_calibration_results( VL53L1_xtalk_calibration_results_t *pdata, char *pprefix, diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api_preset_modes.h b/drivers/input/misc/vl53L1/inc/vl53l1_api_preset_modes.h index b3b92d6ad407..e5e166aa2214 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api_preset_modes.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api_preset_modes.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -118,6 +118,7 @@ extern "C" { + VL53L1_Error VL53L1_init_refspadchar_config_struct( VL53L1_refspadchar_config_t *pdata); @@ -147,6 +148,7 @@ VL53L1_Error VL53L1_init_ssc_config_struct( + VL53L1_Error VL53L1_init_xtalk_config_struct( VL53L1_customer_nvm_managed_t *pnvm, VL53L1_xtalk_config_t *pdata); @@ -161,6 +163,7 @@ VL53L1_Error VL53L1_init_xtalk_config_struct( + VL53L1_Error VL53L1_init_xtalk_extract_config_struct( VL53L1_xtalkextract_config_t *pdata); @@ -201,6 +204,8 @@ VL53L1_Error VL53L1_init_zone_cal_config_struct( + + VL53L1_Error VL53L1_init_hist_post_process_config_struct( uint8_t xtalk_compensation_enable, VL53L1_hist_post_process_config_t *pdata); @@ -216,6 +221,7 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( + VL53L1_Error VL53L1_init_dmax_calibration_data_struct( VL53L1_dmax_calibration_data_t *pdata); @@ -230,6 +236,7 @@ VL53L1_Error VL53L1_init_dmax_calibration_data_struct( + VL53L1_Error VL53L1_init_tuning_parm_storage_struct( VL53L1_tuning_parm_storage_t *pdata); @@ -243,6 +250,7 @@ VL53L1_Error VL53L1_init_tuning_parm_storage_struct( + VL53L1_Error VL53L1_init_hist_gen3_dmax_config_struct( VL53L1_hist_gen3_dmax_config_t *pdata); @@ -263,6 +271,8 @@ VL53L1_Error VL53L1_init_hist_gen3_dmax_config_struct( + + VL53L1_Error VL53L1_preset_mode_standard_ranging( @@ -292,6 +302,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( + + VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range( VL53L1_static_config_t *pstatic, @@ -320,6 +332,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range( + + VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range( @@ -349,6 +363,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range( + + VL53L1_Error VL53L1_preset_mode_standard_ranging_mm1_cal( @@ -378,6 +394,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_mm1_cal( + + VL53L1_Error VL53L1_preset_mode_standard_ranging_mm2_cal( @@ -407,6 +425,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_mm2_cal( + + VL53L1_Error VL53L1_preset_mode_timed_ranging( @@ -437,6 +457,8 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging( + + VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range( @@ -466,6 +488,8 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range( + + VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range( @@ -494,6 +518,9 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range( + + + @@ -525,6 +552,9 @@ VL53L1_Error VL53L1_preset_mode_low_power_auto_ranging( + + + @@ -556,6 +586,9 @@ VL53L1_Error VL53L1_preset_mode_low_power_auto_short_ranging( + + + @@ -582,6 +615,14 @@ VL53L1_Error VL53L1_preset_mode_low_power_auto_long_ranging( + + + + + + + + @@ -615,6 +656,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( + + + + + + + + @@ -648,6 +697,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_with_mm1( + + + + + + + + @@ -681,6 +738,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_with_mm2( + + + + + + + + @@ -714,6 +779,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_mm1_cal( + + + + + + + + @@ -746,6 +819,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_mm2_cal( + + + + + + + + @@ -777,6 +858,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_ref( + + + + + + + + @@ -809,6 +898,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_characterisation( + + + + + + + + @@ -841,6 +938,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_planar( + + + + + + + + @@ -873,6 +978,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_mm1( + + + + + + + + @@ -904,6 +1017,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_mm2( + + + + + + + + @@ -935,6 +1056,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone( + + + + + + + + @@ -966,6 +1095,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone_short_range( + + + + + + + + @@ -997,6 +1134,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone_long_range( + + + + + + + + @@ -1028,6 +1173,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_short_timing( + + + + + + + + @@ -1059,6 +1212,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range( + + + + + + + + @@ -1090,6 +1251,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range( + + + + + + + + @@ -1123,6 +1292,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range( + + + + + + + + @@ -1154,6 +1331,14 @@ VL53L1_Error VL53L1_preset_mode_special_histogram_short_range( + + + + + + + + @@ -1185,6 +1370,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range_mm1( + + + + + + + + @@ -1216,6 +1409,14 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range_mm2( + + + + + + + + diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_api_strings.h b/drivers/input/misc/vl53L1/inc/vl53l1_api_strings.h index 9df1d5ddae58..051fcb2b000c 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_api_strings.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_api_strings.h @@ -1,64 +1,64 @@ -/* -* 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ + +/****************************************************************************** + * 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_strings.h diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_core.h b/drivers/input/misc/vl53L1/inc/vl53l1_core.h index 1e6892c2c9e9..fa6dc8925a55 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_core.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_core.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -366,7 +366,7 @@ void VL53L1_init_histogram_multizone_config_structure( void VL53L1_init_xtalk_bin_data_struct( uint32_t bin_value, - uint16_t VL53L1_PRM_00021, + uint16_t VL53L1_p_024, VL53L1_xtalk_histogram_shape_t *pdata); @@ -699,7 +699,7 @@ VL53L1_Error VL53L1_force_shadow_stream_count_to_zero( uint32_t VL53L1_calc_macro_period_us( uint16_t fast_osc_frequency, - uint8_t VL53L1_PRM_00008); + uint8_t VL53L1_p_009); @@ -852,7 +852,7 @@ VL53L1_Error VL53L1_calc_timeout_register_values( uint8_t VL53L1_encode_vcsel_period( - uint8_t VL53L1_PRM_00030); + uint8_t VL53L1_p_031); @@ -1130,6 +1130,113 @@ void VL53L1_hist_combine_mm1_mm2_offsets( +VL53L1_Error VL53L1_hist_xtalk_extract_calc_window( + int16_t target_distance_mm, + uint16_t target_width_oversize, + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data); + + + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_event_sums( + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data); + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_rate_per_spad( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data); + + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_shape( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape); + + + + + + + + + + + + + + + +VL53L1_Error VL53L1_hist_xtalk_shape_model( + uint16_t events_per_bin, + uint16_t pulse_centre, + uint16_t pulse_width, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape); + + + + + + + + + + + + + + +uint16_t VL53L1_hist_xtalk_shape_model_interp( + uint16_t events_per_bin, + uint32_t phase_delta); + + + + + + + + + + + + + + + + + + void VL53L1_spad_number_to_byte_bit_index( uint8_t spad_number, uint8_t *pbyte_index, @@ -1305,7 +1412,7 @@ void VL53L1_hist_copy_results_to_sys_and_core( -VL53L1_Error VL53L1_sum_histogram_data ( +VL53L1_Error VL53L1_sum_histogram_data( VL53L1_histogram_bin_data_t *phist_input, VL53L1_histogram_bin_data_t *phist_output); @@ -1323,7 +1430,7 @@ VL53L1_Error VL53L1_sum_histogram_data ( -VL53L1_Error VL53L1_avg_histogram_data ( +VL53L1_Error VL53L1_avg_histogram_data( uint8_t no_of_samples, VL53L1_histogram_bin_data_t *phist_sum, VL53L1_histogram_bin_data_t *phist_avg); @@ -1377,7 +1484,7 @@ VL53L1_Error VL53L1_dynamic_zone_update( VL53L1_Error VL53L1_update_internal_stream_counters( - VL53L1_DEV Dev, + VL53L1_DEV Dev, uint8_t external_stream_count, uint8_t *pinternal_stream_count, uint8_t *pinternal_stream_count_val @@ -1404,10 +1511,10 @@ VL53L1_Error VL53L1_multizone_hist_bins_update( VL53L1_Error VL53L1_set_histogram_multizone_initial_bin_config( - VL53L1_zone_config_t *pzone_cfg, - VL53L1_histogram_config_t *phist_cfg, - VL53L1_histogram_config_t *pmulti_hist - ); + VL53L1_zone_config_t *pzone_cfg, + VL53L1_histogram_config_t *phist_cfg, + VL53L1_histogram_config_t *pmulti_hist + ); @@ -1678,10 +1785,10 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_required_samples( VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( - VL53L1_DEV Dev, + VL53L1_DEV Dev, uint32_t xtalk_offset_out, - VL53L1_smudge_corrector_config_t *pconfig, - VL53L1_smudge_corrector_data_t *pout, + VL53L1_smudge_corrector_config_t *pconfig, + VL53L1_smudge_corrector_data_t *pout, uint8_t add_smudge, uint8_t soft_update ); diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_core_support.h b/drivers/input/misc/vl53L1/inc/vl53l1_core_support.h index b7fc0413f7e4..0b117491d6ce 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_core_support.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_core_support.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -160,7 +160,7 @@ uint32_t VL53L1_duration_maths( uint32_t VL53L1_events_per_spad_maths( - int32_t VL53L1_PRM_00012, + int32_t VL53L1_p_013, uint16_t num_spads, uint32_t duration); @@ -259,7 +259,7 @@ uint32_t VL53L1_calc_pll_period_mm( uint16_t VL53L1_rate_maths( - int32_t VL53L1_PRM_00007, + int32_t VL53L1_p_008, uint32_t time_us); @@ -305,7 +305,7 @@ uint16_t VL53L1_rate_per_spad_maths( int32_t VL53L1_range_maths( uint16_t fast_osc_frequency, - uint16_t VL53L1_PRM_00016, + uint16_t VL53L1_p_017, uint16_t zero_distance_phase, uint8_t fractional_bits, int32_t gain_factor, @@ -351,7 +351,7 @@ void VL53L1_copy_xtalk_bin_data_to_histogram_data_struct( void VL53L1_init_histogram_bin_data_struct( int32_t bin_value, - uint16_t VL53L1_PRM_00021, + uint16_t VL53L1_p_024, VL53L1_histogram_bin_data_t *pdata); diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_def.h b/drivers/input/misc/vl53L1/inc/vl53l1_def.h index aaf8d5f43638..74ce15c9dd9b 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_def.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_def.h @@ -1,64 +1,63 @@ -/* -* 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ +/****************************************************************************** + * 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_def.h @@ -84,13 +83,13 @@ extern "C" { /** VL53L1 IMPLEMENTATION major version */ -#define VL53L1_IMPLEMENTATION_VER_MAJOR 5 +#define VL53L1_IMPLEMENTATION_VER_MAJOR 6 /** VL53L1 IMPLEMENTATION minor version */ #define VL53L1_IMPLEMENTATION_VER_MINOR 1 /** VL53L1 IMPLEMENTATION sub version */ -#define VL53L1_IMPLEMENTATION_VER_SUB 1 +#define VL53L1_IMPLEMENTATION_VER_SUB 0 /** VL53L1 IMPLEMENTATION sub version */ -#define VL53L1_IMPLEMENTATION_VER_REVISION 1767 +#define VL53L1_IMPLEMENTATION_VER_REVISION 2120 /**************************************** * PRIVATE define do not edit @@ -112,7 +111,7 @@ typedef struct { */ typedef struct { char Name[VL53L1_DEVINFO_STRLEN]; - /*!< Name of the Device e.g. Left_Distance */ + /*!< 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]; @@ -120,7 +119,9 @@ typedef struct { * @warning Not yet implemented */ uint8_t ProductType; - /*!< Product Type, VL53L1 = 1, VL53L1 = 2*/ + /*!< Product Type, VL53L1 = 0xCC, VL53L3 = 0xAA + * Stands as module_type in the datasheet + */ uint8_t ProductRevisionMajor; /*!< Product revision major */ uint8_t ProductRevisionMinor; @@ -170,9 +171,9 @@ typedef uint8_t VL53L1_OutputModes; /** @} VL53L1_define_OutputModes_group */ /** @defgroup VL53L1_define_XtalkCal_group Defines Xtalk Calibration modes -* Defines all possible Offset Calibration modes for the device -* @{ -*/ + * Defines all possible Offset Calibration modes for the device + * @{ + */ typedef uint8_t VL53L1_XtalkCalibrationModes; #define VL53L1_XTALKCALIBRATIONMODE_NO_TARGET \ @@ -181,13 +182,16 @@ typedef uint8_t VL53L1_XtalkCalibrationModes; #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 -* @{ -*/ + * Defines all possible Offset Calibration modes for the device + * @{ + */ typedef uint8_t VL53L1_OffsetCalibrationModes; #define VL53L1_OFFSETCALIBRATIONMODE_STANDARD \ @@ -200,9 +204,9 @@ typedef uint8_t VL53L1_OffsetCalibrationModes; /** @} VL53L1_define_OffsetCal_group */ /** @defgroup VL53L1_define_DeviceDmaxModes_group Defines Dmax source modes -* Defines all possible sources for Dmax calibration for the device -* @{ -*/ + * Defines all possible sources for Dmax calibration for the device + * @{ + */ typedef uint8_t VL53L1_DeviceDmaxModes; #define VL53L1_DMAXMODE_FMT_CAL_DATA ((VL53L1_DeviceDmaxModes) 1) @@ -313,7 +317,7 @@ typedef uint8_t VL53L1_DetectionMode; #define VL53L1_DETECTION_DISTANCE_OR_RATE \ ((VL53L1_DetectionMode) 4) /*!< Trigger interrupt if "threshold event" occurs on distance OR rate - */ + */ /** @} end of VL53L1_DetectionMode_group */ @@ -336,22 +340,14 @@ typedef struct { /*!< Defines the Output mode to be used for the next measure */ VL53L1_DistanceModes DistanceMode; /*!< Defines the operating mode to be used for the next measure */ - VL53L1_DistanceModes InternalDistanceMode; - /*!< Defines the internal operating mode to be used for the next - * measure - */ - VL53L1_DistanceModes NewDistanceMode; - /*!< Defines the new operating mode to be programmed 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. - */ + * 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]; @@ -534,10 +530,10 @@ typedef struct { /*!< Denotes on which ROI the range data is related to. */ uint8_t NumberOfObjectsFound; /*!< Indicate the number of objects found in the current ROI. - * This is used to know how many ranging data should be get. - * NumberOfObjectsFound is in the range 0 to - * VL53L1_MAX_RANGE_RESULTS. - */ + * This is used to know how many ranging data should be get. + * NumberOfObjectsFound is in the range 0 to + * VL53L1_MAX_RANGE_RESULTS. + */ VL53L1_RoiStatus RoiStatus; /*!< Indicate if the data read is valid or not or if this is * the last valid data in the ROI. @@ -754,80 +750,80 @@ typedef struct { /* Defines */ #define VL53L1_SETPARAMETERFIELD(Dev, field, value) \ - (PALDevDataSet(Dev, CurrentParameters.field, value)) + (VL53L1DevDataSet(Dev, CurrentParameters.field, value)) #define VL53L1_GETPARAMETERFIELD(Dev, field, variable) \ - (variable = PALDevDataGet(Dev, CurrentParameters).field) + (variable = VL53L1DevDataGet(Dev, CurrentParameters).field) #define VL53L1_SETARRAYPARAMETERFIELD(Dev, field, index, value) \ - (PALDevDataSet(Dev, CurrentParameters.field[index], value)) + (VL53L1DevDataSet(Dev, CurrentParameters.field[index], value)) #define VL53L1_GETARRAYPARAMETERFIELD(Dev, field, index, variable) \ - (variable = PALDevDataGet(Dev, CurrentParameters).field[index]) + (variable = VL53L1DevDataGet(Dev, CurrentParameters).field[index]) #define VL53L1_SETDEVICESPECIFICPARAMETER(Dev, field, value) \ - (PALDevDataSet(Dev, DeviceSpecificParameters.field, value)) + (VL53L1DevDataSet(Dev, DeviceSpecificParameters.field, value)) #define VL53L1_GETDEVICESPECIFICPARAMETER(Dev, field) \ - (PALDevDataGet(Dev, DeviceSpecificParameters).field) + (VL53L1DevDataGet(Dev, DeviceSpecificParameters).field) #define VL53L1_FIXPOINT1616TOFIXPOINT44(Value) \ (uint16_t)((Value>>12)&0xFFFF) #define VL53L1_FIXPOINT44TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<12) + (FixPoint1616_t)((uint32_t)Value<<12) #define VL53L1_FIXPOINT1616TOFIXPOINT72(Value) \ (uint16_t)((Value>>14)&0xFFFF) #define VL53L1_FIXPOINT72TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<14) + (FixPoint1616_t)((uint32_t)Value<<14) #define VL53L1_FIXPOINT1616TOFIXPOINT97(Value) \ (uint16_t)((Value>>9)&0xFFFF) #define VL53L1_FIXPOINT97TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<9) + (FixPoint1616_t)((uint32_t)Value<<9) #define VL53L1_FIXPOINT1616TOFIXPOINT88(Value) \ (uint16_t)((Value>>8)&0xFFFF) #define VL53L1_FIXPOINT88TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<8) + (FixPoint1616_t)((uint32_t)Value<<8) #define VL53L1_FIXPOINT1616TOFIXPOINT412(Value) \ (uint16_t)((Value>>4)&0xFFFF) #define VL53L1_FIXPOINT412TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<4) + (FixPoint1616_t)((uint32_t)Value<<4) #define VL53L1_FIXPOINT1616TOFIXPOINT313(Value) \ (uint16_t)((Value>>3)&0xFFFF) #define VL53L1_FIXPOINT313TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<3) + (FixPoint1616_t)((uint32_t)Value<<3) #define VL53L1_FIXPOINT1616TOFIXPOINT08(Value) \ (uint8_t)((Value>>8)&0x00FF) #define VL53L1_FIXPOINT08TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<8) + (FixPoint1616_t)((uint32_t)Value<<8) #define VL53L1_FIXPOINT1616TOFIXPOINT53(Value) \ (uint8_t)((Value>>13)&0x00FF) #define VL53L1_FIXPOINT53TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<13) + (FixPoint1616_t)((uint32_t)Value<<13) #define VL53L1_FIXPOINT1616TOFIXPOINT102(Value) \ (uint16_t)((Value>>14)&0x0FFF) #define VL53L1_FIXPOINT102TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<14) + (FixPoint1616_t)((uint32_t)Value<<14) #define VL53L1_FIXPOINT1616TOFIXPOINT142(Value) \ (uint16_t)((Value>>14)&0xFFFF) #define VL53L1_FIXPOINT142TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<14) + (FixPoint1616_t)((uint32_t)Value<<14) #define VL53L1_FIXPOINT1616TOFIXPOINT160(Value) \ (uint16_t)((Value>>16)&0xFFFF) #define VL53L1_FIXPOINT160TOFIXPOINT1616(Value) \ - (FixPoint1616_t)(Value<<16) + (FixPoint1616_t)((uint32_t)Value<<16) #define VL53L1_MAKEUINT16(lsb, msb) (uint16_t)((((uint16_t)msb)<<8) + \ (uint16_t)lsb) @@ -836,11 +832,6 @@ typedef struct { #define SUPPRESS_UNUSED_WARNING(x) ((void) (x)) #endif -#define CHECK_ERROR_GO_ENDFUNC do {\ - if (Status != VL53L1_ERROR_NONE) \ - goto ENDFUNC; \ - } while (0) - /** @} VL53L1_define_GeneralMacro_group */ /** @} VL53L1_globaldefine_group */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_dmax_structs.h b/drivers/input/misc/vl53L1/inc/vl53l1_dmax_structs.h index 0349cab070fe..5b4d9b7f20e3 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_dmax_structs.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_dmax_structs.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -152,7 +152,7 @@ typedef struct { -} VL53L1_dmax_calibration_data_t ; +} VL53L1_dmax_calibration_data_t; @@ -181,7 +181,8 @@ typedef struct { - uint16_t target_reflectance_for_dmax_calc[VL53L1_MAX_AMBIENT_DMAX_VALUES]; + uint16_t target_reflectance_for_dmax_calc[ + VL53L1_MAX_AMBIENT_DMAX_VALUES]; uint16_t max_effective_spads; diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_error_codes.h b/drivers/input/misc/vl53L1/inc/vl53l1_error_codes.h index 16df23e0f238..1bf727eaf560 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_error_codes.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_error_codes.h @@ -1,30 +1,63 @@ -/******************************************************************************* -Copyright (C) 2016, STMicroelectronics International N.V. -All rights reserved. +/****************************************************************************** + * Copyright (c) 2017, STMicroelectronics - All Rights Reserved -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * 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. - * Neither the name of STMicroelectronics nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. + 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. -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, FITNESS FOR A PARTICULAR PURPOSE, AND -NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. -IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. 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. -*******************************************************************************/ + ****************************************************************************** + + '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 @@ -43,11 +76,14 @@ extern "C" { #endif -/**************************************** +/* + **************************************** * PRIVATE define do not edit - ****************************************/ + *************************************** + */ -/** @defgroup VL53L1_define_Error_group Error and Warning code returned by API +/* + * @defgroup VL53L1_define_Error_group Error and Warning code returned by API * The following DEFINE are used to identify the PAL ERROR * @{ */ @@ -57,9 +93,10 @@ 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 */ + * \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 */ @@ -87,7 +124,8 @@ typedef int8_t VL53L1_Error; /*!< 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) */ + * (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) @@ -107,105 +145,121 @@ typedef int8_t VL53L1_Error; /*!< 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 */ + * 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. */ + * 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 */ + * 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 */ + * 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 */ + * 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 */ + * 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 */ + * 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. */ + * 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 */ + * 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 */ + * 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 */ + * 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 */ + * 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 */ + * 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 */ + * 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 + * 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 + * notification only, 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 + * measure the xtalk signal in vl53l1_run_xtalk_extract(). This can + * signify that any one of the zones 0-3 yielded no successful samples. * 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 + /*!< 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. + * 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 */ + * not compatible with the device + */ #define VL53L1_ERROR_PLATFORM_SPECIFIC_START ((VL53L1_Error) - 60) /*!< Tells the starting code for platform */ /** @} VL53L1_define_Error_group */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_error_exceptions.h b/drivers/input/misc/vl53L1/inc/vl53l1_error_exceptions.h index ac2737aa1c68..0b2db2ba0e28 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_error_exceptions.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_error_exceptions.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_error_strings.h b/drivers/input/misc/vl53L1/inc/vl53l1_error_strings.h index 333c8ac59e92..02cba46adb53 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_error_strings.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_error_strings.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -176,7 +176,7 @@ VL53L1_Error VL53L1_get_pal_error_string( #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 VL53L1_PRM_00010 limit - Xtalk Extract Fail" + "Xtalk does not meet required VL53L1_p_011 limit - Xtalk Extract Fail" #define VL53L1_STRING_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL \ "Offset Cal - one of more stages with no valid samples - fatal" @@ -204,7 +204,7 @@ VL53L1_Error VL53L1_get_pal_error_string( #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 VL53L1_PRM_00010 estimate too high" + "Zone Cal - One of more zones the VL53L1_p_011 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" diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_fpga_core.h b/drivers/input/misc/vl53L1/inc/vl53l1_fpga_core.h deleted file mode 100644 index e5d13a65bb9c..000000000000 --- a/drivers/input/misc/vl53L1/inc/vl53l1_fpga_core.h +++ /dev/null @@ -1,134 +0,0 @@ - -/* -* Copyright (c) 2016, 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#ifndef _VL53L1_FPGA_CORE_H_ -#define _VL53L1_FPGA_CORE_H_ - -#include "vl53l1_platform.h" - -#ifdef __cplusplus -extern "C" { -#endif - - - - - - - - - - - - - - - -VL53L1_Error VL53L1_is_firmware_ready_fpga( - VL53L1_DEV Dev, - uint8_t *pready); - - - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_hist_char.h b/drivers/input/misc/vl53L1/inc/vl53l1_hist_char.h index 3bfb931f4ecf..25d84d16240a 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_hist_char.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_hist_char.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_hist_map.h b/drivers/input/misc/vl53L1/inc/vl53l1_hist_map.h index 3aa52e6371ed..952dd16d6019 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_hist_map.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_hist_map.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -145,7 +145,8 @@ extern "C" #define VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX \ VL53L1_RESULT__INTERRUPT_STATUS #define VL53L1_HISTOGRAM_BIN_DATA_I2C_SIZE_BYTES \ - (VL53L1_RESULT__HISTOGRAM_BIN_23_0_LSB - VL53L1_RESULT__INTERRUPT_STATUS + 1) + (VL53L1_RESULT__HISTOGRAM_BIN_23_0_LSB - \ + VL53L1_RESULT__INTERRUPT_STATUS + 1) #ifdef __cplusplus } diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_hist_structs.h b/drivers/input/misc/vl53L1/inc/vl53l1_hist_structs.h index 7304b62f3763..48909e091ec3 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_hist_structs.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_hist_structs.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -144,13 +144,13 @@ typedef struct { uint8_t histogram_config__user_bin_offset; - uint8_t histogram_config__high_amb_even_bin_0_1; - uint8_t histogram_config__high_amb_even_bin_2_3; - uint8_t histogram_config__high_amb_even_bin_4_5; + uint8_t histogram_config__high_amb_even_bin_0_1; + uint8_t histogram_config__high_amb_even_bin_2_3; + uint8_t histogram_config__high_amb_even_bin_4_5; - uint8_t histogram_config__high_amb_odd_bin_0_1; - uint8_t histogram_config__high_amb_odd_bin_2_3; - uint8_t histogram_config__high_amb_odd_bin_4_5; + uint8_t histogram_config__high_amb_odd_bin_0_1; + uint8_t histogram_config__high_amb_odd_bin_2_3; + uint8_t histogram_config__high_amb_odd_bin_4_5; uint16_t histogram_config__amb_thresh_low; @@ -333,13 +333,13 @@ typedef struct { - uint8_t VL53L1_PRM_00019; + uint8_t VL53L1_p_022; - uint8_t VL53L1_PRM_00020; + uint8_t VL53L1_p_023; - uint8_t VL53L1_PRM_00021; + uint8_t VL53L1_p_024; @@ -387,10 +387,10 @@ typedef struct { uint16_t vcsel_width; - uint8_t VL53L1_PRM_00008; + uint8_t VL53L1_p_009; - uint16_t VL53L1_PRM_00022; + uint16_t VL53L1_p_019; uint32_t total_periods_elapsed; @@ -420,7 +420,7 @@ typedef struct { int32_t ambient_events_sum; - int32_t VL53L1_PRM_00028; + int32_t VL53L1_p_004; @@ -451,13 +451,13 @@ typedef struct { - uint8_t VL53L1_PRM_00019; + uint8_t VL53L1_p_022; - uint8_t VL53L1_PRM_00020; + uint8_t VL53L1_p_023; - uint8_t VL53L1_PRM_00021; + uint8_t VL53L1_p_024; uint32_t bin_data[VL53L1_XTALK_HISTO_BINS]; @@ -477,7 +477,7 @@ typedef struct { uint16_t vcsel_width; - uint16_t VL53L1_PRM_00022; + uint16_t VL53L1_p_019; uint16_t zero_distance_phase; diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_ll_def.h b/drivers/input/misc/vl53L1/inc/vl53l1_ll_def.h index 41889c6386b8..7e599ca26e0f 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_ll_def.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_ll_def.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -128,12 +128,12 @@ extern "C" { #define VL53L1_LL_API_IMPLEMENTATION_VER_MINOR 1 -#define VL53L1_LL_API_IMPLEMENTATION_VER_SUB 43 +#define VL53L1_LL_API_IMPLEMENTATION_VER_SUB 48 -#define VL53L1_LL_API_IMPLEMENTATION_VER_REVISION 12193 +#define VL53L1_LL_API_IMPLEMENTATION_VER_REVISION 12221 -#define VL53L1_LL_API_IMPLEMENTATION_VER_STRING "1.1.43.12193" +#define VL53L1_LL_API_IMPLEMENTATION_VER_STRING "1.1.48.12221" @@ -238,7 +238,7 @@ typedef struct { uint8_t device_test_mode; - uint8_t VL53L1_PRM_00008; + uint8_t VL53L1_p_009; uint32_t timeout_us; @@ -380,7 +380,7 @@ typedef struct { - uint8_t VL53L1_PRM_00008; + uint8_t VL53L1_p_009; uint8_t vcsel_start; @@ -1179,29 +1179,29 @@ typedef struct { uint32_t time_stamp; - uint8_t VL53L1_PRM_00014; + uint8_t VL53L1_p_015; - uint8_t VL53L1_PRM_00019; + uint8_t VL53L1_p_022; - uint8_t VL53L1_PRM_00023; + uint8_t VL53L1_p_025; - uint8_t VL53L1_PRM_00024; + uint8_t VL53L1_p_026; - uint8_t VL53L1_PRM_00015; + uint8_t VL53L1_p_016; - uint8_t VL53L1_PRM_00025; + uint8_t VL53L1_p_027; uint16_t width; - uint8_t VL53L1_PRM_00029; + uint8_t VL53L1_p_030; @@ -1212,7 +1212,7 @@ typedef struct { uint16_t zero_distance_phase; - uint16_t VL53L1_PRM_00004; + uint16_t VL53L1_p_006; @@ -1232,14 +1232,14 @@ typedef struct { - uint32_t VL53L1_PRM_00017; + uint32_t VL53L1_p_020; - uint32_t VL53L1_PRM_00018; + uint32_t VL53L1_p_021; - int32_t VL53L1_PRM_00012; + int32_t VL53L1_p_013; @@ -1259,28 +1259,28 @@ typedef struct { uint16_t total_rate_per_spad_mcps; - uint32_t VL53L1_PRM_00011; + uint32_t VL53L1_p_012; - uint16_t VL53L1_PRM_00003; + uint16_t VL53L1_p_005; - uint16_t VL53L1_PRM_00026; + uint16_t VL53L1_p_028; - uint16_t VL53L1_PRM_00013; + uint16_t VL53L1_p_014; - uint16_t VL53L1_PRM_00027; + uint16_t VL53L1_p_029; @@ -1337,7 +1337,7 @@ typedef struct { - int16_t VL53L1_PRM_00006[VL53L1_MAX_AMBIENT_DMAX_VALUES]; + int16_t VL53L1_p_007[VL53L1_MAX_AMBIENT_DMAX_VALUES]; @@ -1357,7 +1357,7 @@ typedef struct { uint8_t active_results; - VL53L1_range_data_t VL53L1_PRM_00005[VL53L1_MAX_RANGE_RESULTS]; + VL53L1_range_data_t VL53L1_p_002[VL53L1_MAX_RANGE_RESULTS]; VL53L1_range_data_t xmonitor; @@ -1477,7 +1477,8 @@ typedef struct { - VL53L1_xtalk_range_data_t VL53L1_PRM_00005[VL53L1_MAX_XTALK_RANGE_RESULTS]; + VL53L1_xtalk_range_data_t + VL53L1_p_002[VL53L1_MAX_XTALK_RANGE_RESULTS]; VL53L1_histogram_bin_data_t central_histogram_sum; @@ -1496,15 +1497,18 @@ typedef struct { - VL53L1_histogram_bin_data_t histogram_avg_1[VL53L1_MAX_XTALK_RANGE_RESULTS]; + VL53L1_histogram_bin_data_t + histogram_avg_1[VL53L1_MAX_XTALK_RANGE_RESULTS]; - VL53L1_histogram_bin_data_t histogram_avg_2[VL53L1_MAX_XTALK_RANGE_RESULTS]; + VL53L1_histogram_bin_data_t + histogram_avg_2[VL53L1_MAX_XTALK_RANGE_RESULTS]; - VL53L1_histogram_bin_data_t xtalk_avg[VL53L1_MAX_XTALK_RANGE_RESULTS]; + VL53L1_histogram_bin_data_t + xtalk_avg[VL53L1_MAX_XTALK_RANGE_RESULTS]; @@ -1541,7 +1545,7 @@ typedef struct { uint32_t peak_rate_mcps; - uint32_t VL53L1_PRM_00003; + uint32_t VL53L1_p_005; int32_t median_range_mm; @@ -1584,7 +1588,8 @@ typedef struct { uint8_t active_results; - VL53L1_offset_range_data_t VL53L1_PRM_00005[VL53L1_MAX_OFFSET_RANGE_RESULTS]; + VL53L1_offset_range_data_t + VL53L1_p_002[VL53L1_MAX_OFFSET_RANGE_RESULTS]; @@ -1632,14 +1637,14 @@ typedef struct { typedef struct { - uint32_t VL53L1_PRM_00017; + uint32_t VL53L1_p_020; - uint32_t VL53L1_PRM_00018; + uint32_t VL53L1_p_021; - uint16_t VL53L1_PRM_00013; + uint16_t VL53L1_p_014; uint8_t range_status; @@ -1678,7 +1683,7 @@ typedef struct { uint8_t active_objects; - VL53L1_object_data_t VL53L1_PRM_00005[VL53L1_MAX_RANGE_RESULTS]; + VL53L1_object_data_t VL53L1_p_002[VL53L1_MAX_RANGE_RESULTS]; @@ -1709,7 +1714,7 @@ typedef struct { uint8_t active_zones; - VL53L1_zone_objects_t VL53L1_PRM_00005[VL53L1_MAX_USER_ZONES]; + VL53L1_zone_objects_t VL53L1_p_002[VL53L1_MAX_USER_ZONES]; @@ -1737,7 +1742,7 @@ typedef struct { uint16_t result__dss_actual_effective_spads; - uint8_t VL53L1_PRM_00008; + uint8_t VL53L1_p_009; uint32_t total_periods_elapsed; @@ -1768,7 +1773,7 @@ typedef struct { uint8_t active_zones; - VL53L1_zone_hist_info_t VL53L1_PRM_00005[VL53L1_MAX_USER_ZONES]; + VL53L1_zone_hist_info_t VL53L1_p_002[VL53L1_MAX_USER_ZONES]; @@ -1793,10 +1798,10 @@ typedef struct { uint32_t peak_rate_mcps; - uint32_t VL53L1_PRM_00013; + uint32_t VL53L1_p_014; - uint32_t VL53L1_PRM_00003; + uint32_t VL53L1_p_005; @@ -1853,7 +1858,7 @@ typedef struct { uint8_t active_zones; - VL53L1_zone_calibration_data_t VL53L1_PRM_00005[VL53L1_MAX_USER_ZONES]; + VL53L1_zone_calibration_data_t VL53L1_p_002[VL53L1_MAX_USER_ZONES]; @@ -1950,7 +1955,7 @@ typedef struct { uint8_t active_zones; - VL53L1_zone_private_dyn_cfg_t VL53L1_PRM_00005[VL53L1_MAX_USER_ZONES]; + VL53L1_zone_private_dyn_cfg_t VL53L1_p_002[VL53L1_MAX_USER_ZONES]; @@ -1985,6 +1990,109 @@ typedef struct { +typedef struct { + + + + uint32_t sample_count; + + + + uint32_t pll_period_mm; + + + + uint32_t peak_duration_us_sum; + + + + uint32_t effective_spad_count_sum; + + + + uint32_t zero_distance_phase_sum; + + + + uint32_t zero_distance_phase_avg; + + + + int32_t event_scaler_sum; + + + + int32_t event_scaler_avg; + + + + int32_t signal_events_sum; + + + + uint32_t xtalk_rate_kcps_per_spad; + + + + int32_t xtalk_start_phase; + + + + int32_t xtalk_end_phase; + + + + int32_t xtalk_width_phase; + + + + int32_t target_start_phase; + + + + int32_t target_end_phase; + + + + int32_t target_width_phase; + + + + int32_t effective_width; + + + + int32_t event_scaler; + + + + uint8_t VL53L1_p_015; + + + + uint8_t VL53L1_p_016; + + + + uint8_t target_start; + + + + int32_t max_shape_value; + + + + int32_t bin_data_sums[VL53L1_XTALK_HISTO_BINS]; + +} VL53L1_hist_xtalk_extract_data_t; + + + + + + + + typedef struct { @@ -2179,6 +2287,7 @@ typedef struct { VL53L1_xtalk_histogram_data_t xtalk_shapes; VL53L1_xtalk_range_results_t xtalk_results; VL53L1_xtalk_calibration_results_t xtalk_cal; + VL53L1_hist_xtalk_extract_data_t xtalk_extract; @@ -2333,9 +2442,9 @@ typedef struct { uint16_t vl53l1_tuningparm_hist_sigma_thresh_mm; uint16_t vl53l1_tuningparm_hist_gain_factor; uint8_t vl53l1_tuningparm_consistency_hist_phase_tolerance; - uint16_t vl53l1_tuningparm_consistency_hist_min_max_tolerance_mm; + uint16_t vl53l1_tuningparm_consistency_hist_min_max_tolerance_mm; uint8_t vl53l1_tuningparm_consistency_hist_event_sigma; - uint16_t vl53l1_tuningparm_consistency_hist_event_sigma_min_spad_limit; + uint16_t vl53l1_tuningparm_consistency_hist_event_sigma_min_spad_limit; uint8_t vl53l1_tuningparm_initial_phase_rtn_histo_long_range; uint8_t vl53l1_tuningparm_initial_phase_rtn_histo_med_range; uint8_t vl53l1_tuningparm_initial_phase_rtn_histo_short_range; @@ -2413,14 +2522,14 @@ typedef struct { uint8_t vl53l1_tuningparm_spadmap_vcsel_period; uint8_t vl53l1_tuningparm_spadmap_vcsel_start; uint16_t vl53l1_tuningparm_spadmap_rate_limit_mcps; - uint16_t vl53l1_tuningparm_lite_dss_config_target_total_rate_mcps; - uint16_t vl53l1_tuningparm_ranging_dss_config_target_total_rate_mcps; + uint16_t vl53l1_tuningparm_lite_dss_config_target_total_rate_mcps; + uint16_t vl53l1_tuningparm_ranging_dss_config_target_total_rate_mcps; uint16_t vl53l1_tuningparm_mz_dss_config_target_total_rate_mcps; - uint16_t vl53l1_tuningparm_timed_dss_config_target_total_rate_mcps; + uint16_t vl53l1_tuningparm_timed_dss_config_target_total_rate_mcps; uint32_t vl53l1_tuningparm_lite_phasecal_config_timeout_us; - uint32_t vl53l1_tuningparm_ranging_long_phasecal_config_timeout_us; - uint32_t vl53l1_tuningparm_ranging_med_phasecal_config_timeout_us; - uint32_t vl53l1_tuningparm_ranging_short_phasecal_config_timeout_us; + uint32_t vl53l1_tuningparm_ranging_long_phasecal_config_timeout_us; + uint32_t vl53l1_tuningparm_ranging_med_phasecal_config_timeout_us; + uint32_t vl53l1_tuningparm_ranging_short_phasecal_config_timeout_us; uint32_t vl53l1_tuningparm_mz_long_phasecal_config_timeout_us; uint32_t vl53l1_tuningparm_mz_med_phasecal_config_timeout_us; uint32_t vl53l1_tuningparm_mz_short_phasecal_config_timeout_us; @@ -2492,7 +2601,7 @@ typedef struct { uint8_t spad_type; - uint16_t VL53L1_PRM_00020; + uint16_t VL53L1_p_023; uint16_t rate_data[VL53L1_NO_OF_SPAD_ENABLES]; @@ -2560,7 +2669,7 @@ typedef struct { - VL53L1_histogram_bin_data_t VL53L1_PRM_00009; + VL53L1_histogram_bin_data_t VL53L1_p_010; @@ -2574,6 +2683,7 @@ typedef struct { + #define SUPPRESS_UNUSED_WARNING(x) \ ((void) (x)) diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_ll_device.h b/drivers/input/misc/vl53L1/inc/vl53l1_ll_device.h index 512f19f1404a..900c7df606cb 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_ll_device.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_ll_device.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -160,22 +160,35 @@ typedef uint8_t VL53L1_DeviceState; typedef uint8_t VL53L1_DeviceZonePreset; -#define VL53L1_DEVICEZONEPRESET_NONE ((VL53L1_DeviceZonePreset) 0) +#define VL53L1_DEVICEZONEPRESET_NONE \ + ((VL53L1_DeviceZonePreset) 0) -#define VL53L1_DEVICEZONEPRESET_XTALK_PLANAR ((VL53L1_DeviceZonePreset) 1) -#define VL53L1_DEVICEZONEPRESET_1X1_SIZE_16X16 ((VL53L1_DeviceZonePreset) 2) -#define VL53L1_DEVICEZONEPRESET_1X2_SIZE_16X8 ((VL53L1_DeviceZonePreset) 3) -#define VL53L1_DEVICEZONEPRESET_2X1_SIZE_8X16 ((VL53L1_DeviceZonePreset) 4) -#define VL53L1_DEVICEZONEPRESET_2X2_SIZE_8X8 ((VL53L1_DeviceZonePreset) 5) -#define VL53L1_DEVICEZONEPRESET_3X3_SIZE_5X5 ((VL53L1_DeviceZonePreset) 6) -#define VL53L1_DEVICEZONEPRESET_4X4_SIZE_4X4 ((VL53L1_DeviceZonePreset) 7) -#define VL53L1_DEVICEZONEPRESET_5X5_SIZE_4X4 ((VL53L1_DeviceZonePreset) 8) -#define VL53L1_DEVICEZONEPRESET_11X11_SIZE_5X5 ((VL53L1_DeviceZonePreset) 9) -#define VL53L1_DEVICEZONEPRESET_13X13_SIZE_4X4 ((VL53L1_DeviceZonePreset) 10) +#define VL53L1_DEVICEZONEPRESET_XTALK_PLANAR \ + ((VL53L1_DeviceZonePreset) 1) +#define VL53L1_DEVICEZONEPRESET_1X1_SIZE_16X16 \ + ((VL53L1_DeviceZonePreset) 2) +#define VL53L1_DEVICEZONEPRESET_1X2_SIZE_16X8 \ + ((VL53L1_DeviceZonePreset) 3) +#define VL53L1_DEVICEZONEPRESET_2X1_SIZE_8X16 \ + ((VL53L1_DeviceZonePreset) 4) +#define VL53L1_DEVICEZONEPRESET_2X2_SIZE_8X8 \ + ((VL53L1_DeviceZonePreset) 5) +#define VL53L1_DEVICEZONEPRESET_3X3_SIZE_5X5 \ + ((VL53L1_DeviceZonePreset) 6) +#define VL53L1_DEVICEZONEPRESET_4X4_SIZE_4X4 \ + ((VL53L1_DeviceZonePreset) 7) +#define VL53L1_DEVICEZONEPRESET_5X5_SIZE_4X4 \ + ((VL53L1_DeviceZonePreset) 8) +#define VL53L1_DEVICEZONEPRESET_11X11_SIZE_5X5 \ + ((VL53L1_DeviceZonePreset) 9) +#define VL53L1_DEVICEZONEPRESET_13X13_SIZE_4X4 \ + ((VL53L1_DeviceZonePreset) 10) -#define VL53L1_DEVICEZONEPRESET_1X1_SIZE_4X4_POS_8X8 ((VL53L1_DeviceZonePreset) 11) +#define VL53L1_DEVICEZONEPRESET_1X1_SIZE_4X4_POS_8X8 \ + ((VL53L1_DeviceZonePreset) 11) -#define VL53L1_DEVICEZONEPRESET_CUSTOM ((VL53L1_DeviceZonePreset) 255) +#define VL53L1_DEVICEZONEPRESET_CUSTOM \ + ((VL53L1_DeviceZonePreset) 255) @@ -189,46 +202,86 @@ typedef uint8_t VL53L1_DeviceZonePreset; 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_NEAR_FARRANGING ((VL53L1_DevicePresetModes) 9) -#define VL53L1_DEVICEPRESETMODE_QUADRANT_RANGING ((VL53L1_DevicePresetModes) 10) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING ((VL53L1_DevicePresetModes) 11) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_SHORT_TIMING ((VL53L1_DevicePresetModes) 12) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_CHARACTERISATION ((VL53L1_DevicePresetModes) 13) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_PLANAR ((VL53L1_DevicePresetModes) 14) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_MM1 ((VL53L1_DevicePresetModes) 15) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_MM2 ((VL53L1_DevicePresetModes) 16) -#define VL53L1_DEVICEPRESETMODE_OLT ((VL53L1_DevicePresetModes) 17) -#define VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING ((VL53L1_DevicePresetModes) 18) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_REF_ARRAY ((VL53L1_DevicePresetModes) 19) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_WITH_MM1 ((VL53L1_DevicePresetModes) 20) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_WITH_MM2 ((VL53L1_DevicePresetModes) 21) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_MM1_CAL ((VL53L1_DevicePresetModes) 22) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_MM2_CAL ((VL53L1_DevicePresetModes) 23) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE ((VL53L1_DevicePresetModes) 24) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_SHORT_RANGE ((VL53L1_DevicePresetModes) 25) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_LONG_RANGE ((VL53L1_DevicePresetModes) 26) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE ((VL53L1_DevicePresetModes) 27) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE_MM1 ((VL53L1_DevicePresetModes) 28) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE_MM2 ((VL53L1_DevicePresetModes) 29) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE ((VL53L1_DevicePresetModes) 30) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM1 ((VL53L1_DevicePresetModes) 31) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM2 ((VL53L1_DevicePresetModes) 32) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE ((VL53L1_DevicePresetModes) 33) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE_MM1 ((VL53L1_DevicePresetModes) 34) -#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE_MM2 ((VL53L1_DevicePresetModes) 35) -#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) -#define VL53L1_DEVICEPRESETMODE_SPECIAL_HISTOGRAM_SHORT_RANGE ((VL53L1_DevicePresetModes) 39) +#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_NEAR_FARRANGING \ + ((VL53L1_DevicePresetModes) 9) +#define VL53L1_DEVICEPRESETMODE_QUADRANT_RANGING \ + ((VL53L1_DevicePresetModes) 10) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING \ + ((VL53L1_DevicePresetModes) 11) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_SHORT_TIMING \ + ((VL53L1_DevicePresetModes) 12) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_CHARACTERISATION \ + ((VL53L1_DevicePresetModes) 13) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_PLANAR \ + ((VL53L1_DevicePresetModes) 14) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_MM1 \ + ((VL53L1_DevicePresetModes) 15) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_MM2 \ + ((VL53L1_DevicePresetModes) 16) +#define VL53L1_DEVICEPRESETMODE_OLT \ + ((VL53L1_DevicePresetModes) 17) +#define VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING \ + ((VL53L1_DevicePresetModes) 18) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_REF_ARRAY \ + ((VL53L1_DevicePresetModes) 19) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_WITH_MM1 \ + ((VL53L1_DevicePresetModes) 20) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_WITH_MM2 \ + ((VL53L1_DevicePresetModes) 21) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_MM1_CAL \ + ((VL53L1_DevicePresetModes) 22) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_MM2_CAL \ + ((VL53L1_DevicePresetModes) 23) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE \ + ((VL53L1_DevicePresetModes) 24) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_SHORT_RANGE \ + ((VL53L1_DevicePresetModes) 25) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_LONG_RANGE \ + ((VL53L1_DevicePresetModes) 26) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE \ + ((VL53L1_DevicePresetModes) 27) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE_MM1 \ + ((VL53L1_DevicePresetModes) 28) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE_MM2 \ + ((VL53L1_DevicePresetModes) 29) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE \ + ((VL53L1_DevicePresetModes) 30) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM1 \ + ((VL53L1_DevicePresetModes) 31) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM2 \ + ((VL53L1_DevicePresetModes) 32) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE \ + ((VL53L1_DevicePresetModes) 33) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE_MM1 \ + ((VL53L1_DevicePresetModes) 34) +#define VL53L1_DEVICEPRESETMODE_HISTOGRAM_SHORT_RANGE_MM2 \ + ((VL53L1_DevicePresetModes) 35) +#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) +#define VL53L1_DEVICEPRESETMODE_SPECIAL_HISTOGRAM_SHORT_RANGE \ + ((VL53L1_DevicePresetModes) 39) @@ -242,11 +295,16 @@ typedef uint8_t VL53L1_DevicePresetModes; 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) +#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) @@ -260,12 +318,18 @@ typedef uint8_t VL53L1_DeviceMeasurementModes; 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) +#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) @@ -279,9 +343,12 @@ typedef uint8_t VL53L1_OffsetCalibrationMode; 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) +#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) @@ -295,10 +362,14 @@ typedef uint8_t VL53L1_OffsetCorrectionMode; typedef uint8_t VL53L1_DeviceDmaxMode; -#define VL53L1_DEVICEDMAXMODE__NONE ((VL53L1_DeviceDmaxMode) 0) -#define VL53L1_DEVICEDMAXMODE__FMT_CAL_DATA ((VL53L1_DeviceDmaxMode) 1) -#define VL53L1_DEVICEDMAXMODE__CUST_CAL_DATA ((VL53L1_DeviceDmaxMode) 2) -#define VL53L1_DEVICEDMAXMODE__PER_ZONE_CAL_DATA ((VL53L1_DeviceDmaxMode) 3) +#define VL53L1_DEVICEDMAXMODE__NONE \ + ((VL53L1_DeviceDmaxMode) 0) +#define VL53L1_DEVICEDMAXMODE__FMT_CAL_DATA \ + ((VL53L1_DeviceDmaxMode) 1) +#define VL53L1_DEVICEDMAXMODE__CUST_CAL_DATA \ + ((VL53L1_DeviceDmaxMode) 2) +#define VL53L1_DEVICEDMAXMODE__PER_ZONE_CAL_DATA \ + ((VL53L1_DeviceDmaxMode) 3) @@ -313,14 +384,22 @@ typedef uint8_t VL53L1_DeviceDmaxMode; 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) +#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) @@ -334,10 +413,14 @@ typedef uint8_t VL53L1_DeviceSequenceConfig; 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) +#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) @@ -351,13 +434,20 @@ typedef uint8_t VL53L1_DeviceInterruptPolarity; 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) +#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) @@ -375,35 +465,59 @@ typedef uint8_t VL53L1_DeviceGpioMode; typedef uint8_t VL53L1_DeviceError; -#define VL53L1_DEVICEERROR_NOUPDATE ((VL53L1_DeviceError) 0) +#define VL53L1_DEVICEERROR_NOUPDATE \ + ((VL53L1_DeviceError) 0) -#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) +#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) -#define VL53L1_DEVICEERROR_PREV_RANGE_NO_TARGETS ((VL53L1_DeviceError) 23) +#define VL53L1_DEVICEERROR_PREV_RANGE_NO_TARGETS \ + ((VL53L1_DeviceError) 23) @@ -417,19 +531,30 @@ typedef uint8_t VL53L1_DeviceError; typedef uint8_t VL53L1_DeviceReportStatus; -#define VL53L1_DEVICEREPORTSTATUS_NOUPDATE ((VL53L1_DeviceReportStatus) 0) +#define VL53L1_DEVICEREPORTSTATUS_NOUPDATE \ + ((VL53L1_DeviceReportStatus) 0) -#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) +#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) @@ -761,7 +886,8 @@ typedef uint8_t VL53L1_DeviceSscArray; #define VL53L1_MACRO_PERIOD_VCSEL_PERIODS \ - (VL53L1_AMBIENT_WINDOW_VCSEL_PERIODS + VL53L1_RANGING_WINDOW_VCSEL_PERIODS) + (VL53L1_AMBIENT_WINDOW_VCSEL_PERIODS + \ + VL53L1_RANGING_WINDOW_VCSEL_PERIODS) #define VL53L1_MAX_ALLOWED_PHASE 0xFFFF @@ -858,7 +984,7 @@ 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_VERY_SHORT_DSS_RATE_MCPS) + ((VL53L1_TuningParms) VL53L1_TUNINGPARM_VERY_SHORT_DSS_RATE_MCPS) #define VL53L1_TUNINGPARMS_LLD_PRIVATE_MIN_ADDRESS \ ((VL53L1_TuningParms) VL53L1_TUNINGPARM_PRIVATE_PAGE_BASE_ADDRESS) diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_nvm.h b/drivers/input/misc/vl53L1/inc/vl53l1_nvm.h index d5471fc91e4c..53ccad1c112e 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_nvm.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_nvm.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_debug.h b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_debug.h index b738d0c4fea3..0524c0c169f5 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_debug.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_debug.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_map.h b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_map.h index b96f4e08b5e7..15b5e1276665 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_map.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_map.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -118,7 +118,7 @@ extern "C" -#define VL53L1_NVM__IDENTIFICATION__MODEL_ID 0x0008 +#define VL53L1_NVM__IDENTIFICATION__MODEL_ID 0x0008 @@ -134,7 +134,7 @@ extern "C" -#define VL53L1_NVM__IDENTIFICATION__MODULE_TYPE 0x000C +#define VL53L1_NVM__IDENTIFICATION__MODULE_TYPE 0x000C @@ -150,7 +150,7 @@ extern "C" -#define VL53L1_NVM__IDENTIFICATION__REVISION_ID 0x000D +#define VL53L1_NVM__IDENTIFICATION__REVISION_ID 0x000D @@ -166,7 +166,7 @@ extern "C" -#define VL53L1_NVM__IDENTIFICATION__MODULE_ID 0x000E +#define VL53L1_NVM__IDENTIFICATION__MODULE_ID 0x000E @@ -182,7 +182,7 @@ extern "C" -#define VL53L1_NVM__I2C_VALID 0x0010 +#define VL53L1_NVM__I2C_VALID 0x0010 @@ -198,7 +198,7 @@ extern "C" -#define VL53L1_NVM__I2C_SLAVE__DEVICE_ADDRESS 0x0011 +#define VL53L1_NVM__I2C_SLAVE__DEVICE_ADDRESS 0x0011 @@ -214,7 +214,7 @@ extern "C" -#define VL53L1_NVM__EWS__OSC_MEASURED__FAST_OSC_FREQUENCY 0x0014 +#define VL53L1_NVM__EWS__OSC_MEASURED__FAST_OSC_FREQUENCY 0x0014 @@ -230,7 +230,7 @@ extern "C" -#define VL53L1_NVM__EWS__FAST_OSC_TRIM_MAX 0x0016 +#define VL53L1_NVM__EWS__FAST_OSC_TRIM_MAX 0x0016 @@ -246,7 +246,7 @@ extern "C" -#define VL53L1_NVM__EWS__FAST_OSC_FREQ_SET 0x0017 +#define VL53L1_NVM__EWS__FAST_OSC_FREQ_SET 0x0017 @@ -262,7 +262,7 @@ extern "C" -#define VL53L1_NVM__EWS__SLOW_OSC_CALIBRATION 0x0018 +#define VL53L1_NVM__EWS__SLOW_OSC_CALIBRATION 0x0018 @@ -278,7 +278,7 @@ extern "C" -#define VL53L1_NVM__FMT__OSC_MEASURED__FAST_OSC_FREQUENCY 0x001C +#define VL53L1_NVM__FMT__OSC_MEASURED__FAST_OSC_FREQUENCY 0x001C @@ -294,7 +294,7 @@ extern "C" -#define VL53L1_NVM__FMT__FAST_OSC_TRIM_MAX 0x001E +#define VL53L1_NVM__FMT__FAST_OSC_TRIM_MAX 0x001E @@ -310,7 +310,7 @@ extern "C" -#define VL53L1_NVM__FMT__FAST_OSC_FREQ_SET 0x001F +#define VL53L1_NVM__FMT__FAST_OSC_FREQ_SET 0x001F @@ -326,7 +326,7 @@ extern "C" -#define VL53L1_NVM__FMT__SLOW_OSC_CALIBRATION 0x0020 +#define VL53L1_NVM__FMT__SLOW_OSC_CALIBRATION 0x0020 @@ -342,7 +342,7 @@ extern "C" -#define VL53L1_NVM__VHV_CONFIG_UNLOCK 0x0028 +#define VL53L1_NVM__VHV_CONFIG_UNLOCK 0x0028 @@ -358,7 +358,7 @@ extern "C" -#define VL53L1_NVM__REF_SELVDDPIX 0x0029 +#define VL53L1_NVM__REF_SELVDDPIX 0x0029 @@ -374,7 +374,7 @@ extern "C" -#define VL53L1_NVM__REF_SELVQUENCH 0x002A +#define VL53L1_NVM__REF_SELVQUENCH 0x002A @@ -390,7 +390,7 @@ extern "C" -#define VL53L1_NVM__REGAVDD1V2_SEL_REGDVDD1V2_SEL 0x002B +#define VL53L1_NVM__REGAVDD1V2_SEL_REGDVDD1V2_SEL 0x002B @@ -407,7 +407,7 @@ extern "C" -#define VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND 0x002C +#define VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND 0x002C @@ -424,7 +424,7 @@ extern "C" -#define VL53L1_NVM__VHV_CONFIG__COUNT_THRESH 0x002D +#define VL53L1_NVM__VHV_CONFIG__COUNT_THRESH 0x002D @@ -440,7 +440,7 @@ extern "C" -#define VL53L1_NVM__VHV_CONFIG__OFFSET 0x002E +#define VL53L1_NVM__VHV_CONFIG__OFFSET 0x002E @@ -456,7 +456,7 @@ extern "C" -#define VL53L1_NVM__VHV_CONFIG__INIT 0x002F +#define VL53L1_NVM__VHV_CONFIG__INIT 0x002F @@ -473,7 +473,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_TRIM_LL 0x0030 +#define VL53L1_NVM__LASER_SAFETY__VCSEL_TRIM_LL 0x0030 @@ -489,7 +489,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_LL 0x0031 +#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_LL 0x0031 @@ -505,7 +505,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_MAX_LL 0x0032 +#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_MAX_LL 0x0032 @@ -521,7 +521,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__MULT_LL 0x0034 +#define VL53L1_NVM__LASER_SAFETY__MULT_LL 0x0034 @@ -537,7 +537,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__CLIP_LL 0x0035 +#define VL53L1_NVM__LASER_SAFETY__CLIP_LL 0x0035 @@ -553,7 +553,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_TRIM_LD 0x0038 +#define VL53L1_NVM__LASER_SAFETY__VCSEL_TRIM_LD 0x0038 @@ -569,7 +569,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_LD 0x0039 +#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_LD 0x0039 @@ -585,7 +585,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_MAX_LD 0x003A +#define VL53L1_NVM__LASER_SAFETY__VCSEL_SELION_MAX_LD 0x003A @@ -601,7 +601,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__MULT_LD 0x003C +#define VL53L1_NVM__LASER_SAFETY__MULT_LD 0x003C @@ -617,7 +617,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY__CLIP_LD 0x003D +#define VL53L1_NVM__LASER_SAFETY__CLIP_LD 0x003D @@ -633,7 +633,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY_LOCK_BYTE 0x0040 +#define VL53L1_NVM__LASER_SAFETY_LOCK_BYTE 0x0040 @@ -649,7 +649,7 @@ extern "C" -#define VL53L1_NVM__LASER_SAFETY_UNLOCK_BYTE 0x0044 +#define VL53L1_NVM__LASER_SAFETY_UNLOCK_BYTE 0x0044 @@ -665,7 +665,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_0_ 0x0048 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_0_ 0x0048 @@ -681,7 +681,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_1_ 0x0049 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_1_ 0x0049 @@ -697,7 +697,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_2_ 0x004A +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_2_ 0x004A @@ -713,7 +713,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_3_ 0x004B +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_3_ 0x004B @@ -729,7 +729,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_4_ 0x004C +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_4_ 0x004C @@ -745,7 +745,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_5_ 0x004D +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_5_ 0x004D @@ -761,7 +761,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_6_ 0x004E +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_6_ 0x004E @@ -777,7 +777,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_7_ 0x004F +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_7_ 0x004F @@ -793,7 +793,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_8_ 0x0050 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_8_ 0x0050 @@ -809,7 +809,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_9_ 0x0051 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_9_ 0x0051 @@ -825,7 +825,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_10_ 0x0052 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_10_ 0x0052 @@ -841,7 +841,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_11_ 0x0053 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_11_ 0x0053 @@ -857,7 +857,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_12_ 0x0054 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_12_ 0x0054 @@ -873,7 +873,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_13_ 0x0055 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_13_ 0x0055 @@ -889,7 +889,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_14_ 0x0056 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_14_ 0x0056 @@ -905,7 +905,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_15_ 0x0057 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_15_ 0x0057 @@ -921,7 +921,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_16_ 0x0058 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_16_ 0x0058 @@ -937,7 +937,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_17_ 0x0059 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_17_ 0x0059 @@ -953,7 +953,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_18_ 0x005A +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_18_ 0x005A @@ -969,7 +969,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_19_ 0x005B +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_19_ 0x005B @@ -985,7 +985,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_20_ 0x005C +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_20_ 0x005C @@ -1001,7 +1001,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_21_ 0x005D +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_21_ 0x005D @@ -1017,7 +1017,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_22_ 0x005E +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_22_ 0x005E @@ -1033,7 +1033,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_23_ 0x005F +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_23_ 0x005F @@ -1049,7 +1049,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_24_ 0x0060 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_24_ 0x0060 @@ -1065,7 +1065,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_25_ 0x0061 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_25_ 0x0061 @@ -1081,7 +1081,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_26_ 0x0062 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_26_ 0x0062 @@ -1097,7 +1097,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_27_ 0x0063 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_27_ 0x0063 @@ -1113,7 +1113,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_28_ 0x0064 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_28_ 0x0064 @@ -1129,7 +1129,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_29_ 0x0065 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_29_ 0x0065 @@ -1145,7 +1145,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_30_ 0x0066 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_30_ 0x0066 @@ -1161,7 +1161,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_31_ 0x0067 +#define VL53L1_NVM__EWS__SPAD_ENABLES_RTN_31_ 0x0067 @@ -1177,7 +1177,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_0_ 0x0068 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_0_ 0x0068 @@ -1193,7 +1193,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_1_ 0x0069 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_1_ 0x0069 @@ -1209,7 +1209,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_2_ 0x006A +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_2_ 0x006A @@ -1225,7 +1225,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_3_ 0x006B +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_3_ 0x006B @@ -1241,7 +1241,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_4_ 0x006C +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_4_ 0x006C @@ -1257,7 +1257,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_5_ 0x006D +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC1_5_ 0x006D @@ -1273,7 +1273,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_0_ 0x0070 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_0_ 0x0070 @@ -1289,7 +1289,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_1_ 0x0071 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_1_ 0x0071 @@ -1305,7 +1305,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_2_ 0x0072 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_2_ 0x0072 @@ -1321,7 +1321,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_3_ 0x0073 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_3_ 0x0073 @@ -1337,7 +1337,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_4_ 0x0074 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_4_ 0x0074 @@ -1353,7 +1353,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_5_ 0x0075 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC2_5_ 0x0075 @@ -1369,7 +1369,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_0_ 0x0078 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_0_ 0x0078 @@ -1385,7 +1385,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_1_ 0x0079 +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_1_ 0x0079 @@ -1401,7 +1401,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_2_ 0x007A +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_2_ 0x007A @@ -1417,7 +1417,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_3_ 0x007B +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_3_ 0x007B @@ -1433,7 +1433,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_4_ 0x007C +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_4_ 0x007C @@ -1449,7 +1449,7 @@ extern "C" -#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_5_ 0x007D +#define VL53L1_NVM__EWS__SPAD_ENABLES_REF__LOC3_5_ 0x007D @@ -1465,7 +1465,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_0_ 0x0080 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_0_ 0x0080 @@ -1481,7 +1481,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_1_ 0x0081 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_1_ 0x0081 @@ -1497,7 +1497,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_2_ 0x0082 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_2_ 0x0082 @@ -1513,7 +1513,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_3_ 0x0083 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_3_ 0x0083 @@ -1529,7 +1529,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_4_ 0x0084 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_4_ 0x0084 @@ -1545,7 +1545,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_5_ 0x0085 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_5_ 0x0085 @@ -1561,7 +1561,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_6_ 0x0086 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_6_ 0x0086 @@ -1577,7 +1577,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_7_ 0x0087 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_7_ 0x0087 @@ -1593,7 +1593,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_8_ 0x0088 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_8_ 0x0088 @@ -1609,7 +1609,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_9_ 0x0089 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_9_ 0x0089 @@ -1625,7 +1625,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_10_ 0x008A +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_10_ 0x008A @@ -1641,7 +1641,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_11_ 0x008B +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_11_ 0x008B @@ -1657,7 +1657,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_12_ 0x008C +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_12_ 0x008C @@ -1673,7 +1673,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_13_ 0x008D +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_13_ 0x008D @@ -1689,7 +1689,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_14_ 0x008E +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_14_ 0x008E @@ -1705,7 +1705,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_15_ 0x008F +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_15_ 0x008F @@ -1721,7 +1721,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_16_ 0x0090 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_16_ 0x0090 @@ -1737,7 +1737,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_17_ 0x0091 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_17_ 0x0091 @@ -1753,7 +1753,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_18_ 0x0092 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_18_ 0x0092 @@ -1769,7 +1769,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_19_ 0x0093 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_19_ 0x0093 @@ -1785,7 +1785,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_20_ 0x0094 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_20_ 0x0094 @@ -1801,7 +1801,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_21_ 0x0095 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_21_ 0x0095 @@ -1817,7 +1817,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_22_ 0x0096 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_22_ 0x0096 @@ -1833,7 +1833,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_23_ 0x0097 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_23_ 0x0097 @@ -1849,7 +1849,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_24_ 0x0098 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_24_ 0x0098 @@ -1865,7 +1865,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_25_ 0x0099 +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_25_ 0x0099 @@ -1881,7 +1881,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_26_ 0x009A +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_26_ 0x009A @@ -1897,7 +1897,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_27_ 0x009B +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_27_ 0x009B @@ -1913,7 +1913,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_28_ 0x009C +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_28_ 0x009C @@ -1929,7 +1929,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_29_ 0x009D +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_29_ 0x009D @@ -1945,7 +1945,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_30_ 0x009E +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_30_ 0x009E @@ -1961,7 +1961,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_31_ 0x009F +#define VL53L1_NVM__FMT__SPAD_ENABLES_RTN_31_ 0x009F @@ -1977,7 +1977,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_0_ 0x00A0 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_0_ 0x00A0 @@ -1993,7 +1993,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_1_ 0x00A1 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_1_ 0x00A1 @@ -2009,7 +2009,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_2_ 0x00A2 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_2_ 0x00A2 @@ -2025,7 +2025,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_3_ 0x00A3 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_3_ 0x00A3 @@ -2041,7 +2041,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_4_ 0x00A4 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_4_ 0x00A4 @@ -2057,7 +2057,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_5_ 0x00A5 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC1_5_ 0x00A5 @@ -2073,7 +2073,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_0_ 0x00A8 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_0_ 0x00A8 @@ -2089,7 +2089,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_1_ 0x00A9 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_1_ 0x00A9 @@ -2105,7 +2105,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_2_ 0x00AA +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_2_ 0x00AA @@ -2121,7 +2121,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_3_ 0x00AB +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_3_ 0x00AB @@ -2137,7 +2137,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_4_ 0x00AC +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_4_ 0x00AC @@ -2153,7 +2153,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_5_ 0x00AD +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC2_5_ 0x00AD @@ -2169,7 +2169,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_0_ 0x00B0 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_0_ 0x00B0 @@ -2185,7 +2185,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_1_ 0x00B1 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_1_ 0x00B1 @@ -2201,7 +2201,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_2_ 0x00B2 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_2_ 0x00B2 @@ -2217,7 +2217,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_3_ 0x00B3 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_3_ 0x00B3 @@ -2233,7 +2233,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_4_ 0x00B4 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_4_ 0x00B4 @@ -2249,7 +2249,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_5_ 0x00B5 +#define VL53L1_NVM__FMT__SPAD_ENABLES_REF__LOC3_5_ 0x00B5 @@ -2265,7 +2265,7 @@ extern "C" -#define VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_CENTRE_SPAD 0x00B8 +#define VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_CENTRE_SPAD 0x00B8 @@ -2281,7 +2281,7 @@ extern "C" -#define VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_XY_SIZE 0x00B9 +#define VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_XY_SIZE 0x00B9 @@ -2298,7 +2298,7 @@ extern "C" -#define VL53L1_NVM__FMT__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD 0x00BC +#define VL53L1_NVM__FMT__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD 0x00BC @@ -2314,7 +2314,7 @@ extern "C" -#define VL53L1_NVM__FMT__REF_SPAD_MAN__REF_LOCATION 0x00BD +#define VL53L1_NVM__FMT__REF_SPAD_MAN__REF_LOCATION 0x00BD @@ -2330,7 +2330,7 @@ extern "C" -#define VL53L1_NVM__FMT__MM_CONFIG__INNER_OFFSET_MM 0x00C0 +#define VL53L1_NVM__FMT__MM_CONFIG__INNER_OFFSET_MM 0x00C0 @@ -2346,7 +2346,7 @@ extern "C" -#define VL53L1_NVM__FMT__MM_CONFIG__OUTER_OFFSET_MM 0x00C2 +#define VL53L1_NVM__FMT__MM_CONFIG__OUTER_OFFSET_MM 0x00C2 @@ -2362,7 +2362,7 @@ extern "C" -#define VL53L1_NVM__FMT__ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x00C4 +#define VL53L1_NVM__FMT__ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x00C4 @@ -2378,7 +2378,7 @@ extern "C" -#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x00C8 +#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x00C8 @@ -2394,7 +2394,8 @@ extern "C" -#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS 0x00CA +#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS \ + 0x00CA @@ -2410,7 +2411,8 @@ extern "C" -#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS 0x00CC +#define VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS \ + 0x00CC @@ -2426,7 +2428,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0 0x00CE +#define VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0 0x00CE @@ -2442,7 +2444,7 @@ extern "C" -#define VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1 0x00CF +#define VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1 0x00CF @@ -2458,7 +2460,7 @@ extern "C" -#define VL53L1_NVM__CUSTOMER_NVM_SPACE_PROGRAMMED 0x00E0 +#define VL53L1_NVM__CUSTOMER_NVM_SPACE_PROGRAMMED 0x00E0 @@ -2474,7 +2476,7 @@ extern "C" -#define VL53L1_NVM__CUST__I2C_SLAVE__DEVICE_ADDRESS 0x00E4 +#define VL53L1_NVM__CUST__I2C_SLAVE__DEVICE_ADDRESS 0x00E4 @@ -2490,7 +2492,7 @@ extern "C" -#define VL53L1_NVM__CUST__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD 0x00E8 +#define VL53L1_NVM__CUST__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD 0x00E8 @@ -2506,7 +2508,7 @@ extern "C" -#define VL53L1_NVM__CUST__REF_SPAD_MAN__REF_LOCATION 0x00E9 +#define VL53L1_NVM__CUST__REF_SPAD_MAN__REF_LOCATION 0x00E9 @@ -2522,7 +2524,7 @@ extern "C" -#define VL53L1_NVM__CUST__MM_CONFIG__INNER_OFFSET_MM 0x00EC +#define VL53L1_NVM__CUST__MM_CONFIG__INNER_OFFSET_MM 0x00EC @@ -2538,7 +2540,7 @@ extern "C" -#define VL53L1_NVM__CUST__MM_CONFIG__OUTER_OFFSET_MM 0x00EE +#define VL53L1_NVM__CUST__MM_CONFIG__OUTER_OFFSET_MM 0x00EE @@ -2554,7 +2556,7 @@ extern "C" -#define VL53L1_NVM__CUST__ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x00F0 +#define VL53L1_NVM__CUST__ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x00F0 @@ -2570,7 +2572,7 @@ extern "C" -#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x00F4 +#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x00F4 @@ -2586,7 +2588,8 @@ extern "C" -#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS 0x00F6 +#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS \ + 0x00F6 @@ -2602,7 +2605,8 @@ extern "C" -#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS 0x00F8 +#define VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS \ + 0x00F8 @@ -2618,7 +2622,7 @@ extern "C" -#define VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0 0x00FA +#define VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0 0x00FA @@ -2634,7 +2638,7 @@ extern "C" -#define VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1 0x00FB +#define VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1 0x00FB @@ -2650,7 +2654,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_0 0x01DC +#define VL53L1_NVM__FMT__FGC__BYTE_0 0x01DC @@ -2666,7 +2670,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_1 0x01DD +#define VL53L1_NVM__FMT__FGC__BYTE_1 0x01DD @@ -2682,7 +2686,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_2 0x01DE +#define VL53L1_NVM__FMT__FGC__BYTE_2 0x01DE @@ -2698,7 +2702,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_3 0x01DF +#define VL53L1_NVM__FMT__FGC__BYTE_3 0x01DF @@ -2714,7 +2718,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_4 0x01E0 +#define VL53L1_NVM__FMT__FGC__BYTE_4 0x01E0 @@ -2730,7 +2734,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_5 0x01E1 +#define VL53L1_NVM__FMT__FGC__BYTE_5 0x01E1 @@ -2746,7 +2750,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_6 0x01E2 +#define VL53L1_NVM__FMT__FGC__BYTE_6 0x01E2 @@ -2763,7 +2767,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_7 0x01E3 +#define VL53L1_NVM__FMT__FGC__BYTE_7 0x01E3 @@ -2779,7 +2783,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_8 0x01E4 +#define VL53L1_NVM__FMT__FGC__BYTE_8 0x01E4 @@ -2795,7 +2799,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_9 0x01E5 +#define VL53L1_NVM__FMT__FGC__BYTE_9 0x01E5 @@ -2811,7 +2815,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_10 0x01E6 +#define VL53L1_NVM__FMT__FGC__BYTE_10 0x01E6 @@ -2827,7 +2831,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_11 0x01E7 +#define VL53L1_NVM__FMT__FGC__BYTE_11 0x01E7 @@ -2843,7 +2847,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_12 0x01E8 +#define VL53L1_NVM__FMT__FGC__BYTE_12 0x01E8 @@ -2859,7 +2863,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_13 0x01E9 +#define VL53L1_NVM__FMT__FGC__BYTE_13 0x01E9 @@ -2876,7 +2880,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_14 0x01EA +#define VL53L1_NVM__FMT__FGC__BYTE_14 0x01EA @@ -2892,7 +2896,7 @@ extern "C" -#define VL53L1_NVM__FMT__FGC__BYTE_15 0x01EB +#define VL53L1_NVM__FMT__FGC__BYTE_15 0x01EB @@ -2908,7 +2912,7 @@ extern "C" -#define VL53L1_NVM__FMT__TEST_PROGRAM_MAJOR_MINOR 0x01EC +#define VL53L1_NVM__FMT__TEST_PROGRAM_MAJOR_MINOR 0x01EC @@ -2925,7 +2929,7 @@ extern "C" -#define VL53L1_NVM__FMT__MAP_MAJOR_MINOR 0x01ED +#define VL53L1_NVM__FMT__MAP_MAJOR_MINOR 0x01ED @@ -2942,7 +2946,7 @@ extern "C" -#define VL53L1_NVM__FMT__YEAR_MONTH 0x01EE +#define VL53L1_NVM__FMT__YEAR_MONTH 0x01EE @@ -2959,7 +2963,7 @@ extern "C" -#define VL53L1_NVM__FMT__DAY_MODULE_DATE_PHASE 0x01EF +#define VL53L1_NVM__FMT__DAY_MODULE_DATE_PHASE 0x01EF @@ -2976,7 +2980,7 @@ extern "C" -#define VL53L1_NVM__FMT__TIME 0x01F0 +#define VL53L1_NVM__FMT__TIME 0x01F0 @@ -2992,7 +2996,7 @@ extern "C" -#define VL53L1_NVM__FMT__TESTER_ID 0x01F2 +#define VL53L1_NVM__FMT__TESTER_ID 0x01F2 @@ -3008,7 +3012,7 @@ extern "C" -#define VL53L1_NVM__FMT__SITE_ID 0x01F3 +#define VL53L1_NVM__FMT__SITE_ID 0x01F3 @@ -3024,7 +3028,7 @@ extern "C" -#define VL53L1_NVM__EWS__TEST_PROGRAM_MAJOR_MINOR 0x01F4 +#define VL53L1_NVM__EWS__TEST_PROGRAM_MAJOR_MINOR 0x01F4 @@ -3041,7 +3045,7 @@ extern "C" -#define VL53L1_NVM__EWS__PROBE_CARD_MAJOR_MINOR 0x01F5 +#define VL53L1_NVM__EWS__PROBE_CARD_MAJOR_MINOR 0x01F5 @@ -3058,7 +3062,7 @@ extern "C" -#define VL53L1_NVM__EWS__TESTER_ID 0x01F6 +#define VL53L1_NVM__EWS__TESTER_ID 0x01F6 @@ -3074,7 +3078,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_0 0x01F8 +#define VL53L1_NVM__EWS__LOT__BYTE_0 0x01F8 @@ -3090,7 +3094,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_1 0x01F9 +#define VL53L1_NVM__EWS__LOT__BYTE_1 0x01F9 @@ -3106,7 +3110,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_2 0x01FA +#define VL53L1_NVM__EWS__LOT__BYTE_2 0x01FA @@ -3123,7 +3127,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_3 0x01FB +#define VL53L1_NVM__EWS__LOT__BYTE_3 0x01FB @@ -3139,7 +3143,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_4 0x01FC +#define VL53L1_NVM__EWS__LOT__BYTE_4 0x01FC @@ -3155,7 +3159,7 @@ extern "C" -#define VL53L1_NVM__EWS__LOT__BYTE_5 0x01FD +#define VL53L1_NVM__EWS__LOT__BYTE_5 0x01FD @@ -3171,7 +3175,7 @@ extern "C" -#define VL53L1_NVM__EWS__WAFER 0x01FD +#define VL53L1_NVM__EWS__WAFER 0x01FD @@ -3187,7 +3191,7 @@ extern "C" -#define VL53L1_NVM__EWS__XCOORD 0x01FE +#define VL53L1_NVM__EWS__XCOORD 0x01FE @@ -3203,7 +3207,7 @@ extern "C" -#define VL53L1_NVM__EWS__YCOORD 0x01FF +#define VL53L1_NVM__EWS__YCOORD 0x01FF @@ -3220,19 +3224,19 @@ extern "C" -#define VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX 0x00B8 +#define VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX 0x00B8 #define VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_SIZE 4 -#define VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX 0x015C +#define VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX 0x015C #define VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_SIZE 56 -#define VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX 0x0194 +#define VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX 0x0194 #define VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_SIZE 8 #define VL53L1_NVM__FMT__RANGE_RESULTS__140MM_MM_PRE_RANGE 0x019C -#define VL53L1_NVM__FMT__RANGE_RESULTS__140MM_DARK 0x01AC -#define VL53L1_NVM__FMT__RANGE_RESULTS__400MM_DARK 0x01BC -#define VL53L1_NVM__FMT__RANGE_RESULTS__400MM_AMBIENT 0x01CC +#define VL53L1_NVM__FMT__RANGE_RESULTS__140MM_DARK 0x01AC +#define VL53L1_NVM__FMT__RANGE_RESULTS__400MM_DARK 0x01BC +#define VL53L1_NVM__FMT__RANGE_RESULTS__400MM_AMBIENT 0x01CC #define VL53L1_NVM__FMT__RANGE_RESULTS__SIZE_BYTES 16 diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_structs.h b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_structs.h index fb64c352ef4d..4f9504034bc4 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_nvm_structs.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_nvm_structs.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -790,7 +790,10 @@ typedef struct { VL53L1_optical_centre_t fmt_optical_centre; VL53L1_cal_peak_rate_map_t fmt_peak_rate_map; VL53L1_additional_offset_cal_data_t fmt_add_offset_data; - VL53L1_decoded_nvm_fmt_range_data_t fmt_range_data[VL53L1_NVM_MAX_FMT_RANGE_DATA]; + + VL53L1_decoded_nvm_fmt_range_data_t + fmt_range_data[VL53L1_NVM_MAX_FMT_RANGE_DATA]; + VL53L1_decoded_nvm_fmt_info_t fmt_info; VL53L1_decoded_nvm_ews_info_t ews_info; diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_preset_setup.h b/drivers/input/misc/vl53L1/inc/vl53l1_preset_setup.h index 745a3ca24fda..2a93fe70f330 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_preset_setup.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_preset_setup.h @@ -1,64 +1,64 @@ -/* -* 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ + +/****************************************************************************** + * 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. + + + ******************************************************************************* + */ #ifndef _VL53L1_PRESET_SETUP_H_ #define _VL53L1_PRESET_SETUP_H_ @@ -75,13 +75,29 @@ enum VL53L1_Tuning_t { 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_RANGES, + VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER, + VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM, + VL53L1_TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT, VL53L1_TUNING_MAX_TUNABLE_KEY }; /* default values for the tuning settings parameters */ -#define TUNING_VERSION 0x0002 +#define TUNING_VERSION 0x0004 + +#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 5 +/* 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 3 +/* Number of loops done during the simple offset calibration*/ /* the following table should actually be defined as static and shall be part * of the VL53L1_StaticInit() function code diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_register_funcs.h b/drivers/input/misc/vl53L1/inc/vl53l1_register_funcs.h index a600eb8e8532..37f492699c46 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_register_funcs.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_register_funcs.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_register_map.h b/drivers/input/misc/vl53L1/inc/vl53l1_register_map.h index f437a3073713..5b73b703b453 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_register_map.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_register_map.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -107,16 +107,16 @@ -#define VL53L1_SOFT_RESET 0x0000 +#define VL53L1_SOFT_RESET 0x0000 -#define VL53L1_I2C_SLAVE__DEVICE_ADDRESS 0x0001 +#define VL53L1_I2C_SLAVE__DEVICE_ADDRESS 0x0001 @@ -131,8 +131,8 @@ -#define VL53L1_ANA_CONFIG__VHV_REF_SEL_VDDPIX 0x0002 +#define VL53L1_ANA_CONFIG__VHV_REF_SEL_VDDPIX 0x0002 @@ -147,8 +147,8 @@ -#define VL53L1_ANA_CONFIG__VHV_REF_SEL_VQUENCH 0x0003 +#define VL53L1_ANA_CONFIG__VHV_REF_SEL_VQUENCH 0x0003 @@ -163,8 +163,8 @@ -#define VL53L1_ANA_CONFIG__REG_AVDD1V2_SEL 0x0004 +#define VL53L1_ANA_CONFIG__REG_AVDD1V2_SEL 0x0004 @@ -179,8 +179,8 @@ -#define VL53L1_ANA_CONFIG__FAST_OSC__TRIM 0x0005 +#define VL53L1_ANA_CONFIG__FAST_OSC__TRIM 0x0005 @@ -195,8 +195,8 @@ -#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY 0x0006 +#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY 0x0006 @@ -211,24 +211,24 @@ -#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY_HI 0x0006 +#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY_HI 0x0006 -#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY_LO 0x0007 +#define VL53L1_OSC_MEASURED__FAST_OSC__FREQUENCY_LO 0x0007 -#define VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND 0x0008 +#define VL53L1_VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND 0x0008 @@ -244,8 +244,8 @@ -#define VL53L1_VHV_CONFIG__COUNT_THRESH 0x0009 +#define VL53L1_VHV_CONFIG__COUNT_THRESH 0x0009 @@ -260,8 +260,8 @@ -#define VL53L1_VHV_CONFIG__OFFSET 0x000A +#define VL53L1_VHV_CONFIG__OFFSET 0x000A @@ -276,8 +276,8 @@ -#define VL53L1_VHV_CONFIG__INIT 0x000B +#define VL53L1_VHV_CONFIG__INIT 0x000B @@ -293,8 +293,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_0 0x000D +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_0 0x000D @@ -309,8 +309,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_1 0x000E +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_1 0x000E @@ -325,8 +325,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_2 0x000F +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_2 0x000F @@ -341,8 +341,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_3 0x0010 +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_3 0x0010 @@ -357,8 +357,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_4 0x0011 +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_4 0x0011 @@ -373,8 +373,8 @@ -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_5 0x0012 +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_5 0x0012 @@ -389,8 +389,8 @@ -#define VL53L1_GLOBAL_CONFIG__REF_EN_START_SELECT 0x0013 +#define VL53L1_GLOBAL_CONFIG__REF_EN_START_SELECT 0x0013 @@ -405,8 +405,8 @@ -#define VL53L1_REF_SPAD_MAN__NUM_REQUESTED_REF_SPADS 0x0014 +#define VL53L1_REF_SPAD_MAN__NUM_REQUESTED_REF_SPADS 0x0014 @@ -421,8 +421,8 @@ -#define VL53L1_REF_SPAD_MAN__REF_LOCATION 0x0015 +#define VL53L1_REF_SPAD_MAN__REF_LOCATION 0x0015 @@ -437,8 +437,8 @@ -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x0016 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS 0x0016 @@ -453,25 +453,25 @@ -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS_HI 0x0016 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS_HI 0x0016 -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS_LO 0x0017 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS_LO 0x0017 -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS 0x0018 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS 0x0018 @@ -485,26 +485,26 @@ -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS_HI 0x0018 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS_HI 0x0018 -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS_LO 0x0019 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS_LO 0x0019 -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS 0x001A +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS 0x001A @@ -517,27 +517,27 @@ -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS_HI 0x001A +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS_HI 0x001A -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS_LO 0x001B +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS_LO 0x001B -#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS 0x001C +#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS 0x001C @@ -549,28 +549,28 @@ -#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS_HI 0x001C +#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS_HI 0x001C -#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS_LO 0x001D +#define VL53L1_REF_SPAD_CHAR__TOTAL_RATE_TARGET_MCPS_LO 0x001D -#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x001E +#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM 0x001E @@ -581,28 +581,28 @@ -#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM_HI 0x001E +#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM_HI 0x001E -#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM_LO 0x001F +#define VL53L1_ALGO__PART_TO_PART_RANGE_OFFSET_MM_LO 0x001F -#define VL53L1_MM_CONFIG__INNER_OFFSET_MM 0x0020 +#define VL53L1_MM_CONFIG__INNER_OFFSET_MM 0x0020 @@ -613,28 +613,28 @@ -#define VL53L1_MM_CONFIG__INNER_OFFSET_MM_HI 0x0020 +#define VL53L1_MM_CONFIG__INNER_OFFSET_MM_HI 0x0020 -#define VL53L1_MM_CONFIG__INNER_OFFSET_MM_LO 0x0021 +#define VL53L1_MM_CONFIG__INNER_OFFSET_MM_LO 0x0021 -#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM 0x0022 +#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM 0x0022 @@ -645,28 +645,28 @@ -#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM_HI 0x0022 +#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM_HI 0x0022 -#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM_LO 0x0023 +#define VL53L1_MM_CONFIG__OUTER_OFFSET_MM_LO 0x0023 -#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS 0x0024 +#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS 0x0024 @@ -677,28 +677,28 @@ -#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS_HI 0x0024 +#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS_HI 0x0024 -#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS_LO 0x0025 +#define VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS_LO 0x0025 -#define VL53L1_DEBUG__CTRL 0x0026 +#define VL53L1_DEBUG__CTRL 0x0026 @@ -709,12 +709,12 @@ -#define VL53L1_TEST_MODE__CTRL 0x0027 +#define VL53L1_TEST_MODE__CTRL 0x0027 @@ -725,12 +725,12 @@ -#define VL53L1_CLK_GATING__CTRL 0x0028 +#define VL53L1_CLK_GATING__CTRL 0x0028 @@ -744,12 +744,12 @@ -#define VL53L1_NVM_BIST__CTRL 0x0029 +#define VL53L1_NVM_BIST__CTRL 0x0029 @@ -761,12 +761,12 @@ -#define VL53L1_NVM_BIST__NUM_NVM_WORDS 0x002A +#define VL53L1_NVM_BIST__NUM_NVM_WORDS 0x002A @@ -777,12 +777,12 @@ -#define VL53L1_NVM_BIST__START_ADDRESS 0x002B +#define VL53L1_NVM_BIST__START_ADDRESS 0x002B @@ -793,12 +793,12 @@ -#define VL53L1_HOST_IF__STATUS 0x002C +#define VL53L1_HOST_IF__STATUS 0x002C @@ -809,12 +809,12 @@ -#define VL53L1_PAD_I2C_HV__CONFIG 0x002D +#define VL53L1_PAD_I2C_HV__CONFIG 0x002D @@ -830,12 +830,12 @@ -#define VL53L1_PAD_I2C_HV__EXTSUP_CONFIG 0x002E +#define VL53L1_PAD_I2C_HV__EXTSUP_CONFIG 0x002E @@ -846,12 +846,12 @@ -#define VL53L1_GPIO_HV_PAD__CTRL 0x002F +#define VL53L1_GPIO_HV_PAD__CTRL 0x002F @@ -863,12 +863,12 @@ -#define VL53L1_GPIO_HV_MUX__CTRL 0x0030 +#define VL53L1_GPIO_HV_MUX__CTRL 0x0030 @@ -880,12 +880,12 @@ -#define VL53L1_GPIO__TIO_HV_STATUS 0x0031 +#define VL53L1_GPIO__TIO_HV_STATUS 0x0031 @@ -897,12 +897,12 @@ -#define VL53L1_GPIO__FIO_HV_STATUS 0x0032 +#define VL53L1_GPIO__FIO_HV_STATUS 0x0032 @@ -913,12 +913,12 @@ -#define VL53L1_ANA_CONFIG__SPAD_SEL_PSWIDTH 0x0033 +#define VL53L1_ANA_CONFIG__SPAD_SEL_PSWIDTH 0x0033 @@ -929,12 +929,12 @@ -#define VL53L1_ANA_CONFIG__VCSEL_PULSE_WIDTH_OFFSET 0x0034 +#define VL53L1_ANA_CONFIG__VCSEL_PULSE_WIDTH_OFFSET 0x0034 @@ -945,12 +945,12 @@ -#define VL53L1_ANA_CONFIG__FAST_OSC__CONFIG_CTRL 0x0035 +#define VL53L1_ANA_CONFIG__FAST_OSC__CONFIG_CTRL 0x0035 @@ -961,12 +961,12 @@ -#define VL53L1_SIGMA_ESTIMATOR__EFFECTIVE_PULSE_WIDTH_NS 0x0036 +#define VL53L1_SIGMA_ESTIMATOR__EFFECTIVE_PULSE_WIDTH_NS 0x0036 @@ -977,12 +977,12 @@ -#define VL53L1_SIGMA_ESTIMATOR__EFFECTIVE_AMBIENT_WIDTH_NS 0x0037 +#define VL53L1_SIGMA_ESTIMATOR__EFFECTIVE_AMBIENT_WIDTH_NS 0x0037 @@ -993,12 +993,12 @@ -#define VL53L1_SIGMA_ESTIMATOR__SIGMA_REF_MM 0x0038 +#define VL53L1_SIGMA_ESTIMATOR__SIGMA_REF_MM 0x0038 @@ -1009,12 +1009,12 @@ -#define VL53L1_ALGO__CROSSTALK_COMPENSATION_VALID_HEIGHT_MM 0x0039 +#define VL53L1_ALGO__CROSSTALK_COMPENSATION_VALID_HEIGHT_MM 0x0039 @@ -1025,12 +1025,12 @@ -#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_0 0x003A +#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_0 0x003A @@ -1041,12 +1041,12 @@ -#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_1 0x003B +#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_1 0x003B @@ -1057,12 +1057,12 @@ -#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS 0x003C +#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS 0x003C @@ -1073,28 +1073,28 @@ -#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS_HI 0x003C +#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS_HI 0x003C -#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS_LO 0x003D +#define VL53L1_ALGO__RANGE_IGNORE_THRESHOLD_MCPS_LO 0x003D -#define VL53L1_ALGO__RANGE_IGNORE_VALID_HEIGHT_MM 0x003E +#define VL53L1_ALGO__RANGE_IGNORE_VALID_HEIGHT_MM 0x003E @@ -1105,12 +1105,12 @@ -#define VL53L1_ALGO__RANGE_MIN_CLIP 0x003F +#define VL53L1_ALGO__RANGE_MIN_CLIP 0x003F @@ -1122,12 +1122,12 @@ -#define VL53L1_ALGO__CONSISTENCY_CHECK__TOLERANCE 0x0040 +#define VL53L1_ALGO__CONSISTENCY_CHECK__TOLERANCE 0x0040 @@ -1138,12 +1138,12 @@ -#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_2 0x0041 +#define VL53L1_SPARE_HOST_CONFIG__STATIC_CONFIG_SPARE_2 0x0041 @@ -1154,12 +1154,12 @@ -#define VL53L1_SD_CONFIG__RESET_STAGES_MSB 0x0042 +#define VL53L1_SD_CONFIG__RESET_STAGES_MSB 0x0042 @@ -1170,12 +1170,12 @@ -#define VL53L1_SD_CONFIG__RESET_STAGES_LSB 0x0043 +#define VL53L1_SD_CONFIG__RESET_STAGES_LSB 0x0043 @@ -1187,12 +1187,12 @@ -#define VL53L1_GPH_CONFIG__STREAM_COUNT_UPDATE_VALUE 0x0044 +#define VL53L1_GPH_CONFIG__STREAM_COUNT_UPDATE_VALUE 0x0044 @@ -1203,12 +1203,12 @@ -#define VL53L1_GLOBAL_CONFIG__STREAM_DIVIDER 0x0045 +#define VL53L1_GLOBAL_CONFIG__STREAM_DIVIDER 0x0045 @@ -1219,12 +1219,12 @@ -#define VL53L1_SYSTEM__INTERRUPT_CONFIG_GPIO 0x0046 +#define VL53L1_SYSTEM__INTERRUPT_CONFIG_GPIO 0x0046 @@ -1240,12 +1240,12 @@ -#define VL53L1_CAL_CONFIG__VCSEL_START 0x0047 +#define VL53L1_CAL_CONFIG__VCSEL_START 0x0047 @@ -1256,12 +1256,12 @@ -#define VL53L1_CAL_CONFIG__REPEAT_RATE 0x0048 +#define VL53L1_CAL_CONFIG__REPEAT_RATE 0x0048 @@ -1272,28 +1272,28 @@ -#define VL53L1_CAL_CONFIG__REPEAT_RATE_HI 0x0048 +#define VL53L1_CAL_CONFIG__REPEAT_RATE_HI 0x0048 -#define VL53L1_CAL_CONFIG__REPEAT_RATE_LO 0x0049 +#define VL53L1_CAL_CONFIG__REPEAT_RATE_LO 0x0049 -#define VL53L1_GLOBAL_CONFIG__VCSEL_WIDTH 0x004A +#define VL53L1_GLOBAL_CONFIG__VCSEL_WIDTH 0x004A @@ -1304,12 +1304,12 @@ -#define VL53L1_PHASECAL_CONFIG__TIMEOUT_MACROP 0x004B +#define VL53L1_PHASECAL_CONFIG__TIMEOUT_MACROP 0x004B @@ -1320,12 +1320,12 @@ -#define VL53L1_PHASECAL_CONFIG__TARGET 0x004C +#define VL53L1_PHASECAL_CONFIG__TARGET 0x004C @@ -1336,12 +1336,12 @@ -#define VL53L1_PHASECAL_CONFIG__OVERRIDE 0x004D +#define VL53L1_PHASECAL_CONFIG__OVERRIDE 0x004D @@ -1352,12 +1352,12 @@ -#define VL53L1_DSS_CONFIG__ROI_MODE_CONTROL 0x004F +#define VL53L1_DSS_CONFIG__ROI_MODE_CONTROL 0x004F @@ -1369,12 +1369,12 @@ -#define VL53L1_SYSTEM__THRESH_RATE_HIGH 0x0050 +#define VL53L1_SYSTEM__THRESH_RATE_HIGH 0x0050 @@ -1385,28 +1385,28 @@ -#define VL53L1_SYSTEM__THRESH_RATE_HIGH_HI 0x0050 +#define VL53L1_SYSTEM__THRESH_RATE_HIGH_HI 0x0050 -#define VL53L1_SYSTEM__THRESH_RATE_HIGH_LO 0x0051 +#define VL53L1_SYSTEM__THRESH_RATE_HIGH_LO 0x0051 -#define VL53L1_SYSTEM__THRESH_RATE_LOW 0x0052 +#define VL53L1_SYSTEM__THRESH_RATE_LOW 0x0052 @@ -1417,28 +1417,28 @@ -#define VL53L1_SYSTEM__THRESH_RATE_LOW_HI 0x0052 +#define VL53L1_SYSTEM__THRESH_RATE_LOW_HI 0x0052 -#define VL53L1_SYSTEM__THRESH_RATE_LOW_LO 0x0053 +#define VL53L1_SYSTEM__THRESH_RATE_LOW_LO 0x0053 -#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT 0x0054 +#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT 0x0054 @@ -1449,28 +1449,28 @@ -#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_HI 0x0054 +#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_HI 0x0054 -#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_LO 0x0055 +#define VL53L1_DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_LO 0x0055 -#define VL53L1_DSS_CONFIG__MANUAL_BLOCK_SELECT 0x0056 +#define VL53L1_DSS_CONFIG__MANUAL_BLOCK_SELECT 0x0056 @@ -1481,12 +1481,12 @@ -#define VL53L1_DSS_CONFIG__APERTURE_ATTENUATION 0x0057 +#define VL53L1_DSS_CONFIG__APERTURE_ATTENUATION 0x0057 @@ -1497,12 +1497,12 @@ -#define VL53L1_DSS_CONFIG__MAX_SPADS_LIMIT 0x0058 +#define VL53L1_DSS_CONFIG__MAX_SPADS_LIMIT 0x0058 @@ -1513,12 +1513,12 @@ -#define VL53L1_DSS_CONFIG__MIN_SPADS_LIMIT 0x0059 +#define VL53L1_DSS_CONFIG__MIN_SPADS_LIMIT 0x0059 @@ -1529,12 +1529,12 @@ -#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_HI 0x005A +#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_HI 0x005A @@ -1545,12 +1545,12 @@ -#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_LO 0x005B +#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_LO 0x005B @@ -1561,12 +1561,12 @@ -#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_B_HI 0x005C +#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_B_HI 0x005C @@ -1577,12 +1577,12 @@ -#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_B_LO 0x005D +#define VL53L1_MM_CONFIG__TIMEOUT_MACROP_B_LO 0x005D @@ -1593,12 +1593,12 @@ -#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_A_HI 0x005E +#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_A_HI 0x005E @@ -1609,12 +1609,12 @@ -#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_A_LO 0x005F +#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_A_LO 0x005F @@ -1625,12 +1625,12 @@ -#define VL53L1_RANGE_CONFIG__VCSEL_PERIOD_A 0x0060 +#define VL53L1_RANGE_CONFIG__VCSEL_PERIOD_A 0x0060 @@ -1641,12 +1641,12 @@ -#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_B_HI 0x0061 +#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_B_HI 0x0061 @@ -1657,12 +1657,12 @@ -#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_B_LO 0x0062 +#define VL53L1_RANGE_CONFIG__TIMEOUT_MACROP_B_LO 0x0062 @@ -1673,12 +1673,12 @@ -#define VL53L1_RANGE_CONFIG__VCSEL_PERIOD_B 0x0063 +#define VL53L1_RANGE_CONFIG__VCSEL_PERIOD_B 0x0063 @@ -1689,12 +1689,12 @@ -#define VL53L1_RANGE_CONFIG__SIGMA_THRESH 0x0064 +#define VL53L1_RANGE_CONFIG__SIGMA_THRESH 0x0064 @@ -1705,28 +1705,28 @@ -#define VL53L1_RANGE_CONFIG__SIGMA_THRESH_HI 0x0064 +#define VL53L1_RANGE_CONFIG__SIGMA_THRESH_HI 0x0064 -#define VL53L1_RANGE_CONFIG__SIGMA_THRESH_LO 0x0065 +#define VL53L1_RANGE_CONFIG__SIGMA_THRESH_LO 0x0065 -#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS 0x0066 +#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS 0x0066 @@ -1737,29 +1737,29 @@ -#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_HI 0x0066 +#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_HI 0x0066 -#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_LO 0x0067 +#define VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_LO 0x0067 -#define VL53L1_RANGE_CONFIG__VALID_PHASE_LOW 0x0068 +#define VL53L1_RANGE_CONFIG__VALID_PHASE_LOW 0x0068 @@ -1769,13 +1769,13 @@ -#define VL53L1_RANGE_CONFIG__VALID_PHASE_HIGH 0x0069 +#define VL53L1_RANGE_CONFIG__VALID_PHASE_HIGH 0x0069 @@ -1785,13 +1785,13 @@ -#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD 0x006C +#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD 0x006C @@ -1801,45 +1801,45 @@ -#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_3 0x006C +#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_3 0x006C -#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_2 0x006D +#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_2 0x006D -#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_1 0x006E +#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_1 0x006E -#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_0 0x006F +#define VL53L1_SYSTEM__INTERMEASUREMENT_PERIOD_0 0x006F -#define VL53L1_SYSTEM__FRACTIONAL_ENABLE 0x0070 +#define VL53L1_SYSTEM__FRACTIONAL_ENABLE 0x0070 @@ -1849,13 +1849,13 @@ -#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_0 0x0071 +#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_0 0x0071 @@ -1866,13 +1866,13 @@ -#define VL53L1_SYSTEM__THRESH_HIGH 0x0072 +#define VL53L1_SYSTEM__THRESH_HIGH 0x0072 @@ -1882,29 +1882,29 @@ -#define VL53L1_SYSTEM__THRESH_HIGH_HI 0x0072 +#define VL53L1_SYSTEM__THRESH_HIGH_HI 0x0072 -#define VL53L1_SYSTEM__THRESH_HIGH_LO 0x0073 +#define VL53L1_SYSTEM__THRESH_HIGH_LO 0x0073 -#define VL53L1_SYSTEM__THRESH_LOW 0x0074 +#define VL53L1_SYSTEM__THRESH_LOW 0x0074 @@ -1914,29 +1914,29 @@ -#define VL53L1_SYSTEM__THRESH_LOW_HI 0x0074 +#define VL53L1_SYSTEM__THRESH_LOW_HI 0x0074 -#define VL53L1_SYSTEM__THRESH_LOW_LO 0x0075 +#define VL53L1_SYSTEM__THRESH_LOW_LO 0x0075 -#define VL53L1_SYSTEM__ENABLE_XTALK_PER_QUADRANT 0x0076 +#define VL53L1_SYSTEM__ENABLE_XTALK_PER_QUADRANT 0x0076 @@ -1946,13 +1946,13 @@ -#define VL53L1_SYSTEM__SEED_CONFIG 0x0077 +#define VL53L1_SYSTEM__SEED_CONFIG 0x0077 @@ -1963,13 +1963,13 @@ -#define VL53L1_SD_CONFIG__WOI_SD0 0x0078 +#define VL53L1_SD_CONFIG__WOI_SD0 0x0078 @@ -1979,13 +1979,13 @@ -#define VL53L1_SD_CONFIG__WOI_SD1 0x0079 +#define VL53L1_SD_CONFIG__WOI_SD1 0x0079 @@ -1995,13 +1995,13 @@ -#define VL53L1_SD_CONFIG__INITIAL_PHASE_SD0 0x007A +#define VL53L1_SD_CONFIG__INITIAL_PHASE_SD0 0x007A @@ -2011,13 +2011,13 @@ -#define VL53L1_SD_CONFIG__INITIAL_PHASE_SD1 0x007B +#define VL53L1_SD_CONFIG__INITIAL_PHASE_SD1 0x007B @@ -2027,13 +2027,13 @@ -#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_1 0x007C +#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_1 0x007C @@ -2044,13 +2044,13 @@ -#define VL53L1_SD_CONFIG__FIRST_ORDER_SELECT 0x007D +#define VL53L1_SD_CONFIG__FIRST_ORDER_SELECT 0x007D @@ -2061,13 +2061,13 @@ -#define VL53L1_SD_CONFIG__QUANTIFIER 0x007E +#define VL53L1_SD_CONFIG__QUANTIFIER 0x007E @@ -2077,13 +2077,13 @@ -#define VL53L1_ROI_CONFIG__USER_ROI_CENTRE_SPAD 0x007F +#define VL53L1_ROI_CONFIG__USER_ROI_CENTRE_SPAD 0x007F @@ -2093,13 +2093,13 @@ -#define VL53L1_ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE 0x0080 +#define VL53L1_ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE 0x0080 @@ -2109,13 +2109,13 @@ -#define VL53L1_SYSTEM__SEQUENCE_CONFIG 0x0081 +#define VL53L1_SYSTEM__SEQUENCE_CONFIG 0x0081 @@ -2132,13 +2132,13 @@ -#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD 0x0082 +#define VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD 0x0082 @@ -2149,13 +2149,13 @@ -#define VL53L1_POWER_MANAGEMENT__GO1_POWER_FORCE 0x0083 +#define VL53L1_POWER_MANAGEMENT__GO1_POWER_FORCE 0x0083 @@ -2165,13 +2165,13 @@ -#define VL53L1_SYSTEM__STREAM_COUNT_CTRL 0x0084 +#define VL53L1_SYSTEM__STREAM_COUNT_CTRL 0x0084 @@ -2181,13 +2181,13 @@ -#define VL53L1_FIRMWARE__ENABLE 0x0085 +#define VL53L1_FIRMWARE__ENABLE 0x0085 @@ -2197,13 +2197,13 @@ -#define VL53L1_SYSTEM__INTERRUPT_CLEAR 0x0086 +#define VL53L1_SYSTEM__INTERRUPT_CLEAR 0x0086 @@ -2214,13 +2214,13 @@ -#define VL53L1_SYSTEM__MODE_START 0x0087 +#define VL53L1_SYSTEM__MODE_START 0x0087 @@ -2235,13 +2235,13 @@ -#define VL53L1_RESULT__INTERRUPT_STATUS 0x0088 +#define VL53L1_RESULT__INTERRUPT_STATUS 0x0088 @@ -2253,13 +2253,13 @@ -#define VL53L1_RESULT__RANGE_STATUS 0x0089 +#define VL53L1_RESULT__RANGE_STATUS 0x0089 @@ -2272,13 +2272,13 @@ -#define VL53L1_RESULT__REPORT_STATUS 0x008A +#define VL53L1_RESULT__REPORT_STATUS 0x008A @@ -2288,13 +2288,13 @@ -#define VL53L1_RESULT__STREAM_COUNT 0x008B +#define VL53L1_RESULT__STREAM_COUNT 0x008B @@ -2304,13 +2304,13 @@ -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x008C +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x008C @@ -2320,7 +2320,6 @@ -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x008C @@ -2328,7 +2327,7 @@ -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x008D +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x008C @@ -2336,7 +2335,7 @@ -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x008E +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x008D @@ -2344,6 +2343,7 @@ +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x008E @@ -2352,7 +2352,6 @@ -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x008E @@ -2360,16 +2359,16 @@ -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x008F +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x008E -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0090 +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x008F @@ -2377,6 +2376,7 @@ +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0090 @@ -2384,7 +2384,6 @@ -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0090 @@ -2392,17 +2391,17 @@ -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0091 +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0090 -#define VL53L1_RESULT__SIGMA_SD0 0x0092 +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0091 @@ -2410,13 +2409,13 @@ +#define VL53L1_RESULT__SIGMA_SD0 0x0092 -#define VL53L1_RESULT__SIGMA_SD0_HI 0x0092 @@ -2424,17 +2423,17 @@ -#define VL53L1_RESULT__SIGMA_SD0_LO 0x0093 +#define VL53L1_RESULT__SIGMA_SD0_HI 0x0092 -#define VL53L1_RESULT__PHASE_SD0 0x0094 +#define VL53L1_RESULT__SIGMA_SD0_LO 0x0093 @@ -2442,13 +2441,13 @@ +#define VL53L1_RESULT__PHASE_SD0 0x0094 -#define VL53L1_RESULT__PHASE_SD0_HI 0x0094 @@ -2456,17 +2455,17 @@ -#define VL53L1_RESULT__PHASE_SD0_LO 0x0095 +#define VL53L1_RESULT__PHASE_SD0_HI 0x0094 -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0096 +#define VL53L1_RESULT__PHASE_SD0_LO 0x0095 @@ -2474,13 +2473,13 @@ +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0096 -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0096 @@ -2488,17 +2487,17 @@ -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0097 +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0096 -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0098 +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0097 @@ -2506,13 +2505,13 @@ +#define VL53L1_PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0098 -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0098 @@ -2520,7 +2519,7 @@ -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0099 +#define VL53L1__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0098 @@ -2528,7 +2527,7 @@ -#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x009A +#define VL53L1___PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0099 @@ -2536,6 +2535,7 @@ +#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x009A @@ -2544,7 +2544,6 @@ -#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x009A @@ -2552,16 +2551,16 @@ -#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x009B +#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x009A -#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x009C +#define VL53L1_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x009B @@ -2569,6 +2568,7 @@ +#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x009C @@ -2576,7 +2576,6 @@ -#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x009C @@ -2584,17 +2583,17 @@ -#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x009D +#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x009C -#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x009E +#define VL53L1_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x009D @@ -2602,13 +2601,13 @@ +#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x009E -#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x009E @@ -2616,18 +2615,18 @@ -#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x009F +#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x009E -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x00A0 +#define VL53L1_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x009F @@ -2635,12 +2634,12 @@ +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x00A0 -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x00A0 @@ -2648,19 +2647,19 @@ -#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x00A1 +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x00A0 -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x00A2 +#define VL53L1_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x00A1 @@ -2668,11 +2667,11 @@ +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x00A2 -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x00A2 @@ -2680,20 +2679,20 @@ -#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x00A3 +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x00A2 -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x00A4 +#define VL53L1_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x00A3 @@ -2701,10 +2700,10 @@ +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x00A4 -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x00A4 @@ -2712,20 +2711,20 @@ -#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x00A5 +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x00A4 -#define VL53L1_RESULT__SIGMA_SD1 0x00A6 +#define VL53L1_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x00A5 @@ -2733,10 +2732,10 @@ +#define VL53L1_RESULT__SIGMA_SD1 0x00A6 -#define VL53L1_RESULT__SIGMA_SD1_HI 0x00A6 @@ -2744,20 +2743,20 @@ -#define VL53L1_RESULT__SIGMA_SD1_LO 0x00A7 +#define VL53L1_RESULT__SIGMA_SD1_HI 0x00A6 -#define VL53L1_RESULT__PHASE_SD1 0x00A8 +#define VL53L1_RESULT__SIGMA_SD1_LO 0x00A7 @@ -2765,10 +2764,10 @@ +#define VL53L1_RESULT__PHASE_SD1 0x00A8 -#define VL53L1_RESULT__PHASE_SD1_HI 0x00A8 @@ -2776,20 +2775,20 @@ -#define VL53L1_RESULT__PHASE_SD1_LO 0x00A9 +#define VL53L1_RESULT__PHASE_SD1_HI 0x00A8 -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x00AA +#define VL53L1_RESULT__PHASE_SD1_LO 0x00A9 @@ -2797,10 +2796,10 @@ +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x00AA -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x00AA @@ -2808,20 +2807,20 @@ -#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x00AB +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x00AA -#define VL53L1_RESULT__SPARE_0_SD1 0x00AC +#define VL53L1_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x00AB @@ -2829,10 +2828,10 @@ +#define VL53L1_RESULT__SPARE_0_SD1 0x00AC -#define VL53L1_RESULT__SPARE_0_SD1_HI 0x00AC @@ -2840,20 +2839,20 @@ -#define VL53L1_RESULT__SPARE_0_SD1_LO 0x00AD +#define VL53L1_RESULT__SPARE_0_SD1_HI 0x00AC -#define VL53L1_RESULT__SPARE_1_SD1 0x00AE +#define VL53L1_RESULT__SPARE_0_SD1_LO 0x00AD @@ -2861,10 +2860,10 @@ +#define VL53L1_RESULT__SPARE_1_SD1 0x00AE -#define VL53L1_RESULT__SPARE_1_SD1_HI 0x00AE @@ -2872,20 +2871,20 @@ -#define VL53L1_RESULT__SPARE_1_SD1_LO 0x00AF +#define VL53L1_RESULT__SPARE_1_SD1_HI 0x00AE -#define VL53L1_RESULT__SPARE_2_SD1 0x00B0 +#define VL53L1_RESULT__SPARE_1_SD1_LO 0x00AF @@ -2893,10 +2892,10 @@ +#define VL53L1_RESULT__SPARE_2_SD1 0x00B0 -#define VL53L1_RESULT__SPARE_2_SD1_HI 0x00B0 @@ -2904,20 +2903,20 @@ -#define VL53L1_RESULT__SPARE_2_SD1_LO 0x00B1 +#define VL53L1_RESULT__SPARE_2_SD1_HI 0x00B0 -#define VL53L1_RESULT__SPARE_3_SD1 0x00B2 +#define VL53L1_RESULT__SPARE_2_SD1_LO 0x00B1 @@ -2925,10 +2924,10 @@ +#define VL53L1_RESULT__SPARE_3_SD1 0x00B2 -#define VL53L1_RESULT__THRESH_INFO 0x00B3 @@ -2941,11 +2940,11 @@ +#define VL53L1_RESULT__THRESH_INFO 0x00B3 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x00B4 @@ -2958,10 +2957,10 @@ +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x00B4 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x00B4 @@ -2969,36 +2968,36 @@ -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x00B5 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x00B4 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x00B6 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x00B5 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x00B7 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x00B6 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x00B8 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x00B7 @@ -3006,10 +3005,10 @@ +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x00B8 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x00B8 @@ -3017,36 +3016,36 @@ -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x00B9 +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x00B8 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x00BA +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x00B9 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x00BB +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x00BA -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x00BC +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x00BB @@ -3054,10 +3053,10 @@ +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x00BC -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x00BC @@ -3065,36 +3064,36 @@ -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x00BD +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x00BC -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x00BE +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x00BD -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x00BF +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x00BE -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x00C0 +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x00BF @@ -3102,10 +3101,10 @@ +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x00C0 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x00C0 @@ -3113,36 +3112,36 @@ -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x00C1 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x00C0 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x00C2 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x00C1 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x00C3 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x00C2 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x00C4 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x00C3 @@ -3150,10 +3149,10 @@ +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x00C4 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x00C4 @@ -3161,36 +3160,36 @@ -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x00C5 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x00C4 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x00C6 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x00C5 -#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x00C7 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x00C6 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x00C8 +#define VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x00C7 @@ -3198,10 +3197,10 @@ +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x00C8 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x00C8 @@ -3209,36 +3208,36 @@ -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x00C9 +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x00C8 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x00CA +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x00C9 -#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x00CB +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x00CA -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x00CC +#define VL53L1_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x00CB @@ -3246,10 +3245,10 @@ +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x00CC -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x00CC @@ -3257,36 +3256,36 @@ -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x00CD +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x00CC -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x00CE +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x00CD -#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x00CF +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x00CE -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x00D0 +#define VL53L1_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x00CF @@ -3294,10 +3293,10 @@ +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x00D0 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x00D0 @@ -3305,36 +3304,36 @@ -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x00D1 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x00D0 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x00D2 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x00D1 -#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x00D3 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x00D2 -#define VL53L1_RESULT_CORE__SPARE_0 0x00D4 +#define VL53L1_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x00D3 @@ -3342,10 +3341,10 @@ +#define VL53L1_RESULT_CORE__SPARE_0 0x00D4 -#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE 0x00D6 @@ -3358,10 +3357,10 @@ +#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE 0x00D6 -#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE_HI 0x00D6 @@ -3369,20 +3368,20 @@ -#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE_LO 0x00D7 +#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE_HI 0x00D6 -#define VL53L1_PHASECAL_RESULT__VCSEL_START 0x00D8 +#define VL53L1_PHASECAL_RESULT__REFERENCE_PHASE_LO 0x00D7 @@ -3390,10 +3389,10 @@ +#define VL53L1_PHASECAL_RESULT__VCSEL_START 0x00D8 -#define VL53L1_REF_SPAD_CHAR_RESULT__NUM_ACTUAL_REF_SPADS 0x00D9 @@ -3406,10 +3405,10 @@ +#define VL53L1_REF_SPAD_CHAR_RESULT__NUM_ACTUAL_REF_SPADS 0x00D9 -#define VL53L1_REF_SPAD_CHAR_RESULT__REF_LOCATION 0x00DA @@ -3422,10 +3421,10 @@ +#define VL53L1_REF_SPAD_CHAR_RESULT__REF_LOCATION 0x00DA -#define VL53L1_VHV_RESULT__COLDBOOT_STATUS 0x00DB @@ -3438,10 +3437,10 @@ +#define VL53L1_VHV_RESULT__COLDBOOT_STATUS 0x00DB -#define VL53L1_VHV_RESULT__SEARCH_RESULT 0x00DC @@ -3454,10 +3453,10 @@ +#define VL53L1_VHV_RESULT__SEARCH_RESULT 0x00DC -#define VL53L1_VHV_RESULT__LATEST_SETTING 0x00DD @@ -3470,10 +3469,10 @@ +#define VL53L1_VHV_RESULT__LATEST_SETTING 0x00DD -#define VL53L1_RESULT__OSC_CALIBRATE_VAL 0x00DE @@ -3486,10 +3485,10 @@ +#define VL53L1_RESULT__OSC_CALIBRATE_VAL 0x00DE -#define VL53L1_RESULT__OSC_CALIBRATE_VAL_HI 0x00DE @@ -3497,20 +3496,20 @@ -#define VL53L1_RESULT__OSC_CALIBRATE_VAL_LO 0x00DF +#define VL53L1_RESULT__OSC_CALIBRATE_VAL_HI 0x00DE -#define VL53L1_ANA_CONFIG__POWERDOWN_GO1 0x00E0 +#define VL53L1_RESULT__OSC_CALIBRATE_VAL_LO 0x00DF @@ -3518,11 +3517,11 @@ +#define VL53L1_ANA_CONFIG__POWERDOWN_GO1 0x00E0 -#define VL53L1_ANA_CONFIG__REF_BG_CTRL 0x00E1 @@ -3535,11 +3534,11 @@ +#define VL53L1_ANA_CONFIG__REF_BG_CTRL 0x00E1 -#define VL53L1_ANA_CONFIG__REGDVDD1V2_CTRL 0x00E2 @@ -3552,12 +3551,12 @@ +#define VL53L1_ANA_CONFIG__REGDVDD1V2_CTRL 0x00E2 -#define VL53L1_ANA_CONFIG__OSC_SLOW_CTRL 0x00E3 @@ -3570,12 +3569,12 @@ +#define VL53L1_ANA_CONFIG__OSC_SLOW_CTRL 0x00E3 -#define VL53L1_TEST_MODE__STATUS 0x00E4 @@ -3588,10 +3587,10 @@ +#define VL53L1_TEST_MODE__STATUS 0x00E4 -#define VL53L1_FIRMWARE__SYSTEM_STATUS 0x00E5 @@ -3604,11 +3603,11 @@ +#define VL53L1_FIRMWARE__SYSTEM_STATUS 0x00E5 -#define VL53L1_FIRMWARE__MODE_STATUS 0x00E6 @@ -3621,10 +3620,10 @@ +#define VL53L1_FIRMWARE__MODE_STATUS 0x00E6 -#define VL53L1_FIRMWARE__SECONDARY_MODE_STATUS 0x00E7 @@ -3637,10 +3636,10 @@ +#define VL53L1_FIRMWARE__SECONDARY_MODE_STATUS 0x00E7 -#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER 0x00E8 @@ -3653,10 +3652,10 @@ +#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER 0x00E8 -#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER_HI 0x00E8 @@ -3664,28 +3663,28 @@ -#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER_LO 0x00E9 +#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER_HI 0x00E8 -#define VL53L1_FIRMWARE__HISTOGRAM_BIN 0x00EA +#define VL53L1_FIRMWARE__CAL_REPEAT_RATE_COUNTER_LO 0x00E9 -#define VL53L1_GPH__SYSTEM__THRESH_HIGH 0x00EC +#define VL53L1_FIRMWARE__HISTOGRAM_BIN 0x00EA @@ -3693,10 +3692,10 @@ +#define VL53L1_GPH__SYSTEM__THRESH_HIGH 0x00EC -#define VL53L1_GPH__SYSTEM__THRESH_HIGH_HI 0x00EC @@ -3704,20 +3703,20 @@ -#define VL53L1_GPH__SYSTEM__THRESH_HIGH_LO 0x00ED +#define VL53L1_GPH__SYSTEM__THRESH_HIGH_HI 0x00EC -#define VL53L1_GPH__SYSTEM__THRESH_LOW 0x00EE +#define VL53L1_GPH__SYSTEM__THRESH_HIGH_LO 0x00ED @@ -3725,10 +3724,10 @@ +#define VL53L1_GPH__SYSTEM__THRESH_LOW 0x00EE -#define VL53L1_GPH__SYSTEM__THRESH_LOW_HI 0x00EE @@ -3736,20 +3735,20 @@ -#define VL53L1_GPH__SYSTEM__THRESH_LOW_LO 0x00EF +#define VL53L1_GPH__SYSTEM__THRESH_LOW_HI 0x00EE -#define VL53L1_GPH__SYSTEM__ENABLE_XTALK_PER_QUADRANT 0x00F0 +#define VL53L1_GPH__SYSTEM__THRESH_LOW_LO 0x00EF @@ -3757,10 +3756,10 @@ +#define VL53L1_GPH__SYSTEM__ENABLE_XTALK_PER_QUADRANT 0x00F0 -#define VL53L1_GPH__SPARE_0 0x00F1 @@ -3773,12 +3772,12 @@ +#define VL53L1_GPH__SPARE_0 0x00F1 -#define VL53L1_GPH__SD_CONFIG__WOI_SD0 0x00F2 @@ -3791,10 +3790,10 @@ +#define VL53L1_GPH__SD_CONFIG__WOI_SD0 0x00F2 -#define VL53L1_GPH__SD_CONFIG__WOI_SD1 0x00F3 @@ -3807,10 +3806,10 @@ +#define VL53L1_GPH__SD_CONFIG__WOI_SD1 0x00F3 -#define VL53L1_GPH__SD_CONFIG__INITIAL_PHASE_SD0 0x00F4 @@ -3823,10 +3822,10 @@ +#define VL53L1_GPH__SD_CONFIG__INITIAL_PHASE_SD0 0x00F4 -#define VL53L1_GPH__SD_CONFIG__INITIAL_PHASE_SD1 0x00F5 @@ -3839,10 +3838,10 @@ +#define VL53L1_GPH__SD_CONFIG__INITIAL_PHASE_SD1 0x00F5 -#define VL53L1_GPH__SD_CONFIG__FIRST_ORDER_SELECT 0x00F6 @@ -3855,11 +3854,11 @@ +#define VL53L1_GPH__SD_CONFIG__FIRST_ORDER_SELECT 0x00F6 -#define VL53L1_GPH__SD_CONFIG__QUANTIFIER 0x00F7 @@ -3872,10 +3871,10 @@ +#define VL53L1_GPH__SD_CONFIG__QUANTIFIER 0x00F7 -#define VL53L1_GPH__ROI_CONFIG__USER_ROI_CENTRE_SPAD 0x00F8 @@ -3888,10 +3887,10 @@ +#define VL53L1_GPH__ROI_CONFIG__USER_ROI_CENTRE_SPAD 0x00F8 -#define VL53L1_GPH__ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE 0x00F9 @@ -3904,10 +3903,10 @@ +#define VL53L1_GPH__ROI_CONFIG__USER_ROI_REQUESTED_GLOBAL_XY_SIZE 0x00F9 -#define VL53L1_GPH__SYSTEM__SEQUENCE_CONFIG 0x00FA @@ -3920,6 +3919,7 @@ +#define VL53L1_GPH__SYSTEM__SEQUENCE_CONFIG 0x00FA @@ -3930,7 +3930,6 @@ -#define VL53L1_GPH__GPH_ID 0x00FB @@ -3943,10 +3942,10 @@ +#define VL53L1_GPH__GPH_ID 0x00FB -#define VL53L1_SYSTEM__INTERRUPT_SET 0x00FC @@ -3959,11 +3958,11 @@ +#define VL53L1_SYSTEM__INTERRUPT_SET 0x00FC -#define VL53L1_INTERRUPT_MANAGER__ENABLES 0x00FD @@ -3976,6 +3975,7 @@ +#define VL53L1_INTERRUPT_MANAGER__ENABLES 0x00FD @@ -3983,7 +3983,6 @@ -#define VL53L1_INTERRUPT_MANAGER__CLEAR 0x00FE @@ -3996,6 +3995,7 @@ +#define VL53L1_INTERRUPT_MANAGER__CLEAR 0x00FE @@ -4003,7 +4003,6 @@ -#define VL53L1_INTERRUPT_MANAGER__STATUS 0x00FF @@ -4016,6 +4015,7 @@ +#define VL53L1_INTERRUPT_MANAGER__STATUS 0x00FF @@ -4023,7 +4023,6 @@ -#define VL53L1_MCU_TO_HOST_BANK__WR_ACCESS_EN 0x0100 @@ -4036,10 +4035,10 @@ +#define VL53L1_MCU_TO_HOST_BANK__WR_ACCESS_EN 0x0100 -#define VL53L1_POWER_MANAGEMENT__GO1_RESET_STATUS 0x0101 @@ -4052,10 +4051,10 @@ +#define VL53L1_POWER_MANAGEMENT__GO1_RESET_STATUS 0x0101 -#define VL53L1_PAD_STARTUP_MODE__VALUE_RO 0x0102 @@ -4068,11 +4067,11 @@ +#define VL53L1_PAD_STARTUP_MODE__VALUE_RO 0x0102 -#define VL53L1_PAD_STARTUP_MODE__VALUE_CTRL 0x0103 @@ -4085,13 +4084,13 @@ +#define VL53L1_PAD_STARTUP_MODE__VALUE_CTRL 0x0103 -#define VL53L1_PLL_PERIOD_US 0x0104 @@ -4104,10 +4103,10 @@ +#define VL53L1_PLL_PERIOD_US 0x0104 -#define VL53L1_PLL_PERIOD_US_3 0x0104 @@ -4115,36 +4114,36 @@ -#define VL53L1_PLL_PERIOD_US_2 0x0105 +#define VL53L1_PLL_PERIOD_US_3 0x0104 -#define VL53L1_PLL_PERIOD_US_1 0x0106 +#define VL53L1_PLL_PERIOD_US_2 0x0105 -#define VL53L1_PLL_PERIOD_US_0 0x0107 +#define VL53L1_PLL_PERIOD_US_1 0x0106 -#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT 0x0108 +#define VL53L1_PLL_PERIOD_US_0 0x0107 @@ -4152,10 +4151,10 @@ +#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT 0x0108 -#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_3 0x0108 @@ -4163,36 +4162,36 @@ -#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_2 0x0109 +#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_3 0x0108 -#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_1 0x010A +#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_2 0x0109 -#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_0 0x010B +#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_1 0x010A -#define VL53L1_NVM_BIST__COMPLETE 0x010C +#define VL53L1_INTERRUPT_SCHEDULER__DATA_OUT_0 0x010B @@ -4200,10 +4199,10 @@ +#define VL53L1_NVM_BIST__COMPLETE 0x010C -#define VL53L1_NVM_BIST__STATUS 0x010D @@ -4216,10 +4215,10 @@ +#define VL53L1_NVM_BIST__STATUS 0x010D -#define VL53L1_IDENTIFICATION__MODEL_ID 0x010F @@ -4232,10 +4231,10 @@ +#define VL53L1_IDENTIFICATION__MODEL_ID 0x010F -#define VL53L1_IDENTIFICATION__MODULE_TYPE 0x0110 @@ -4248,10 +4247,10 @@ +#define VL53L1_IDENTIFICATION__MODULE_TYPE 0x0110 -#define VL53L1_IDENTIFICATION__REVISION_ID 0x0111 @@ -4264,11 +4263,11 @@ +#define VL53L1_IDENTIFICATION__REVISION_ID 0x0111 -#define VL53L1_IDENTIFICATION__MODULE_ID 0x0112 @@ -4281,10 +4280,10 @@ +#define VL53L1_IDENTIFICATION__MODULE_ID 0x0112 -#define VL53L1_IDENTIFICATION__MODULE_ID_HI 0x0112 @@ -4292,20 +4291,20 @@ -#define VL53L1_IDENTIFICATION__MODULE_ID_LO 0x0113 +#define VL53L1_IDENTIFICATION__MODULE_ID_HI 0x0112 -#define VL53L1_ANA_CONFIG__FAST_OSC__TRIM_MAX 0x0114 +#define VL53L1_IDENTIFICATION__MODULE_ID_LO 0x0113 @@ -4313,10 +4312,10 @@ +#define VL53L1_ANA_CONFIG__FAST_OSC__TRIM_MAX 0x0114 -#define VL53L1_ANA_CONFIG__FAST_OSC__FREQ_SET 0x0115 @@ -4329,10 +4328,10 @@ +#define VL53L1_ANA_CONFIG__FAST_OSC__FREQ_SET 0x0115 -#define VL53L1_ANA_CONFIG__VCSEL_TRIM 0x0116 @@ -4345,10 +4344,10 @@ +#define VL53L1_ANA_CONFIG__VCSEL_TRIM 0x0116 -#define VL53L1_ANA_CONFIG__VCSEL_SELION 0x0117 @@ -4361,10 +4360,10 @@ +#define VL53L1_ANA_CONFIG__VCSEL_SELION 0x0117 -#define VL53L1_ANA_CONFIG__VCSEL_SELION_MAX 0x0118 @@ -4377,10 +4376,10 @@ +#define VL53L1_ANA_CONFIG__VCSEL_SELION_MAX 0x0118 -#define VL53L1_PROTECTED_LASER_SAFETY__LOCK_BIT 0x0119 @@ -4393,10 +4392,10 @@ +#define VL53L1_PROTECTED_LASER_SAFETY__LOCK_BIT 0x0119 -#define VL53L1_LASER_SAFETY__KEY 0x011A @@ -4409,10 +4408,10 @@ +#define VL53L1_LASER_SAFETY__KEY 0x011A -#define VL53L1_LASER_SAFETY__KEY_RO 0x011B @@ -4425,10 +4424,10 @@ +#define VL53L1_LASER_SAFETY__KEY_RO 0x011B -#define VL53L1_LASER_SAFETY__CLIP 0x011C @@ -4441,10 +4440,10 @@ +#define VL53L1_LASER_SAFETY__CLIP 0x011C -#define VL53L1_LASER_SAFETY__MULT 0x011D @@ -4457,10 +4456,10 @@ +#define VL53L1_LASER_SAFETY__MULT 0x011D -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_0 0x011E @@ -4473,10 +4472,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_0 0x011E -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_1 0x011F @@ -4489,10 +4488,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_1 0x011F -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_2 0x0120 @@ -4505,10 +4504,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_2 0x0120 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_3 0x0121 @@ -4521,10 +4520,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_3 0x0121 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_4 0x0122 @@ -4537,10 +4536,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_4 0x0122 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_5 0x0123 @@ -4553,10 +4552,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_5 0x0123 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_6 0x0124 @@ -4569,10 +4568,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_6 0x0124 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_7 0x0125 @@ -4585,10 +4584,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_7 0x0125 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_8 0x0126 @@ -4601,10 +4600,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_8 0x0126 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_9 0x0127 @@ -4617,10 +4616,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_9 0x0127 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_10 0x0128 @@ -4633,10 +4632,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_10 0x0128 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_11 0x0129 @@ -4649,10 +4648,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_11 0x0129 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_12 0x012A @@ -4665,10 +4664,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_12 0x012A -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_13 0x012B @@ -4681,10 +4680,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_13 0x012B -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_14 0x012C @@ -4697,10 +4696,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_14 0x012C -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_15 0x012D @@ -4713,10 +4712,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_15 0x012D -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_16 0x012E @@ -4729,10 +4728,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_16 0x012E -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_17 0x012F @@ -4745,10 +4744,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_17 0x012F -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_18 0x0130 @@ -4761,10 +4760,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_18 0x0130 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_19 0x0131 @@ -4777,10 +4776,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_19 0x0131 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_20 0x0132 @@ -4793,10 +4792,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_20 0x0132 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_21 0x0133 @@ -4809,10 +4808,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_21 0x0133 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_22 0x0134 @@ -4825,10 +4824,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_22 0x0134 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_23 0x0135 @@ -4841,10 +4840,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_23 0x0135 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_24 0x0136 @@ -4857,10 +4856,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_24 0x0136 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_25 0x0137 @@ -4873,10 +4872,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_25 0x0137 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_26 0x0138 @@ -4889,10 +4888,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_26 0x0138 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_27 0x0139 @@ -4905,10 +4904,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_27 0x0139 -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_28 0x013A @@ -4921,10 +4920,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_28 0x013A -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_29 0x013B @@ -4937,10 +4936,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_29 0x013B -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_30 0x013C @@ -4953,10 +4952,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_30 0x013C -#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_31 0x013D @@ -4969,10 +4968,10 @@ +#define VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_RTN_31 0x013D -#define VL53L1_ROI_CONFIG__MODE_ROI_CENTRE_SPAD 0x013E @@ -4985,10 +4984,10 @@ +#define VL53L1_ROI_CONFIG__MODE_ROI_CENTRE_SPAD 0x013E -#define VL53L1_ROI_CONFIG__MODE_ROI_XY_SIZE 0x013F @@ -5001,10 +5000,10 @@ +#define VL53L1_ROI_CONFIG__MODE_ROI_XY_SIZE 0x013F -#define VL53L1_GO2_HOST_BANK_ACCESS__OVERRIDE 0x0300 @@ -5012,420 +5011,420 @@ -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND 0x0400 +#define VL53L1_GO2_HOST_BANK_ACCESS__OVERRIDE 0x0300 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_3 0x0400 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND 0x0400 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_2 0x0401 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_3 0x0400 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_1 0x0402 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_2 0x0401 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_0 0x0403 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_1 0x0402 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER 0x0404 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLICAND_0 0x0403 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_3 0x0404 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER 0x0404 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_2 0x0405 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_3 0x0404 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_1 0x0406 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_2 0x0405 -#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_0 0x0407 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_1 0x0406 -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI 0x0408 +#define VL53L1_MCU_UTIL_MULTIPLIER__MULTIPLIER_0 0x0407 -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_3 0x0408 +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI 0x0408 -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_2 0x0409 +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_3 0x0408 -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_1 0x040A +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_2 0x0409 -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_0 0x040B +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_1 0x040A -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO 0x040C +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_HI_0 0x040B -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_3 0x040C +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO 0x040C -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_2 0x040D +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_3 0x040C -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_1 0x040E +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_2 0x040D -#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_0 0x040F +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_1 0x040E -#define VL53L1_MCU_UTIL_MULTIPLIER__START 0x0410 +#define VL53L1_MCU_UTIL_MULTIPLIER__PRODUCT_LO_0 0x040F -#define VL53L1_MCU_UTIL_MULTIPLIER__STATUS 0x0411 +#define VL53L1_MCU_UTIL_MULTIPLIER__START 0x0410 -#define VL53L1_MCU_UTIL_DIVIDER__START 0x0412 +#define VL53L1_MCU_UTIL_MULTIPLIER__STATUS 0x0411 -#define VL53L1_MCU_UTIL_DIVIDER__STATUS 0x0413 +#define VL53L1_MCU_UTIL_DIVIDER__START 0x0412 -#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND 0x0414 +#define VL53L1_MCU_UTIL_DIVIDER__STATUS 0x0413 -#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_3 0x0414 +#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND 0x0414 -#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_2 0x0415 +#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_3 0x0414 -#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_1 0x0416 +#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_2 0x0415 -#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_0 0x0417 +#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_1 0x0416 -#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR 0x0418 +#define VL53L1_MCU_UTIL_DIVIDER__DIVIDEND_0 0x0417 -#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_3 0x0418 +#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR 0x0418 -#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_2 0x0419 +#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_3 0x0418 -#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_1 0x041A +#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_2 0x0419 -#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_0 0x041B +#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_1 0x041A -#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT 0x041C +#define VL53L1_MCU_UTIL_DIVIDER__DIVISOR_0 0x041B -#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_3 0x041C +#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT 0x041C -#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_2 0x041D +#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_3 0x041C -#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_1 0x041E +#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_2 0x041D -#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_0 0x041F +#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_1 0x041E -#define VL53L1_TIMER0__VALUE_IN 0x0420 +#define VL53L1_MCU_UTIL_DIVIDER__QUOTIENT_0 0x041F -#define VL53L1_TIMER0__VALUE_IN_3 0x0420 +#define VL53L1_TIMER0__VALUE_IN 0x0420 -#define VL53L1_TIMER0__VALUE_IN_2 0x0421 +#define VL53L1_TIMER0__VALUE_IN_3 0x0420 -#define VL53L1_TIMER0__VALUE_IN_1 0x0422 +#define VL53L1_TIMER0__VALUE_IN_2 0x0421 -#define VL53L1_TIMER0__VALUE_IN_0 0x0423 +#define VL53L1_TIMER0__VALUE_IN_1 0x0422 -#define VL53L1_TIMER1__VALUE_IN 0x0424 +#define VL53L1_TIMER0__VALUE_IN_0 0x0423 -#define VL53L1_TIMER1__VALUE_IN_3 0x0424 +#define VL53L1_TIMER1__VALUE_IN 0x0424 -#define VL53L1_TIMER1__VALUE_IN_2 0x0425 +#define VL53L1_TIMER1__VALUE_IN_3 0x0424 -#define VL53L1_TIMER1__VALUE_IN_1 0x0426 +#define VL53L1_TIMER1__VALUE_IN_2 0x0425 -#define VL53L1_TIMER1__VALUE_IN_0 0x0427 +#define VL53L1_TIMER1__VALUE_IN_1 0x0426 -#define VL53L1_TIMER0__CTRL 0x0428 +#define VL53L1_TIMER1__VALUE_IN_0 0x0427 -#define VL53L1_TIMER1__CTRL 0x0429 +#define VL53L1_TIMER0__CTRL 0x0428 -#define VL53L1_MCU_GENERAL_PURPOSE__GP_0 0x042C +#define VL53L1_TIMER1__CTRL 0x0429 @@ -5433,10 +5432,10 @@ +#define VL53L1_MCU_GENERAL_PURPOSE__GP_0 0x042C -#define VL53L1_MCU_GENERAL_PURPOSE__GP_1 0x042D @@ -5449,10 +5448,10 @@ +#define VL53L1_MCU_GENERAL_PURPOSE__GP_1 0x042D -#define VL53L1_MCU_GENERAL_PURPOSE__GP_2 0x042E @@ -5465,10 +5464,10 @@ +#define VL53L1_MCU_GENERAL_PURPOSE__GP_2 0x042E -#define VL53L1_MCU_GENERAL_PURPOSE__GP_3 0x042F @@ -5481,10 +5480,10 @@ +#define VL53L1_MCU_GENERAL_PURPOSE__GP_3 0x042F -#define VL53L1_MCU_RANGE_CALC__CONFIG 0x0430 @@ -5497,6 +5496,7 @@ +#define VL53L1_MCU_RANGE_CALC__CONFIG 0x0430 @@ -5506,7 +5506,6 @@ -#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE 0x0432 @@ -5519,10 +5518,10 @@ +#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE 0x0432 -#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE_HI 0x0432 @@ -5530,20 +5529,20 @@ -#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE_LO 0x0433 +#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE_HI 0x0432 -#define VL53L1_MCU_RANGE_CALC__SPARE_4 0x0434 +#define VL53L1_MCU_RANGE_CALC__OFFSET_CORRECTED_RANGE_LO 0x0433 @@ -5551,10 +5550,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_4 0x0434 -#define VL53L1_MCU_RANGE_CALC__SPARE_4_3 0x0434 @@ -5562,36 +5561,36 @@ -#define VL53L1_MCU_RANGE_CALC__SPARE_4_2 0x0435 +#define VL53L1_MCU_RANGE_CALC__SPARE_4_3 0x0434 -#define VL53L1_MCU_RANGE_CALC__SPARE_4_1 0x0436 +#define VL53L1_MCU_RANGE_CALC__SPARE_4_2 0x0435 -#define VL53L1_MCU_RANGE_CALC__SPARE_4_0 0x0437 +#define VL53L1_MCU_RANGE_CALC__SPARE_4_1 0x0436 -#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC 0x0438 +#define VL53L1_MCU_RANGE_CALC__SPARE_4_0 0x0437 @@ -5599,10 +5598,10 @@ +#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC 0x0438 -#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC_HI 0x0438 @@ -5610,20 +5609,20 @@ -#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC_LO 0x0439 +#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC_HI 0x0438 -#define VL53L1_MCU_RANGE_CALC__ALGO_VCSEL_PERIOD 0x043C +#define VL53L1_MCU_RANGE_CALC__AMBIENT_DURATION_PRE_CALC_LO 0x0439 @@ -5631,10 +5630,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_VCSEL_PERIOD 0x043C -#define VL53L1_MCU_RANGE_CALC__SPARE_5 0x043D @@ -5647,10 +5646,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_5 0x043D -#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS 0x043E @@ -5663,10 +5662,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS 0x043E -#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS_HI 0x043E @@ -5674,20 +5673,20 @@ -#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS_LO 0x043F +#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS_HI 0x043E -#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE 0x0440 +#define VL53L1_MCU_RANGE_CALC__ALGO_TOTAL_PERIODS_LO 0x043F @@ -5695,10 +5694,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE 0x0440 -#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_3 0x0440 @@ -5706,36 +5705,36 @@ -#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_2 0x0441 +#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_3 0x0440 -#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_1 0x0442 +#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_2 0x0441 -#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_0 0x0443 +#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_1 0x0442 -#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS 0x0444 +#define VL53L1_MCU_RANGE_CALC__ALGO_ACCUM_PHASE_0 0x0443 @@ -5743,10 +5742,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS 0x0444 -#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_3 0x0444 @@ -5754,36 +5753,36 @@ -#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_2 0x0445 +#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_3 0x0444 -#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_1 0x0446 +#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_2 0x0445 -#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_0 0x0447 +#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_1 0x0446 -#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS 0x0448 +#define VL53L1_MCU_RANGE_CALC__ALGO_SIGNAL_EVENTS_0 0x0447 @@ -5791,10 +5790,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS 0x0448 -#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_3 0x0448 @@ -5802,36 +5801,36 @@ -#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_2 0x0449 +#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_3 0x0448 -#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_1 0x044A +#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_2 0x0449 -#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_0 0x044B +#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_1 0x044A -#define VL53L1_MCU_RANGE_CALC__SPARE_6 0x044C +#define VL53L1_MCU_RANGE_CALC__ALGO_AMBIENT_EVENTS_0 0x044B @@ -5839,10 +5838,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_6 0x044C -#define VL53L1_MCU_RANGE_CALC__SPARE_6_HI 0x044C @@ -5850,20 +5849,20 @@ -#define VL53L1_MCU_RANGE_CALC__SPARE_6_LO 0x044D +#define VL53L1_MCU_RANGE_CALC__SPARE_6_HI 0x044C -#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD 0x044E +#define VL53L1_MCU_RANGE_CALC__SPARE_6_LO 0x044D @@ -5871,10 +5870,10 @@ +#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD 0x044E -#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD_HI 0x044E @@ -5882,20 +5881,20 @@ -#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD_LO 0x044F +#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD_HI 0x044E -#define VL53L1_MCU_RANGE_CALC__NUM_SPADS 0x0450 +#define VL53L1_MCU_RANGE_CALC__ALGO_ADJUST_VCSEL_PERIOD_LO 0x044F @@ -5903,10 +5902,10 @@ +#define VL53L1_MCU_RANGE_CALC__NUM_SPADS 0x0450 -#define VL53L1_MCU_RANGE_CALC__NUM_SPADS_HI 0x0450 @@ -5914,20 +5913,20 @@ -#define VL53L1_MCU_RANGE_CALC__NUM_SPADS_LO 0x0451 +#define VL53L1_MCU_RANGE_CALC__NUM_SPADS_HI 0x0450 -#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT 0x0452 +#define VL53L1_MCU_RANGE_CALC__NUM_SPADS_LO 0x0451 @@ -5935,10 +5934,10 @@ +#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT 0x0452 -#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT_HI 0x0452 @@ -5946,20 +5945,20 @@ -#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT_LO 0x0453 +#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT_HI 0x0452 -#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS 0x0454 +#define VL53L1_MCU_RANGE_CALC__PHASE_OUTPUT_LO 0x0453 @@ -5967,10 +5966,10 @@ +#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS 0x0454 -#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_3 0x0454 @@ -5978,36 +5977,36 @@ -#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_2 0x0455 +#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_3 0x0454 -#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_1 0x0456 +#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_2 0x0455 -#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_0 0x0457 +#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_1 0x0456 -#define VL53L1_MCU_RANGE_CALC__SPARE_7 0x0458 +#define VL53L1_MCU_RANGE_CALC__RATE_PER_SPAD_MCPS_0 0x0457 @@ -6015,10 +6014,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_7 0x0458 -#define VL53L1_MCU_RANGE_CALC__SPARE_8 0x0459 @@ -6031,10 +6030,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_8 0x0459 -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS 0x045A @@ -6047,10 +6046,10 @@ +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS 0x045A -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS_HI 0x045A @@ -6058,20 +6057,20 @@ -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS_LO 0x045B +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS_HI 0x045A -#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS 0x045C +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_MCPS_LO 0x045B @@ -6079,10 +6078,10 @@ +#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS 0x045C -#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS_HI 0x045C @@ -6090,20 +6089,20 @@ -#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS_LO 0x045D +#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS_HI 0x045C -#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS 0x045E +#define VL53L1_MCU_RANGE_CALC__AVG_SIGNAL_RATE_MCPS_LO 0x045D @@ -6111,10 +6110,10 @@ +#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS 0x045E -#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS_HI 0x045E @@ -6122,20 +6121,20 @@ -#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS_LO 0x045F +#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS_HI 0x045E -#define VL53L1_MCU_RANGE_CALC__XTALK 0x0460 +#define VL53L1_MCU_RANGE_CALC__AMBIENT_RATE_MCPS_LO 0x045F @@ -6143,10 +6142,10 @@ +#define VL53L1_MCU_RANGE_CALC__XTALK 0x0460 -#define VL53L1_MCU_RANGE_CALC__XTALK_HI 0x0460 @@ -6154,20 +6153,20 @@ -#define VL53L1_MCU_RANGE_CALC__XTALK_LO 0x0461 +#define VL53L1_MCU_RANGE_CALC__XTALK_HI 0x0460 -#define VL53L1_MCU_RANGE_CALC__CALC_STATUS 0x0462 +#define VL53L1_MCU_RANGE_CALC__XTALK_LO 0x0461 @@ -6175,10 +6174,10 @@ +#define VL53L1_MCU_RANGE_CALC__CALC_STATUS 0x0462 -#define VL53L1_MCU_RANGE_CALC__DEBUG 0x0463 @@ -6191,10 +6190,10 @@ +#define VL53L1_MCU_RANGE_CALC__DEBUG 0x0463 -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS 0x0464 @@ -6207,10 +6206,10 @@ +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS 0x0464 -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS_HI 0x0464 @@ -6218,20 +6217,20 @@ -#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS_LO 0x0465 +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS_HI 0x0464 -#define VL53L1_MCU_RANGE_CALC__SPARE_0 0x0468 +#define VL53L1_MCU_RANGE_CALC__PEAK_SIGNAL_RATE_XTALK_CORR_MCPS_LO 0x0465 @@ -6239,10 +6238,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_0 0x0468 -#define VL53L1_MCU_RANGE_CALC__SPARE_1 0x0469 @@ -6255,10 +6254,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_1 0x0469 -#define VL53L1_MCU_RANGE_CALC__SPARE_2 0x046A @@ -6271,10 +6270,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_2 0x046A -#define VL53L1_MCU_RANGE_CALC__SPARE_3 0x046B @@ -6287,10 +6286,10 @@ +#define VL53L1_MCU_RANGE_CALC__SPARE_3 0x046B -#define VL53L1_PATCH__CTRL 0x0470 @@ -6298,836 +6297,836 @@ -#define VL53L1_PATCH__JMP_ENABLES 0x0472 +#define VL53L1_PATCH__CTRL 0x0470 -#define VL53L1_PATCH__JMP_ENABLES_HI 0x0472 +#define VL53L1_PATCH__JMP_ENABLES 0x0472 -#define VL53L1_PATCH__JMP_ENABLES_LO 0x0473 +#define VL53L1_PATCH__JMP_ENABLES_HI 0x0472 -#define VL53L1_PATCH__DATA_ENABLES 0x0474 +#define VL53L1_PATCH__JMP_ENABLES_LO 0x0473 -#define VL53L1_PATCH__DATA_ENABLES_HI 0x0474 +#define VL53L1_PATCH__DATA_ENABLES 0x0474 -#define VL53L1_PATCH__DATA_ENABLES_LO 0x0475 +#define VL53L1_PATCH__DATA_ENABLES_HI 0x0474 -#define VL53L1_PATCH__OFFSET_0 0x0476 +#define VL53L1_PATCH__DATA_ENABLES_LO 0x0475 -#define VL53L1_PATCH__OFFSET_0_HI 0x0476 +#define VL53L1_PATCH__OFFSET_0 0x0476 -#define VL53L1_PATCH__OFFSET_0_LO 0x0477 +#define VL53L1_PATCH__OFFSET_0_HI 0x0476 -#define VL53L1_PATCH__OFFSET_1 0x0478 +#define VL53L1_PATCH__OFFSET_0_LO 0x0477 -#define VL53L1_PATCH__OFFSET_1_HI 0x0478 +#define VL53L1_PATCH__OFFSET_1 0x0478 -#define VL53L1_PATCH__OFFSET_1_LO 0x0479 +#define VL53L1_PATCH__OFFSET_1_HI 0x0478 -#define VL53L1_PATCH__OFFSET_2 0x047A +#define VL53L1_PATCH__OFFSET_1_LO 0x0479 -#define VL53L1_PATCH__OFFSET_2_HI 0x047A +#define VL53L1_PATCH__OFFSET_2 0x047A -#define VL53L1_PATCH__OFFSET_2_LO 0x047B +#define VL53L1_PATCH__OFFSET_2_HI 0x047A -#define VL53L1_PATCH__OFFSET_3 0x047C +#define VL53L1_PATCH__OFFSET_2_LO 0x047B -#define VL53L1_PATCH__OFFSET_3_HI 0x047C +#define VL53L1_PATCH__OFFSET_3 0x047C -#define VL53L1_PATCH__OFFSET_3_LO 0x047D +#define VL53L1_PATCH__OFFSET_3_HI 0x047C -#define VL53L1_PATCH__OFFSET_4 0x047E +#define VL53L1_PATCH__OFFSET_3_LO 0x047D -#define VL53L1_PATCH__OFFSET_4_HI 0x047E +#define VL53L1_PATCH__OFFSET_4 0x047E -#define VL53L1_PATCH__OFFSET_4_LO 0x047F +#define VL53L1_PATCH__OFFSET_4_HI 0x047E -#define VL53L1_PATCH__OFFSET_5 0x0480 +#define VL53L1_PATCH__OFFSET_4_LO 0x047F -#define VL53L1_PATCH__OFFSET_5_HI 0x0480 +#define VL53L1_PATCH__OFFSET_5 0x0480 -#define VL53L1_PATCH__OFFSET_5_LO 0x0481 +#define VL53L1_PATCH__OFFSET_5_HI 0x0480 -#define VL53L1_PATCH__OFFSET_6 0x0482 +#define VL53L1_PATCH__OFFSET_5_LO 0x0481 -#define VL53L1_PATCH__OFFSET_6_HI 0x0482 +#define VL53L1_PATCH__OFFSET_6 0x0482 -#define VL53L1_PATCH__OFFSET_6_LO 0x0483 +#define VL53L1_PATCH__OFFSET_6_HI 0x0482 -#define VL53L1_PATCH__OFFSET_7 0x0484 +#define VL53L1_PATCH__OFFSET_6_LO 0x0483 -#define VL53L1_PATCH__OFFSET_7_HI 0x0484 +#define VL53L1_PATCH__OFFSET_7 0x0484 -#define VL53L1_PATCH__OFFSET_7_LO 0x0485 +#define VL53L1_PATCH__OFFSET_7_HI 0x0484 -#define VL53L1_PATCH__OFFSET_8 0x0486 +#define VL53L1_PATCH__OFFSET_7_LO 0x0485 -#define VL53L1_PATCH__OFFSET_8_HI 0x0486 +#define VL53L1_PATCH__OFFSET_8 0x0486 -#define VL53L1_PATCH__OFFSET_8_LO 0x0487 +#define VL53L1_PATCH__OFFSET_8_HI 0x0486 -#define VL53L1_PATCH__OFFSET_9 0x0488 +#define VL53L1_PATCH__OFFSET_8_LO 0x0487 -#define VL53L1_PATCH__OFFSET_9_HI 0x0488 +#define VL53L1_PATCH__OFFSET_9 0x0488 -#define VL53L1_PATCH__OFFSET_9_LO 0x0489 +#define VL53L1_PATCH__OFFSET_9_HI 0x0488 -#define VL53L1_PATCH__OFFSET_10 0x048A +#define VL53L1_PATCH__OFFSET_9_LO 0x0489 -#define VL53L1_PATCH__OFFSET_10_HI 0x048A +#define VL53L1_PATCH__OFFSET_10 0x048A -#define VL53L1_PATCH__OFFSET_10_LO 0x048B +#define VL53L1_PATCH__OFFSET_10_HI 0x048A -#define VL53L1_PATCH__OFFSET_11 0x048C +#define VL53L1_PATCH__OFFSET_10_LO 0x048B -#define VL53L1_PATCH__OFFSET_11_HI 0x048C +#define VL53L1_PATCH__OFFSET_11 0x048C -#define VL53L1_PATCH__OFFSET_11_LO 0x048D +#define VL53L1_PATCH__OFFSET_11_HI 0x048C -#define VL53L1_PATCH__OFFSET_12 0x048E +#define VL53L1_PATCH__OFFSET_11_LO 0x048D -#define VL53L1_PATCH__OFFSET_12_HI 0x048E +#define VL53L1_PATCH__OFFSET_12 0x048E -#define VL53L1_PATCH__OFFSET_12_LO 0x048F +#define VL53L1_PATCH__OFFSET_12_HI 0x048E -#define VL53L1_PATCH__OFFSET_13 0x0490 +#define VL53L1_PATCH__OFFSET_12_LO 0x048F -#define VL53L1_PATCH__OFFSET_13_HI 0x0490 +#define VL53L1_PATCH__OFFSET_13 0x0490 -#define VL53L1_PATCH__OFFSET_13_LO 0x0491 +#define VL53L1_PATCH__OFFSET_13_HI 0x0490 -#define VL53L1_PATCH__OFFSET_14 0x0492 +#define VL53L1_PATCH__OFFSET_13_LO 0x0491 -#define VL53L1_PATCH__OFFSET_14_HI 0x0492 +#define VL53L1_PATCH__OFFSET_14 0x0492 -#define VL53L1_PATCH__OFFSET_14_LO 0x0493 +#define VL53L1_PATCH__OFFSET_14_HI 0x0492 -#define VL53L1_PATCH__OFFSET_15 0x0494 +#define VL53L1_PATCH__OFFSET_14_LO 0x0493 -#define VL53L1_PATCH__OFFSET_15_HI 0x0494 +#define VL53L1_PATCH__OFFSET_15 0x0494 -#define VL53L1_PATCH__OFFSET_15_LO 0x0495 +#define VL53L1_PATCH__OFFSET_15_HI 0x0494 -#define VL53L1_PATCH__ADDRESS_0 0x0496 +#define VL53L1_PATCH__OFFSET_15_LO 0x0495 -#define VL53L1_PATCH__ADDRESS_0_HI 0x0496 +#define VL53L1_PATCH__ADDRESS_0 0x0496 -#define VL53L1_PATCH__ADDRESS_0_LO 0x0497 +#define VL53L1_PATCH__ADDRESS_0_HI 0x0496 -#define VL53L1_PATCH__ADDRESS_1 0x0498 +#define VL53L1_PATCH__ADDRESS_0_LO 0x0497 -#define VL53L1_PATCH__ADDRESS_1_HI 0x0498 +#define VL53L1_PATCH__ADDRESS_1 0x0498 -#define VL53L1_PATCH__ADDRESS_1_LO 0x0499 +#define VL53L1_PATCH__ADDRESS_1_HI 0x0498 -#define VL53L1_PATCH__ADDRESS_2 0x049A +#define VL53L1_PATCH__ADDRESS_1_LO 0x0499 -#define VL53L1_PATCH__ADDRESS_2_HI 0x049A +#define VL53L1_PATCH__ADDRESS_2 0x049A -#define VL53L1_PATCH__ADDRESS_2_LO 0x049B +#define VL53L1_PATCH__ADDRESS_2_HI 0x049A -#define VL53L1_PATCH__ADDRESS_3 0x049C +#define VL53L1_PATCH__ADDRESS_2_LO 0x049B -#define VL53L1_PATCH__ADDRESS_3_HI 0x049C +#define VL53L1_PATCH__ADDRESS_3 0x049C -#define VL53L1_PATCH__ADDRESS_3_LO 0x049D +#define VL53L1_PATCH__ADDRESS_3_HI 0x049C -#define VL53L1_PATCH__ADDRESS_4 0x049E +#define VL53L1_PATCH__ADDRESS_3_LO 0x049D -#define VL53L1_PATCH__ADDRESS_4_HI 0x049E +#define VL53L1_PATCH__ADDRESS_4 0x049E -#define VL53L1_PATCH__ADDRESS_4_LO 0x049F +#define VL53L1_PATCH__ADDRESS_4_HI 0x049E -#define VL53L1_PATCH__ADDRESS_5 0x04A0 +#define VL53L1_PATCH__ADDRESS_4_LO 0x049F -#define VL53L1_PATCH__ADDRESS_5_HI 0x04A0 +#define VL53L1_PATCH__ADDRESS_5 0x04A0 -#define VL53L1_PATCH__ADDRESS_5_LO 0x04A1 +#define VL53L1_PATCH__ADDRESS_5_HI 0x04A0 -#define VL53L1_PATCH__ADDRESS_6 0x04A2 +#define VL53L1_PATCH__ADDRESS_5_LO 0x04A1 -#define VL53L1_PATCH__ADDRESS_6_HI 0x04A2 +#define VL53L1_PATCH__ADDRESS_6 0x04A2 -#define VL53L1_PATCH__ADDRESS_6_LO 0x04A3 +#define VL53L1_PATCH__ADDRESS_6_HI 0x04A2 -#define VL53L1_PATCH__ADDRESS_7 0x04A4 +#define VL53L1_PATCH__ADDRESS_6_LO 0x04A3 -#define VL53L1_PATCH__ADDRESS_7_HI 0x04A4 +#define VL53L1_PATCH__ADDRESS_7 0x04A4 -#define VL53L1_PATCH__ADDRESS_7_LO 0x04A5 +#define VL53L1_PATCH__ADDRESS_7_HI 0x04A4 -#define VL53L1_PATCH__ADDRESS_8 0x04A6 +#define VL53L1_PATCH__ADDRESS_7_LO 0x04A5 -#define VL53L1_PATCH__ADDRESS_8_HI 0x04A6 +#define VL53L1_PATCH__ADDRESS_8 0x04A6 -#define VL53L1_PATCH__ADDRESS_8_LO 0x04A7 +#define VL53L1_PATCH__ADDRESS_8_HI 0x04A6 -#define VL53L1_PATCH__ADDRESS_9 0x04A8 +#define VL53L1_PATCH__ADDRESS_8_LO 0x04A7 -#define VL53L1_PATCH__ADDRESS_9_HI 0x04A8 +#define VL53L1_PATCH__ADDRESS_9 0x04A8 -#define VL53L1_PATCH__ADDRESS_9_LO 0x04A9 +#define VL53L1_PATCH__ADDRESS_9_HI 0x04A8 -#define VL53L1_PATCH__ADDRESS_10 0x04AA +#define VL53L1_PATCH__ADDRESS_9_LO 0x04A9 -#define VL53L1_PATCH__ADDRESS_10_HI 0x04AA +#define VL53L1_PATCH__ADDRESS_10 0x04AA -#define VL53L1_PATCH__ADDRESS_10_LO 0x04AB +#define VL53L1_PATCH__ADDRESS_10_HI 0x04AA -#define VL53L1_PATCH__ADDRESS_11 0x04AC +#define VL53L1_PATCH__ADDRESS_10_LO 0x04AB -#define VL53L1_PATCH__ADDRESS_11_HI 0x04AC +#define VL53L1_PATCH__ADDRESS_11 0x04AC -#define VL53L1_PATCH__ADDRESS_11_LO 0x04AD +#define VL53L1_PATCH__ADDRESS_11_HI 0x04AC -#define VL53L1_PATCH__ADDRESS_12 0x04AE +#define VL53L1_PATCH__ADDRESS_11_LO 0x04AD -#define VL53L1_PATCH__ADDRESS_12_HI 0x04AE +#define VL53L1_PATCH__ADDRESS_12 0x04AE -#define VL53L1_PATCH__ADDRESS_12_LO 0x04AF +#define VL53L1_PATCH__ADDRESS_12_HI 0x04AE -#define VL53L1_PATCH__ADDRESS_13 0x04B0 +#define VL53L1_PATCH__ADDRESS_12_LO 0x04AF -#define VL53L1_PATCH__ADDRESS_13_HI 0x04B0 +#define VL53L1_PATCH__ADDRESS_13 0x04B0 -#define VL53L1_PATCH__ADDRESS_13_LO 0x04B1 +#define VL53L1_PATCH__ADDRESS_13_HI 0x04B0 -#define VL53L1_PATCH__ADDRESS_14 0x04B2 +#define VL53L1_PATCH__ADDRESS_13_LO 0x04B1 -#define VL53L1_PATCH__ADDRESS_14_HI 0x04B2 +#define VL53L1_PATCH__ADDRESS_14 0x04B2 -#define VL53L1_PATCH__ADDRESS_14_LO 0x04B3 +#define VL53L1_PATCH__ADDRESS_14_HI 0x04B2 -#define VL53L1_PATCH__ADDRESS_15 0x04B4 +#define VL53L1_PATCH__ADDRESS_14_LO 0x04B3 -#define VL53L1_PATCH__ADDRESS_15_HI 0x04B4 +#define VL53L1_PATCH__ADDRESS_15 0x04B4 -#define VL53L1_PATCH__ADDRESS_15_LO 0x04B5 +#define VL53L1_PATCH__ADDRESS_15_HI 0x04B4 -#define VL53L1_SPI_ASYNC_MUX__CTRL 0x04C0 +#define VL53L1_PATCH__ADDRESS_15_LO 0x04B5 -#define VL53L1_CLK__CONFIG 0x04C4 +#define VL53L1_SPI_ASYNC_MUX__CTRL 0x04C0 @@ -7135,10 +7134,10 @@ +#define VL53L1_CLK__CONFIG 0x04C4 -#define VL53L1_GPIO_LV_MUX__CTRL 0x04CC @@ -7151,11 +7150,11 @@ +#define VL53L1_GPIO_LV_MUX__CTRL 0x04CC -#define VL53L1_GPIO_LV_PAD__CTRL 0x04CD @@ -7168,10 +7167,10 @@ +#define VL53L1_GPIO_LV_PAD__CTRL 0x04CD -#define VL53L1_PAD_I2C_LV__CONFIG 0x04D0 @@ -7179,12 +7178,12 @@ -#define VL53L1_PAD_STARTUP_MODE__VALUE_RO_GO1 0x04D4 +#define VL53L1_PAD_I2C_LV__CONFIG 0x04D0 @@ -7192,10 +7191,10 @@ +#define VL53L1_PAD_STARTUP_MODE__VALUE_RO_GO1 0x04D4 -#define VL53L1_HOST_IF__STATUS_GO1 0x04D5 @@ -7208,10 +7207,10 @@ +#define VL53L1_HOST_IF__STATUS_GO1 0x04D5 -#define VL53L1_MCU_CLK_GATING__CTRL 0x04D8 @@ -7224,13 +7223,13 @@ +#define VL53L1_MCU_CLK_GATING__CTRL 0x04D8 -#define VL53L1_TEST__BIST_ROM_CTRL 0x04E0 @@ -7238,1828 +7237,1828 @@ -#define VL53L1_TEST__BIST_ROM_RESULT 0x04E1 +#define VL53L1_TEST__BIST_ROM_CTRL 0x04E0 -#define VL53L1_TEST__BIST_ROM_MCU_SIG 0x04E2 +#define VL53L1_TEST__BIST_ROM_RESULT 0x04E1 -#define VL53L1_TEST__BIST_ROM_MCU_SIG_HI 0x04E2 +#define VL53L1_TEST__BIST_ROM_MCU_SIG 0x04E2 -#define VL53L1_TEST__BIST_ROM_MCU_SIG_LO 0x04E3 +#define VL53L1_TEST__BIST_ROM_MCU_SIG_HI 0x04E2 -#define VL53L1_TEST__BIST_RAM_CTRL 0x04E4 +#define VL53L1_TEST__BIST_ROM_MCU_SIG_LO 0x04E3 -#define VL53L1_TEST__BIST_RAM_RESULT 0x04E5 +#define VL53L1_TEST__BIST_RAM_CTRL 0x04E4 -#define VL53L1_TEST__TMC 0x04E8 +#define VL53L1_TEST__BIST_RAM_RESULT 0x04E5 -#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD 0x04F0 +#define VL53L1_TEST__TMC 0x04E8 -#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD_HI 0x04F0 +#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD 0x04F0 -#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD_LO 0x04F1 +#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD_HI 0x04F0 -#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD 0x04F2 +#define VL53L1_TEST__PLL_BIST_MIN_THRESHOLD_LO 0x04F1 -#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD_HI 0x04F2 +#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD 0x04F2 -#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD_LO 0x04F3 +#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD_HI 0x04F2 -#define VL53L1_TEST__PLL_BIST_COUNT_OUT 0x04F4 +#define VL53L1_TEST__PLL_BIST_MAX_THRESHOLD_LO 0x04F3 -#define VL53L1_TEST__PLL_BIST_COUNT_OUT_HI 0x04F4 +#define VL53L1_TEST__PLL_BIST_COUNT_OUT 0x04F4 -#define VL53L1_TEST__PLL_BIST_COUNT_OUT_LO 0x04F5 +#define VL53L1_TEST__PLL_BIST_COUNT_OUT_HI 0x04F4 -#define VL53L1_TEST__PLL_BIST_GONOGO 0x04F6 +#define VL53L1_TEST__PLL_BIST_COUNT_OUT_LO 0x04F5 -#define VL53L1_TEST__PLL_BIST_CTRL 0x04F7 +#define VL53L1_TEST__PLL_BIST_GONOGO 0x04F6 -#define VL53L1_RANGING_CORE__DEVICE_ID 0x0680 +#define VL53L1_TEST__PLL_BIST_CTRL 0x04F7 -#define VL53L1_RANGING_CORE__REVISION_ID 0x0681 +#define VL53L1_RANGING_CORE__DEVICE_ID 0x0680 -#define VL53L1_RANGING_CORE__CLK_CTRL1 0x0683 +#define VL53L1_RANGING_CORE__REVISION_ID 0x0681 -#define VL53L1_RANGING_CORE__CLK_CTRL2 0x0684 +#define VL53L1_RANGING_CORE__CLK_CTRL1 0x0683 -#define VL53L1_RANGING_CORE__WOI_1 0x0685 +#define VL53L1_RANGING_CORE__CLK_CTRL2 0x0684 -#define VL53L1_RANGING_CORE__WOI_REF_1 0x0686 +#define VL53L1_RANGING_CORE__WOI_1 0x0685 -#define VL53L1_RANGING_CORE__START_RANGING 0x0687 +#define VL53L1_RANGING_CORE__WOI_REF_1 0x0686 -#define VL53L1_RANGING_CORE__LOW_LIMIT_1 0x0690 +#define VL53L1_RANGING_CORE__START_RANGING 0x0687 -#define VL53L1_RANGING_CORE__HIGH_LIMIT_1 0x0691 +#define VL53L1_RANGING_CORE__LOW_LIMIT_1 0x0690 -#define VL53L1_RANGING_CORE__LOW_LIMIT_REF_1 0x0692 +#define VL53L1_RANGING_CORE__HIGH_LIMIT_1 0x0691 -#define VL53L1_RANGING_CORE__HIGH_LIMIT_REF_1 0x0693 +#define VL53L1_RANGING_CORE__LOW_LIMIT_REF_1 0x0692 -#define VL53L1_RANGING_CORE__QUANTIFIER_1_MSB 0x0694 +#define VL53L1_RANGING_CORE__HIGH_LIMIT_REF_1 0x0693 -#define VL53L1_RANGING_CORE__QUANTIFIER_1_LSB 0x0695 +#define VL53L1_RANGING_CORE__QUANTIFIER_1_MSB 0x0694 -#define VL53L1_RANGING_CORE__QUANTIFIER_REF_1_MSB 0x0696 +#define VL53L1_RANGING_CORE__QUANTIFIER_1_LSB 0x0695 -#define VL53L1_RANGING_CORE__QUANTIFIER_REF_1_LSB 0x0697 +#define VL53L1_RANGING_CORE__QUANTIFIER_REF_1_MSB 0x0696 -#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_1_MSB 0x0698 +#define VL53L1_RANGING_CORE__QUANTIFIER_REF_1_LSB 0x0697 -#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_1_LSB 0x0699 +#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_1_MSB 0x0698 -#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_REF_1_MSB 0x069A +#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_1_LSB 0x0699 -#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_REF_1_LSB 0x069B +#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_REF_1_MSB 0x069A -#define VL53L1_RANGING_CORE__FILTER_STRENGTH_1 0x069C +#define VL53L1_RANGING_CORE__AMBIENT_OFFSET_REF_1_LSB 0x069B -#define VL53L1_RANGING_CORE__FILTER_STRENGTH_REF_1 0x069D +#define VL53L1_RANGING_CORE__FILTER_STRENGTH_1 0x069C -#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_1_MSB 0x069E +#define VL53L1_RANGING_CORE__FILTER_STRENGTH_REF_1 0x069D -#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_1_LSB 0x069F +#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_1_MSB 0x069E -#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_REF_1_MSB 0x06A0 +#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_1_LSB 0x069F -#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_REF_1_LSB 0x06A1 +#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_REF_1_MSB 0x06A0 -#define VL53L1_RANGING_CORE__TIMEOUT_OVERALL_PERIODS_MSB 0x06A4 +#define VL53L1_RANGING_CORE__SIGNAL_EVENT_LIMIT_REF_1_LSB 0x06A1 -#define VL53L1_RANGING_CORE__TIMEOUT_OVERALL_PERIODS_LSB 0x06A5 +#define VL53L1_RANGING_CORE__TIMEOUT_OVERALL_PERIODS_MSB 0x06A4 -#define VL53L1_RANGING_CORE__INVERT_HW 0x06A6 +#define VL53L1_RANGING_CORE__TIMEOUT_OVERALL_PERIODS_LSB 0x06A5 -#define VL53L1_RANGING_CORE__FORCE_HW 0x06A7 +#define VL53L1_RANGING_CORE__INVERT_HW 0x06A6 -#define VL53L1_RANGING_CORE__STATIC_HW_VALUE 0x06A8 +#define VL53L1_RANGING_CORE__FORCE_HW 0x06A7 -#define VL53L1_RANGING_CORE__FORCE_CONTINUOUS_AMBIENT 0x06A9 +#define VL53L1_RANGING_CORE__STATIC_HW_VALUE 0x06A8 -#define VL53L1_RANGING_CORE__TEST_PHASE_SELECT_TO_FILTER 0x06AA +#define VL53L1_RANGING_CORE__FORCE_CONTINUOUS_AMBIENT 0x06A9 -#define VL53L1_RANGING_CORE__TEST_PHASE_SELECT_TO_TIMING_GEN 0x06AB +#define VL53L1_RANGING_CORE__TEST_PHASE_SELECT_TO_FILTER 0x06AA -#define VL53L1_RANGING_CORE__INITIAL_PHASE_VALUE_1 0x06AC +#define VL53L1_RANGING_CORE__TEST_PHASE_SELECT_TO_TIMING_GEN 0x06AB -#define VL53L1_RANGING_CORE__INITIAL_PHASE_VALUE_REF_1 0x06AD +#define VL53L1_RANGING_CORE__INITIAL_PHASE_VALUE_1 0x06AC -#define VL53L1_RANGING_CORE__FORCE_UP_IN 0x06AE +#define VL53L1_RANGING_CORE__INITIAL_PHASE_VALUE_REF_1 0x06AD -#define VL53L1_RANGING_CORE__FORCE_DN_IN 0x06AF +#define VL53L1_RANGING_CORE__FORCE_UP_IN 0x06AE -#define VL53L1_RANGING_CORE__STATIC_UP_VALUE_1 0x06B0 +#define VL53L1_RANGING_CORE__FORCE_DN_IN 0x06AF -#define VL53L1_RANGING_CORE__STATIC_UP_VALUE_REF_1 0x06B1 +#define VL53L1_RANGING_CORE__STATIC_UP_VALUE_1 0x06B0 -#define VL53L1_RANGING_CORE__STATIC_DN_VALUE_1 0x06B2 +#define VL53L1_RANGING_CORE__STATIC_UP_VALUE_REF_1 0x06B1 -#define VL53L1_RANGING_CORE__STATIC_DN_VALUE_REF_1 0x06B3 +#define VL53L1_RANGING_CORE__STATIC_DN_VALUE_1 0x06B2 -#define VL53L1_RANGING_CORE__MONITOR_UP_DN 0x06B4 +#define VL53L1_RANGING_CORE__STATIC_DN_VALUE_REF_1 0x06B3 -#define VL53L1_RANGING_CORE__INVERT_UP_DN 0x06B5 +#define VL53L1_RANGING_CORE__MONITOR_UP_DN 0x06B4 -#define VL53L1_RANGING_CORE__CPUMP_1 0x06B6 +#define VL53L1_RANGING_CORE__INVERT_UP_DN 0x06B5 -#define VL53L1_RANGING_CORE__CPUMP_2 0x06B7 +#define VL53L1_RANGING_CORE__CPUMP_1 0x06B6 -#define VL53L1_RANGING_CORE__CPUMP_3 0x06B8 +#define VL53L1_RANGING_CORE__CPUMP_2 0x06B7 -#define VL53L1_RANGING_CORE__OSC_1 0x06B9 +#define VL53L1_RANGING_CORE__CPUMP_3 0x06B8 -#define VL53L1_RANGING_CORE__PLL_1 0x06BB +#define VL53L1_RANGING_CORE__OSC_1 0x06B9 -#define VL53L1_RANGING_CORE__PLL_2 0x06BC +#define VL53L1_RANGING_CORE__PLL_1 0x06BB -#define VL53L1_RANGING_CORE__REFERENCE_1 0x06BD +#define VL53L1_RANGING_CORE__PLL_2 0x06BC -#define VL53L1_RANGING_CORE__REFERENCE_3 0x06BF +#define VL53L1_RANGING_CORE__REFERENCE_1 0x06BD -#define VL53L1_RANGING_CORE__REFERENCE_4 0x06C0 +#define VL53L1_RANGING_CORE__REFERENCE_3 0x06BF -#define VL53L1_RANGING_CORE__REFERENCE_5 0x06C1 +#define VL53L1_RANGING_CORE__REFERENCE_4 0x06C0 -#define VL53L1_RANGING_CORE__REGAVDD1V2 0x06C3 +#define VL53L1_RANGING_CORE__REFERENCE_5 0x06C1 -#define VL53L1_RANGING_CORE__CALIB_1 0x06C4 +#define VL53L1_RANGING_CORE__REGAVDD1V2 0x06C3 -#define VL53L1_RANGING_CORE__CALIB_2 0x06C5 +#define VL53L1_RANGING_CORE__CALIB_1 0x06C4 -#define VL53L1_RANGING_CORE__CALIB_3 0x06C6 +#define VL53L1_RANGING_CORE__CALIB_2 0x06C5 -#define VL53L1_RANGING_CORE__TST_MUX_SEL1 0x06C9 +#define VL53L1_RANGING_CORE__CALIB_3 0x06C6 -#define VL53L1_RANGING_CORE__TST_MUX_SEL2 0x06CA +#define VL53L1_RANGING_CORE__TST_MUX_SEL1 0x06C9 -#define VL53L1_RANGING_CORE__TST_MUX 0x06CB +#define VL53L1_RANGING_CORE__TST_MUX_SEL2 0x06CA -#define VL53L1_RANGING_CORE__GPIO_OUT_TESTMUX 0x06CC +#define VL53L1_RANGING_CORE__TST_MUX 0x06CB -#define VL53L1_RANGING_CORE__CUSTOM_FE 0x06CD +#define VL53L1_RANGING_CORE__GPIO_OUT_TESTMUX 0x06CC -#define VL53L1_RANGING_CORE__CUSTOM_FE_2 0x06CE +#define VL53L1_RANGING_CORE__CUSTOM_FE 0x06CD -#define VL53L1_RANGING_CORE__SPAD_READOUT 0x06CF +#define VL53L1_RANGING_CORE__CUSTOM_FE_2 0x06CE -#define VL53L1_RANGING_CORE__SPAD_READOUT_1 0x06D0 +#define VL53L1_RANGING_CORE__SPAD_READOUT 0x06CF -#define VL53L1_RANGING_CORE__SPAD_READOUT_2 0x06D1 +#define VL53L1_RANGING_CORE__SPAD_READOUT_1 0x06D0 -#define VL53L1_RANGING_CORE__SPAD_PS 0x06D2 +#define VL53L1_RANGING_CORE__SPAD_READOUT_2 0x06D1 -#define VL53L1_RANGING_CORE__LASER_SAFETY_2 0x06D4 +#define VL53L1_RANGING_CORE__SPAD_PS 0x06D2 -#define VL53L1_RANGING_CORE__NVM_CTRL__MODE 0x0780 +#define VL53L1_RANGING_CORE__LASER_SAFETY_2 0x06D4 -#define VL53L1_RANGING_CORE__NVM_CTRL__PDN 0x0781 +#define VL53L1_RANGING_CORE__NVM_CTRL__MODE 0x0780 -#define VL53L1_RANGING_CORE__NVM_CTRL__PROGN 0x0782 +#define VL53L1_RANGING_CORE__NVM_CTRL__PDN 0x0781 -#define VL53L1_RANGING_CORE__NVM_CTRL__READN 0x0783 +#define VL53L1_RANGING_CORE__NVM_CTRL__PROGN 0x0782 -#define VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_MSB 0x0784 +#define VL53L1_RANGING_CORE__NVM_CTRL__READN 0x0783 -#define VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_LSB 0x0785 +#define VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_MSB 0x0784 -#define VL53L1_RANGING_CORE__NVM_CTRL__HV_RISE_MSB 0x0786 +#define VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_LSB 0x0785 -#define VL53L1_RANGING_CORE__NVM_CTRL__HV_RISE_LSB 0x0787 +#define VL53L1_RANGING_CORE__NVM_CTRL__HV_RISE_MSB 0x0786 -#define VL53L1_RANGING_CORE__NVM_CTRL__HV_FALL_MSB 0x0788 +#define VL53L1_RANGING_CORE__NVM_CTRL__HV_RISE_LSB 0x0787 -#define VL53L1_RANGING_CORE__NVM_CTRL__HV_FALL_LSB 0x0789 +#define VL53L1_RANGING_CORE__NVM_CTRL__HV_FALL_MSB 0x0788 -#define VL53L1_RANGING_CORE__NVM_CTRL__TST 0x078A +#define VL53L1_RANGING_CORE__NVM_CTRL__HV_FALL_LSB 0x0789 -#define VL53L1_RANGING_CORE__NVM_CTRL__TESTREAD 0x078B +#define VL53L1_RANGING_CORE__NVM_CTRL__TST 0x078A -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_MMM 0x078C +#define VL53L1_RANGING_CORE__NVM_CTRL__TESTREAD 0x078B -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LMM 0x078D +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_MMM 0x078C -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LLM 0x078E +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LMM 0x078D -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LLL 0x078F +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LLM 0x078E -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_MMM 0x0790 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAIN_LLL 0x078F -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LMM 0x0791 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_MMM 0x0790 -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LLM 0x0792 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LMM 0x0791 -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LLL 0x0793 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LLM 0x0792 -#define VL53L1_RANGING_CORE__NVM_CTRL__ADDR 0x0794 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_LLL 0x0793 -#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_ECC 0x0795 +#define VL53L1_RANGING_CORE__NVM_CTRL__ADDR 0x0794 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_0 0x0796 +#define VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_ECC 0x0795 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_1 0x0797 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_0 0x0796 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_2 0x0798 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_1 0x0797 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_3 0x0799 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_2 0x0798 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_4 0x079A +#define VL53L1_RANGING_CORE__RET_SPAD_EN_3 0x0799 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_5 0x079B +#define VL53L1_RANGING_CORE__RET_SPAD_EN_4 0x079A -#define VL53L1_RANGING_CORE__RET_SPAD_EN_6 0x079C +#define VL53L1_RANGING_CORE__RET_SPAD_EN_5 0x079B -#define VL53L1_RANGING_CORE__RET_SPAD_EN_7 0x079D +#define VL53L1_RANGING_CORE__RET_SPAD_EN_6 0x079C -#define VL53L1_RANGING_CORE__RET_SPAD_EN_8 0x079E +#define VL53L1_RANGING_CORE__RET_SPAD_EN_7 0x079D -#define VL53L1_RANGING_CORE__RET_SPAD_EN_9 0x079F +#define VL53L1_RANGING_CORE__RET_SPAD_EN_8 0x079E -#define VL53L1_RANGING_CORE__RET_SPAD_EN_10 0x07A0 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_9 0x079F -#define VL53L1_RANGING_CORE__RET_SPAD_EN_11 0x07A1 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_10 0x07A0 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_12 0x07A2 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_11 0x07A1 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_13 0x07A3 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_12 0x07A2 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_14 0x07A4 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_13 0x07A3 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_15 0x07A5 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_14 0x07A4 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_16 0x07A6 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_15 0x07A5 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_17 0x07A7 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_16 0x07A6 -#define VL53L1_RANGING_CORE__SPAD_SHIFT_EN 0x07BA +#define VL53L1_RANGING_CORE__RET_SPAD_EN_17 0x07A7 -#define VL53L1_RANGING_CORE__SPAD_DISABLE_CTRL 0x07BB +#define VL53L1_RANGING_CORE__SPAD_SHIFT_EN 0x07BA -#define VL53L1_RANGING_CORE__SPAD_EN_SHIFT_OUT_DEBUG 0x07BC +#define VL53L1_RANGING_CORE__SPAD_DISABLE_CTRL 0x07BB -#define VL53L1_RANGING_CORE__SPI_MODE 0x07BD +#define VL53L1_RANGING_CORE__SPAD_EN_SHIFT_OUT_DEBUG 0x07BC -#define VL53L1_RANGING_CORE__GPIO_DIR 0x07BE +#define VL53L1_RANGING_CORE__SPI_MODE 0x07BD -#define VL53L1_RANGING_CORE__VCSEL_PERIOD 0x0880 +#define VL53L1_RANGING_CORE__GPIO_DIR 0x07BE -#define VL53L1_RANGING_CORE__VCSEL_START 0x0881 +#define VL53L1_RANGING_CORE__VCSEL_PERIOD 0x0880 -#define VL53L1_RANGING_CORE__VCSEL_STOP 0x0882 +#define VL53L1_RANGING_CORE__VCSEL_START 0x0881 -#define VL53L1_RANGING_CORE__VCSEL_1 0x0885 +#define VL53L1_RANGING_CORE__VCSEL_STOP 0x0882 -#define VL53L1_RANGING_CORE__VCSEL_STATUS 0x088D +#define VL53L1_RANGING_CORE__VCSEL_1 0x0885 -#define VL53L1_RANGING_CORE__STATUS 0x0980 +#define VL53L1_RANGING_CORE__VCSEL_STATUS 0x088D -#define VL53L1_RANGING_CORE__LASER_CONTINUITY_STATE 0x0981 +#define VL53L1_RANGING_CORE__STATUS 0x0980 -#define VL53L1_RANGING_CORE__RANGE_1_MMM 0x0982 +#define VL53L1_RANGING_CORE__LASER_CONTINUITY_STATE 0x0981 -#define VL53L1_RANGING_CORE__RANGE_1_LMM 0x0983 +#define VL53L1_RANGING_CORE__RANGE_1_MMM 0x0982 -#define VL53L1_RANGING_CORE__RANGE_1_LLM 0x0984 +#define VL53L1_RANGING_CORE__RANGE_1_LMM 0x0983 -#define VL53L1_RANGING_CORE__RANGE_1_LLL 0x0985 +#define VL53L1_RANGING_CORE__RANGE_1_LLM 0x0984 -#define VL53L1_RANGING_CORE__RANGE_REF_1_MMM 0x0986 +#define VL53L1_RANGING_CORE__RANGE_1_LLL 0x0985 -#define VL53L1_RANGING_CORE__RANGE_REF_1_LMM 0x0987 +#define VL53L1_RANGING_CORE__RANGE_REF_1_MMM 0x0986 -#define VL53L1_RANGING_CORE__RANGE_REF_1_LLM 0x0988 +#define VL53L1_RANGING_CORE__RANGE_REF_1_LMM 0x0987 -#define VL53L1_RANGING_CORE__RANGE_REF_1_LLL 0x0989 +#define VL53L1_RANGING_CORE__RANGE_REF_1_LLM 0x0988 -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_MMM 0x098A +#define VL53L1_RANGING_CORE__RANGE_REF_1_LLL 0x0989 -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LMM 0x098B +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_MMM 0x098A -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LLM 0x098C +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LMM 0x098B -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LLL 0x098D +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LLM 0x098C -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_MMM 0x098E +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_1_LLL 0x098D -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LMM 0x098F +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_MMM 0x098E -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LLM 0x0990 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LMM 0x098F -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LLL 0x0991 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LLM 0x0990 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_MMM 0x0992 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_1_LLL 0x0991 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LMM 0x0993 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_MMM 0x0992 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LLM 0x0994 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LMM 0x0993 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LLL 0x0995 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LLM 0x0994 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_MM 0x0996 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_1_LLL 0x0995 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_LM 0x0997 +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_MM 0x0996 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_LL 0x0998 +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_LM 0x0997 -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_MM 0x0999 +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_1_LL 0x0998 -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_LM 0x099A +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_MM 0x0999 -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_LL 0x099B +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_LM 0x099A -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_MMM 0x099C +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_LL 0x099B -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LMM 0x099D +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_MMM 0x099C -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LLM 0x099E +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LMM 0x099D -#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LLL 0x099F +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LLM 0x099E -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_MMM 0x09A0 +#define VL53L1_RANGING_CORE__AMBIENT_WINDOW_EVENTS_REF_1_LLL 0x099F -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LMM 0x09A1 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_MMM 0x09A0 -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LLM 0x09A2 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LMM 0x09A1 -#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LLL 0x09A3 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LLM 0x09A2 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_MMM 0x09A4 +#define VL53L1_RANGING_CORE__RANGING_TOTAL_EVENTS_REF_1_LLL 0x09A3 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LMM 0x09A5 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_MMM 0x09A4 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LLM 0x09A6 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LMM 0x09A5 -#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LLL 0x09A7 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LLM 0x09A6 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_MM 0x09A8 +#define VL53L1_RANGING_CORE__SIGNAL_TOTAL_EVENTS_REF_1_LLL 0x09A7 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_LM 0x09A9 +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_MM 0x09A8 -#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_LL 0x09AA +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_LM 0x09A9 -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_MM 0x09AB +#define VL53L1_RANGING_CORE__TOTAL_PERIODS_ELAPSED_REF_1_LL 0x09AA -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_LM 0x09AC +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_MM 0x09AB -#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_LL 0x09AD +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_LM 0x09AC -#define VL53L1_RANGING_CORE__GPIO_CONFIG__A0 0x0A00 +#define VL53L1_RANGING_CORE__AMBIENT_MISMATCH_REF_LL 0x09AD -#define VL53L1_RANGING_CORE__RESET_CONTROL__A0 0x0A01 +#define VL53L1_RANGING_CORE__GPIO_CONFIG__A0 0x0A00 -#define VL53L1_RANGING_CORE__INTR_MANAGER__A0 0x0A02 +#define VL53L1_RANGING_CORE__RESET_CONTROL__A0 0x0A01 -#define VL53L1_RANGING_CORE__POWER_FSM_TIME_OSC__A0 0x0A06 +#define VL53L1_RANGING_CORE__INTR_MANAGER__A0 0x0A02 -#define VL53L1_RANGING_CORE__VCSEL_ATEST__A0 0x0A07 +#define VL53L1_RANGING_CORE__POWER_FSM_TIME_OSC__A0 0x0A06 -#define VL53L1_RANGING_CORE__VCSEL_PERIOD_CLIPPED__A0 0x0A08 +#define VL53L1_RANGING_CORE__VCSEL_ATEST__A0 0x0A07 -#define VL53L1_RANGING_CORE__VCSEL_STOP_CLIPPED__A0 0x0A09 +#define VL53L1_RANGING_CORE__VCSEL_PERIOD_CLIPPED__A0 0x0A08 -#define VL53L1_RANGING_CORE__CALIB_2__A0 0x0A0A +#define VL53L1_RANGING_CORE__VCSEL_STOP_CLIPPED__A0 0x0A09 -#define VL53L1_RANGING_CORE__STOP_CONDITION__A0 0x0A0B +#define VL53L1_RANGING_CORE__CALIB_2__A0 0x0A0A -#define VL53L1_RANGING_CORE__STATUS_RESET__A0 0x0A0C +#define VL53L1_RANGING_CORE__STOP_CONDITION__A0 0x0A0B -#define VL53L1_RANGING_CORE__READOUT_CFG__A0 0x0A0D +#define VL53L1_RANGING_CORE__STATUS_RESET__A0 0x0A0C -#define VL53L1_RANGING_CORE__WINDOW_SETTING__A0 0x0A0E +#define VL53L1_RANGING_CORE__READOUT_CFG__A0 0x0A0D -#define VL53L1_RANGING_CORE__VCSEL_DELAY__A0 0x0A1A +#define VL53L1_RANGING_CORE__WINDOW_SETTING__A0 0x0A0E -#define VL53L1_RANGING_CORE__REFERENCE_2__A0 0x0A1B +#define VL53L1_RANGING_CORE__VCSEL_DELAY__A0 0x0A1A -#define VL53L1_RANGING_CORE__REGAVDD1V2__A0 0x0A1D +#define VL53L1_RANGING_CORE__REFERENCE_2__A0 0x0A1B -#define VL53L1_RANGING_CORE__TST_MUX__A0 0x0A1F +#define VL53L1_RANGING_CORE__REGAVDD1V2__A0 0x0A1D -#define VL53L1_RANGING_CORE__CUSTOM_FE_2__A0 0x0A20 +#define VL53L1_RANGING_CORE__TST_MUX__A0 0x0A1F -#define VL53L1_RANGING_CORE__SPAD_READOUT__A0 0x0A21 +#define VL53L1_RANGING_CORE__CUSTOM_FE_2__A0 0x0A20 -#define VL53L1_RANGING_CORE__CPUMP_1__A0 0x0A22 +#define VL53L1_RANGING_CORE__SPAD_READOUT__A0 0x0A21 -#define VL53L1_RANGING_CORE__SPARE_REGISTER__A0 0x0A23 +#define VL53L1_RANGING_CORE__CPUMP_1__A0 0x0A22 -#define VL53L1_RANGING_CORE__VCSEL_CONT_STAGE5_BYPASS__A0 0x0A24 +#define VL53L1_RANGING_CORE__SPARE_REGISTER__A0 0x0A23 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_18 0x0A25 +#define VL53L1_RANGING_CORE__VCSEL_CONT_STAGE5_BYPASS__A0 0x0A24 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_19 0x0A26 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_18 0x0A25 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_20 0x0A27 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_19 0x0A26 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_21 0x0A28 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_20 0x0A27 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_22 0x0A29 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_21 0x0A28 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_23 0x0A2A +#define VL53L1_RANGING_CORE__RET_SPAD_EN_22 0x0A29 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_24 0x0A2B +#define VL53L1_RANGING_CORE__RET_SPAD_EN_23 0x0A2A -#define VL53L1_RANGING_CORE__RET_SPAD_EN_25 0x0A2C +#define VL53L1_RANGING_CORE__RET_SPAD_EN_24 0x0A2B -#define VL53L1_RANGING_CORE__RET_SPAD_EN_26 0x0A2D +#define VL53L1_RANGING_CORE__RET_SPAD_EN_25 0x0A2C -#define VL53L1_RANGING_CORE__RET_SPAD_EN_27 0x0A2E +#define VL53L1_RANGING_CORE__RET_SPAD_EN_26 0x0A2D -#define VL53L1_RANGING_CORE__RET_SPAD_EN_28 0x0A2F +#define VL53L1_RANGING_CORE__RET_SPAD_EN_27 0x0A2E -#define VL53L1_RANGING_CORE__RET_SPAD_EN_29 0x0A30 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_28 0x0A2F -#define VL53L1_RANGING_CORE__RET_SPAD_EN_30 0x0A31 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_29 0x0A30 -#define VL53L1_RANGING_CORE__RET_SPAD_EN_31 0x0A32 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_30 0x0A31 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_0__EWOK 0x0A33 +#define VL53L1_RANGING_CORE__RET_SPAD_EN_31 0x0A32 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_1__EWOK 0x0A34 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_0__EWOK 0x0A33 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_2__EWOK 0x0A35 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_1__EWOK 0x0A34 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_3__EWOK 0x0A36 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_2__EWOK 0x0A35 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_4__EWOK 0x0A37 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_3__EWOK 0x0A36 -#define VL53L1_RANGING_CORE__REF_SPAD_EN_5__EWOK 0x0A38 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_4__EWOK 0x0A37 -#define VL53L1_RANGING_CORE__REF_EN_START_SELECT 0x0A39 +#define VL53L1_RANGING_CORE__REF_SPAD_EN_5__EWOK 0x0A38 -#define VL53L1_RANGING_CORE__REGDVDD1V2_ATEST__EWOK 0x0A41 +#define VL53L1_RANGING_CORE__REF_EN_START_SELECT 0x0A39 -#define VL53L1_SOFT_RESET_GO1 0x0B00 +#define VL53L1_RANGING_CORE__REGDVDD1V2_ATEST__EWOK 0x0A41 -#define VL53L1_PRIVATE__PATCH_BASE_ADDR_RSLV 0x0E00 +#define VL53L1_SOFT_RESET_GO1 0x0B00 -#define VL53L1_PREV_SHADOW_RESULT__INTERRUPT_STATUS 0x0ED0 +#define VL53L1_PRIVATE__PATCH_BASE_ADDR_RSLV 0x0E00 @@ -9067,12 +9066,12 @@ +#define VL53L1_PREV_SHADOW_RESULT__INTERRUPT_STATUS 0x0ED0 -#define VL53L1_PREV_SHADOW_RESULT__RANGE_STATUS 0x0ED1 @@ -9085,13 +9084,13 @@ +#define VL53L1_PREV_SHADOW_RESULT__RANGE_STATUS 0x0ED1 -#define VL53L1_PREV_SHADOW_RESULT__REPORT_STATUS 0x0ED2 @@ -9104,10 +9103,10 @@ +#define VL53L1_PREV_SHADOW_RESULT__REPORT_STATUS 0x0ED2 -#define VL53L1_PREV_SHADOW_RESULT__STREAM_COUNT 0x0ED3 @@ -9120,10 +9119,10 @@ +#define VL53L1_PREV_SHADOW_RESULT__STREAM_COUNT 0x0ED3 -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x0ED4 @@ -9136,10 +9135,10 @@ +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x0ED4 -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0ED4 @@ -9147,21 +9146,21 @@ -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0ED5 +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0ED4 -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x0ED6 +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0ED5 @@ -9169,9 +9168,9 @@ +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x0ED6 -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0ED6 @@ -9179,7 +9178,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0ED7 @@ -9187,7 +9185,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0ED8 +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0ED6 @@ -9195,6 +9193,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0ED7 @@ -9202,8 +9201,8 @@ +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0ED8 -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0ED8 @@ -9211,7 +9210,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0ED9 @@ -9219,8 +9217,8 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0 0x0EDA +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0ED8 @@ -9228,6 +9226,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0ED9 @@ -9235,7 +9234,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0_HI 0x0EDA +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0 0x0EDA @@ -9243,7 +9242,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0_LO 0x0EDB @@ -9251,8 +9249,8 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0 0x0EDC +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0_HI 0x0EDA @@ -9260,6 +9258,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD0_LO 0x0EDB @@ -9267,7 +9266,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0_HI 0x0EDC +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0 0x0EDC @@ -9275,7 +9274,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0_LO 0x0EDD @@ -9283,8 +9281,8 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0EDE +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0_HI 0x0EDC @@ -9292,6 +9290,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD0_LO 0x0EDD @@ -9299,7 +9298,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0EDE +#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0EDE @@ -9307,7 +9306,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0EDF @@ -9315,8 +9313,8 @@ -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0EE0 +#define VL53L1_PREV__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0EDE @@ -9324,6 +9322,7 @@ +#define VL53L1_PREV__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0EDF @@ -9331,7 +9330,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0EE0 +#define VL53L1_PREV__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0EE0 @@ -9339,7 +9338,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0EE1 @@ -9347,9 +9345,9 @@ -#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0EE2 +#define VL53L1_PPEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0EE0 @@ -9357,21 +9355,21 @@ +#define VL53L1_PPEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0EE1 -#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0EE2 +#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0EE2 -#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0EE3 @@ -9379,10 +9377,10 @@ -#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0EE4 +#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0EE2 @@ -9390,20 +9388,20 @@ +#define VL53L1_PREV_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0EE3 -#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0EE4 +#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0EE4 -#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0EE5 @@ -9411,11 +9409,11 @@ -#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x0EE6 +#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0EE4 @@ -9423,19 +9421,19 @@ +#define VL53L1_PREV_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0EE5 -#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0EE6 +#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x0EE6 -#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0EE7 @@ -9443,12 +9441,12 @@ -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x0EE8 +#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0EE6 @@ -9456,18 +9454,18 @@ +#define VL53L1_PREV_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0EE7 -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x0EE8 +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x0EE8 -#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x0EE9 @@ -9475,13 +9473,13 @@ -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x0EEA +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x0EE8 @@ -9489,17 +9487,17 @@ +#define VL53L1_PREV_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x0EE9 -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x0EEA +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x0EEA -#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x0EEB @@ -9507,7 +9505,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x0EEC @@ -9515,6 +9512,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x0EEA @@ -9522,16 +9520,16 @@ +#define VL53L1_PREV_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x0EEB -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x0EEC +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x0EEC -#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x0EED @@ -9539,7 +9537,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1 0x0EEE @@ -9548,6 +9545,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x0EEC @@ -9555,7 +9553,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1_HI 0x0EEE +#define VL53L1_PREV_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x0EED @@ -9563,7 +9561,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1_LO 0x0EEF +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1 0x0EEE @@ -9571,7 +9569,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1 0x0EF0 @@ -9580,6 +9577,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1_HI 0x0EEE @@ -9587,7 +9585,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1_HI 0x0EF0 +#define VL53L1_PREV_SHADOW_RESULT__SIGMA_SD1_LO 0x0EEF @@ -9595,7 +9593,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1_LO 0x0EF1 +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1 0x0EF0 @@ -9603,7 +9601,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x0EF2 @@ -9612,6 +9609,7 @@ +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1_HI 0x0EF0 @@ -9619,7 +9617,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x0EF2 +#define VL53L1_PREV_SHADOW_RESULT__PHASE_SD1_LO 0x0EF1 @@ -9627,7 +9625,7 @@ -#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x0EF3 +#define VL53L1_PREV_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x0EF2 @@ -9635,7 +9633,6 @@ -#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1 0x0EF4 @@ -9645,29 +9642,29 @@ +#define VL53L1_PFINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x0EF2 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1_HI 0x0EF4 +#define VL53L1_PFINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x0EF3 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1_LO 0x0EF5 +#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1 0x0EF4 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1 0x0EF6 @@ -9677,29 +9674,29 @@ +#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1_HI 0x0EF4 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1_HI 0x0EF6 +#define VL53L1_PREV_SHADOW_RESULT__SPARE_0_SD1_LO 0x0EF5 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1_LO 0x0EF7 +#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1 0x0EF6 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1 0x0EF8 @@ -9709,29 +9706,29 @@ +#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1_HI 0x0EF6 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1_HI 0x0EF8 +#define VL53L1_PREV_SHADOW_RESULT__SPARE_1_SD1_LO 0x0EF7 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1_LO 0x0EF9 +#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1 0x0EF8 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1 0x0EFA @@ -9741,29 +9738,29 @@ +#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1_HI 0x0EF8 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1_HI 0x0EFA +#define VL53L1_PREV_SHADOW_RESULT__SPARE_2_SD1_LO 0x0EF9 -#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1_LO 0x0EFB +#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1 0x0EFA -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x0EFC @@ -9773,29 +9770,29 @@ +#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1_HI 0x0EFA -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x0EFC +#define VL53L1_PREV_SHADOW_RESULT__SPARE_3_SD1_LO 0x0EFB -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x0EFD +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x0EFC -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x0EFE @@ -9803,17 +9800,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x0EFF +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x0EFC -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x0F00 +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x0EFD @@ -9821,29 +9818,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x0EFE -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x0F00 +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x0EFF -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x0F01 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x0F00 -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x0F02 @@ -9851,17 +9848,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x0F03 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x0F00 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x0F04 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x0F01 @@ -9869,29 +9866,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x0F02 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x0F04 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x0F03 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x0F05 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x0F04 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x0F06 @@ -9899,17 +9896,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x0F07 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x0F04 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x0F08 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x0F05 @@ -9917,29 +9914,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x0F06 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x0F08 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x0F07 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x0F09 +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x0F08 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x0F0A @@ -9947,17 +9944,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x0F0B +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x0F08 -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x0F0C +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x0F09 @@ -9965,29 +9962,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x0F0A -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x0F0C +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x0F0B -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x0F0D +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x0F0C -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x0F0E @@ -9995,17 +9992,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x0F0F +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x0F0C -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x0F10 +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x0F0D @@ -10013,29 +10010,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x0F0E -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x0F10 +#define VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x0F0F -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x0F11 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x0F10 -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x0F12 @@ -10043,17 +10040,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x0F13 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x0F10 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x0F14 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x0F11 @@ -10061,29 +10058,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x0F12 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x0F14 +#define VL53L1_PREV_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x0F13 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x0F15 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x0F14 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x0F16 @@ -10091,17 +10088,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x0F17 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x0F14 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x0F18 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x0F15 @@ -10109,29 +10106,29 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x0F16 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x0F18 +#define VL53L1_PREV_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x0F17 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x0F19 +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x0F18 -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x0F1A @@ -10139,17 +10136,17 @@ -#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x0F1B +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x0F18 -#define VL53L1_PREV_SHADOW_RESULT_CORE__SPARE_0 0x0F1C +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x0F19 @@ -10157,14 +10154,15 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x0F1A -#define VL53L1_RESULT__DEBUG_STATUS 0x0F20 +#define VL53L1_PREV_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x0F1B @@ -10172,6 +10170,7 @@ +#define VL53L1_PREV_SHADOW_RESULT_CORE__SPARE_0 0x0F1C @@ -10179,7 +10178,6 @@ -#define VL53L1_RESULT__DEBUG_STAGE 0x0F21 @@ -10188,6 +10186,7 @@ +#define VL53L1_RESULT__DEBUG_STATUS 0x0F20 @@ -10195,7 +10194,6 @@ -#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH 0x0F24 @@ -10204,6 +10202,7 @@ +#define VL53L1_RESULT__DEBUG_STAGE 0x0F21 @@ -10211,7 +10210,6 @@ -#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH_HI 0x0F24 @@ -10219,15 +10217,14 @@ -#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH_LO 0x0F25 +#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH 0x0F24 -#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW 0x0F26 @@ -10237,29 +10234,29 @@ +#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH_HI 0x0F24 -#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW_HI 0x0F26 +#define VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH_LO 0x0F25 -#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW_LO 0x0F27 +#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW 0x0F26 -#define VL53L1_GPH__SYSTEM__INTERRUPT_CONFIG_GPIO 0x0F28 @@ -10269,6 +10266,7 @@ +#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW_HI 0x0F26 @@ -10276,14 +10274,15 @@ +#define VL53L1_GPH__SYSTEM__THRESH_RATE_LOW_LO 0x0F27 -#define VL53L1_GPH__DSS_CONFIG__ROI_MODE_CONTROL 0x0F2F +#define VL53L1_GPH__SYSTEM__INTERRUPT_CONFIG_GPIO 0x0F28 @@ -10297,7 +10296,6 @@ -#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT 0x0F30 @@ -10305,6 +10303,7 @@ +#define VL53L1_GPH__DSS_CONFIG__ROI_MODE_CONTROL 0x0F2F @@ -10313,7 +10312,6 @@ -#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_HI 0x0F30 @@ -10321,15 +10319,14 @@ -#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_LO 0x0F31 +#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT 0x0F30 -#define VL53L1_GPH__DSS_CONFIG__MANUAL_BLOCK_SELECT 0x0F32 @@ -10339,14 +10336,15 @@ +#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_HI 0x0F30 -#define VL53L1_GPH__DSS_CONFIG__MAX_SPADS_LIMIT 0x0F33 +#define VL53L1_GPH__DSS_CONFIG__MANUAL_EFFECTIVE_SPADS_SELECT_LO 0x0F31 @@ -10354,6 +10352,7 @@ +#define VL53L1_GPH__DSS_CONFIG__MANUAL_BLOCK_SELECT 0x0F32 @@ -10361,7 +10360,6 @@ -#define VL53L1_GPH__DSS_CONFIG__MIN_SPADS_LIMIT 0x0F34 @@ -10370,6 +10368,7 @@ +#define VL53L1_GPH__DSS_CONFIG__MAX_SPADS_LIMIT 0x0F33 @@ -10377,7 +10376,6 @@ -#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_HI 0x0F36 @@ -10386,6 +10384,7 @@ +#define VL53L1_GPH__DSS_CONFIG__MIN_SPADS_LIMIT 0x0F34 @@ -10393,7 +10392,6 @@ -#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_LO 0x0F37 @@ -10402,6 +10400,7 @@ +#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_HI 0x0F36 @@ -10409,7 +10408,6 @@ -#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_B_HI 0x0F38 @@ -10418,6 +10416,7 @@ +#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_LO 0x0F37 @@ -10425,7 +10424,6 @@ -#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_B_LO 0x0F39 @@ -10434,6 +10432,7 @@ +#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_B_HI 0x0F38 @@ -10441,7 +10440,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_A_HI 0x0F3A @@ -10450,6 +10448,7 @@ +#define VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_B_LO 0x0F39 @@ -10457,7 +10456,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_A_LO 0x0F3B @@ -10466,6 +10464,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_A_HI 0x0F3A @@ -10473,7 +10472,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__VCSEL_PERIOD_A 0x0F3C @@ -10482,6 +10480,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_A_LO 0x0F3B @@ -10489,7 +10488,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__VCSEL_PERIOD_B 0x0F3D @@ -10498,6 +10496,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__VCSEL_PERIOD_A 0x0F3C @@ -10505,7 +10504,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_B_HI 0x0F3E @@ -10514,6 +10512,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__VCSEL_PERIOD_B 0x0F3D @@ -10521,7 +10520,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_B_LO 0x0F3F @@ -10530,6 +10528,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_B_HI 0x0F3E @@ -10537,7 +10536,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH 0x0F40 @@ -10546,6 +10544,7 @@ +#define VL53L1_GPH__RANGE_CONFIG__TIMEOUT_MACROP_B_LO 0x0F3F @@ -10553,7 +10552,6 @@ -#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH_HI 0x0F40 @@ -10561,15 +10559,14 @@ -#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH_LO 0x0F41 +#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH 0x0F40 -#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS 0x0F42 @@ -10579,29 +10576,29 @@ +#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH_HI 0x0F40 -#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_HI 0x0F42 +#define VL53L1_GPH__RANGE_CONFIG__SIGMA_THRESH_LO 0x0F41 -#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_LO 0x0F43 +#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS 0x0F42 -#define VL53L1_GPH__RANGE_CONFIG__VALID_PHASE_LOW 0x0F44 @@ -10612,14 +10609,15 @@ +#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_HI 0x0F42 -#define VL53L1_GPH__RANGE_CONFIG__VALID_PHASE_HIGH 0x0F45 +#define VL53L1_GPH__RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS_LO 0x0F43 @@ -10627,13 +10625,13 @@ +#define VL53L1_GPH__RANGE_CONFIG__VALID_PHASE_LOW 0x0F44 -#define VL53L1_FIRMWARE__INTERNAL_STREAM_COUNT_DIV 0x0F46 @@ -10643,13 +10641,13 @@ +#define VL53L1_GPH__RANGE_CONFIG__VALID_PHASE_HIGH 0x0F45 -#define VL53L1_FIRMWARE__INTERNAL_STREAM_COUNTER_VAL 0x0F47 @@ -10659,13 +10657,13 @@ +#define VL53L1_FIRMWARE__INTERNAL_STREAM_COUNT_DIV 0x0F46 -#define VL53L1_DSS_CALC__ROI_CTRL 0x0F54 @@ -10675,6 +10673,7 @@ +#define VL53L1_FIRMWARE__INTERNAL_STREAM_COUNTER_VAL 0x0F47 @@ -10682,7 +10681,6 @@ -#define VL53L1_DSS_CALC__SPARE_1 0x0F55 @@ -10691,6 +10689,7 @@ +#define VL53L1_DSS_CALC__ROI_CTRL 0x0F54 @@ -10698,7 +10697,6 @@ -#define VL53L1_DSS_CALC__SPARE_2 0x0F56 @@ -10708,13 +10706,13 @@ +#define VL53L1_DSS_CALC__SPARE_1 0x0F55 -#define VL53L1_DSS_CALC__SPARE_3 0x0F57 @@ -10724,13 +10722,13 @@ +#define VL53L1_DSS_CALC__SPARE_2 0x0F56 -#define VL53L1_DSS_CALC__SPARE_4 0x0F58 @@ -10740,13 +10738,13 @@ +#define VL53L1_DSS_CALC__SPARE_3 0x0F57 -#define VL53L1_DSS_CALC__SPARE_5 0x0F59 @@ -10756,13 +10754,13 @@ +#define VL53L1_DSS_CALC__SPARE_4 0x0F58 -#define VL53L1_DSS_CALC__SPARE_6 0x0F5A @@ -10772,13 +10770,13 @@ +#define VL53L1_DSS_CALC__SPARE_5 0x0F59 -#define VL53L1_DSS_CALC__SPARE_7 0x0F5B @@ -10788,13 +10786,13 @@ +#define VL53L1_DSS_CALC__SPARE_6 0x0F5A -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_0 0x0F5C @@ -10804,13 +10802,13 @@ +#define VL53L1_DSS_CALC__SPARE_7 0x0F5B -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_1 0x0F5D @@ -10820,13 +10818,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_0 0x0F5C -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_2 0x0F5E @@ -10836,13 +10834,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_1 0x0F5D -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_3 0x0F5F @@ -10852,13 +10850,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_2 0x0F5E -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_4 0x0F60 @@ -10868,13 +10866,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_3 0x0F5F -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_5 0x0F61 @@ -10884,13 +10882,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_4 0x0F60 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_6 0x0F62 @@ -10900,13 +10898,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_5 0x0F61 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_7 0x0F63 @@ -10916,13 +10914,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_6 0x0F62 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_8 0x0F64 @@ -10932,13 +10930,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_7 0x0F63 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_9 0x0F65 @@ -10948,13 +10946,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_8 0x0F64 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_10 0x0F66 @@ -10964,13 +10962,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_9 0x0F65 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_11 0x0F67 @@ -10980,13 +10978,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_10 0x0F66 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_12 0x0F68 @@ -10996,13 +10994,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_11 0x0F67 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_13 0x0F69 @@ -11012,13 +11010,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_12 0x0F68 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_14 0x0F6A @@ -11028,13 +11026,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_13 0x0F69 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_15 0x0F6B @@ -11044,13 +11042,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_14 0x0F6A -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_16 0x0F6C @@ -11060,13 +11058,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_15 0x0F6B -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_17 0x0F6D @@ -11076,13 +11074,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_16 0x0F6C -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_18 0x0F6E @@ -11092,13 +11090,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_17 0x0F6D -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_19 0x0F6F @@ -11108,13 +11106,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_18 0x0F6E -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_20 0x0F70 @@ -11124,13 +11122,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_19 0x0F6F -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_21 0x0F71 @@ -11140,13 +11138,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_20 0x0F70 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_22 0x0F72 @@ -11156,13 +11154,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_21 0x0F71 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_23 0x0F73 @@ -11172,13 +11170,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_22 0x0F72 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_24 0x0F74 @@ -11188,13 +11186,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_23 0x0F73 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_25 0x0F75 @@ -11204,13 +11202,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_24 0x0F74 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_26 0x0F76 @@ -11220,13 +11218,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_25 0x0F75 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_27 0x0F77 @@ -11236,13 +11234,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_26 0x0F76 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_28 0x0F78 @@ -11252,13 +11250,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_27 0x0F77 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_29 0x0F79 @@ -11268,13 +11266,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_28 0x0F78 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_30 0x0F7A @@ -11284,13 +11282,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_29 0x0F79 -#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_31 0x0F7B @@ -11300,13 +11298,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_30 0x0F7A -#define VL53L1_DSS_CALC__USER_ROI_0 0x0F7C @@ -11316,13 +11314,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_SPAD_EN_31 0x0F7B -#define VL53L1_DSS_CALC__USER_ROI_1 0x0F7D @@ -11332,13 +11330,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_0 0x0F7C -#define VL53L1_DSS_CALC__MODE_ROI_0 0x0F7E @@ -11348,13 +11346,13 @@ +#define VL53L1_DSS_CALC__USER_ROI_1 0x0F7D -#define VL53L1_DSS_CALC__MODE_ROI_1 0x0F7F @@ -11364,13 +11362,13 @@ +#define VL53L1_DSS_CALC__MODE_ROI_0 0x0F7E -#define VL53L1_SIGMA_ESTIMATOR_CALC__SPARE_0 0x0F80 @@ -11380,13 +11378,13 @@ +#define VL53L1_DSS_CALC__MODE_ROI_1 0x0F7F -#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS 0x0F82 @@ -11396,13 +11394,13 @@ +#define VL53L1_SIGMA_ESTIMATOR_CALC__SPARE_0 0x0F80 -#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS_HI 0x0F82 @@ -11410,15 +11408,14 @@ -#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS_LO 0x0F83 +#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS 0x0F82 -#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF 0x0F84 @@ -11429,28 +11426,28 @@ +#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS_HI 0x0F82 -#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_3 0x0F84 +#define VL53L1_VHV_RESULT__PEAK_SIGNAL_RATE_MCPS_LO 0x0F83 -#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_2 0x0F85 +#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF 0x0F84 -#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_1 0x0F86 @@ -11458,18 +11455,18 @@ -#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_0 0x0F87 +#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_3 0x0F84 -#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF 0x0F88 +#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_2 0x0F85 @@ -11477,28 +11474,28 @@ +#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_1 0x0F86 -#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF_HI 0x0F88 +#define VL53L1_VHV_RESULT__SIGNAL_TOTAL_EVENTS_REF_0 0x0F87 -#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF_LO 0x0F89 +#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF 0x0F88 -#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD 0x0F8A @@ -11509,28 +11506,28 @@ +#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF_HI 0x0F88 -#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD_HI 0x0F8A +#define VL53L1_PHASECAL_RESULT__PHASE_OUTPUT_REF_LO 0x0F89 -#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD_LO 0x0F8B +#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD 0x0F8A -#define VL53L1_DSS_RESULT__ENABLED_BLOCKS 0x0F8C @@ -11541,14 +11538,15 @@ +#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD_HI 0x0F8A -#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS 0x0F8E +#define VL53L1_DSS_RESULT__TOTAL_RATE_PER_SPAD_LO 0x0F8B @@ -11556,13 +11554,13 @@ +#define VL53L1_DSS_RESULT__ENABLED_BLOCKS 0x0F8C -#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS_HI 0x0F8E @@ -11570,15 +11568,14 @@ -#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS_LO 0x0F8F +#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS 0x0F8E -#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE 0x0F92 @@ -11589,28 +11586,28 @@ +#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS_HI 0x0F8E -#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE_HI 0x0F92 +#define VL53L1_DSS_RESULT__NUM_REQUESTED_SPADS_LO 0x0F8F -#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE_LO 0x0F93 +#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE 0x0F92 -#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE 0x0F94 @@ -11621,28 +11618,28 @@ +#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE_HI 0x0F92 -#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE_HI 0x0F94 +#define VL53L1_MM_RESULT__INNER_INTERSECTION_RATE_LO 0x0F93 -#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE_LO 0x0F95 +#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE 0x0F94 -#define VL53L1_MM_RESULT__TOTAL_OFFSET 0x0F96 @@ -11653,28 +11650,28 @@ +#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE_HI 0x0F94 -#define VL53L1_MM_RESULT__TOTAL_OFFSET_HI 0x0F96 +#define VL53L1_MM_RESULT__OUTER_COMPLEMENT_RATE_LO 0x0F95 -#define VL53L1_MM_RESULT__TOTAL_OFFSET_LO 0x0F97 +#define VL53L1_MM_RESULT__TOTAL_OFFSET 0x0F96 -#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS 0x0F98 @@ -11685,28 +11682,28 @@ +#define VL53L1_MM_RESULT__TOTAL_OFFSET_HI 0x0F96 -#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_3 0x0F98 +#define VL53L1_MM_RESULT__TOTAL_OFFSET_LO 0x0F97 -#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_2 0x0F99 +#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS 0x0F98 -#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_1 0x0F9A @@ -11714,18 +11711,18 @@ -#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_0 0x0F9B +#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_3 0x0F98 -#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS 0x0F9C +#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_2 0x0F99 @@ -11733,28 +11730,28 @@ +#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_1 0x0F9A -#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_3 0x0F9C +#define VL53L1_XTALK_CALC__XTALK_FOR_ENABLED_SPADS_0 0x0F9B -#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_2 0x0F9D +#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS 0x0F9C -#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_1 0x0F9E @@ -11762,19 +11759,19 @@ -#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_0 0x0F9F +#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_3 0x0F9C -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS 0x0FA0 +#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_2 0x0F9D @@ -11782,27 +11779,27 @@ +#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_1 0x0F9E -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_3 0x0FA0 +#define VL53L1_XTALK_RESULT__AVG_XTALK_USER_ROI_KCPS_0 0x0F9F -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_2 0x0FA1 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS 0x0FA0 -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_1 0x0FA2 @@ -11810,20 +11807,20 @@ -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_0 0x0FA3 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_3 0x0FA0 -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS 0x0FA4 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_2 0x0FA1 @@ -11831,26 +11828,26 @@ +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_1 0x0FA2 -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_3 0x0FA4 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_INNER_ROI_KCPS_0 0x0FA3 -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_2 0x0FA5 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS 0x0FA4 -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_1 0x0FA6 @@ -11858,21 +11855,21 @@ -#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_0 0x0FA7 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_3 0x0FA4 -#define VL53L1_RANGE_RESULT__ACCUM_PHASE 0x0FA8 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_2 0x0FA5 @@ -11880,25 +11877,25 @@ +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_1 0x0FA6 -#define VL53L1_RANGE_RESULT__ACCUM_PHASE_3 0x0FA8 +#define VL53L1_XTALK_RESULT__AVG_XTALK_MM_OUTER_ROI_KCPS_0 0x0FA7 -#define VL53L1_RANGE_RESULT__ACCUM_PHASE_2 0x0FA9 +#define VL53L1_RANGE_RESULT__ACCUM_PHASE 0x0FA8 -#define VL53L1_RANGE_RESULT__ACCUM_PHASE_1 0x0FAA @@ -11906,21 +11903,21 @@ -#define VL53L1_RANGE_RESULT__ACCUM_PHASE_0 0x0FAB +#define VL53L1_RANGE_RESULT__ACCUM_PHASE_3 0x0FA8 -#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE 0x0FAC +#define VL53L1_RANGE_RESULT__ACCUM_PHASE_2 0x0FA9 @@ -11928,25 +11925,25 @@ +#define VL53L1_RANGE_RESULT__ACCUM_PHASE_1 0x0FAA -#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE_HI 0x0FAC +#define VL53L1_RANGE_RESULT__ACCUM_PHASE_0 0x0FAB -#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE_LO 0x0FAD +#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE 0x0FAC -#define VL53L1_SHADOW_PHASECAL_RESULT__VCSEL_START 0x0FAE @@ -11960,14 +11957,15 @@ +#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE_HI 0x0FAC -#define VL53L1_SHADOW_RESULT__INTERRUPT_STATUS 0x0FB0 +#define VL53L1_RANGE_RESULT__OFFSET_CORRECTED_RANGE_LO 0x0FAD @@ -11975,12 +11973,12 @@ +#define VL53L1_SHADOW_PHASECAL_RESULT__VCSEL_START 0x0FAE -#define VL53L1_SHADOW_RESULT__RANGE_STATUS 0x0FB1 @@ -11991,6 +11989,7 @@ +#define VL53L1_SHADOW_RESULT__INTERRUPT_STATUS 0x0FB0 @@ -11999,7 +11998,6 @@ -#define VL53L1_SHADOW_RESULT__REPORT_STATUS 0x0FB2 @@ -12009,13 +12007,13 @@ +#define VL53L1_SHADOW_RESULT__RANGE_STATUS 0x0FB1 -#define VL53L1_SHADOW_RESULT__STREAM_COUNT 0x0FB3 @@ -12028,10 +12026,10 @@ +#define VL53L1_SHADOW_RESULT__REPORT_STATUS 0x0FB2 -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FB4 @@ -12044,10 +12042,10 @@ +#define VL53L1_SHADOW_RESULT__STREAM_COUNT 0x0FB3 -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FB4 @@ -12055,15 +12053,14 @@ -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FB5 +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FB4 -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x0FB6 @@ -12078,24 +12075,24 @@ +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FB4 -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0FB6 +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FB5 -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0FB7 +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0 0x0FB6 -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0FB8 @@ -12111,7 +12108,7 @@ -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0FB8 +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0FB6 @@ -12119,7 +12116,7 @@ -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0FB9 +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0FB7 @@ -12127,7 +12124,7 @@ -#define VL53L1_SHADOW_RESULT__SIGMA_SD0 0x0FBA +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0 0x0FB8 @@ -12143,24 +12140,24 @@ -#define VL53L1_SHADOW_RESULT__SIGMA_SD0_HI 0x0FBA +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_HI 0x0FB8 -#define VL53L1_SHADOW_RESULT__SIGMA_SD0_LO 0x0FBB +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD0_LO 0x0FB9 -#define VL53L1_SHADOW_RESULT__PHASE_SD0 0x0FBC +#define VL53L1_SHADOW_RESULT__SIGMA_SD0 0x0FBA @@ -12175,24 +12172,24 @@ -#define VL53L1_SHADOW_RESULT__PHASE_SD0_HI 0x0FBC +#define VL53L1_SHADOW_RESULT__SIGMA_SD0_HI 0x0FBA -#define VL53L1_SHADOW_RESULT__PHASE_SD0_LO 0x0FBD +#define VL53L1_SHADOW_RESULT__SIGMA_SD0_LO 0x0FBB -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0FBE +#define VL53L1_SHADOW_RESULT__PHASE_SD0 0x0FBC @@ -12207,24 +12204,24 @@ -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0FBE +#define VL53L1_SHADOW_RESULT__PHASE_SD0_HI 0x0FBC -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0FBF +#define VL53L1_SHADOW_RESULT__PHASE_SD0_LO 0x0FBD -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0FC0 +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0 0x0FBE @@ -12239,24 +12236,24 @@ -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0FC0 +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_HI 0x0FBE -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0FC1 +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD0_LO 0x0FBF -#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FC2 +#define VL53L1_SHPEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0 0x0FC0 @@ -12271,25 +12268,25 @@ -#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FC2 +#define VL53L1_SHPEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_HI 0x0FC0 -#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FC3 +#define VL53L1_SHPEAK_SIGNAL_COUNT_RATE_CROSSTALK_CORRECTED_MCPS_SD0_LO 0x0FC1 -#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FC4 +#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FC2 @@ -12303,26 +12300,26 @@ -#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FC4 +#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FC2 -#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FC5 +#define VL53L1_SHADOW_RESULT__MM_INNER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FC3 -#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x0FC6 +#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0 0x0FC4 @@ -12335,27 +12332,27 @@ -#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0FC6 +#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_HI 0x0FC4 -#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0FC7 +#define VL53L1_SHADOW_RESULT__MM_OUTER_ACTUAL_EFFECTIVE_SPADS_SD0_LO 0x0FC5 -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x0FC8 +#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0 0x0FC6 @@ -12367,28 +12364,28 @@ -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x0FC8 +#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_HI 0x0FC6 -#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x0FC9 +#define VL53L1_SHADOW_RESULT__AVG_SIGNAL_COUNT_RATE_MCPS_SD0_LO 0x0FC7 -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x0FCA +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1 0x0FC8 @@ -12399,29 +12396,29 @@ -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x0FCA +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_HI 0x0FC8 -#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x0FCB +#define VL53L1_SHADOW_RESULT__DSS_ACTUAL_EFFECTIVE_SPADS_SD1_LO 0x0FC9 -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x0FCC +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1 0x0FCA @@ -12431,7 +12428,6 @@ -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x0FCC @@ -12439,7 +12435,7 @@ -#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x0FCD +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_HI 0x0FCA @@ -12447,7 +12443,7 @@ -#define VL53L1_SHADOW_RESULT__SIGMA_SD1 0x0FCE +#define VL53L1_SHADOW_RESULT__PEAK_SIGNAL_COUNT_RATE_MCPS_SD1_LO 0x0FCB @@ -12455,6 +12451,7 @@ +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1 0x0FCC @@ -12463,7 +12460,6 @@ -#define VL53L1_SHADOW_RESULT__SIGMA_SD1_HI 0x0FCE @@ -12471,16 +12467,16 @@ -#define VL53L1_SHADOW_RESULT__SIGMA_SD1_LO 0x0FCF +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_HI 0x0FCC -#define VL53L1_SHADOW_RESULT__PHASE_SD1 0x0FD0 +#define VL53L1_SHADOW_RESULT__AMBIENT_COUNT_RATE_MCPS_SD1_LO 0x0FCD @@ -12488,6 +12484,7 @@ +#define VL53L1_SHADOW_RESULT__SIGMA_SD1 0x0FCE @@ -12495,7 +12492,6 @@ -#define VL53L1_SHADOW_RESULT__PHASE_SD1_HI 0x0FD0 @@ -12503,16 +12499,16 @@ -#define VL53L1_SHADOW_RESULT__PHASE_SD1_LO 0x0FD1 +#define VL53L1_SHADOW_RESULT__SIGMA_SD1_HI 0x0FCE -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x0FD2 +#define VL53L1_SHADOW_RESULT__SIGMA_SD1_LO 0x0FCF @@ -12520,6 +12516,7 @@ +#define VL53L1_SHADOW_RESULT__PHASE_SD1 0x0FD0 @@ -12527,7 +12524,6 @@ -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x0FD2 @@ -12535,16 +12531,16 @@ -#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x0FD3 +#define VL53L1_SHADOW_RESULT__PHASE_SD1_HI 0x0FD0 -#define VL53L1_SHADOW_RESULT__SPARE_0_SD1 0x0FD4 +#define VL53L1_SHADOW_RESULT__PHASE_SD1_LO 0x0FD1 @@ -12552,6 +12548,7 @@ +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1 0x0FD2 @@ -12559,7 +12556,6 @@ -#define VL53L1_SHADOW_RESULT__SPARE_0_SD1_HI 0x0FD4 @@ -12567,16 +12563,16 @@ -#define VL53L1_SHADOW_RESULT__SPARE_0_SD1_LO 0x0FD5 +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_HI 0x0FD2 -#define VL53L1_SHADOW_RESULT__SPARE_1_SD1 0x0FD6 +#define VL53L1_SHADOW_RESULT__FINAL_CROSSTALK_CORRECTED_RANGE_MM_SD1_LO 0x0FD3 @@ -12584,6 +12580,7 @@ +#define VL53L1_SHADOW_RESULT__SPARE_0_SD1 0x0FD4 @@ -12591,7 +12588,6 @@ -#define VL53L1_SHADOW_RESULT__SPARE_1_SD1_HI 0x0FD6 @@ -12599,16 +12595,16 @@ -#define VL53L1_SHADOW_RESULT__SPARE_1_SD1_LO 0x0FD7 +#define VL53L1_SHADOW_RESULT__SPARE_0_SD1_HI 0x0FD4 -#define VL53L1_SHADOW_RESULT__SPARE_2_SD1 0x0FD8 +#define VL53L1_SHADOW_RESULT__SPARE_0_SD1_LO 0x0FD5 @@ -12616,6 +12612,7 @@ +#define VL53L1_SHADOW_RESULT__SPARE_1_SD1 0x0FD6 @@ -12623,7 +12620,6 @@ -#define VL53L1_SHADOW_RESULT__SPARE_2_SD1_HI 0x0FD8 @@ -12631,16 +12627,16 @@ -#define VL53L1_SHADOW_RESULT__SPARE_2_SD1_LO 0x0FD9 +#define VL53L1_SHADOW_RESULT__SPARE_1_SD1_HI 0x0FD6 -#define VL53L1_SHADOW_RESULT__SPARE_3_SD1 0x0FDA +#define VL53L1_SHADOW_RESULT__SPARE_1_SD1_LO 0x0FD7 @@ -12648,6 +12644,7 @@ +#define VL53L1_SHADOW_RESULT__SPARE_2_SD1 0x0FD8 @@ -12655,7 +12652,6 @@ -#define VL53L1_SHADOW_RESULT__THRESH_INFO 0x0FDB @@ -12664,6 +12660,7 @@ +#define VL53L1_SHADOW_RESULT__SPARE_2_SD1_HI 0x0FD8 @@ -12671,14 +12668,15 @@ +#define VL53L1_SHADOW_RESULT__SPARE_2_SD1_LO 0x0FD9 -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x0FDC +#define VL53L1_SHADOW_RESULT__SPARE_3_SD1 0x0FDA @@ -12688,15 +12686,14 @@ -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x0FDC +#define VL53L1_SHADOW_RESULT__THRESH_INFO 0x0FDB -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x0FDD @@ -12704,7 +12701,6 @@ -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x0FDE @@ -12712,15 +12708,14 @@ -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x0FDF +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 0x0FDC -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x0FE0 @@ -12730,45 +12725,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_3 0x0FDC -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x0FE0 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_2 0x0FDD -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x0FE1 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_1 0x0FDE -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x0FE2 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0_0 0x0FDF -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x0FE3 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0 0x0FE0 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x0FE4 @@ -12778,45 +12773,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_3 0x0FE0 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x0FE4 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_2 0x0FE1 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x0FE5 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_1 0x0FE2 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x0FE6 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD0_0 0x0FE3 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x0FE7 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0 0x0FE4 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x0FE8 @@ -12826,45 +12821,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_3 0x0FE4 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x0FE8 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_2 0x0FE5 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x0FE9 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_1 0x0FE6 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x0FEA +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD0_0 0x0FE7 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x0FEB +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0 0x0FE8 -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x0FEC @@ -12874,45 +12869,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_3 0x0FE8 -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x0FEC +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_2 0x0FE9 -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x0FED +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_1 0x0FEA -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x0FEE +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD0_0 0x0FEB -#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x0FEF +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1 0x0FEC -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x0FF0 @@ -12922,45 +12917,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_3 0x0FEC -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x0FF0 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_2 0x0FED -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x0FF1 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_1 0x0FEE -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x0FF2 +#define VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD1_0 0x0FEF -#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x0FF3 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1 0x0FF0 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x0FF4 @@ -12970,45 +12965,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_3 0x0FF0 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x0FF4 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_2 0x0FF1 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x0FF5 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_1 0x0FF2 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x0FF6 +#define VL53L1_SHADOW_RESULT_CORE__RANGING_TOTAL_EVENTS_SD1_0 0x0FF3 -#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x0FF7 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1 0x0FF4 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x0FF8 @@ -13018,45 +13013,45 @@ +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_3 0x0FF4 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x0FF8 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_2 0x0FF5 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x0FF9 +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_1 0x0FF6 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x0FFA +#define VL53L1_SHADOW_RESULT_CORE__SIGNAL_TOTAL_EVENTS_SD1_0 0x0FF7 -#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x0FFB +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1 0x0FF8 -#define VL53L1_SHADOW_RESULT_CORE__SPARE_0 0x0FFC @@ -13066,14 +13061,15 @@ +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_3 0x0FF8 -#define VL53L1_SHADOW_PHASECAL_RESULT__REFERENCE_PHASE_HI 0x0FFE +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_2 0x0FF9 @@ -13081,6 +13077,7 @@ +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_1 0x0FFA @@ -13088,7 +13085,47 @@ -#define VL53L1_SHADOW_PHASECAL_RESULT__REFERENCE_PHASE_LO 0x0FFF +#define VL53L1_SHADOW_RESULT_CORE__TOTAL_PERIODS_ELAPSED_SD1_0 0x0FFB + + + + + + + +#define VL53L1_SHADOW_RESULT_CORE__SPARE_0 0x0FFC + + + + + + + + + + + + + + + +#define VL53L1_SHADOW_PHASECAL_RESULT__REFERENCE_PHASE_HI 0x0FFE + + + + + + + + + + + + + + + +#define VL53L1_SHADOW_PHASECAL_RESULT__REFERENCE_PHASE_LO 0x0FFF diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_register_settings.h b/drivers/input/misc/vl53L1/inc/vl53l1_register_settings.h index a5029421d4bc..767367f08217 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_register_settings.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_register_settings.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_register_structs.h b/drivers/input/misc/vl53L1/inc/vl53l1_register_structs.h index d5ba026eb951..c5d70adf68f2 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_register_structs.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_register_structs.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -105,27 +105,48 @@ #include "vl53l1_types.h" #include "vl53l1_register_map.h" -#define VL53L1_STATIC_NVM_MANAGED_I2C_INDEX VL53L1_I2C_SLAVE__DEVICE_ADDRESS -#define VL53L1_CUSTOMER_NVM_MANAGED_I2C_INDEX VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_0 -#define VL53L1_STATIC_CONFIG_I2C_INDEX VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS -#define VL53L1_GENERAL_CONFIG_I2C_INDEX VL53L1_GPH_CONFIG__STREAM_COUNT_UPDATE_VALUE -#define VL53L1_TIMING_CONFIG_I2C_INDEX VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_HI -#define VL53L1_DYNAMIC_CONFIG_I2C_INDEX VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_0 -#define VL53L1_SYSTEM_CONTROL_I2C_INDEX VL53L1_POWER_MANAGEMENT__GO1_POWER_FORCE -#define VL53L1_SYSTEM_RESULTS_I2C_INDEX VL53L1_RESULT__INTERRUPT_STATUS -#define VL53L1_CORE_RESULTS_I2C_INDEX VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 -#define VL53L1_DEBUG_RESULTS_I2C_INDEX VL53L1_PHASECAL_RESULT__REFERENCE_PHASE -#define VL53L1_NVM_COPY_DATA_I2C_INDEX VL53L1_IDENTIFICATION__MODEL_ID -#define VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_INDEX VL53L1_PREV_SHADOW_RESULT__INTERRUPT_STATUS -#define VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_INDEX VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 -#define VL53L1_PATCH_DEBUG_I2C_INDEX VL53L1_RESULT__DEBUG_STATUS -#define VL53L1_GPH_GENERAL_CONFIG_I2C_INDEX VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH -#define VL53L1_GPH_STATIC_CONFIG_I2C_INDEX VL53L1_GPH__DSS_CONFIG__ROI_MODE_CONTROL -#define VL53L1_GPH_TIMING_CONFIG_I2C_INDEX VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_HI -#define VL53L1_FW_INTERNAL_I2C_INDEX VL53L1_FIRMWARE__INTERNAL_STREAM_COUNT_DIV -#define VL53L1_PATCH_RESULTS_I2C_INDEX VL53L1_DSS_CALC__ROI_CTRL -#define VL53L1_SHADOW_SYSTEM_RESULTS_I2C_INDEX VL53L1_SHADOW_PHASECAL_RESULT__VCSEL_START -#define VL53L1_SHADOW_CORE_RESULTS_I2C_INDEX VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 +#define VL53L1_STATIC_NVM_MANAGED_I2C_INDEX \ + VL53L1_I2C_SLAVE__DEVICE_ADDRESS +#define VL53L1_CUSTOMER_NVM_MANAGED_I2C_INDEX \ + VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_0 +#define VL53L1_STATIC_CONFIG_I2C_INDEX \ + VL53L1_DSS_CONFIG__TARGET_TOTAL_RATE_MCPS +#define VL53L1_GENERAL_CONFIG_I2C_INDEX \ + VL53L1_GPH_CONFIG__STREAM_COUNT_UPDATE_VALUE +#define VL53L1_TIMING_CONFIG_I2C_INDEX \ + VL53L1_MM_CONFIG__TIMEOUT_MACROP_A_HI +#define VL53L1_DYNAMIC_CONFIG_I2C_INDEX \ + VL53L1_SYSTEM__GROUPED_PARAMETER_HOLD_0 +#define VL53L1_SYSTEM_CONTROL_I2C_INDEX \ + VL53L1_POWER_MANAGEMENT__GO1_POWER_FORCE +#define VL53L1_SYSTEM_RESULTS_I2C_INDEX \ + VL53L1_RESULT__INTERRUPT_STATUS +#define VL53L1_CORE_RESULTS_I2C_INDEX \ + VL53L1_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 +#define VL53L1_DEBUG_RESULTS_I2C_INDEX \ + VL53L1_PHASECAL_RESULT__REFERENCE_PHASE +#define VL53L1_NVM_COPY_DATA_I2C_INDEX \ + VL53L1_IDENTIFICATION__MODEL_ID +#define VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_INDEX \ + VL53L1_PREV_SHADOW_RESULT__INTERRUPT_STATUS +#define VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_INDEX \ + VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 +#define VL53L1_PATCH_DEBUG_I2C_INDEX \ + VL53L1_RESULT__DEBUG_STATUS +#define VL53L1_GPH_GENERAL_CONFIG_I2C_INDEX \ + VL53L1_GPH__SYSTEM__THRESH_RATE_HIGH +#define VL53L1_GPH_STATIC_CONFIG_I2C_INDEX \ + VL53L1_GPH__DSS_CONFIG__ROI_MODE_CONTROL +#define VL53L1_GPH_TIMING_CONFIG_I2C_INDEX \ + VL53L1_GPH__MM_CONFIG__TIMEOUT_MACROP_A_HI +#define VL53L1_FW_INTERNAL_I2C_INDEX \ + VL53L1_FIRMWARE__INTERNAL_STREAM_COUNT_DIV +#define VL53L1_PATCH_RESULTS_I2C_INDEX \ + VL53L1_DSS_CALC__ROI_CTRL +#define VL53L1_SHADOW_SYSTEM_RESULTS_I2C_INDEX \ + VL53L1_SHADOW_PHASECAL_RESULT__VCSEL_START +#define VL53L1_SHADOW_CORE_RESULTS_I2C_INDEX \ + VL53L1_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0 #define VL53L1_STATIC_NVM_MANAGED_I2C_SIZE_BYTES 11 #define VL53L1_CUSTOMER_NVM_MANAGED_I2C_SIZE_BYTES 23 @@ -3096,7 +3117,8 @@ typedef struct { - uint16_t prev_shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; + uint16_t + psr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; @@ -4540,7 +4562,8 @@ typedef struct { - uint16_t shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; + uint16_t + shr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_silicon_core.h b/drivers/input/misc/vl53L1/inc/vl53l1_silicon_core.h index d77267a99dae..f9eea814d65f 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_silicon_core.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_silicon_core.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_tuning_parm_defaults.h b/drivers/input/misc/vl53L1/inc/vl53l1_tuning_parm_defaults.h index 1984174e91c8..119d67e0b17e 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_tuning_parm_defaults.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_tuning_parm_defaults.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -150,13 +150,13 @@ extern "C" { #define VL53L1_TUNINGPARM_HIST_SIGMA_THRESH_MM_DEFAULT \ ((uint16_t) 160) #define VL53L1_TUNINGPARM_HIST_GAIN_FACTOR_DEFAULT \ -((uint16_t) 1997) +((uint16_t) 1987) #define VL53L1_TUNINGPARM_CONSISTENCY_HIST_PHASE_TOLERANCE_DEFAULT \ ((uint8_t) 8) #define VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM_DEFAULT \ ((uint16_t) 250) #define VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_DEFAULT \ -((uint8_t) 240) +((uint8_t) 0) #define VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_MIN_SPAD_LIMIT_DEFAULT \ ((uint16_t) 2048) #define VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_LONG_RANGE_DEFAULT \ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_wait.h b/drivers/input/misc/vl53L1/inc/vl53l1_wait.h index 424cc44166f0..eb19e3b9bcb4 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_wait.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_wait.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/inc/vl53l1_zone_presets.h b/drivers/input/misc/vl53L1/inc/vl53l1_zone_presets.h index 114c5d575399..34f3652f0a95 100644 --- a/drivers/input/misc/vl53L1/inc/vl53l1_zone_presets.h +++ b/drivers/input/misc/vl53L1/inc/vl53l1_zone_presets.h @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/ipp/ipp_linux.c b/drivers/input/misc/vl53L1/ipp/ipp_linux.c index 94d69c8762b7..12c63f0bce1b 100644 --- a/drivers/input/misc/vl53L1/ipp/ipp_linux.c +++ b/drivers/input/misc/vl53L1/ipp/ipp_linux.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 ipp_linux.c kernel side implementation of vl53l1 protected processing @@ -53,7 +53,7 @@ static int stmvl53l1_ipp_do_wrapper(struct stmvl53l1_data *data, rc = IPP_ERR_CODE; goto done; } - BUG_ON(pin->payload > IPP_WORK_MAX_PAYLOAD); + WARN_ON(pin->payload > IPP_WORK_MAX_PAYLOAD); stmvl531_ipp_tim_start(data); rc = stmvl53l1_ipp_do(data, pin, pout); if (rc != 0) { @@ -71,7 +71,7 @@ static int stmvl53l1_ipp_do_wrapper(struct stmvl53l1_data *data, rc = IPP_ERR_CODE; goto done; } - BUG_ON(pout->payload > IPP_WORK_MAX_PAYLOAD); + WARN_ON(pout->payload > IPP_WORK_MAX_PAYLOAD); if (pout->payload != payload_out) { /* bad formated answer */ vl53l1_errmsg("bad payload %d != %d in ipp work back", diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api.c b/drivers/input/misc/vl53L1/src/vl53l1_api.c index 992acca46d38..dcb1e10025a3 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -121,7 +121,6 @@ - #include "vl53l1_api.h" @@ -136,10 +135,11 @@ #include "vl53l1_api_core.h" #include "vl53l1_nvm.h" -#if defined(SMALL_FOOTPRINT) -#elif VL53L1_MAX_USER_ZONES < 5 +#define ZONE_CHECK VL53L1_MAX_USER_ZONES + +#if ZONE_CHECK < 5 #error Must define at least 5 zones in MAX_USER_ZONES constant #endif @@ -176,21 +176,6 @@ #define LOWPOWER_AUTO_OVERHEAD_BEFORE_A_RANGING 1448 #define LOWPOWER_AUTO_OVERHEAD_BETWEEN_A_B_RANGING 2100 -#define TUNING_PROXY_MIN -30 - -#define TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM 600 - - -#define TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER 50 - - -#define TUNING_MIN_AMBIENT_DMAX_VALID 8 - - -#define TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_RANGES 50 - - - #define FDA_MAX_TIMING_BUDGET_US 550000 @@ -207,16 +192,19 @@ static int32_t BDTable[VL53L1_TUNING_MAX_TUNABLE_KEY] = { TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM, TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER, TUNING_MIN_AMBIENT_DMAX_VALID, - TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_RANGES + TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER, + TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM, + TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT }; + static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) { VL53L1_Error Status = VL53L1_ERROR_NONE; - uint16_t sum_ranging = 0; - uint16_t sum_spads = 0; + uint32_t sum_ranging = 0; + uint32_t sum_spads = 0; FixPoint1616_t sum_signalRate = 0; FixPoint1616_t total_count = 0; uint8_t xtalk_meas = 0; @@ -243,7 +231,7 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); if ((PresetMode != VL53L1_PRESETMODE_AUTONOMOUS) && (PresetMode != VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS) && @@ -255,10 +243,20 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) Status = VL53L1_disable_xtalk_compensation(Dev); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; Status = VL53L1_StartMeasurement(Dev); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; + + + + VL53L1_WaitMeasurementDataReady(Dev); + VL53L1_GetRangingMeasurementData(Dev, &RMData); + VL53L1_ClearInterruptAndStartMeasurement(Dev); sum_ranging = 0; sum_spads = 0; @@ -281,10 +279,10 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) xTalkStoredMeanSignalRate = sum_signalRate / total_count; - xTalkStoredMeanRange = (FixPoint1616_t)((uint32_t)( - sum_ranging << 16) / total_count); - xTalkStoredMeanRtnSpads = (FixPoint1616_t)((uint32_t)( - sum_spads << 16) / total_count); + xTalkStoredMeanRange = (FixPoint1616_t)(sum_ranging << 16); + xTalkStoredMeanRange /= total_count; + xTalkStoredMeanRtnSpads = (FixPoint1616_t)(sum_spads << 16); + xTalkStoredMeanRtnSpads /= total_count; @@ -319,17 +317,6 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) - - - - - - - - - - - signalXTalkTotalPerSpad = (xTalkStoredMeanSignalRate) / xTalkStoredMeanRtnSpadsAsInt; @@ -339,7 +326,7 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) - signalXTalkTotalPerSpad *= ((1 << 16) - + signalXTalkTotalPerSpad *= (((uint32_t)1 << 16) - (xTalkStoredMeanRange / xTalkCalDistanceAsInt)); @@ -350,16 +337,20 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) Status = VL53L1_GetCalibrationData(Dev, &CalibrationData); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; pC = &CalibrationData.customer; pC->algo__crosstalk_compensation_plane_offset_kcps = (uint32_t)(1000 * ((XTalkCompensationRateMegaCps + - (1<<6)) >> (16-9))); + ((uint32_t)1<<6)) >> (16-9))); Status = VL53L1_SetCalibrationData(Dev, &CalibrationData); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; Status = VL53L1_enable_xtalk_compensation(Dev); @@ -526,6 +517,12 @@ VL53L1_Error VL53L1_GetDeviceInfo(VL53L1_DEV Dev, strncpy(pVL53L1_DeviceInfo->Type, VL53L1_STRING_DEVICE_INFO_TYPE, VL53L1_DEVINFO_STRLEN-1); + + + if (pVL53L1_DeviceInfo->ProductType == 0xAA) { + pVL53L1_DeviceInfo->Name[5] = '3'; + pVL53L1_DeviceInfo->Type[5] = '3'; + } #else pVL53L1_DeviceInfo->Name[0] = 0; pVL53L1_DeviceInfo->Type[0] = 0; @@ -582,7 +579,7 @@ VL53L1_Error VL53L1_GetPalState(VL53L1_DEV Dev, VL53L1_State *pPalState) LOG_FUNCTION_START(""); - *pPalState = PALDevDataGet(Dev, PalState); + *pPalState = VL53L1DevDataGet(Dev, PalState); LOG_FUNCTION_END(Status); return Status; @@ -600,7 +597,7 @@ VL53L1_Error VL53L1_SetDeviceAddress(VL53L1_DEV Dev, uint8_t DeviceAddress) LOG_FUNCTION_START(""); Status = VL53L1_WrByte(Dev, VL53L1_I2C_SLAVE__DEVICE_ADDRESS, - DeviceAddress); + DeviceAddress / 2); LOG_FUNCTION_END(Status); return Status; @@ -628,8 +625,8 @@ VL53L1_Error VL53L1_DataInit(VL53L1_DEV Dev) Status = VL53L1_data_init(Dev, 1); if (Status == VL53L1_ERROR_NONE) { - PALDevDataSet(Dev, PalState, VL53L1_STATE_WAIT_STATICINIT); - PALDevDataSet(Dev, CurrentParameters.PresetMode, + VL53L1DevDataSet(Dev, PalState, VL53L1_STATE_WAIT_STATICINIT); + VL53L1DevDataSet(Dev, CurrentParameters.PresetMode, VL53L1_PRESETMODE_RANGING); } @@ -658,6 +655,16 @@ VL53L1_Error VL53L1_DataInit(VL53L1_DEV Dev) } + + + + if (Status == VL53L1_ERROR_NONE) { + Status = VL53L1_set_dmax_mode(Dev, + VL53L1_DEVICEDMAXMODE__CUST_CAL_DATA); + } + + + LOG_FUNCTION_END(Status); return Status; } @@ -670,22 +677,15 @@ VL53L1_Error VL53L1_StaticInit(VL53L1_DEV Dev) LOG_FUNCTION_START(""); - if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, PalState, VL53L1_STATE_IDLE); + VL53L1DevDataSet(Dev, PalState, VL53L1_STATE_IDLE); measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; - PALDevDataSet(Dev, LLData.measurement_mode, measurement_mode); + VL53L1DevDataSet(Dev, LLData.measurement_mode, measurement_mode); - PALDevDataSet(Dev, CurrentParameters.NewDistanceMode, + VL53L1DevDataSet(Dev, CurrentParameters.DistanceMode, VL53L1_DISTANCEMODE_LONG); - PALDevDataSet(Dev, CurrentParameters.InternalDistanceMode, - VL53L1_DISTANCEMODE_LONG); - - PALDevDataSet(Dev, CurrentParameters.DistanceMode, - VL53L1_DISTANCEMODE_LONG); - - PALDevDataSet(Dev, CurrentParameters.OutputMode, + VL53L1DevDataSet(Dev, CurrentParameters.OutputMode, VL53L1_OUTPUTMODE_NEAREST); LOG_FUNCTION_END(Status); return Status; @@ -836,12 +836,13 @@ static VL53L1_Error SetPresetMode(VL53L1_DEV Dev, inter_measurement_period_ms); if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, LLData.measurement_mode, measurement_mode); + VL53L1DevDataSet(Dev, LLData.measurement_mode, + measurement_mode); if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, CurrentParameters.PresetMode, PresetMode); + VL53L1DevDataSet(Dev, CurrentParameters.PresetMode, PresetMode); - PALDevDataSet(Dev, CurrentParameters.OutputMode, + VL53L1DevDataSet(Dev, CurrentParameters.OutputMode, VL53L1_OUTPUTMODE_NEAREST); LOG_FUNCTION_END(Status); return Status; @@ -854,6 +855,10 @@ VL53L1_Error VL53L1_SetPresetMode(VL53L1_DEV Dev, VL53L1_PresetModes PresetMode) LOG_FUNCTION_START("%d", (int)PresetMode); + + + Status = VL53L1_low_power_auto_data_init(Dev); + if (PresetMode == VL53L1_PRESETMODE_PROXY_RANGING_MODE) DistanceMode = VL53L1_DISTANCEMODE_SHORT; Status = SetPresetMode(Dev, @@ -862,12 +867,6 @@ VL53L1_Error VL53L1_SetPresetMode(VL53L1_DEV Dev, VL53L1_PresetModes PresetMode) 1000); if (Status == VL53L1_ERROR_NONE) { - PALDevDataSet(Dev, CurrentParameters.InternalDistanceMode, - DistanceMode); - - PALDevDataSet(Dev, CurrentParameters.NewDistanceMode, - DistanceMode); - if ((PresetMode == VL53L1_PRESETMODE_LITE_RANGING) || (PresetMode == VL53L1_PRESETMODE_AUTONOMOUS) || (PresetMode == VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS)) @@ -899,7 +898,7 @@ VL53L1_Error VL53L1_GetPresetMode(VL53L1_DEV Dev, LOG_FUNCTION_START(""); - *pPresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + *pPresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); LOG_FUNCTION_END(Status); return Status; @@ -910,7 +909,6 @@ VL53L1_Error VL53L1_SetDistanceMode(VL53L1_DEV Dev, { VL53L1_Error Status = VL53L1_ERROR_NONE; VL53L1_PresetModes PresetMode; - VL53L1_DistanceModes InternalDistanceMode; uint32_t inter_measurement_period_ms; uint32_t TimingBudget; uint32_t MmTimeoutUs; @@ -919,7 +917,7 @@ VL53L1_Error VL53L1_SetDistanceMode(VL53L1_DEV Dev, LOG_FUNCTION_START("%d", (int)DistanceMode); - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); @@ -935,23 +933,10 @@ VL53L1_Error VL53L1_SetDistanceMode(VL53L1_DEV Dev, (DistanceMode != VL53L1_DISTANCEMODE_LONG)) return VL53L1_ERROR_INVALID_PARAMS; - - - - - if (Status == VL53L1_ERROR_NONE) { - if ((DistanceMode == VL53L1_DISTANCEMODE_SHORT) || - (DistanceMode == VL53L1_DISTANCEMODE_MEDIUM)) - InternalDistanceMode = DistanceMode; - else - - InternalDistanceMode = VL53L1_DISTANCEMODE_LONG; - } - if (Status == VL53L1_ERROR_NONE) Status = VL53L1_get_zone_config(Dev, &zone_config); - inter_measurement_period_ms = PALDevDataGet(Dev, + inter_measurement_period_ms = VL53L1DevDataGet(Dev, LLData.inter_measurement_period_ms); if (Status == VL53L1_ERROR_NONE) @@ -961,15 +946,11 @@ VL53L1_Error VL53L1_SetDistanceMode(VL53L1_DEV Dev, if (Status == VL53L1_ERROR_NONE) Status = SetPresetMode(Dev, PresetMode, - InternalDistanceMode, + DistanceMode, inter_measurement_period_ms); if (Status == VL53L1_ERROR_NONE) { - PALDevDataSet(Dev, CurrentParameters.InternalDistanceMode, - InternalDistanceMode); - PALDevDataSet(Dev, CurrentParameters.NewDistanceMode, - InternalDistanceMode); - PALDevDataSet(Dev, CurrentParameters.DistanceMode, + VL53L1DevDataSet(Dev, CurrentParameters.DistanceMode, DistanceMode); } @@ -978,7 +959,7 @@ VL53L1_Error VL53L1_SetDistanceMode(VL53L1_DEV Dev, MmTimeoutUs, TimingBudget); if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, LLData.range_config_timeout_us, + VL53L1DevDataSet(Dev, LLData.range_config_timeout_us, TimingBudget); } @@ -996,7 +977,7 @@ VL53L1_Error VL53L1_GetDistanceMode(VL53L1_DEV Dev, LOG_FUNCTION_START(""); - *pDistanceMode = PALDevDataGet(Dev, CurrentParameters.DistanceMode); + *pDistanceMode = VL53L1DevDataGet(Dev, CurrentParameters.DistanceMode); LOG_FUNCTION_END(Status); return Status; @@ -1013,7 +994,7 @@ VL53L1_Error VL53L1_SetOutputMode(VL53L1_DEV Dev, (OutputMode != VL53L1_OUTPUTMODE_STRONGEST)) Status = VL53L1_ERROR_MODE_NOT_SUPPORTED; else - PALDevDataSet(Dev, CurrentParameters.OutputMode, OutputMode); + VL53L1DevDataSet(Dev, CurrentParameters.OutputMode, OutputMode); LOG_FUNCTION_END(Status); return Status; @@ -1026,7 +1007,7 @@ VL53L1_Error VL53L1_GetOutputMode(VL53L1_DEV Dev, LOG_FUNCTION_START(""); - *pOutputMode = PALDevDataGet(Dev, CurrentParameters.OutputMode); + *pOutputMode = VL53L1DevDataGet(Dev, CurrentParameters.OutputMode); LOG_FUNCTION_END(Status); return Status; @@ -1050,7 +1031,6 @@ VL53L1_Error VL53L1_SetMeasurementTimingBudgetMicroSeconds(VL53L1_DEV Dev, int32_t vhv_loops; uint32_t FDAMaxTimingBudgetUs = FDA_MAX_TIMING_BUDGET_US; - LOG_FUNCTION_START(""); @@ -1075,7 +1055,8 @@ VL53L1_Error VL53L1_SetMeasurementTimingBudgetMicroSeconds(VL53L1_DEV Dev, &TimingBudget); if (Status == VL53L1_ERROR_NONE) { - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, + CurrentParameters.PresetMode); TimingGuard = 0; divisor = 1; @@ -1148,13 +1129,13 @@ VL53L1_Error VL53L1_SetMeasurementTimingBudgetMicroSeconds(VL53L1_DEV Dev, } if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, + VL53L1DevDataSet(Dev, LLData.range_config_timeout_us, TimingBudget); } } if (Status == VL53L1_ERROR_NONE) { - PALDevDataSet(Dev, + VL53L1DevDataSet(Dev, CurrentParameters.MeasurementTimingBudgetMicroSeconds, MeasurementTimingBudgetMicroSeconds); } @@ -1198,7 +1179,8 @@ VL53L1_Error VL53L1_GetMeasurementTimingBudgetMicroSeconds(VL53L1_DEV Dev, &RangeTimeoutUs); if (Status == VL53L1_ERROR_NONE) { - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, + CurrentParameters.PresetMode); switch (PresetMode) { case VL53L1_PRESETMODE_LITE_RANGING: @@ -1260,11 +1242,18 @@ VL53L1_Error VL53L1_SetInterMeasurementPeriodMilliSeconds(VL53L1_DEV Dev, uint32_t InterMeasurementPeriodMilliSeconds) { VL53L1_Error Status = VL53L1_ERROR_NONE; + uint32_t adjustedIMP; LOG_FUNCTION_START(""); + + + adjustedIMP = InterMeasurementPeriodMilliSeconds; + adjustedIMP += (adjustedIMP * 64) / 1000; + + Status = VL53L1_set_inter_measurement_period_ms(Dev, - InterMeasurementPeriodMilliSeconds); + adjustedIMP); LOG_FUNCTION_END(Status); return Status; @@ -1274,11 +1263,17 @@ VL53L1_Error VL53L1_GetInterMeasurementPeriodMilliSeconds(VL53L1_DEV Dev, uint32_t *pInterMeasurementPeriodMilliSeconds) { VL53L1_Error Status = VL53L1_ERROR_NONE; + uint32_t adjustedIMP; LOG_FUNCTION_START(""); - Status = VL53L1_get_inter_measurement_period_ms(Dev, - pInterMeasurementPeriodMilliSeconds); + Status = VL53L1_get_inter_measurement_period_ms(Dev, &adjustedIMP); + + + adjustedIMP -= (adjustedIMP * 64) / 1000; + *pInterMeasurementPeriodMilliSeconds = adjustedIMP; + + LOG_FUNCTION_END(Status); return Status; @@ -1655,7 +1650,7 @@ VL53L1_Error VL53L1_GetMaxNumberOfROI(VL53L1_DEV Dev, LOG_FUNCTION_START(""); - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); @@ -1685,7 +1680,7 @@ VL53L1_Error VL53L1_SetROI(VL53L1_DEV Dev, - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); @@ -1840,7 +1835,7 @@ VL53L1_Error VL53L1_SetSequenceStepEnable(VL53L1_DEV Dev, - MeasurementTimingBudgetMicroSeconds = PALDevDataGet(Dev, + MeasurementTimingBudgetMicroSeconds = VL53L1DevDataGet(Dev, CurrentParameters.MeasurementTimingBudgetMicroSeconds); VL53L1_SetMeasurementTimingBudgetMicroSeconds(Dev, @@ -1881,13 +1876,16 @@ VL53L1_Error VL53L1_GetSequenceStepEnable(VL53L1_DEV Dev, VL53L1_Error VL53L1_StartMeasurement(VL53L1_DEV Dev) { +#define TIMED_MODE_TIMING_GUARD_MILLISECONDS 4 VL53L1_Error Status = VL53L1_ERROR_NONE; uint8_t DeviceMeasurementMode; VL53L1_State CurrPalState; + VL53L1_Error lStatus; + uint32_t MTBus, IMPms; LOG_FUNCTION_START(""); - CurrPalState = PALDevDataGet(Dev, PalState); + CurrPalState = VL53L1DevDataGet(Dev, PalState); switch (CurrPalState) { case VL53L1_STATE_IDLE: Status = VL53L1_ERROR_NONE; @@ -1905,7 +1903,26 @@ VL53L1_Error VL53L1_StartMeasurement(VL53L1_DEV Dev) Status = VL53L1_ERROR_UNDEFINED; } - DeviceMeasurementMode = PALDevDataGet(Dev, LLData.measurement_mode); + DeviceMeasurementMode = VL53L1DevDataGet(Dev, LLData.measurement_mode); + + + + + if ((Status == VL53L1_ERROR_NONE) && + (DeviceMeasurementMode == VL53L1_DEVICEMEASUREMENTMODE_TIMED)) { + lStatus = VL53L1_GetMeasurementTimingBudgetMicroSeconds(Dev, + &MTBus); + + + MTBus /= 1000; + lStatus = VL53L1_GetInterMeasurementPeriodMilliSeconds(Dev, + &IMPms); + + + SUPPRESS_UNUSED_WARNING(lStatus); + if (IMPms < MTBus + TIMED_MODE_TIMING_GUARD_MILLISECONDS) + Status = VL53L1_ERROR_INVALID_PARAMS; + } if (Status == VL53L1_ERROR_NONE) Status = VL53L1_init_and_start_range( @@ -1916,7 +1933,7 @@ VL53L1_Error VL53L1_StartMeasurement(VL53L1_DEV Dev) if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, PalState, VL53L1_STATE_RUNNING); + VL53L1DevDataSet(Dev, PalState, VL53L1_STATE_RUNNING); LOG_FUNCTION_END(Status); @@ -1934,77 +1951,7 @@ VL53L1_Error VL53L1_StopMeasurement(VL53L1_DEV Dev) if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, PalState, VL53L1_STATE_IDLE); - - LOG_FUNCTION_END(Status); - return Status; -} - -static VL53L1_Error ChangePresetMode(VL53L1_DEV Dev) -{ - VL53L1_Error Status = VL53L1_ERROR_NONE; - VL53L1_PresetModes PresetMode; - VL53L1_DistanceModes NewDistanceMode; - VL53L1_zone_config_t zone_config; - uint32_t TimingBudget; - uint32_t MmTimeoutUs; - uint32_t PhaseCalTimeoutUs; - uint8_t DeviceMeasurementMode; - uint32_t inter_measurement_period_ms; - - LOG_FUNCTION_START(""); - - Status = VL53L1_get_zone_config(Dev, &zone_config); - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_get_timeouts_us(Dev, &PhaseCalTimeoutUs, - &MmTimeoutUs, &TimingBudget); - - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_stop_range(Dev); - - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_WaitUs(Dev, 500); - - if (Status == VL53L1_ERROR_NONE) { - PresetMode = PALDevDataGet(Dev, - CurrentParameters.PresetMode); - NewDistanceMode = PALDevDataGet(Dev, - CurrentParameters.NewDistanceMode); - inter_measurement_period_ms = PALDevDataGet(Dev, - LLData.inter_measurement_period_ms); - - Status = SetPresetMode(Dev, - PresetMode, - NewDistanceMode, - inter_measurement_period_ms); - } - - if (Status == VL53L1_ERROR_NONE) { - Status = VL53L1_set_timeouts_us(Dev, PhaseCalTimeoutUs, - MmTimeoutUs, TimingBudget); - - if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, LLData.range_config_timeout_us, - TimingBudget); - } - - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_set_zone_config(Dev, &zone_config); - - if (Status == VL53L1_ERROR_NONE) { - DeviceMeasurementMode = PALDevDataGet(Dev, - LLData.measurement_mode); - - Status = VL53L1_init_and_start_range( - Dev, - DeviceMeasurementMode, - VL53L1_DEVICECONFIGLEVEL_FULL); - } - - if (Status == VL53L1_ERROR_NONE) - PALDevDataSet(Dev, - CurrentParameters.InternalDistanceMode, - NewDistanceMode); + VL53L1DevDataSet(Dev, PalState, VL53L1_STATE_IDLE); LOG_FUNCTION_END(Status); return Status; @@ -2015,23 +1962,13 @@ VL53L1_Error VL53L1_ClearInterruptAndStartMeasurement(VL53L1_DEV Dev) { VL53L1_Error Status = VL53L1_ERROR_NONE; uint8_t DeviceMeasurementMode; - VL53L1_DistanceModes InternalDistanceMode; - VL53L1_DistanceModes NewDistanceMode; LOG_FUNCTION_START(""); - DeviceMeasurementMode = PALDevDataGet(Dev, LLData.measurement_mode); - InternalDistanceMode = PALDevDataGet(Dev, - CurrentParameters.InternalDistanceMode); - NewDistanceMode = PALDevDataGet(Dev, - CurrentParameters.NewDistanceMode); + DeviceMeasurementMode = VL53L1DevDataGet(Dev, LLData.measurement_mode); - if (NewDistanceMode != InternalDistanceMode) - Status = ChangePresetMode(Dev); - else - Status = VL53L1_clear_interrupt_and_enable_next_range( - Dev, - DeviceMeasurementMode); + Status = VL53L1_clear_interrupt_and_enable_next_range(Dev, + DeviceMeasurementMode); LOG_FUNCTION_END(Status); return Status; @@ -2122,7 +2059,7 @@ static void CheckAndChangeDistanceMode(VL53L1_DEV Dev, VL53L1_DistanceModes *pNewDistanceMode ) { - VL53L1_DistanceModes InternalDistanceMode; + VL53L1_DistanceModes DistanceMode; uint8_t RangeStatus = pRangeData->RangeStatus; uint8_t DmaxValid; int32_t MinAmbient = BDTable[VL53L1_TUNING_MIN_AMBIENT_DMAX_VALID]; @@ -2146,22 +2083,22 @@ static void CheckAndChangeDistanceMode(VL53L1_DEV Dev, } DmaxValid = 1; - tmpint32 = pdev->hist_data.VL53L1_PRM_00028; - if (tmpint32 < MinAmbient) + tmpint32 = pdev->hist_data.VL53L1_p_004; + if ((tmpint32 < MinAmbient) || (Ambient100DmaxMm == 0)) DmaxValid = 0; - InternalDistanceMode = PALDevDataGet(Dev, - CurrentParameters.InternalDistanceMode); + DistanceMode = VL53L1DevDataGet(Dev, + CurrentParameters.DistanceMode); - *pNewDistanceMode = InternalDistanceMode; + *pNewDistanceMode = DistanceMode; if (RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) GenNewPresetMode(pRangeData->RangeMilliMeter, - InternalDistanceMode, pNewDistanceMode); + DistanceMode, pNewDistanceMode); else { if (DmaxValid) GenNewPresetMode(Ambient100DmaxMm, - InternalDistanceMode, pNewDistanceMode); + DistanceMode, pNewDistanceMode); else *pNewDistanceMode = VL53L1_DISTANCEMODE_LONG; } @@ -2176,9 +2113,12 @@ static uint8_t ComputeRQL(uint8_t active_results, uint16_t SRAS = 30; FixPoint1616_t RAS; FixPoint1616_t SRQL; - FixPoint1616_t GI = 117.7 * 65536; - FixPoint1616_t GGm = 48.8 * 65536; - FixPoint1616_t LRAP = 0.1 * 65536; + FixPoint1616_t GI = 7713587; + + FixPoint1616_t GGm = 3198157; + + FixPoint1616_t LRAP = 6554; + FixPoint1616_t partial; uint8_t finalvalue; uint8_t returnvalue; @@ -2198,7 +2138,7 @@ static uint8_t ComputeRQL(uint8_t active_results, if (RAS != 0) { - partial = (GGm * presults_data->VL53L1_PRM_00003); + partial = (GGm * presults_data->VL53L1_p_005); partial = partial + (RAS >> 1); partial = partial / RAS; partial = partial * 65536; @@ -2329,10 +2269,10 @@ static VL53L1_Error SetSimpleData(VL53L1_DEV Dev, pRangeData->AmbientRateRtnMegaCps = AmbientRate; pRangeData->EffectiveSpadRtnCount = - presults_data->VL53L1_PRM_00004; + presults_data->VL53L1_p_006; TempFix1616 = VL53L1_FIXPOINT97TOFIXPOINT1616( - presults_data->VL53L1_PRM_00003); + presults_data->VL53L1_p_005); pRangeData->SigmaMilliMeter = TempFix1616; @@ -2359,7 +2299,8 @@ static VL53L1_Error SetSimpleData(VL53L1_DEV Dev, if (pRangeData->RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) { - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, + CurrentParameters.PresetMode); if ((PresetMode == VL53L1_PRESETMODE_MULTIZONES_SCANNING) || (PresetMode == VL53L1_PRESETMODE_RANGING) || (PresetMode == VL53L1_PRESETMODE_PROXY_RANGING_MODE)) @@ -2373,7 +2314,7 @@ static VL53L1_Error SetSimpleData(VL53L1_DEV Dev, TempFix1616 = VL53L1_FIXPOINT97TOFIXPOINT1616( - presults_data->VL53L1_PRM_00003); + presults_data->VL53L1_p_005); VL53L1_SETARRAYPARAMETERFIELD(Dev, LimitChecksCurrent, VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE, TempFix1616); @@ -2469,7 +2410,7 @@ static VL53L1_Error SetTargetData(VL53L1_DEV Dev, pRangeData->AmbientRateRtnMegaCps = AmbientRate; TempFix1616 = VL53L1_FIXPOINT97TOFIXPOINT1616( - presults_data->VL53L1_PRM_00003); + presults_data->VL53L1_p_005); pRangeData->SigmaMilliMeter = TempFix1616; @@ -2497,8 +2438,21 @@ static VL53L1_Error SetTargetData(VL53L1_DEV Dev, + if ((pRangeData->RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) && + (active_results == 0)) { + pRangeData->RangeStatus = VL53L1_RANGESTATUS_NONE; + pRangeData->SignalRateRtnMegaCps = 0; + pRangeData->SigmaMilliMeter = 0; + pRangeData->RangeMilliMeter = 8191; + pRangeData->RangeMaxMilliMeter = 8191; + pRangeData->RangeMinMilliMeter = 8191; + } + + + if (pRangeData->RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) { - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, + CurrentParameters.PresetMode); if ((PresetMode == VL53L1_PRESETMODE_MULTIZONES_SCANNING) || (PresetMode == VL53L1_PRESETMODE_RANGING) || (PresetMode == VL53L1_PRESETMODE_PROXY_RANGING_MODE)) @@ -2512,7 +2466,7 @@ static VL53L1_Error SetTargetData(VL53L1_DEV Dev, TempFix1616 = VL53L1_FIXPOINT97TOFIXPOINT1616( - presults_data->VL53L1_PRM_00003); + presults_data->VL53L1_p_005); VL53L1_SETARRAYPARAMETERFIELD(Dev, LimitChecksCurrent, VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE, TempFix1616); @@ -2581,7 +2535,7 @@ static uint8_t GetOutputDataIndex(VL53L1_DEV Dev, uint8_t index = 0; VL53L1_OutputModes OutputMode; - OutputMode = PALDevDataGet(Dev, CurrentParameters.OutputMode); + OutputMode = VL53L1DevDataGet(Dev, CurrentParameters.OutputMode); @@ -2594,8 +2548,8 @@ static uint8_t GetOutputDataIndex(VL53L1_DEV Dev, for (i = 1; i < presults->active_results; i++) { - if (presults->VL53L1_PRM_00005[i].peak_signal_count_rate_mcps > - presults->VL53L1_PRM_00005[index].peak_signal_count_rate_mcps) + if (presults->VL53L1_p_002[i].peak_signal_count_rate_mcps > + presults->VL53L1_p_002[index].peak_signal_count_rate_mcps) index = i; } @@ -2616,7 +2570,7 @@ VL53L1_Error VL53L1_GetRangingMeasurementData(VL53L1_DEV Dev, - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); if (PresetMode == VL53L1_PRESETMODE_MULTIZONES_SCANNING) { Status = VL53L1_ERROR_MODE_NOT_SUPPORTED; @@ -2644,7 +2598,7 @@ VL53L1_Error VL53L1_GetRangingMeasurementData(VL53L1_DEV Dev, index = GetOutputDataIndex(Dev, presults); - presults_data = &(presults->VL53L1_PRM_00005[index]); + presults_data = &(presults->VL53L1_p_002[index]); Status = SetSimpleData(Dev, presults->active_results, presults->device_status, presults_data, @@ -2674,7 +2628,7 @@ static VL53L1_Error SetMeasurementData(VL53L1_DEV Dev, pMultiRangingData->HasXtalkValueChanged = presults->smudge_corrector_data.new_xtalk_applied_flag; dmax_min = MIN(presults->wrap_dmax_mm, - presults->VL53L1_PRM_00006[DMAX_REFLECTANCE_IDX]); + presults->VL53L1_p_007[DMAX_REFLECTANCE_IDX]); pMultiRangingData->DmaxMilliMeter = dmax_min; @@ -2686,7 +2640,7 @@ static VL53L1_Error SetMeasurementData(VL53L1_DEV Dev, pMultiRangingData->StreamCount = presults->stream_count; pMultiRangingData->RecommendedDistanceMode = - PALDevDataGet(Dev, CurrentParameters.DistanceMode); + VL53L1DevDataGet(Dev, CurrentParameters.DistanceMode); ActiveResults = presults->active_results; if (ActiveResults < 1) @@ -2699,7 +2653,7 @@ static VL53L1_Error SetMeasurementData(VL53L1_DEV Dev, for (i = 0; i < iteration; i++) { pRangeData = &(pMultiRangingData->RangeData[i]); - presults_data = &(presults->VL53L1_PRM_00005[i]); + presults_data = &(presults->VL53L1_p_002[i]); if (Status == VL53L1_ERROR_NONE) Status = SetTargetData(Dev, ActiveResults, presults->device_status, @@ -2707,7 +2661,7 @@ static VL53L1_Error SetMeasurementData(VL53L1_DEV Dev, pRangeData); pMultiRangingData->EffectiveSpadRtnCount = - presults_data->VL53L1_PRM_00004; + presults_data->VL53L1_p_006; if ((pRangeData->RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) && (pRangeData->RangeMilliMeter > Furthest_range)) { @@ -2721,7 +2675,7 @@ static VL53L1_Error SetMeasurementData(VL53L1_DEV Dev, if ((Status == VL53L1_ERROR_NONE) && (ActiveResults > 0)) { pRangeData = &(pMultiRangingData->RangeData[Furthest_idx]); CheckAndChangeDistanceMode(Dev, pRangeData, - presults->VL53L1_PRM_00006[VL53L1_MAX_AMBIENT_DMAX_VALUES-1], + presults->VL53L1_p_007[VL53L1_MAX_AMBIENT_DMAX_VALUES-1], &pMultiRangingData->RecommendedDistanceMode); } @@ -2804,6 +2758,12 @@ VL53L1_Error VL53L1_SetTuningParameter(VL53L1_DEV Dev, LOG_FUNCTION_START(""); + + if (TuningParameterId == + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS) + return VL53L1_ERROR_INVALID_PARAMS; + + if (TuningParameterId >= 32768) Status = VL53L1_set_tuning_parm(Dev, TuningParameterId, @@ -2854,19 +2814,29 @@ VL53L1_Error VL53L1_PerformRefSpadManagement(VL53L1_DEV Dev) VL53L1_Error Status = VL53L1_ERROR_NONE; VL53L1_Error RawStatus; uint8_t dcrbuffer[24]; - uint8_t *comms_buffer; - uint8_t numloc[2] = {5,3}; + uint8_t *commbuf; + uint8_t numloc[2] = {5, 3}; VL53L1_LLDriverData_t *pdev; VL53L1_customer_nvm_managed_t *pc; + VL53L1_PresetModes PresetMode; LOG_FUNCTION_START(""); pdev = VL53L1DevStructGetLLDriverHandle(Dev); pc = &pdev->customer; - if (Status == VL53L1_ERROR_NONE) + if (Status == VL53L1_ERROR_NONE) { + PresetMode = VL53L1DevDataGet(Dev, + CurrentParameters.PresetMode); Status = VL53L1_run_ref_spad_char(Dev, &RawStatus); + + + + if (Status == VL53L1_ERROR_NONE) + Status = VL53L1_SetPresetMode(Dev, PresetMode); + } + if (Status == VL53L1_WARNING_REF_SPAD_CHAR_RATE_TOO_HIGH) { @@ -2878,7 +2848,7 @@ VL53L1_Error VL53L1_PerformRefSpadManagement(VL53L1_DEV Dev) dcrbuffer); if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_WriteMulti( Dev, + Status = VL53L1_WriteMulti(Dev, VL53L1_REF_SPAD_MAN__NUM_REQUESTED_REF_SPADS, numloc, 2); @@ -2888,7 +2858,7 @@ VL53L1_Error VL53L1_PerformRefSpadManagement(VL53L1_DEV Dev) } if (Status == VL53L1_ERROR_NONE) - comms_buffer = &dcrbuffer[16]; + commbuf = &dcrbuffer[16]; @@ -2898,15 +2868,15 @@ VL53L1_Error VL53L1_PerformRefSpadManagement(VL53L1_DEV Dev) if (Status == VL53L1_ERROR_NONE) Status = VL53L1_WriteMulti(Dev, VL53L1_GLOBAL_CONFIG__SPAD_ENABLES_REF_0, - comms_buffer, 6); + commbuf, 6); if (Status == VL53L1_ERROR_NONE) { - pc->global_config__spad_enables_ref_0 = comms_buffer[0]; - pc->global_config__spad_enables_ref_1 = comms_buffer[1]; - pc->global_config__spad_enables_ref_2 = comms_buffer[2]; - pc->global_config__spad_enables_ref_3 = comms_buffer[3]; - pc->global_config__spad_enables_ref_4 = comms_buffer[4]; - pc->global_config__spad_enables_ref_5 = comms_buffer[5]; + pc->global_config__spad_enables_ref_0 = commbuf[0]; + pc->global_config__spad_enables_ref_1 = commbuf[1]; + pc->global_config__spad_enables_ref_2 = commbuf[2]; + pc->global_config__spad_enables_ref_3 = commbuf[3]; + pc->global_config__spad_enables_ref_4 = commbuf[4]; + pc->global_config__spad_enables_ref_5 = commbuf[5]; } @@ -2999,43 +2969,43 @@ VL53L1_Error VL53L1_GetXTalkCompensationEnable(VL53L1_DEV Dev, } - VL53L1_Error VL53L1_PerformXTalkCalibration(VL53L1_DEV Dev, uint8_t CalibrationOption) { VL53L1_Error Status = VL53L1_ERROR_NONE; VL53L1_Error UnfilteredStatus; - int16_t max_valid_range_mm; - int16_t min_valid_range_mm; - uint16_t max_valid_rate_kcps; - uint16_t max_sigma_mm; + int16_t CalDistanceMm; + VL53L1_xtalk_calibration_results_t xtalk; LOG_FUNCTION_START(""); - if (CalibrationOption == VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET) { - Status = SingleTargetXTalkCalibration(Dev); - } else { - VL53L1_get_xtalk_detect_config(Dev, &max_valid_range_mm, - &min_valid_range_mm, &max_valid_rate_kcps, &max_sigma_mm); - - max_valid_range_mm = 70; - min_valid_range_mm = -70; - - VL53L1_set_xtalk_detect_config(Dev, max_valid_range_mm, - min_valid_range_mm, max_valid_rate_kcps, max_sigma_mm); - - - - - - + switch (CalibrationOption) { + case VL53L1_XTALKCALIBRATIONMODE_NO_TARGET: Status = VL53L1_run_xtalk_extraction(Dev, &UnfilteredStatus); - if (Status == VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL) VL53L1_xtalk_cal_data_init(Dev); + break; + case VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET: + Status = SingleTargetXTalkCalibration(Dev); + break; + case VL53L1_XTALKCALIBRATIONMODE_FULL_ROI: + CalDistanceMm = (int16_t) + BDTable[VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM]; + Status = VL53L1_run_hist_xtalk_extraction(Dev, CalDistanceMm, + &UnfilteredStatus); + break; + default: + Status = VL53L1_ERROR_INVALID_PARAMS; + } + + if (Status == VL53L1_ERROR_NONE) { + Status = VL53L1_get_current_xtalk_settings(Dev, &xtalk); + Status = VL53L1_set_tuning_parm(Dev, + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS, + xtalk.algo__crosstalk_compensation_plane_offset_kcps); } @@ -3043,7 +3013,6 @@ VL53L1_Error VL53L1_PerformXTalkCalibration(VL53L1_DEV Dev, return Status; } - VL53L1_Error VL53L1_SetOffsetCalibrationMode(VL53L1_DEV Dev, VL53L1_OffsetCalibrationModes OffsetCalibrationMode) { @@ -3075,7 +3044,6 @@ VL53L1_Error VL53L1_SetOffsetCalibrationMode(VL53L1_DEV Dev, return Status; } - VL53L1_Error VL53L1_SetOffsetCorrectionMode(VL53L1_DEV Dev, VL53L1_OffsetCorrectionModes OffsetCorrectionMode) { @@ -3103,7 +3071,6 @@ VL53L1_Error VL53L1_SetOffsetCorrectionMode(VL53L1_DEV Dev, return Status; } - VL53L1_Error VL53L1_PerformOffsetCalibration(VL53L1_DEV Dev, int32_t CalDistanceMilliMeter, FixPoint1616_t CalReflectancePercent) { @@ -3168,114 +3135,91 @@ VL53L1_Error VL53L1_PerformOffsetCalibration(VL53L1_DEV Dev, return Status; } - -#if defined(VL53L1_NOCALIB) && defined(SMALL_FOOTPRINT) -VL53L1_Error VL53L1_PerformOffsetCalibration(VL53L1_DEV Dev, - int32_t CalDistanceMilliMeter) -{ - VL53L1_Error Status = VL53L1_ERROR_NOT_SUPPORTED; - - SUPPRESS_UNUSED_WARNING(Dev); - SUPPRESS_UNUSED_WARNING(CalDistanceMilliMeter); - - return Status; -} -#endif - -#if defined(SMALL_FOOTPRINT) && !defined(VL53L1_NOCALIB) -VL53L1_Error VL53L1_PerformOffsetCalibration(VL53L1_DEV Dev, - int32_t CalDistanceMilliMeter) -{ - VL53L1_Error Status = VL53L1_ERROR_NONE; - VL53L1_Error UnfilteredStatus; - VL53L1_OffsetCalibrationMode offset_cal_mode; - - LOG_FUNCTION_START(""); - - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_get_offset_calibration_mode(Dev, - &offset_cal_mode); - - if (Status != VL53L1_ERROR_NONE) { - LOG_FUNCTION_END(Status); - return Status; - } - - if ((offset_cal_mode == - VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__STANDARD) || - (offset_cal_mode == - VL53L1_OFFSETCALIBRATIONMODE__MM1_MM2__STANDARD_PRE_RANGE_ONLY - )) { - if (Status == VL53L1_ERROR_NONE) - Status = VL53L1_run_offset_calibration( - Dev, - (int16_t)CalDistanceMilliMeter, - &UnfilteredStatus); - } else { - Status = VL53L1_ERROR_INVALID_PARAMS; - } - LOG_FUNCTION_END(Status); - return Status; -} -#endif - VL53L1_Error VL53L1_PerformOffsetSimpleCalibration(VL53L1_DEV Dev, int32_t CalDistanceMilliMeter) { VL53L1_Error Status = VL53L1_ERROR_NONE; int32_t sum_ranging; uint8_t offset_meas; - uint8_t Max; - uint8_t total_count; + int16_t Max, UnderMax, OverMax, Repeat; + int32_t total_count, inloopcount; + int32_t IncRounding; int16_t meanDistance_mm; int16_t offset; VL53L1_RangingMeasurementData_t RangingMeasurementData; VL53L1_LLDriverData_t *pdev; + uint8_t goodmeas; + VL53L1_Error SmudgeStatus = VL53L1_ERROR_NONE; + uint8_t smudge_corr_en; LOG_FUNCTION_START(""); pdev = VL53L1DevStructGetLLDriverHandle(Dev); + smudge_corr_en = pdev->smudge_correct_config.smudge_corr_enabled; + SmudgeStatus = VL53L1_dynamic_xtalk_correction_disable(Dev); + + pdev->customer.algo__part_to_part_range_offset_mm = 0; pdev->customer.mm_config__inner_offset_mm = 0; pdev->customer.mm_config__outer_offset_mm = 0; - Max = BDTable[VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_RANGES]; - - Status = VL53L1_StartMeasurement(Dev); + Repeat = BDTable[VL53L1_TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT]; + Max = BDTable[ + VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER]; + UnderMax = 1 + (Max / 2); + OverMax = Max + (Max / 2); sum_ranging = 0; - offset_meas = 0; total_count = 0; - while ((Status == VL53L1_ERROR_NONE) && (offset_meas < Max)) { - Status = VL53L1_WaitMeasurementDataReady(Dev); - if (Status == VL53L1_ERROR_NONE) { + + while ((Repeat > 0) && (Status == VL53L1_ERROR_NONE)) { + Status = VL53L1_StartMeasurement(Dev); + + + if (Status == VL53L1_ERROR_NONE) + Status = VL53L1_WaitMeasurementDataReady(Dev); + if (Status == VL53L1_ERROR_NONE) Status = VL53L1_GetRangingMeasurementData(Dev, - &RangingMeasurementData); - } - if (Status == VL53L1_ERROR_NONE) { - if (RangingMeasurementData.RangeStatus == - VL53L1_RANGESTATUS_RANGE_VALID) { + &RangingMeasurementData); + if (Status == VL53L1_ERROR_NONE) + Status = VL53L1_ClearInterruptAndStartMeasurement(Dev); + + + inloopcount = 0; + offset_meas = 0; + while ((Status == VL53L1_ERROR_NONE) && (inloopcount < Max) && + (offset_meas < OverMax)) { + Status = VL53L1_WaitMeasurementDataReady(Dev); + if (Status == VL53L1_ERROR_NONE) + Status = VL53L1_GetRangingMeasurementData(Dev, + &RangingMeasurementData); + goodmeas = (RangingMeasurementData.RangeStatus == + VL53L1_RANGESTATUS_RANGE_VALID); + if ((Status == VL53L1_ERROR_NONE) && goodmeas) { sum_ranging = sum_ranging + RangingMeasurementData.RangeMilliMeter; - total_count++; + inloopcount++; } + Status = VL53L1_ClearInterruptAndStartMeasurement(Dev); + offset_meas++; } - if (Status == VL53L1_ERROR_NONE) { - Status = VL53L1_ClearInterruptAndStartMeasurement( - Dev); - } - offset_meas++; + total_count += inloopcount; + + + + if (inloopcount < UnderMax) + Status = VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL; + + VL53L1_StopMeasurement(Dev); + + Repeat--; + } - VL53L1_StopMeasurement(Dev); - - - - if (total_count == 0) { - Status = VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL; - } + if ((SmudgeStatus == VL53L1_ERROR_NONE) && (smudge_corr_en == 1)) + SmudgeStatus = VL53L1_dynamic_xtalk_correction_enable(Dev); if ((sum_ranging < 0) || @@ -3283,8 +3227,10 @@ VL53L1_Error VL53L1_PerformOffsetSimpleCalibration(VL53L1_DEV Dev, Status = VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH; } - if (Status == VL53L1_ERROR_NONE) { - meanDistance_mm = (int16_t)(sum_ranging / total_count); + if ((Status == VL53L1_ERROR_NONE) && (total_count > 0)) { + IncRounding = total_count / 2; + meanDistance_mm = (int16_t)((sum_ranging + IncRounding) + / total_count); offset = (int16_t)CalDistanceMilliMeter - meanDistance_mm; pdev->customer.algo__part_to_part_range_offset_mm = 0; pdev->customer.mm_config__inner_offset_mm = offset; @@ -3316,6 +3262,7 @@ VL53L1_Error VL53L1_SetCalibrationData(VL53L1_DEV Dev, + memcpy( &(cal_data.fmt_dmax_cal), &(pCalibrationData->fmt_dmax_cal), @@ -3401,13 +3348,23 @@ VL53L1_Error VL53L1_SetCalibrationData(VL53L1_DEV Dev, pC->mm_config__outer_offset_mm; Status = VL53L1_set_part_to_part_data(Dev, &cal_data); - CHECK_ERROR_GO_ENDFUNC; + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; Status = VL53L1_get_current_xtalk_settings(Dev, &xtalk); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; xtalk.algo__crosstalk_compensation_plane_offset_kcps = x; + + Status = VL53L1_set_tuning_parm(Dev, + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS, + x); + + + Status = VL53L1_set_current_xtalk_settings(Dev, &xtalk); ENDFUNC: @@ -3523,7 +3480,7 @@ VL53L1_Error VL53L1_GetCalibrationData(VL53L1_DEV Dev, pC2->algo__crosstalk_compensation_plane_offset_kcps); - PresetMode = PALDevDataGet(Dev, CurrentParameters.PresetMode); + PresetMode = VL53L1DevDataGet(Dev, CurrentParameters.PresetMode); if ((PresetMode == VL53L1_PRESETMODE_RANGING) || (PresetMode == VL53L1_PRESETMODE_MULTIZONES_SCANNING) || @@ -3531,7 +3488,9 @@ VL53L1_Error VL53L1_GetCalibrationData(VL53L1_DEV Dev, ) { Status = VL53L1_get_current_xtalk_settings(Dev, &xtalk); - CHECK_ERROR_GO_ENDFUNC; + + if (Status != VL53L1_ERROR_NONE) + goto ENDFUNC; tmp = xtalk.algo__crosstalk_compensation_plane_offset_kcps; pC->algo__crosstalk_compensation_plane_offset_kcps = tmp; @@ -3641,11 +3600,11 @@ VL53L1_Error VL53L1_SetThresholdConfig(VL53L1_DEV Dev, g = pdev->gain_cal.standard_ranging_gain_factor; - gain = (FixPoint1616_t) (g << 5); - high1616 = (FixPoint1616_t) - (pConfig->Distance.High << 16); - low1616 = (FixPoint1616_t) - (pConfig->Distance.Low << 16); + gain = (FixPoint1616_t) ((uint32_t)g << 5); + high1616 = (FixPoint1616_t) ((uint32_t) + pConfig->Distance.High << 16); + low1616 = (FixPoint1616_t) ((uint32_t) + pConfig->Distance.Low << 16); high1616 = (high1616 + 32768) / gain; @@ -3774,3 +3733,4 @@ VL53L1_Error VL53L1_GetThresholdConfig(VL53L1_DEV Dev, + diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api_calibration.c b/drivers/input/misc/vl53L1/src/vl53l1_api_calibration.c index 5d6aa6b13204..b3b1a98a20ae 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api_calibration.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api_calibration.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -168,14 +168,14 @@ VL53L1_Error VL53L1_run_ref_spad_char( if (status == VL53L1_ERROR_NONE) status = - VL53L1_set_ref_spad_char_config( - Dev, - prefspadchar->VL53L1_PRM_00008, - prefspadchar->timeout_us, - prefspadchar->target_count_rate_mcps, - prefspadchar->max_count_rate_limit_mcps, - prefspadchar->min_count_rate_limit_mcps, - pdev->stat_nvm.osc_measured__fast_osc__frequency); + VL53L1_set_ref_spad_char_config( + Dev, + prefspadchar->VL53L1_p_009, + prefspadchar->timeout_us, + prefspadchar->target_count_rate_mcps, + prefspadchar->max_count_rate_limit_mcps, + prefspadchar->min_count_rate_limit_mcps, + pdev->stat_nvm.osc_measured__fast_osc__frequency); @@ -194,11 +194,11 @@ VL53L1_Error VL53L1_run_ref_spad_char( if (status == VL53L1_ERROR_NONE) status = - VL53L1_ReadMulti( - Dev, - VL53L1_REF_SPAD_CHAR_RESULT__NUM_ACTUAL_REF_SPADS, - comms_buffer, - 2); + VL53L1_ReadMulti( + Dev, + VL53L1_REF_SPAD_CHAR_RESULT__NUM_ACTUAL_REF_SPADS, + comms_buffer, + 2); if (status == VL53L1_ERROR_NONE) { pdev->dbg_results.ref_spad_char_result__num_actual_ref_spads = @@ -364,9 +364,15 @@ VL53L1_Error VL53L1_run_xtalk_extraction( + VL53L1_xtalkextract_config_t *pX = &(pdev->xtalk_extract_cfg); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_xtalk_calibration_results_t *pXC = &(pdev->xtalk_cal); + uint8_t results_invalid = 0; uint8_t i = 0; + uint16_t tmp16 = 0; + uint8_t measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; LOG_FUNCTION_START(""); @@ -400,26 +406,24 @@ VL53L1_Error VL53L1_run_xtalk_extraction( if (status == VL53L1_ERROR_NONE) status = - VL53L1_set_preset_mode( - Dev, - VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_PLANAR, + VL53L1_set_preset_mode( + Dev, + VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_PLANAR, - pdev->xtalk_extract_cfg.dss_config__target_total_rate_mcps, - pdev->xtalk_extract_cfg.phasecal_config_timeout_us, - pdev->xtalk_extract_cfg.mm_config_timeout_us, - pdev->xtalk_extract_cfg.range_config_timeout_us, + pX->dss_config__target_total_rate_mcps, + pX->phasecal_config_timeout_us, + pX->mm_config_timeout_us, + pX->range_config_timeout_us, - 100); + 100); - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_disable_xtalk_compensation( - Dev); - } + if (status == VL53L1_ERROR_NONE) + status = VL53L1_disable_xtalk_compensation(Dev); @@ -439,49 +443,49 @@ VL53L1_Error VL53L1_run_xtalk_extraction( pdev->xtalk_results.zero_samples_status = 0x00; pdev->xtalk_results.max_sigma_status = 0x00; - for (i = 0 ; i < pdev->xtalk_results.max_results ; i++) { - pdev->xtalk_results.VL53L1_PRM_00005[i].no_of_samples = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].signal_total_events_avg = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].signal_total_events_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].rate_per_spad_kcps_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].rate_per_spad_kcps_avg = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].sigma_mm_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].sigma_mm_avg = 0; + for (i = 0; i < pdev->xtalk_results.max_results; i++) { + pdev->xtalk_results.VL53L1_p_002[i].no_of_samples = 0; + pdev->xtalk_results.VL53L1_p_002[i].signal_total_events_avg = 0; + pdev->xtalk_results.VL53L1_p_002[i].signal_total_events_sum = 0; + pdev->xtalk_results.VL53L1_p_002[i].rate_per_spad_kcps_sum = 0; + pdev->xtalk_results.VL53L1_p_002[i].rate_per_spad_kcps_avg = 0; + pdev->xtalk_results.VL53L1_p_002[i].sigma_mm_sum = 0; + pdev->xtalk_results.VL53L1_p_002[i].sigma_mm_avg = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].median_phase_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].median_phase_avg = 0; + pdev->xtalk_results.VL53L1_p_002[i].median_phase_sum = 0; + pdev->xtalk_results.VL53L1_p_002[i].median_phase_avg = 0; } - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_get_and_avg_xtalk_samples( - Dev, + status = + VL53L1_get_and_avg_xtalk_samples( + Dev, - pdev->xtalk_extract_cfg.num_of_samples, + pX->num_of_samples, - measurement_mode, + measurement_mode, - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_range_mm, - pdev->xtalk_extract_cfg.algo__crosstalk_extract_min_valid_range_mm, - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_rate_kcps, + pX->algo__crosstalk_extract_max_valid_range_mm, + pX->algo__crosstalk_extract_min_valid_range_mm, + pX->algo__crosstalk_extract_max_valid_rate_kcps, - 0x0, + 0x0, - 0x4, + 0x4, - &(pdev->xtalk_results), - &(pdev->xtalk_results.central_histogram_sum), - &(pdev->xtalk_results.central_histogram_avg)); + &(pdev->xtalk_results), + &(pdev->xtalk_results.central_histogram_sum), + &(pdev->xtalk_results.central_histogram_avg)); } @@ -496,85 +500,79 @@ VL53L1_Error VL53L1_run_xtalk_extraction( - if (status == VL53L1_ERROR_NONE) { - if ((pdev->xtalk_results.VL53L1_PRM_00005[4].no_of_samples == 0) || - (pdev->xtalk_results.VL53L1_PRM_00005[4].sigma_mm_avg > - ((uint32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm<<5))) { - results_invalid = 0x01; - } - } + if (status == VL53L1_ERROR_NONE) + if ((pdev->xtalk_results.VL53L1_p_002[4].no_of_samples == 0) || + (pdev->xtalk_results.VL53L1_p_002[4].sigma_mm_avg > + ((uint32_t)pX->algo__crosstalk_extract_max_sigma_mm + << 5))) + results_invalid = 0x01; + #ifdef VL53L1_LOG_ENABLE - if (status == VL53L1_ERROR_NONE) - VL53L1_print_xtalk_range_results( - &(pdev->xtalk_results), - "pdev->xtalk_results", - VL53L1_TRACE_MODULE_CORE); + if (status == VL53L1_ERROR_NONE) + VL53L1_print_xtalk_range_results( + &(pdev->xtalk_results), + "pdev->xtalk_results", + VL53L1_TRACE_MODULE_CORE); #endif + if ((status == VL53L1_ERROR_NONE) && (results_invalid == 0)) { - if (status == VL53L1_ERROR_NONE) { + status = + VL53L1_ipp_xtalk_calibration_process_data( + Dev, + &(pdev->xtalk_results), + &(pdev->xtalk_shapes), + &(pdev->xtalk_cal)); - if (results_invalid == 0) { + if (status == VL53L1_ERROR_NONE) { - if (status == VL53L1_ERROR_NONE) - - status = VL53L1_ipp_xtalk_calibration_process_data( - Dev, - &(pdev->xtalk_results), - &(pdev->xtalk_shapes), - &(pdev->xtalk_cal)); - - if (status == VL53L1_ERROR_NONE) { - - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_y_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_plane_offset_kcps; - - - } + pC->algo__crosstalk_compensation_x_plane_gradient_kcps = + pXC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pC->algo__crosstalk_compensation_y_plane_gradient_kcps = + pXC->algo__crosstalk_compensation_y_plane_gradient_kcps; + pC->algo__crosstalk_compensation_plane_offset_kcps = + pXC->algo__crosstalk_compensation_plane_offset_kcps; } + + } - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_enable_xtalk_compensation( - Dev); - } + if (status == VL53L1_ERROR_NONE) + status = VL53L1_enable_xtalk_compensation(Dev); + if (status == VL53L1_ERROR_NONE) { - for (i = 0 ; i < pdev->xtalk_results.max_results ; i++) { + for (i = 0; i < pdev->xtalk_results.max_results; i++) { - if (pdev->xtalk_results.VL53L1_PRM_00005[i].no_of_samples != + if (pdev->xtalk_results.VL53L1_p_002[i].no_of_samples != - pdev->xtalk_extract_cfg.num_of_samples) { + pX->num_of_samples) { pdev->xtalk_results.num_of_samples_status = - pdev->xtalk_results.num_of_samples_status | + pdev->xtalk_results.num_of_samples_status | (1 << i); } - if (pdev->xtalk_results.VL53L1_PRM_00005[i].no_of_samples == + if (pdev->xtalk_results.VL53L1_p_002[i].no_of_samples == 0x00) { pdev->xtalk_results.zero_samples_status = - pdev->xtalk_results.zero_samples_status | + pdev->xtalk_results.zero_samples_status | (1 << i); } @@ -589,8 +587,9 @@ VL53L1_Error VL53L1_run_xtalk_extraction( - if (pdev->xtalk_results.VL53L1_PRM_00005[i].sigma_mm_avg > - ((uint32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm<<5)) { + tmp16 = pX->algo__crosstalk_extract_max_sigma_mm; + if (pdev->xtalk_results.VL53L1_p_002[i].sigma_mm_avg > + ((uint32_t)tmp16 << 5)) { pdev->xtalk_results.max_sigma_status = pdev->xtalk_results.max_sigma_status | (1 << i); @@ -615,15 +614,17 @@ VL53L1_Error VL53L1_run_xtalk_extraction( if (results_invalid > 0) { - if (pdev->xtalk_results.VL53L1_PRM_00005[4].no_of_samples == 0) { + if (pdev->xtalk_results.VL53L1_p_002[4].no_of_samples == 0) { status = VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL; } else { - if ((uint32_t)pdev->xtalk_results.VL53L1_PRM_00005[4].sigma_mm_avg > - ((uint32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm)<<5) { - status = VL53L1_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL; + if (pdev->xtalk_results.VL53L1_p_002[4].sigma_mm_avg > + (((uint32_t)pX->algo__crosstalk_extract_max_sigma_mm) + << 5)) { + status = + VL53L1_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL; } @@ -635,12 +636,13 @@ VL53L1_Error VL53L1_run_xtalk_extraction( status = VL53L1_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT; } else { if (pdev->xtalk_results.max_sigma_status != 0x00) { - status = VL53L1_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT; + status = + VL53L1_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT; } else { if (pdev->xtalk_results.num_of_samples_status != - 0x00) { - status = VL53L1_WARNING_XTALK_MISSING_SAMPLES; - } + 0x00) + status = + VL53L1_WARNING_XTALK_MISSING_SAMPLES; } } } @@ -726,383 +728,6 @@ VL53L1_Error VL53L1_run_xtalk_extraction( -VL53L1_Error VL53L1_run_xtalk_extraction_dual_reflectance( - VL53L1_DEV Dev, - uint16_t dss_config__target_total_rate_mcps, - uint32_t phasecal_config_timeout_us, - uint32_t mm_config_timeout_us, - uint32_t range_config_timeout_us, - uint8_t num_of_samples, - uint8_t calc_parms, - uint8_t higher_reflectance, - uint16_t expected_target_distance_mm, - uint16_t xtalk_filter_thresh_mm, - VL53L1_Error *pcal_status) -{ - - - - - - - - - - - - - - - - - - - - - - - VL53L1_Error status = VL53L1_ERROR_NONE; - VL53L1_LLDriverData_t *pdev = - VL53L1DevStructGetLLDriverHandle(Dev); - - - - - - - VL53L1_histogram_bin_data_t *pxtalk_avg_samples = &(pdev->xtalk_results.xtalk_avg[0]); - - VL53L1_range_results_t results_int; - VL53L1_range_results_t *presults_int = &(results_int); - - VL53L1_range_data_t *prange_data = &(presults_int->VL53L1_PRM_00005[0]); - - uint8_t results_invalid = 0; - - uint8_t i = 0; - uint8_t measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; - - LOG_FUNCTION_START(""); - - - - - - - - if (calc_parms == 0x00) { - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_1[0])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_1[1])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_1[2])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_1[3])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_1[4])); - } - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_2[0])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_2[1])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_2[2])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_2[3])); - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - &(pdev->xtalk_results.histogram_avg_2[4])); - - - - - - - - - - - - - if (status == VL53L1_ERROR_NONE) - - status = - VL53L1_set_preset_mode( - Dev, - VL53L1_DEVICEPRESETMODE_HISTOGRAM_XTALK_PLANAR, - dss_config__target_total_rate_mcps, - phasecal_config_timeout_us, - mm_config_timeout_us, - range_config_timeout_us, - 100); - - - - - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_disable_xtalk_compensation( - Dev); - } - - - - - - - pdev->xtalk_results.max_results = VL53L1_MAX_XTALK_RANGE_RESULTS; - pdev->xtalk_results.active_results = pdev->zone_cfg.active_zones+1; - - for (i = 0 ; i < pdev->xtalk_results.max_results ; i++) { - pdev->xtalk_results.VL53L1_PRM_00005[i].no_of_samples = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].signal_total_events_avg = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].signal_total_events_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].rate_per_spad_kcps_sum = 0; - pdev->xtalk_results.VL53L1_PRM_00005[i].rate_per_spad_kcps_avg = 0; - } - - - - - if ((status == VL53L1_ERROR_NONE) && - (calc_parms == 0x00)) { - - status = VL53L1_get_and_avg_all_xtalk_samples( - Dev, - num_of_samples, - measurement_mode, - xtalk_filter_thresh_mm, - &(pdev->xtalk_results), - &(pdev->xtalk_results.histogram_avg_1[0]), - &(pdev->xtalk_results.histogram_avg_1[1]), - &(pdev->xtalk_results.histogram_avg_1[2]), - &(pdev->xtalk_results.histogram_avg_1[3]), - &(pdev->xtalk_results.histogram_avg_1[4]) - ); - - } else { - - status = VL53L1_get_and_avg_all_xtalk_samples( - Dev, - num_of_samples, - measurement_mode, - xtalk_filter_thresh_mm, - &(pdev->xtalk_results), - &(pdev->xtalk_results.histogram_avg_2[0]), - &(pdev->xtalk_results.histogram_avg_2[1]), - &(pdev->xtalk_results.histogram_avg_2[2]), - &(pdev->xtalk_results.histogram_avg_2[3]), - &(pdev->xtalk_results.histogram_avg_2[4]) - ); - } - - - - - if ((status == VL53L1_ERROR_NONE) && - (calc_parms == 0x01)) { - status = VL53L1_ipp_generate_dual_reflectance_xtalk_samples( - Dev, - &(pdev->xtalk_results), - expected_target_distance_mm, - higher_reflectance, - &(pdev->xtalk_results.xtalk_avg[0])); - } - - - - - for (i = 0 ; i < 5 ; i++) { - - if ((status == VL53L1_ERROR_NONE) && - (calc_parms == 0x01)) { - - status = VL53L1_ipp_hist_process_data( - Dev, - &(pdev->fmt_dmax_cal), - &(pdev->dmax_cfg), - &(pdev->histpostprocess), - &(pxtalk_avg_samples[i]), - &(pdev->xtalk_shapes), - presults_int); - } - - if (status == VL53L1_ERROR_NONE) { - if ((presults_int->active_results > 0) && - (prange_data->median_range_mm < - (int16_t)xtalk_filter_thresh_mm)) { - - pdev->xtalk_results.VL53L1_PRM_00005[i].no_of_samples++; - - pdev->xtalk_results.VL53L1_PRM_00005[i].rate_per_spad_kcps_avg = - prange_data->VL53L1_PRM_00011; - - pdev->xtalk_results.VL53L1_PRM_00005[i].signal_total_events_avg = - prange_data->VL53L1_PRM_00012; - } - } - } - - - - - memcpy(&(pdev->xtalk_results.central_histogram_avg), - &(pxtalk_avg_samples[4]), - sizeof(VL53L1_histogram_bin_data_t)); - - - - - - - - - - - if ((status == VL53L1_ERROR_NONE) && - (calc_parms == 0x01)) { - if (pdev->xtalk_results.VL53L1_PRM_00005[4].no_of_samples == 0) { - results_invalid = 0x01; - } - } - - -#ifdef VL53L1_LOG_ENABLE - if (status == VL53L1_ERROR_NONE) - VL53L1_print_xtalk_range_results( - &(pdev->xtalk_results), - "pdev->xtalk_results", - VL53L1_TRACE_MODULE_CORE); -#endif - - - if ((status == VL53L1_ERROR_NONE) && - (calc_parms == 0x01)) { - - if (results_invalid == 0) { - - if (status == VL53L1_ERROR_NONE) - - status = VL53L1_ipp_xtalk_calibration_process_data( - Dev, - &(pdev->xtalk_results), - &(pdev->xtalk_shapes), - &(pdev->xtalk_cal)); - - if (status == VL53L1_ERROR_NONE) { - - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_y_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps = - pdev->xtalk_cal.algo__crosstalk_compensation_plane_offset_kcps; - - - } - - - } - } - - - - - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_enable_xtalk_compensation( - Dev); - } - - - - - if (results_invalid > 0) - status = VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL; - - - - - - - pdev->xtalk_results.cal_status = status; - *pcal_status = pdev->xtalk_results.cal_status; - - - - - IGNORE_STATUS( - IGNORE_XTALK_EXTRACTION_NO_SAMPLE_FAIL, - VL53L1_ERROR_XTALK_EXTRACTION_NO_SAMPLE_FAIL, - status); - -#ifdef VL53L1_LOG_ENABLE - - - - - VL53L1_print_customer_nvm_managed( - &(pdev->customer), - "pdev->lldata.customer.", - VL53L1_TRACE_MODULE_XTALK_DATA); - - VL53L1_print_xtalk_config( - &(pdev->xtalk_cfg), - "pdev->lldata.xtalk_cfg.", - VL53L1_TRACE_MODULE_XTALK_DATA); - - VL53L1_print_histogram_bin_data( - &(pdev->hist_data), - "pdev->lldata.hist_data.", - VL53L1_TRACE_MODULE_XTALK_DATA); - - VL53L1_print_xtalk_histogram_data( - &(pdev->xtalk_shapes), - "pdev->lldata.xtalk_shapes.", - VL53L1_TRACE_MODULE_XTALK_DATA); - - VL53L1_print_xtalk_range_results( - &(pdev->xtalk_results), - "pdev->lldata.xtalk_results.", - VL53L1_TRACE_MODULE_XTALK_DATA); - -#endif - - LOG_FUNCTION_END(status); - - return status; - -} - - - VL53L1_Error VL53L1_get_and_avg_xtalk_samples( VL53L1_DEV Dev, uint8_t num_of_samples, @@ -1112,7 +737,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( uint16_t xtalk_max_valid_rate_kcps, uint8_t xtalk_result_id, uint8_t xtalk_histo_id, - VL53L1_xtalk_range_results_t *pxtalk_results, + VL53L1_xtalk_range_results_t *pXR, VL53L1_histogram_bin_data_t *psum_histo, VL53L1_histogram_bin_data_t *pavg_histo) { @@ -1137,7 +762,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( #endif VL53L1_range_results_t range_results; - VL53L1_range_results_t *prange_results = &range_results; + VL53L1_range_results_t *prs = &range_results; VL53L1_range_data_t *prange_data; VL53L1_xtalk_range_data_t *pxtalk_range_data; @@ -1146,6 +771,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( uint8_t j = 0; uint8_t zone_id = 0; uint8_t final_zone = pdev->zone_cfg.active_zones+1; + uint8_t valid_result; uint8_t smudge_corr_en = 0; @@ -1172,7 +798,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); - for (i = 0 ; i <= (final_zone*num_of_samples) ; i++) { + for (i = 0; i <= (final_zone*num_of_samples); i++) { @@ -1191,7 +817,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( VL53L1_get_device_results( Dev, VL53L1_DEVICERESULTSLEVEL_FULL, - prange_results); + prs); @@ -1200,53 +826,59 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( if (status == VL53L1_ERROR_NONE && pdev->ll_state.rd_device_state != - VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { + VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { - zone_id = pdev->ll_state.rd_zone_id + xtalk_result_id; - prange_data = &(prange_results->VL53L1_PRM_00005[0]); + zone_id = pdev->ll_state.rd_zone_id + xtalk_result_id; + prange_data = &(prs->VL53L1_p_002[0]); - if (prange_results->active_results > 1) { - for (j = 1 ; j < prange_results->active_results ; j++) { + if (prs->active_results > 1) { + for (j = 1; + j < prs->active_results; j++) { + if (prs->VL53L1_p_002[j].median_range_mm + < + prange_data->median_range_mm) + prange_data = + &(prs->VL53L1_p_002[j]); - if (prange_results->VL53L1_PRM_00005[j].median_range_mm < - prange_data->median_range_mm){ - prange_data = &(prange_results->VL53L1_PRM_00005[j]); - } } } - pxtalk_range_data = &(pxtalk_results->VL53L1_PRM_00005[zone_id]); + pxtalk_range_data = &(pXR->VL53L1_p_002[zone_id]); - - if ((prange_results->active_results > 0) && + if ((prs->active_results > 0) && (prange_data->median_range_mm < xtalk_filter_thresh_max_mm) && (prange_data->median_range_mm > xtalk_filter_thresh_min_mm) && - (prange_data->VL53L1_PRM_00011 < - (uint32_t)(xtalk_max_valid_rate_kcps * 16))) { + (prange_data->VL53L1_p_012 < + (uint32_t)(xtalk_max_valid_rate_kcps * 16))) + valid_result = 1; + else + valid_result = 0; + + if (valid_result == 1) { pxtalk_range_data->no_of_samples++; pxtalk_range_data->rate_per_spad_kcps_sum += - prange_data->VL53L1_PRM_00011; + prange_data->VL53L1_p_012; pxtalk_range_data->signal_total_events_sum += - prange_data->VL53L1_PRM_00012; + prange_data->VL53L1_p_013; pxtalk_range_data->sigma_mm_sum += - (uint32_t)prange_data->VL53L1_PRM_00003; + (uint32_t)prange_data->VL53L1_p_005; pxtalk_range_data->median_phase_sum += - (uint32_t)prange_data->VL53L1_PRM_00013; + (uint32_t)prange_data->VL53L1_p_014; @@ -1257,32 +889,31 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( - - if (zone_id >= 4) { - status = VL53L1_sum_histogram_data( - &(pdev->hist_data), - psum_histo); - - - - - - if (prange_data->VL53L1_PRM_00014 < - pxtalk_results->central_histogram__window_start) { - pxtalk_results->central_histogram__window_start = - prange_data->VL53L1_PRM_00014; - } - - - - if (prange_data->VL53L1_PRM_00015 > - pxtalk_results->central_histogram__window_end) { - pxtalk_results->central_histogram__window_end = - prange_data->VL53L1_PRM_00015; - } - - } } + + if ((valid_result == 1) && (zone_id >= 4)) { + status = VL53L1_sum_histogram_data( + &(pdev->hist_data), + psum_histo); + + + + + + if (prange_data->VL53L1_p_015 < + pXR->central_histogram__window_start) + pXR->central_histogram__window_start = + prange_data->VL53L1_p_015; + + + + if (prange_data->VL53L1_p_016 > + pXR->central_histogram__window_end) + pXR->central_histogram__window_end = + prange_data->VL53L1_p_016; + + } + } @@ -1292,7 +923,7 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( #ifdef VL53L1_LOG_ENABLE - if ((status == VL53L1_ERROR_NONE)) { + if (status == VL53L1_ERROR_NONE) { VL53L1_print_range_results( &(pres->range_results), "pres->range_results.", @@ -1339,40 +970,40 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( - for (i = 0 ; i < (pdev->zone_cfg.active_zones+1) ; i++) { + for (i = 0; i < (pdev->zone_cfg.active_zones+1); i++) { - pxtalk_range_data = &(pxtalk_results->VL53L1_PRM_00005[i+xtalk_result_id]); + pxtalk_range_data = &(pXR->VL53L1_p_002[i+xtalk_result_id]); if (pxtalk_range_data->no_of_samples > 0) { pxtalk_range_data->rate_per_spad_kcps_avg = - pxtalk_range_data->rate_per_spad_kcps_sum / - (uint32_t)pxtalk_range_data->no_of_samples; + pxtalk_range_data->rate_per_spad_kcps_sum / + (uint32_t)pxtalk_range_data->no_of_samples; pxtalk_range_data->signal_total_events_avg = - pxtalk_range_data->signal_total_events_sum / - (int32_t)pxtalk_range_data->no_of_samples; + pxtalk_range_data->signal_total_events_sum / + (int32_t)pxtalk_range_data->no_of_samples; pxtalk_range_data->sigma_mm_avg = - pxtalk_range_data->sigma_mm_sum / - (uint32_t)pxtalk_range_data->no_of_samples; + pxtalk_range_data->sigma_mm_sum / + (uint32_t)pxtalk_range_data->no_of_samples; pxtalk_range_data->median_phase_avg = - pxtalk_range_data->median_phase_sum / - (uint32_t)pxtalk_range_data->no_of_samples; + pxtalk_range_data->median_phase_sum / + (uint32_t)pxtalk_range_data->no_of_samples; } else { pxtalk_range_data->rate_per_spad_kcps_avg = - pxtalk_range_data->rate_per_spad_kcps_sum; + pxtalk_range_data->rate_per_spad_kcps_sum; pxtalk_range_data->signal_total_events_avg = - pxtalk_range_data->signal_total_events_sum; + pxtalk_range_data->signal_total_events_sum; pxtalk_range_data->sigma_mm_avg = - pxtalk_range_data->sigma_mm_sum; + pxtalk_range_data->sigma_mm_sum; @@ -1388,14 +1019,15 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( - memcpy(pavg_histo, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); + memcpy(pavg_histo, &(pdev->hist_data), + sizeof(VL53L1_histogram_bin_data_t)); if (status == VL53L1_ERROR_NONE) { - pxtalk_range_data = &(pxtalk_results->VL53L1_PRM_00005[xtalk_histo_id]); + pxtalk_range_data = &(pXR->VL53L1_p_002[xtalk_histo_id]); status = VL53L1_avg_histogram_data( pxtalk_range_data->no_of_samples, @@ -1423,276 +1055,6 @@ VL53L1_Error VL53L1_get_and_avg_xtalk_samples( -VL53L1_Error VL53L1_get_and_avg_all_xtalk_samples( - VL53L1_DEV Dev, - uint8_t num_of_samples, - uint8_t measurement_mode, - int16_t xtalk_filter_thresh_mm, - VL53L1_xtalk_range_results_t *pxtalk_results, - VL53L1_histogram_bin_data_t *pavg_histo_z0, - VL53L1_histogram_bin_data_t *pavg_histo_z1, - VL53L1_histogram_bin_data_t *pavg_histo_z2, - VL53L1_histogram_bin_data_t *pavg_histo_z3, - VL53L1_histogram_bin_data_t *pavg_histo_z4) -{ - - - - - - - - - - - - VL53L1_Error status = VL53L1_ERROR_NONE; - VL53L1_LLDriverData_t *pdev = - VL53L1DevStructGetLLDriverHandle(Dev); - - - - - - - VL53L1_range_results_t range_results; - VL53L1_range_results_t *prange_results = &range_results; - - VL53L1_range_data_t *prange_data; - - - VL53L1_histogram_bin_data_t z_sum[4]; - - VL53L1_histogram_bin_data_t *pz0_sum = &z_sum[0]; - VL53L1_histogram_bin_data_t *pz1_sum = &z_sum[1]; - VL53L1_histogram_bin_data_t *pz2_sum = &z_sum[2]; - VL53L1_histogram_bin_data_t *pz3_sum = &z_sum[3]; - VL53L1_histogram_bin_data_t *pz4_sum = &z_sum[4]; - - VL53L1_histogram_bin_data_t *pzcurrent_sum = &z_sum[0]; - - VL53L1_histogram_bin_data_t *pzcurrent_avg = pavg_histo_z0; - - uint8_t i = 0; - uint8_t zone_id = 0; - uint8_t final_zone = pdev->zone_cfg.active_zones+1; - - SUPPRESS_UNUSED_WARNING(pxtalk_results); - - - - - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - pz0_sum); - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - pz1_sum); - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - pz2_sum); - VL53L1_init_histogram_bin_data_struct( - 0, - (uint16_t)VL53L1_HISTOGRAM_BUFFER_SIZE, - pz3_sum); - - - - - - if (status == VL53L1_ERROR_NONE) - - status = - VL53L1_init_and_start_range( - Dev, - measurement_mode, - VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); - - - for (i = 0 ; i <= (final_zone*num_of_samples) ; i++) { - - - - - if (status == VL53L1_ERROR_NONE) - status = VL53L1_wait_for_range_completion(Dev); - - - - - - - - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_get_device_results( - Dev, - VL53L1_DEVICERESULTSLEVEL_FULL, - prange_results); - - - - - - - if (status == VL53L1_ERROR_NONE && - pdev->ll_state.rd_device_state != - VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { - - zone_id = pdev->ll_state.rd_zone_id; - prange_data = &(prange_results->VL53L1_PRM_00005[0]); - - - - - - if ((prange_results->active_results > 0) && - (prange_data->median_range_mm < - (int16_t)xtalk_filter_thresh_mm)) { - - - - - switch (zone_id) { - case 0: - pzcurrent_sum = pz0_sum; - break; - case 1: - pzcurrent_sum = pz1_sum; - break; - case 2: - pzcurrent_sum = pz2_sum; - break; - case 3: - pzcurrent_sum = pz3_sum; - break; - case 4: - pzcurrent_sum = pz4_sum; - break; - default: - pzcurrent_sum = pz0_sum; - break; - } - - - - - - - status = VL53L1_sum_histogram_data( - &(pdev->hist_data), - pzcurrent_sum); - - - } - } - - - - - - - - - - - - - - - - - - if (status == VL53L1_ERROR_NONE) - status = VL53L1_wait_for_firmware_ready(Dev); - - - - - - - - - - - - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_clear_interrupt_and_enable_next_range( - Dev, - measurement_mode); - - - } - - - - - - if (status == VL53L1_ERROR_NONE) - status = VL53L1_stop_range(Dev); - - - - - - memcpy(pavg_histo_z0, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); - memcpy(pavg_histo_z1, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); - memcpy(pavg_histo_z2, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); - memcpy(pavg_histo_z3, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); - memcpy(pavg_histo_z4, &(pdev->hist_data), sizeof(VL53L1_histogram_bin_data_t)); - - - - - - pzcurrent_sum = pz0_sum; - - for (i = 0 ; i < (pdev->zone_cfg.active_zones+1) ; i++) { - - switch (i) { - case 0: - pzcurrent_avg = pavg_histo_z0; - break; - case 1: - pzcurrent_avg = pavg_histo_z1; - break; - case 2: - pzcurrent_avg = pavg_histo_z2; - break; - case 3: - pzcurrent_avg = pavg_histo_z3; - break; - case 4: - pzcurrent_avg = pavg_histo_z4; - break; - default: - pzcurrent_avg = pavg_histo_z0; - break; - } - - if (status == VL53L1_ERROR_NONE) { - status = VL53L1_avg_histogram_data( - num_of_samples, - pzcurrent_sum, - pzcurrent_avg); - } - - pzcurrent_sum++; - - } - - - LOG_FUNCTION_END(status); - - return status; - -} - - VL53L1_Error VL53L1_run_offset_calibration( VL53L1_DEV Dev, int16_t cal_distance_mm, @@ -1732,19 +1094,22 @@ VL53L1_Error VL53L1_run_offset_calibration( VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - VL53L1_DevicePresetModes device_preset_modes[VL53L1_MAX_OFFSET_RANGE_RESULTS]; + VL53L1_DevicePresetModes device_preset_modes[ + VL53L1_MAX_OFFSET_RANGE_RESULTS]; VL53L1_range_results_t range_results; VL53L1_range_results_t *prange_results = &range_results; - VL53L1_range_data_t *prange_data = NULL; - VL53L1_offset_range_data_t *poffset = NULL; + VL53L1_range_data_t *pRData = NULL; + VL53L1_offset_range_data_t *pfs = NULL; + VL53L1_general_config_t *pG = &(pdev->gen_cfg); + VL53L1_additional_offset_cal_data_t *pAO = &(pdev->add_off_cal_data); uint8_t i = 0; uint8_t m = 0; uint8_t measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; uint16_t manual_effective_spads = - pdev->gen_cfg.dss_config__manual_effective_spads_select; + pG->dss_config__manual_effective_spads_select; uint8_t num_of_samples[VL53L1_MAX_OFFSET_RANGE_RESULTS]; @@ -1815,19 +1180,19 @@ VL53L1_Error VL53L1_run_offset_calibration( - pdev->offset_results.max_results = VL53L1_MAX_OFFSET_RANGE_RESULTS; + pdev->offset_results.max_results = VL53L1_MAX_OFFSET_RANGE_RESULTS; pdev->offset_results.cal_distance_mm = cal_distance_mm; pdev->offset_results.cal_reflectance_pc = cal_reflectance_pc; - for (m = 0 ; m < VL53L1_MAX_OFFSET_RANGE_RESULTS; m++) { + for (m = 0; m < VL53L1_MAX_OFFSET_RANGE_RESULTS; m++) { - poffset = &(pdev->offset_results.VL53L1_PRM_00005[m]); - poffset->preset_mode = 0; - poffset->no_of_samples = 0; - poffset->effective_spads = 0; - poffset->peak_rate_mcps = 0; - poffset->VL53L1_PRM_00003 = 0; - poffset->median_range_mm = 0; + pfs = &(pdev->offset_results.VL53L1_p_002[m]); + pfs->preset_mode = 0; + pfs->no_of_samples = 0; + pfs->effective_spads = 0; + pfs->peak_rate_mcps = 0; + pfs->VL53L1_p_005 = 0; + pfs->median_range_mm = 0; } @@ -1842,31 +1207,31 @@ VL53L1_Error VL53L1_run_offset_calibration( - for (m = 0 ; m < pdev->offset_results.active_results ; m++) { + for (m = 0; m < pdev->offset_results.active_results; m++) { - poffset = &(pdev->offset_results.VL53L1_PRM_00005[m]); + pfs = &(pdev->offset_results.VL53L1_p_002[m]); - poffset->preset_mode = device_preset_modes[m]; + pfs->preset_mode = device_preset_modes[m]; if (status == VL53L1_ERROR_NONE) status = - VL53L1_set_preset_mode( - Dev, - device_preset_modes[m], + VL53L1_set_preset_mode( + Dev, + device_preset_modes[m], - pdev->offsetcal_cfg.dss_config__target_total_rate_mcps, - pdev->offsetcal_cfg.phasecal_config_timeout_us, - pdev->offsetcal_cfg.mm_config_timeout_us, - pdev->offsetcal_cfg.range_config_timeout_us, + pdev->offsetcal_cfg.dss_config__target_total_rate_mcps, + pdev->offsetcal_cfg.phasecal_config_timeout_us, + pdev->offsetcal_cfg.mm_config_timeout_us, + pdev->offsetcal_cfg.range_config_timeout_us, - 100); + 100); - pdev->gen_cfg.dss_config__manual_effective_spads_select = + pG->dss_config__manual_effective_spads_select = manual_effective_spads; @@ -1874,12 +1239,12 @@ VL53L1_Error VL53L1_run_offset_calibration( if (status == VL53L1_ERROR_NONE) status = - VL53L1_init_and_start_range( - Dev, - measurement_mode, - VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); + VL53L1_init_and_start_range( + Dev, + measurement_mode, + VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); - for (i = 0 ; i <= (num_of_samples[m]+2) ; i++) { + for (i = 0; i <= (num_of_samples[m]+2); i++) { @@ -1910,29 +1275,28 @@ VL53L1_Error VL53L1_run_offset_calibration( - prange_data = &(prange_results->VL53L1_PRM_00005[0]); + pRData = &(prange_results->VL53L1_p_002[0]); - if (prange_results->active_results > 0 && - prange_results->stream_count > 1) { + if ((prange_results->active_results > 0 && + prange_results->stream_count > 1) && + (pRData->range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE)) { - if (prange_data->range_status == - VL53L1_DEVICEERROR_RANGECOMPLETE) { + pfs->no_of_samples++; + pfs->effective_spads += + (uint32_t)pRData->VL53L1_p_006; + pfs->peak_rate_mcps += + (uint32_t)pRData->peak_signal_count_rate_mcps; + pfs->VL53L1_p_005 += + (uint32_t)pRData->VL53L1_p_005; + pfs->median_range_mm += + (int32_t)pRData->median_range_mm; - poffset->no_of_samples++; - poffset->effective_spads += - (uint32_t)prange_data->VL53L1_PRM_00004; - poffset->peak_rate_mcps += - (uint32_t)prange_data->peak_signal_count_rate_mcps; - poffset->VL53L1_PRM_00003 += - (uint32_t)prange_data->VL53L1_PRM_00003; - poffset->median_range_mm += - (int32_t)prange_data->median_range_mm; + pfs->dss_config__roi_mode_control = + pG->dss_config__roi_mode_control; + pfs->dss_config__manual_effective_spads_select = + pG->dss_config__manual_effective_spads_select; - poffset->dss_config__roi_mode_control = - pdev->gen_cfg.dss_config__roi_mode_control; - poffset->dss_config__manual_effective_spads_select = - pdev->gen_cfg.dss_config__manual_effective_spads_select; - } } @@ -1958,9 +1322,9 @@ VL53L1_Error VL53L1_run_offset_calibration( if (status == VL53L1_ERROR_NONE) status = - VL53L1_clear_interrupt_and_enable_next_range( - Dev, - measurement_mode); + VL53L1_clear_interrupt_and_enable_next_range( + Dev, + measurement_mode); } @@ -1977,29 +1341,29 @@ VL53L1_Error VL53L1_run_offset_calibration( - if (poffset->no_of_samples > 0) { + if (pfs->no_of_samples > 0) { - poffset->effective_spads += (poffset->no_of_samples/2); - poffset->effective_spads /= poffset->no_of_samples; + pfs->effective_spads += (pfs->no_of_samples/2); + pfs->effective_spads /= pfs->no_of_samples; - poffset->peak_rate_mcps += (poffset->no_of_samples/2); - poffset->peak_rate_mcps /= poffset->no_of_samples; + pfs->peak_rate_mcps += (pfs->no_of_samples/2); + pfs->peak_rate_mcps /= pfs->no_of_samples; - poffset->VL53L1_PRM_00003 += (poffset->no_of_samples/2); - poffset->VL53L1_PRM_00003 /= poffset->no_of_samples; + pfs->VL53L1_p_005 += (pfs->no_of_samples/2); + pfs->VL53L1_p_005 /= pfs->no_of_samples; - poffset->median_range_mm += (poffset->no_of_samples/2); - poffset->median_range_mm /= poffset->no_of_samples; + pfs->median_range_mm += (pfs->no_of_samples/2); + pfs->median_range_mm /= pfs->no_of_samples; - poffset->range_mm_offset = (int32_t)cal_distance_mm; - poffset->range_mm_offset -= poffset->median_range_mm; + pfs->range_mm_offset = (int32_t)cal_distance_mm; + pfs->range_mm_offset -= pfs->median_range_mm; - if (poffset->preset_mode == + if (pfs->preset_mode == VL53L1_DEVICEPRESETMODE_STANDARD_RANGING) manual_effective_spads = - (uint16_t)poffset->effective_spads; + (uint16_t)pfs->effective_spads; } } @@ -2014,33 +1378,33 @@ VL53L1_Error VL53L1_run_offset_calibration( pdev->customer.mm_config__inner_offset_mm += - (int16_t)pdev->offset_results.VL53L1_PRM_00005[0].range_mm_offset; + (int16_t)pdev->offset_results.VL53L1_p_002[0].range_mm_offset; pdev->customer.mm_config__outer_offset_mm += - (int16_t)pdev->offset_results.VL53L1_PRM_00005[0].range_mm_offset; + (int16_t)pdev->offset_results.VL53L1_p_002[0].range_mm_offset; break; default: pdev->customer.mm_config__inner_offset_mm = - (int16_t)pdev->offset_results.VL53L1_PRM_00005[1].range_mm_offset; + (int16_t)pdev->offset_results.VL53L1_p_002[1].range_mm_offset; pdev->customer.mm_config__outer_offset_mm = - (int16_t)pdev->offset_results.VL53L1_PRM_00005[2].range_mm_offset; + (int16_t)pdev->offset_results.VL53L1_p_002[2].range_mm_offset; pdev->customer.algo__part_to_part_range_offset_mm = 0; - pdev->add_off_cal_data.result__mm_inner_actual_effective_spads = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[1].effective_spads; - pdev->add_off_cal_data.result__mm_outer_actual_effective_spads = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[2].effective_spads; + pAO->result__mm_inner_actual_effective_spads = + (uint16_t)pdev->offset_results.VL53L1_p_002[1].effective_spads; + pAO->result__mm_outer_actual_effective_spads = + (uint16_t)pdev->offset_results.VL53L1_p_002[2].effective_spads; - pdev->add_off_cal_data.result__mm_inner_peak_signal_count_rtn_mcps = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[1].peak_rate_mcps; - pdev->add_off_cal_data.result__mm_outer_peak_signal_count_rtn_mcps = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[2].peak_rate_mcps; + pAO->result__mm_inner_peak_signal_count_rtn_mcps = + (uint16_t)pdev->offset_results.VL53L1_p_002[1].peak_rate_mcps; + pAO->result__mm_outer_peak_signal_count_rtn_mcps = + (uint16_t)pdev->offset_results.VL53L1_p_002[2].peak_rate_mcps; break; } @@ -2051,12 +1415,10 @@ VL53L1_Error VL53L1_run_offset_calibration( - - pdev->cust_dmax_cal.ref__actual_effective_spads = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[0].effective_spads; + (uint16_t)pdev->offset_results.VL53L1_p_002[0].effective_spads; pdev->cust_dmax_cal.ref__peak_signal_count_rate_mcps = - (uint16_t)pdev->offset_results.VL53L1_PRM_00005[0].peak_rate_mcps; + (uint16_t)pdev->offset_results.VL53L1_p_002[0].peak_rate_mcps; @@ -2091,38 +1453,43 @@ VL53L1_Error VL53L1_run_offset_calibration( - for (m = 0 ; m < pdev->offset_results.active_results ; m++) { + for (m = 0; m < pdev->offset_results.active_results; m++) { - poffset = &(pdev->offset_results.VL53L1_PRM_00005[m]); + pfs = &(pdev->offset_results.VL53L1_p_002[m]); if (status == VL53L1_ERROR_NONE) { pdev->offset_results.cal_report = m; - if (poffset->no_of_samples < num_of_samples[m]) - status = VL53L1_WARNING_OFFSET_CAL_MISSING_SAMPLES; + if (pfs->no_of_samples < num_of_samples[m]) + status = + VL53L1_WARNING_OFFSET_CAL_MISSING_SAMPLES; - if (m == 0 && poffset->VL53L1_PRM_00003 > - ((uint32_t)VL53L1_OFFSET_CAL_MAX_SIGMA_MM<<5)) - status = VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH; + if (m == 0 && pfs->VL53L1_p_005 > + ((uint32_t)VL53L1_OFFSET_CAL_MAX_SIGMA_MM << 5)) + status = + VL53L1_WARNING_OFFSET_CAL_SIGMA_TOO_HIGH; - if (poffset->peak_rate_mcps > + if (pfs->peak_rate_mcps > VL53L1_OFFSET_CAL_MAX_PRE_PEAK_RATE_MCPS) - status = VL53L1_WARNING_OFFSET_CAL_RATE_TOO_HIGH; + status = + VL53L1_WARNING_OFFSET_CAL_RATE_TOO_HIGH; - if (poffset->dss_config__manual_effective_spads_select < + if (pfs->dss_config__manual_effective_spads_select < VL53L1_OFFSET_CAL_MIN_EFFECTIVE_SPADS) - status = VL53L1_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW; + status = + VL53L1_WARNING_OFFSET_CAL_SPAD_COUNT_TOO_LOW; - if (poffset->dss_config__manual_effective_spads_select == 0) - status = VL53L1_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL; + if (pfs->dss_config__manual_effective_spads_select == 0) + status = + VL53L1_ERROR_OFFSET_CAL_NO_SPADS_ENABLED_FAIL; - if (poffset->no_of_samples == 0) + if (pfs->no_of_samples == 0) status = VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL; } } @@ -2219,26 +1586,26 @@ VL53L1_Error VL53L1_run_phasecal_average( uint32_t samples = 0; uint32_t period = 0; - uint32_t VL53L1_PRM_00016 = 0; + uint32_t VL53L1_p_017 = 0; uint32_t phasecal_result__reference_phase = 0; uint32_t zero_distance_phase = 0; - for (m = 0 ; m < phasecal_num_of_samples ; m++) { + for (m = 0; m < phasecal_num_of_samples; m++) { if (status == VL53L1_ERROR_NONE) status = - VL53L1_init_and_start_range( - Dev, - measurement_mode, - VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); + VL53L1_init_and_start_range( + Dev, + measurement_mode, + VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); - for (i = 0 ; i <= 1 ; i++) { + for (i = 0; i <= 1; i++) { @@ -2279,9 +1646,9 @@ VL53L1_Error VL53L1_run_phasecal_average( if (status == VL53L1_ERROR_NONE) status = - VL53L1_clear_interrupt_and_enable_next_range( - Dev, - measurement_mode); + VL53L1_clear_interrupt_and_enable_next_range( + Dev, + measurement_mode); } @@ -2311,23 +1678,23 @@ VL53L1_Error VL53L1_run_phasecal_average( period = 2048 * (uint32_t)VL53L1_decode_vcsel_period( - pdev->hist_data.VL53L1_PRM_00008); + pdev->hist_data.VL53L1_p_009); - VL53L1_PRM_00016 = period; - VL53L1_PRM_00016 += - (uint32_t)pdev->hist_data.phasecal_result__reference_phase; - VL53L1_PRM_00016 += + VL53L1_p_017 = period; + VL53L1_p_017 += (uint32_t)( + pdev->hist_data.phasecal_result__reference_phase); + VL53L1_p_017 += (2048 * (uint32_t)phasecal_result__vcsel_start); - VL53L1_PRM_00016 -= - (2048 * (uint32_t)pdev->hist_data.cal_config__vcsel_start); + VL53L1_p_017 -= (2048 * + (uint32_t)pdev->hist_data.cal_config__vcsel_start); - VL53L1_PRM_00016 = VL53L1_PRM_00016 % period; + VL53L1_p_017 = VL53L1_p_017 % period; - phasecal_result__reference_phase += - (uint32_t)pdev->hist_data.phasecal_result__reference_phase; + phasecal_result__reference_phase += (uint32_t)( + pdev->hist_data.phasecal_result__reference_phase); - zero_distance_phase += (uint32_t)VL53L1_PRM_00016; + zero_distance_phase += (uint32_t)VL53L1_p_017; } } @@ -2387,7 +1754,7 @@ VL53L1_Error VL53L1_run_zone_calibration( VL53L1DevStructGetLLResultsHandle(Dev); VL53L1_range_results_t range_results; - VL53L1_range_results_t *prange_results = &range_results; + VL53L1_range_results_t *pRR = &range_results; VL53L1_range_data_t *prange_data = NULL; VL53L1_zone_calibration_data_t *pzone_data = NULL; @@ -2409,17 +1776,17 @@ VL53L1_Error VL53L1_run_zone_calibration( if (status == VL53L1_ERROR_NONE) status = VL53L1_set_preset_mode( - Dev, - device_preset_mode, + Dev, + device_preset_mode, - pdev->zonecal_cfg.dss_config__target_total_rate_mcps, - pdev->zonecal_cfg.phasecal_config_timeout_us, - pdev->zonecal_cfg.mm_config_timeout_us, - pdev->zonecal_cfg.range_config_timeout_us, + pdev->zonecal_cfg.dss_config__target_total_rate_mcps, + pdev->zonecal_cfg.phasecal_config_timeout_us, + pdev->zonecal_cfg.mm_config_timeout_us, + pdev->zonecal_cfg.range_config_timeout_us, - 100); + 100); @@ -2455,15 +1822,15 @@ VL53L1_Error VL53L1_run_zone_calibration( pres->zone_cal.max_zones = VL53L1_MAX_USER_ZONES; pres->zone_cal.active_zones = pdev->zone_cfg.active_zones + 1; - for (i = 0 ; i < VL53L1_MAX_USER_ZONES ; i++) { - pres->zone_cal.VL53L1_PRM_00005[i].no_of_samples = 0; - pres->zone_cal.VL53L1_PRM_00005[i].effective_spads = 0; - pres->zone_cal.VL53L1_PRM_00005[i].peak_rate_mcps = 0; - pres->zone_cal.VL53L1_PRM_00005[i].VL53L1_PRM_00013 = 0; - pres->zone_cal.VL53L1_PRM_00005[i].VL53L1_PRM_00003 = 0; - pres->zone_cal.VL53L1_PRM_00005[i].median_range_mm = 0; - pres->zone_cal.VL53L1_PRM_00005[i].range_mm_offset = 0; - } + for (i = 0; i < VL53L1_MAX_USER_ZONES; i++) { + pres->zone_cal.VL53L1_p_002[i].no_of_samples = 0; + pres->zone_cal.VL53L1_p_002[i].effective_spads = 0; + pres->zone_cal.VL53L1_p_002[i].peak_rate_mcps = 0; + pres->zone_cal.VL53L1_p_002[i].VL53L1_p_014 = 0; + pres->zone_cal.VL53L1_p_002[i].VL53L1_p_005 = 0; + pres->zone_cal.VL53L1_p_002[i].median_range_mm = 0; + pres->zone_cal.VL53L1_p_002[i].range_mm_offset = 0; + } pres->zone_cal.phasecal_result__reference_phase = 0; pres->zone_cal.zero_distance_phase = 0; @@ -2500,11 +1867,12 @@ VL53L1_Error VL53L1_run_zone_calibration( - m = (pdev->zonecal_cfg.zone_num_of_samples + 2) * (uint16_t)pres->zone_cal.active_zones; + m = (pdev->zonecal_cfg.zone_num_of_samples + 2) * + (uint16_t)pres->zone_cal.active_zones; - for (i = 0 ; i <= m ; i++) { + for (i = 0; i <= m; i++) { @@ -2525,7 +1893,7 @@ VL53L1_Error VL53L1_run_zone_calibration( VL53L1_get_device_results( Dev, VL53L1_DEVICERESULTSLEVEL_FULL, - prange_results); + pRR); @@ -2535,31 +1903,34 @@ VL53L1_Error VL53L1_run_zone_calibration( - prange_data = &(prange_results->VL53L1_PRM_00005[0]); + prange_data = &(pRR->VL53L1_p_002[0]); - if (prange_results->active_results > 0 && + if (pRR->active_results > 0 && i > (uint16_t)pres->zone_cal.active_zones) { if (prange_data->range_status == VL53L1_DEVICEERROR_RANGECOMPLETE) { - pres->zone_cal.phasecal_result__reference_phase = - pdev->hist_data.phasecal_result__reference_phase; + pres->zone_cal.phasecal_result__reference_phase + = + pdev->hist_data.phasecal_result__reference_phase + ; pres->zone_cal.zero_distance_phase = - pdev->hist_data.zero_distance_phase; + pdev->hist_data.zero_distance_phase; - pzone_data = &(pres->zone_cal.VL53L1_PRM_00005[prange_results->zone_id]); + pzone_data = + &(pres->zone_cal.VL53L1_p_002[pRR->zone_id]); pzone_data->no_of_samples++; pzone_data->effective_spads += - (uint32_t)prange_data->VL53L1_PRM_00004; - pzone_data->peak_rate_mcps += - (uint32_t)prange_data->peak_signal_count_rate_mcps; - pzone_data->VL53L1_PRM_00013 += - (uint32_t)prange_data->VL53L1_PRM_00013; - pzone_data->VL53L1_PRM_00003 += - (uint32_t)prange_data->VL53L1_PRM_00003; + (uint32_t)prange_data->VL53L1_p_006; + pzone_data->peak_rate_mcps += (uint32_t)( + prange_data->peak_signal_count_rate_mcps); + pzone_data->VL53L1_p_014 += + (uint32_t)prange_data->VL53L1_p_014; + pzone_data->VL53L1_p_005 += + (uint32_t)prange_data->VL53L1_p_005; pzone_data->median_range_mm += - (int32_t)prange_data->median_range_mm; + (int32_t)prange_data->median_range_mm; } } @@ -2608,17 +1979,17 @@ VL53L1_Error VL53L1_run_zone_calibration( if (status == VL53L1_ERROR_NONE) status = VL53L1_run_phasecal_average( - Dev, - measurement_mode, - pdev->hist_data.phasecal_result__vcsel_start, + Dev, + measurement_mode, + pdev->hist_data.phasecal_result__vcsel_start, - pdev->zonecal_cfg.phasecal_num_of_samples, + pdev->zonecal_cfg.phasecal_num_of_samples, - prange_results, - &(pres->zone_cal.phasecal_result__reference_phase), - &(pres->zone_cal.zero_distance_phase)); + pRR, + &(pres->zone_cal.phasecal_result__reference_phase), + &(pres->zone_cal.zero_distance_phase)); @@ -2634,25 +2005,33 @@ VL53L1_Error VL53L1_run_zone_calibration( if (status == VL53L1_ERROR_NONE) { - for (z = 0 ; z < pres->zone_cal.active_zones ; z++) { + for (z = 0; z < pres->zone_cal.active_zones; z++) { - pzone_data = &(pres->zone_cal.VL53L1_PRM_00005[z]); + pzone_data = &(pres->zone_cal.VL53L1_p_002[z]); if (pzone_data->no_of_samples > 0) { - pzone_data->effective_spads += (pzone_data->no_of_samples/2); - pzone_data->effective_spads /= pzone_data->no_of_samples; + pzone_data->effective_spads += + (pzone_data->no_of_samples/2); + pzone_data->effective_spads /= + pzone_data->no_of_samples; - pzone_data->peak_rate_mcps += (pzone_data->no_of_samples/2); - pzone_data->peak_rate_mcps /= pzone_data->no_of_samples; + pzone_data->peak_rate_mcps += + (pzone_data->no_of_samples/2); + pzone_data->peak_rate_mcps /= + pzone_data->no_of_samples; - pzone_data->VL53L1_PRM_00013 += (pzone_data->no_of_samples/2); - pzone_data->VL53L1_PRM_00013 /= pzone_data->no_of_samples; + pzone_data->VL53L1_p_014 += + (pzone_data->no_of_samples/2); + pzone_data->VL53L1_p_014 /= + pzone_data->no_of_samples; - pzone_data->VL53L1_PRM_00003 += (pzone_data->no_of_samples/2); - pzone_data->VL53L1_PRM_00003 /= pzone_data->no_of_samples; + pzone_data->VL53L1_p_005 += + (pzone_data->no_of_samples/2); + pzone_data->VL53L1_p_005 /= + pzone_data->no_of_samples; @@ -2661,34 +2040,41 @@ VL53L1_Error VL53L1_run_zone_calibration( pzone_data->median_range_mm = - VL53L1_range_maths( - pdev->stat_nvm.osc_measured__fast_osc__frequency, - (uint16_t)pzone_data->VL53L1_PRM_00013, - pres->zone_cal.zero_distance_phase, - 2, + VL53L1_range_maths( + pdev->stat_nvm.osc_measured__fast_osc__frequency + , (uint16_t)pzone_data->VL53L1_p_014, + pres->zone_cal.zero_distance_phase, + 2, - 0x0800, + 0x0800, - 0); + 0); - pzone_data->range_mm_offset = ((int32_t)cal_distance_mm) * 4; - pzone_data->range_mm_offset -= pzone_data->median_range_mm; + pzone_data->range_mm_offset = + ((int32_t)cal_distance_mm) * 4; + pzone_data->range_mm_offset -= + pzone_data->median_range_mm; - if (pzone_data->no_of_samples < pdev->zonecal_cfg.zone_num_of_samples) - status = VL53L1_WARNING_ZONE_CAL_MISSING_SAMPLES; + if (pzone_data->no_of_samples < + pdev->zonecal_cfg.zone_num_of_samples) + status = + VL53L1_WARNING_ZONE_CAL_MISSING_SAMPLES; - if (pzone_data->VL53L1_PRM_00003 > - ((uint32_t)VL53L1_ZONE_CAL_MAX_SIGMA_MM<<5)) - status = VL53L1_WARNING_ZONE_CAL_SIGMA_TOO_HIGH; + if (pzone_data->VL53L1_p_005 > + ((uint32_t)VL53L1_ZONE_CAL_MAX_SIGMA_MM + << 5)) + status = + VL53L1_WARNING_ZONE_CAL_SIGMA_TOO_HIGH; if (pzone_data->peak_rate_mcps > VL53L1_ZONE_CAL_MAX_PRE_PEAK_RATE_MCPS) - status = VL53L1_WARNING_ZONE_CAL_RATE_TOO_HIGH; + status = + VL53L1_WARNING_ZONE_CAL_RATE_TOO_HIGH; } else { status = VL53L1_ERROR_ZONE_CAL_NO_SAMPLE_FAIL; @@ -2745,7 +2131,7 @@ VL53L1_Error VL53L1_run_spad_rate_map( VL53L1_DeviceTestMode device_test_mode, VL53L1_DeviceSscArray array_select, uint32_t ssc_config_timeout_us, - VL53L1_spad_rate_data_t *pspad_rate_data) + VL53L1_spad_rate_data_t *pspad_rate_data) { @@ -2776,10 +2162,10 @@ VL53L1_Error VL53L1_run_spad_rate_map( pdev->ssc_cfg.array_select = array_select; pdev->ssc_cfg.timeout_us = ssc_config_timeout_us; status = - VL53L1_set_ssc_config( - Dev, - &(pdev->ssc_cfg), - pdev->stat_nvm.osc_measured__fast_osc__frequency); + VL53L1_set_ssc_config( + Dev, + &(pdev->ssc_cfg), + pdev->stat_nvm.osc_measured__fast_osc__frequency); } @@ -2798,7 +2184,7 @@ VL53L1_Error VL53L1_run_spad_rate_map( - if (status == VL53L1_ERROR_NONE) + if (status == VL53L1_ERROR_NONE) status = VL53L1_get_spad_rate_data( Dev, @@ -2819,7 +2205,7 @@ VL53L1_Error VL53L1_run_spad_rate_map( - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) { VL53L1_print_spad_rate_data( pspad_rate_data, "run_spad_rate_map():", @@ -2828,7 +2214,7 @@ VL53L1_Error VL53L1_run_spad_rate_map( pspad_rate_data, "run_spad_rate_map():", VL53L1_TRACE_MODULE_SPAD_RATE_MAP); - } + } #endif LOG_FUNCTION_END(status); @@ -2911,12 +2297,12 @@ VL53L1_Error VL53L1_run_device_test( if (status == VL53L1_ERROR_NONE) { trace_print( - VL53L1_TRACE_LEVEL_INFO, - " Device Test Complete:\n\t%-32s = %3u\n\t%-32s = %3u\n", - "result__range_status", - pdev->sys_results.result__range_status, - "result__report_status", - pdev->sys_results.result__report_status); + VL53L1_TRACE_LEVEL_INFO, + " Device Test Complete:\n\t%-32s = %3u\n\t%-32s = %3u\n", + "result__range_status", + pdev->sys_results.result__range_status, + "result__report_status", + pdev->sys_results.result__report_status); @@ -2945,3 +2331,435 @@ VL53L1_Error VL53L1_run_device_test( } +void VL53L1_hist_xtalk_extract_data_init( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data) +{ + + + + + + int32_t lb = 0; + + pxtalk_data->sample_count = 0U; + pxtalk_data->pll_period_mm = 0U; + pxtalk_data->peak_duration_us_sum = 0U; + pxtalk_data->effective_spad_count_sum = 0U; + pxtalk_data->zero_distance_phase_sum = 0U; + pxtalk_data->zero_distance_phase_avg = 0U; + pxtalk_data->event_scaler_sum = 0U; + pxtalk_data->event_scaler_avg = 4096U; + pxtalk_data->signal_events_sum = 0; + pxtalk_data->xtalk_rate_kcps_per_spad = 0U; + pxtalk_data->VL53L1_p_015 = 0U; + pxtalk_data->VL53L1_p_016 = 0U; + pxtalk_data->target_start = 0U; + + for (lb = 0; lb < VL53L1_XTALK_HISTO_BINS; lb++) + pxtalk_data->bin_data_sums[lb] = 0; + +} + + +VL53L1_Error VL53L1_hist_xtalk_extract_update( + int16_t target_distance_mm, + uint16_t target_width_oversize, + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data) +{ + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + LOG_FUNCTION_START(""); + + status = + VL53L1_hist_xtalk_extract_calc_window( + target_distance_mm, + target_width_oversize, + phist_bins, + pxtalk_data); + + if (status == VL53L1_ERROR_NONE) { + status = + VL53L1_hist_xtalk_extract_calc_event_sums( + phist_bins, + pxtalk_data); + } + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_hist_xtalk_extract_fini( + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data, + VL53L1_xtalk_calibration_results_t *pxtalk_cal, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape) +{ + + + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + VL53L1_xtalk_calibration_results_t *pX = pxtalk_cal; + + LOG_FUNCTION_START(""); + + if (pxtalk_data->sample_count > 0) { + + + + pxtalk_data->event_scaler_avg = pxtalk_data->event_scaler_sum; + pxtalk_data->event_scaler_avg += + (pxtalk_data->sample_count >> 1); + pxtalk_data->event_scaler_avg /= pxtalk_data->sample_count; + + + + + + + status = + VL53L1_hist_xtalk_extract_calc_rate_per_spad( + pxtalk_data); + + + + + + + if (status == VL53L1_ERROR_NONE) { + + + + pxtalk_data->zero_distance_phase_avg = + pxtalk_data->zero_distance_phase_sum; + pxtalk_data->zero_distance_phase_avg += + (pxtalk_data->sample_count >> 1); + pxtalk_data->zero_distance_phase_avg /= + pxtalk_data->sample_count; + + + + status = + VL53L1_hist_xtalk_extract_calc_shape( + pxtalk_data, + pxtalk_shape); + + + + + + + + + + + + pxtalk_shape->phasecal_result__vcsel_start = + phist_bins->phasecal_result__vcsel_start; + pxtalk_shape->cal_config__vcsel_start = + phist_bins->cal_config__vcsel_start; + pxtalk_shape->vcsel_width = + phist_bins->vcsel_width; + pxtalk_shape->VL53L1_p_019 = + phist_bins->VL53L1_p_019; + } + + + + + + + if (status == VL53L1_ERROR_NONE) { + + + + pX->algo__crosstalk_compensation_plane_offset_kcps = + pxtalk_data->xtalk_rate_kcps_per_spad; + pX->algo__crosstalk_compensation_x_plane_gradient_kcps + = 0U; + pX->algo__crosstalk_compensation_y_plane_gradient_kcps + = 0U; + + } + } + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_run_hist_xtalk_extraction( + VL53L1_DEV Dev, + int16_t cal_distance_mm, + VL53L1_Error *pcal_status) +{ + + + + + + + + + + + + + + + + + + + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + VL53L1_LLDriverData_t *pdev = + VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_xtalkextract_config_t *pX = &(pdev->xtalk_extract_cfg); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_xtalk_calibration_results_t *pXC = &(pdev->xtalk_cal); + + + + + + + uint8_t smudge_corr_en = 0; + uint8_t i = 0; + uint8_t measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; + + + + + VL53L1_range_results_t range_results; + VL53L1_range_results_t *prange_results = &range_results; + + LOG_FUNCTION_START(""); + + + + + VL53L1_hist_xtalk_extract_data_init( + &(pdev->xtalk_extract)); + + + + + + + + + + + + if (status == VL53L1_ERROR_NONE) + + status = + VL53L1_set_preset_mode( + Dev, + VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE, + pX->dss_config__target_total_rate_mcps, + pX->phasecal_config_timeout_us, + pX->mm_config_timeout_us, + pX->range_config_timeout_us, + 100); + + + + + if (status == VL53L1_ERROR_NONE) { + status = VL53L1_disable_xtalk_compensation( + Dev); + } + + + + + smudge_corr_en = pdev->smudge_correct_config.smudge_corr_enabled; + + if (status == VL53L1_ERROR_NONE) { + status = + VL53L1_dynamic_xtalk_correction_disable(Dev); + } + + + + + if (status == VL53L1_ERROR_NONE) + + status = + VL53L1_init_and_start_range( + Dev, + measurement_mode, + VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS); + + + + + for (i = 0; i <= pX->num_of_samples; i++) { + + + + + if (status == VL53L1_ERROR_NONE) + status = VL53L1_wait_for_range_completion(Dev); + + + + + + + + if (status == VL53L1_ERROR_NONE) + status = + VL53L1_get_device_results( + Dev, + VL53L1_DEVICERESULTSLEVEL_FULL, + prange_results); + + + + + + + if (status == VL53L1_ERROR_NONE && + pdev->ll_state.rd_device_state != + VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { + + status = + VL53L1_hist_xtalk_extract_update( + cal_distance_mm, + 4, + + &(pdev->hist_data), + &(pdev->xtalk_extract)); + } + + + + + + + + if (status == VL53L1_ERROR_NONE) + status = VL53L1_wait_for_firmware_ready(Dev); + + + + + + + + + + + + if (status == VL53L1_ERROR_NONE) + status = + VL53L1_clear_interrupt_and_enable_next_range( + Dev, + measurement_mode); + } + + + + + if (status == VL53L1_ERROR_NONE) + status = VL53L1_stop_range(Dev); + + + + + + + + if (status == VL53L1_ERROR_NONE) + status = + VL53L1_hist_xtalk_extract_fini( + &(pdev->hist_data), + &(pdev->xtalk_extract), + &(pdev->xtalk_cal), + &(pdev->xtalk_shapes.xtalk_shape)); + + + + + + if (status == VL53L1_ERROR_NONE) { + pC->algo__crosstalk_compensation_x_plane_gradient_kcps = + pXC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pC->algo__crosstalk_compensation_y_plane_gradient_kcps = + pXC->algo__crosstalk_compensation_y_plane_gradient_kcps; + pC->algo__crosstalk_compensation_plane_offset_kcps = + pXC->algo__crosstalk_compensation_plane_offset_kcps; + } + + + + + if (status == VL53L1_ERROR_NONE) + status = VL53L1_enable_xtalk_compensation(Dev); + + + + + + if (status == VL53L1_ERROR_NONE) + if (smudge_corr_en == 1) + status = VL53L1_dynamic_xtalk_correction_enable(Dev); + + + + + + + pdev->xtalk_results.cal_status = status; + *pcal_status = pdev->xtalk_results.cal_status; + + +#ifdef VL53L1_LOG_ENABLE + + + + + VL53L1_print_customer_nvm_managed( + &(pdev->customer), + "run_xtalk_extraction():pdev->lldata.customer.", + VL53L1_TRACE_MODULE_XTALK_DATA); + + VL53L1_print_xtalk_config( + &(pdev->xtalk_cfg), + "run_xtalk_extraction():pdev->lldata.xtalk_cfg.", + VL53L1_TRACE_MODULE_XTALK_DATA); + + VL53L1_print_xtalk_histogram_data( + &(pdev->xtalk_shapes), + "pdev->lldata.xtalk_shapes.", + VL53L1_TRACE_MODULE_XTALK_DATA); + +#endif + + LOG_FUNCTION_END(status); + + return status; +} + diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api_core.c b/drivers/input/misc/vl53L1/src/vl53l1_api_core.c index a297b01b59b6..9697ecec82c1 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api_core.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api_core.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -221,11 +221,11 @@ VL53L1_Error VL53L1_data_init( pres->zone_results.max_zones = VL53L1_MAX_USER_ZONES; pres->zone_results.active_zones = 0; - for (i = 0 ; i < VL53L1_MAX_USER_ZONES ; i++) { - pobjects = &(pres->zone_results.VL53L1_PRM_00005[i]); - pobjects->xmonitor.VL53L1_PRM_00017 = 0; - pobjects->xmonitor.VL53L1_PRM_00018 = 0; - pobjects->xmonitor.VL53L1_PRM_00013 = 0; + for (i = 0; i < VL53L1_MAX_USER_ZONES; i++) { + pobjects = &(pres->zone_results.VL53L1_p_002[i]); + pobjects->xmonitor.VL53L1_p_020 = 0; + pobjects->xmonitor.VL53L1_p_021 = 0; + pobjects->xmonitor.VL53L1_p_014 = 0; pobjects->xmonitor.range_status = VL53L1_DEVICEERROR_NOUPDATE; } @@ -241,16 +241,16 @@ VL53L1_Error VL53L1_data_init( pres->zone_cal.max_zones = VL53L1_MAX_USER_ZONES; pres->zone_cal.active_zones = 0; - for (i = 0 ; i < VL53L1_MAX_USER_ZONES ; i++) { - pres->zone_cal.VL53L1_PRM_00005[i].no_of_samples = 0; - pres->zone_cal.VL53L1_PRM_00005[i].effective_spads = 0; - pres->zone_cal.VL53L1_PRM_00005[i].peak_rate_mcps = 0; - pres->zone_cal.VL53L1_PRM_00005[i].median_range_mm = 0; - pres->zone_cal.VL53L1_PRM_00005[i].range_mm_offset = 0; - } + for (i = 0; i < VL53L1_MAX_USER_ZONES; i++) { + pres->zone_cal.VL53L1_p_002[i].no_of_samples = 0; + pres->zone_cal.VL53L1_p_002[i].effective_spads = 0; + pres->zone_cal.VL53L1_p_002[i].peak_rate_mcps = 0; + pres->zone_cal.VL53L1_p_002[i].median_range_mm = 0; + pres->zone_cal.VL53L1_p_002[i].range_mm_offset = 0; + } pdev->wait_method = VL53L1_WAIT_METHOD_BLOCKING; - pdev->preset_mode = VL53L1_DEVICEPRESETMODE_STANDARD_RANGING; + pdev->preset_mode = VL53L1_DEVICEPRESETMODE_STANDARD_RANGING; pdev->zone_preset = VL53L1_DEVICEZONEPRESET_NONE; pdev->measurement_mode = VL53L1_DEVICEMEASUREMENTMODE_STOP; @@ -297,68 +297,69 @@ VL53L1_Error VL53L1_data_init( if (read_p2p_data > 0 && status == VL53L1_ERROR_NONE) - status = VL53L1_read_p2p_data(Dev); + status = VL53L1_read_p2p_data(Dev); - status = - VL53L1_init_refspadchar_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_refspadchar_config_struct( &(pdev->refspadchar)); - status = - VL53L1_init_ssc_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_ssc_config_struct( &(pdev->ssc_cfg)); - status = - VL53L1_init_xtalk_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_xtalk_config_struct( &(pdev->customer), &(pdev->xtalk_cfg)); - status = - VL53L1_init_xtalk_extract_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_xtalk_extract_config_struct( &(pdev->xtalk_extract_cfg)); - status = - VL53L1_init_offset_cal_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_offset_cal_config_struct( &(pdev->offsetcal_cfg)); - status = VL53L1_init_zone_cal_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_zone_cal_config_struct( &(pdev->zonecal_cfg)); - status = - VL53L1_init_hist_post_process_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_hist_post_process_config_struct( pdev->xtalk_cfg.global_crosstalk_compensation_enable, &(pdev->histpostprocess)); - status = - VL53L1_init_hist_gen3_dmax_config_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_hist_gen3_dmax_config_struct( &(pdev->dmax_cfg)); - status = - VL53L1_init_tuning_parm_storage_struct( + if (status == VL53L1_ERROR_NONE) + status = VL53L1_init_tuning_parm_storage_struct( &(pdev->tuning_parms)); @@ -369,14 +370,14 @@ VL53L1_Error VL53L1_data_init( if (status == VL53L1_ERROR_NONE) status = VL53L1_set_preset_mode( - Dev, - pdev->preset_mode, - pdev->dss_config__target_total_rate_mcps, + Dev, + pdev->preset_mode, + pdev->dss_config__target_total_rate_mcps, - pdev->phasecal_config_timeout_us, - pdev->mm_config_timeout_us, - pdev->range_config_timeout_us, - pdev->inter_measurement_period_ms); + pdev->phasecal_config_timeout_us, + pdev->mm_config_timeout_us, + pdev->range_config_timeout_us, + pdev->inter_measurement_period_ms); @@ -409,7 +410,7 @@ VL53L1_Error VL53L1_data_init( - VL53L1_dynamic_xtalk_correction_data_init ( + VL53L1_dynamic_xtalk_correction_data_init( Dev ); @@ -494,8 +495,12 @@ VL53L1_Error VL53L1_read_p2p_data( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); + VL53L1_additional_offset_cal_data_t *pCD = &(pdev->add_off_cal_data); + + VL53L1_decoded_nvm_fmt_range_data_t fmt_rrd; - VL53L1_decoded_nvm_fmt_range_data_t fmt_range_result_data; LOG_FUNCTION_START(""); @@ -528,20 +533,18 @@ VL53L1_Error VL53L1_read_p2p_data( if (status == VL53L1_ERROR_NONE) { - - pdev->histpostprocess.algo__crosstalk_compensation_plane_offset_kcps = - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->customer.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->customer.algo__crosstalk_compensation_y_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_plane_offset_kcps = + pN->algo__crosstalk_compensation_plane_offset_kcps; + pHP->algo__crosstalk_compensation_x_plane_gradient_kcps = + pN->algo__crosstalk_compensation_x_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_y_plane_gradient_kcps = + pN->algo__crosstalk_compensation_y_plane_gradient_kcps; } - if (status == VL53L1_ERROR_NONE) status = VL53L1_read_nvm_optical_centre( @@ -576,27 +579,29 @@ VL53L1_Error VL53L1_read_p2p_data( - if (pdev->add_off_cal_data.result__mm_inner_peak_signal_count_rtn_mcps == 0 && - pdev->add_off_cal_data.result__mm_outer_peak_signal_count_rtn_mcps == 0) { + if (pCD->result__mm_inner_peak_signal_count_rtn_mcps == 0 && + pCD->result__mm_outer_peak_signal_count_rtn_mcps == 0) { - pdev->add_off_cal_data.result__mm_inner_peak_signal_count_rtn_mcps = 0x0080; + pCD->result__mm_inner_peak_signal_count_rtn_mcps + = 0x0080; - pdev->add_off_cal_data.result__mm_outer_peak_signal_count_rtn_mcps = 0x0180; + pCD->result__mm_outer_peak_signal_count_rtn_mcps + = 0x0180; VL53L1_calc_mm_effective_spads( - pdev->nvm_copy_data.roi_config__mode_roi_centre_spad, - pdev->nvm_copy_data.roi_config__mode_roi_xy_size, - 0xC7, + pdev->nvm_copy_data.roi_config__mode_roi_centre_spad, + pdev->nvm_copy_data.roi_config__mode_roi_xy_size, + 0xC7, - 0xFF, - &(pdev->rtn_good_spads[0]), - VL53L1_RTN_SPAD_APERTURE_TRANSMISSION, - &(pdev->add_off_cal_data.result__mm_inner_actual_effective_spads), - &(pdev->add_off_cal_data.result__mm_outer_actual_effective_spads)); + 0xFF, + &(pdev->rtn_good_spads[0]), + VL53L1_RTN_SPAD_APERTURE_TRANSMISSION, + &(pCD->result__mm_inner_actual_effective_spads), + &(pCD->result__mm_outer_actual_effective_spads)); } } @@ -604,22 +609,21 @@ VL53L1_Error VL53L1_read_p2p_data( - if (status == VL53L1_ERROR_NONE) { status = VL53L1_read_nvm_fmt_range_results_data( Dev, VL53L1_NVM__FMT__RANGE_RESULTS__140MM_DARK, - &fmt_range_result_data); + &fmt_rrd); if (status == VL53L1_ERROR_NONE) { pdev->fmt_dmax_cal.ref__actual_effective_spads = - fmt_range_result_data.result__actual_effective_rtn_spads; + fmt_rrd.result__actual_effective_rtn_spads; pdev->fmt_dmax_cal.ref__peak_signal_count_rate_mcps = - fmt_range_result_data.result__peak_signal_count_rate_rtn_mcps; + fmt_rrd.result__peak_signal_count_rate_rtn_mcps; pdev->fmt_dmax_cal.ref__distance_mm = - fmt_range_result_data.measured_distance_mm; + fmt_rrd.measured_distance_mm; @@ -628,7 +632,7 @@ VL53L1_Error VL53L1_read_p2p_data( if (pdev->cal_peak_rate_map.cal_reflectance_pc != 0) { pdev->fmt_dmax_cal.ref_reflectance_pc = - pdev->cal_peak_rate_map.cal_reflectance_pc; + pdev->cal_peak_rate_map.cal_reflectance_pc; } else { pdev->fmt_dmax_cal.ref_reflectance_pc = 0x0014; } @@ -756,6 +760,9 @@ VL53L1_Error VL53L1_set_part_to_part_data( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); uint32_t tempu32; @@ -822,42 +829,45 @@ VL53L1_Error VL53L1_set_part_to_part_data( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps = - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->customer.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->customer.algo__crosstalk_compensation_y_plane_gradient_kcps; + pC->algo__crosstalk_compensation_plane_offset_kcps = + pN->algo__crosstalk_compensation_plane_offset_kcps; + pC->algo__crosstalk_compensation_x_plane_gradient_kcps = + pN->algo__crosstalk_compensation_x_plane_gradient_kcps; + pC->algo__crosstalk_compensation_y_plane_gradient_kcps = + pN->algo__crosstalk_compensation_y_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_plane_offset_kcps = + pHP->algo__crosstalk_compensation_plane_offset_kcps = VL53L1_calc_crosstalk_plane_offset_with_margin( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps); + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->histogram_mode_crosstalk_margin_kcps); - pdev->histpostprocess.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_x_plane_gradient_kcps = + pC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_y_plane_gradient_kcps = + pC->algo__crosstalk_compensation_y_plane_gradient_kcps; - if (pdev->xtalk_cfg.global_crosstalk_compensation_enable == 0x00) { - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps = + if (pC->global_crosstalk_compensation_enable == 0x00) { + pN->algo__crosstalk_compensation_plane_offset_kcps = 0x00; - pdev->customer.algo__crosstalk_compensation_x_plane_gradient_kcps = + pN->algo__crosstalk_compensation_x_plane_gradient_kcps = 0x00; - pdev->customer.algo__crosstalk_compensation_y_plane_gradient_kcps = + pN->algo__crosstalk_compensation_y_plane_gradient_kcps = 0x00; } else { - tempu32 = VL53L1_calc_crosstalk_plane_offset_with_margin( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.lite_mode_crosstalk_margin_kcps); - if (tempu32 > 0xFFFF) { + tempu32 = + VL53L1_calc_crosstalk_plane_offset_with_margin( + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->lite_mode_crosstalk_margin_kcps); + + + if (tempu32 > 0xFFFF) tempu32 = 0xFFFF; - } - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps = + + pN->algo__crosstalk_compensation_plane_offset_kcps = (uint16_t)tempu32; } } @@ -879,6 +889,8 @@ VL53L1_Error VL53L1_get_part_to_part_data( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_customer_nvm_managed_t *pCN = &(pcal_data->customer); LOG_FUNCTION_START(""); @@ -897,17 +909,17 @@ VL53L1_Error VL53L1_get_part_to_part_data( - if (pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps > 0xFFFF) { - pcal_data->customer.algo__crosstalk_compensation_plane_offset_kcps = + if (pC->algo__crosstalk_compensation_plane_offset_kcps > 0xFFFF) { + pCN->algo__crosstalk_compensation_plane_offset_kcps = 0xFFFF; } else { - pcal_data->customer.algo__crosstalk_compensation_plane_offset_kcps = - (uint16_t)pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps; + pCN->algo__crosstalk_compensation_plane_offset_kcps = + (uint16_t)pC->algo__crosstalk_compensation_plane_offset_kcps; } - pcal_data->customer.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; - pcal_data->customer.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; + pCN->algo__crosstalk_compensation_x_plane_gradient_kcps = + pC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pCN->algo__crosstalk_compensation_y_plane_gradient_kcps = + pC->algo__crosstalk_compensation_y_plane_gradient_kcps; @@ -983,7 +995,7 @@ VL53L1_Error VL53L1_set_inter_measurement_period_ms( if (status == VL53L1_ERROR_NONE) { pdev->inter_measurement_period_ms = inter_measurement_period_ms; - pdev->tim_cfg.system__intermeasurement_period = \ + pdev->tim_cfg.system__intermeasurement_period = inter_measurement_period_ms * (uint32_t)pdev->dbg_results.result__osc_calibrate_val; } @@ -1012,7 +1024,7 @@ VL53L1_Error VL53L1_get_inter_measurement_period_ms( status = VL53L1_ERROR_DIVISION_BY_ZERO; if (status == VL53L1_ERROR_NONE) - *pinter_measurement_period_ms = \ + *pinter_measurement_period_ms = pdev->tim_cfg.system__intermeasurement_period / (uint32_t)pdev->dbg_results.result__osc_calibrate_val; @@ -1051,13 +1063,13 @@ VL53L1_Error VL53L1_set_timeouts_us( pdev->range_config_timeout_us = range_config_timeout_us; status = - VL53L1_calc_timeout_register_values( - phasecal_config_timeout_us, - mm_config_timeout_us, - range_config_timeout_us, - pdev->stat_nvm.osc_measured__fast_osc__frequency, - &(pdev->gen_cfg), - &(pdev->tim_cfg)); + VL53L1_calc_timeout_register_values( + phasecal_config_timeout_us, + mm_config_timeout_us, + range_config_timeout_us, + pdev->stat_nvm.osc_measured__fast_osc__frequency, + &(pdev->gen_cfg), + &(pdev->tim_cfg)); } LOG_FUNCTION_END(status); @@ -1096,16 +1108,16 @@ VL53L1_Error VL53L1_get_timeouts_us( macro_period_us = VL53L1_calc_macro_period_us( - pdev->stat_nvm.osc_measured__fast_osc__frequency, - pdev->tim_cfg.range_config__vcsel_period_a); + pdev->stat_nvm.osc_measured__fast_osc__frequency, + pdev->tim_cfg.range_config__vcsel_period_a); *pphasecal_config_timeout_us = VL53L1_calc_timeout_us( - (uint32_t)pdev->gen_cfg.phasecal_config__timeout_macrop, - macro_period_us); + (uint32_t)pdev->gen_cfg.phasecal_config__timeout_macrop, + macro_period_us); @@ -1124,9 +1136,9 @@ VL53L1_Error VL53L1_get_timeouts_us( timeout_encoded = - (uint16_t)pdev->tim_cfg.range_config__timeout_macrop_a_hi; + (uint16_t)pdev->tim_cfg.range_config__timeout_macrop_a_hi; timeout_encoded = (timeout_encoded << 8) + - (uint16_t)pdev->tim_cfg.range_config__timeout_macrop_a_lo; + (uint16_t)pdev->tim_cfg.range_config__timeout_macrop_a_lo; *prange_config_timeout_us = VL53L1_calc_decoded_timeout_us( @@ -1212,8 +1224,8 @@ VL53L1_Error VL53L1_set_sequence_config_bit( clr_mask = 0xFF - bit_mask; } - pdev->dyn_cfg.system__sequence_config = \ - (pdev->dyn_cfg.system__sequence_config & clr_mask) | \ + pdev->dyn_cfg.system__sequence_config = + (pdev->dyn_cfg.system__sequence_config & clr_mask) | bit_value; } else { @@ -1244,16 +1256,14 @@ VL53L1_Error VL53L1_get_sequence_config_bit( if (bit_id <= VL53L1_DEVICESEQUENCECONFIG_RANGE) { - if (bit_id > 0) { + if (bit_id > 0) bit_mask = 0x01 << bit_id; - } *pvalue = pdev->dyn_cfg.system__sequence_config & bit_mask; - if (bit_id > 0) { + if (bit_id > 0) *pvalue = *pvalue >> bit_id; - } } else { status = VL53L1_ERROR_INVALID_PARAMS; @@ -1276,11 +1286,11 @@ VL53L1_Error VL53L1_set_interrupt_polarity( VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - pdev->stat_cfg.gpio_hv_mux__ctrl = \ - (pdev->stat_cfg.gpio_hv_mux__ctrl & \ - VL53L1_DEVICEINTERRUPTPOLARITY_CLEAR_MASK) | \ - (interrupt_polarity & \ - VL53L1_DEVICEINTERRUPTPOLARITY_BIT_MASK); + pdev->stat_cfg.gpio_hv_mux__ctrl = + (pdev->stat_cfg.gpio_hv_mux__ctrl & + VL53L1_DEVICEINTERRUPTPOLARITY_CLEAR_MASK) | + (interrupt_polarity & + VL53L1_DEVICEINTERRUPTPOLARITY_BIT_MASK); return status; @@ -1303,7 +1313,7 @@ VL53L1_Error VL53L1_set_refspadchar_config_struct( LOG_FUNCTION_START(""); pdev->refspadchar.device_test_mode = pdata->device_test_mode; - pdev->refspadchar.VL53L1_PRM_00008 = pdata->VL53L1_PRM_00008; + pdev->refspadchar.VL53L1_p_009 = pdata->VL53L1_p_009; pdev->refspadchar.timeout_us = pdata->timeout_us; pdev->refspadchar.target_count_rate_mcps = pdata->target_count_rate_mcps; @@ -1333,9 +1343,10 @@ VL53L1_Error VL53L1_get_refspadchar_config_struct( LOG_FUNCTION_START(""); pdata->device_test_mode = pdev->refspadchar.device_test_mode; - pdata->VL53L1_PRM_00008 = pdev->refspadchar.VL53L1_PRM_00008; + pdata->VL53L1_p_009 = pdev->refspadchar.VL53L1_p_009; pdata->timeout_us = pdev->refspadchar.timeout_us; - pdata->target_count_rate_mcps = pdev->refspadchar.target_count_rate_mcps; + pdata->target_count_rate_mcps = + pdev->refspadchar.target_count_rate_mcps; pdata->min_count_rate_limit_mcps = pdev->refspadchar.min_count_rate_limit_mcps; pdata->max_count_rate_limit_mcps = @@ -1393,7 +1404,7 @@ VL53L1_Error VL53L1_get_range_ignore_threshold( VL53L1DevStructGetLLDriverHandle(Dev); *prange_ignore_thresh_mult = - pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult; + pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult; *prange_ignore_threshold_mcps_current = pdev->stat_cfg.algo__range_ignore_threshold_mcps; @@ -1420,9 +1431,9 @@ VL53L1_Error VL53L1_get_interrupt_polarity( VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - *pinterrupt_polarity = \ - pdev->stat_cfg.gpio_hv_mux__ctrl & \ - VL53L1_DEVICEINTERRUPTPOLARITY_BIT_MASK ; + *pinterrupt_polarity = + pdev->stat_cfg.gpio_hv_mux__ctrl & + VL53L1_DEVICEINTERRUPTPOLARITY_BIT_MASK; return status; @@ -1588,9 +1599,11 @@ VL53L1_Error VL53L1_set_zone_config( if (pzone_cfg->active_zones == 0) pdev->gen_cfg.global_config__stream_divider = 0; else if (pzone_cfg->active_zones < VL53L1_MAX_USER_ZONES) - pdev->gen_cfg.global_config__stream_divider = pzone_cfg->active_zones + 1; + pdev->gen_cfg.global_config__stream_divider = + pzone_cfg->active_zones + 1; else - pdev->gen_cfg.global_config__stream_divider = VL53L1_MAX_USER_ZONES + 1; + pdev->gen_cfg.global_config__stream_divider = + VL53L1_MAX_USER_ZONES + 1; LOG_FUNCTION_END(status); @@ -1645,13 +1658,13 @@ VL53L1_Error VL53L1_get_preset_mode_timing_cfg( case VL53L1_DEVICEPRESETMODE_STANDARD_RANGING_MM2_CAL: case VL53L1_DEVICEPRESETMODE_OLT: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_lite_mcps; + pdev->tuning_parms.tp_dss_target_lite_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_lite_us; + pdev->tuning_parms.tp_phasecal_timeout_lite_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_lite_us; + pdev->tuning_parms.tp_mm_timeout_lite_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_lite_us; + pdev->tuning_parms.tp_range_timeout_lite_us; break; case VL53L1_DEVICEPRESETMODE_TIMED_RANGING: @@ -1659,26 +1672,26 @@ VL53L1_Error VL53L1_get_preset_mode_timing_cfg( case VL53L1_DEVICEPRESETMODE_TIMED_RANGING_LONG_RANGE: case VL53L1_DEVICEPRESETMODE_SINGLESHOT_RANGING: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_timed_mcps; + pdev->tuning_parms.tp_dss_target_timed_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_timed_us; + pdev->tuning_parms.tp_phasecal_timeout_timed_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_timed_us; + pdev->tuning_parms.tp_mm_timeout_timed_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_timed_us; + pdev->tuning_parms.tp_range_timeout_timed_us; break; case VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_SHORT_RANGE: case VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_MEDIUM_RANGE: case VL53L1_DEVICEPRESETMODE_LOWPOWERAUTO_LONG_RANGE: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_timed_mcps; + pdev->tuning_parms.tp_dss_target_timed_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_timed_us; + pdev->tuning_parms.tp_phasecal_timeout_timed_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_lpa_us; + pdev->tuning_parms.tp_mm_timeout_lpa_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_lpa_us; + pdev->tuning_parms.tp_range_timeout_lpa_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING: @@ -1692,71 +1705,71 @@ VL53L1_Error VL53L1_get_preset_mode_timing_cfg( case VL53L1_DEVICEPRESETMODE_HISTOGRAM_LONG_RANGE_MM2: case VL53L1_DEVICEPRESETMODE_HISTOGRAM_CHARACTERISATION: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mcps; + pdev->tuning_parms.tp_dss_target_histo_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_hist_long_us; + pdev->tuning_parms.tp_phasecal_timeout_hist_long_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_histo_us; + pdev->tuning_parms.tp_mm_timeout_histo_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_histo_us; + pdev->tuning_parms.tp_range_timeout_histo_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mz_mcps; + pdev->tuning_parms.tp_dss_target_histo_mz_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_mz_med_us; + pdev->tuning_parms.tp_phasecal_timeout_mz_med_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_mz_us; + pdev->tuning_parms.tp_mm_timeout_mz_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_mz_us; + pdev->tuning_parms.tp_range_timeout_mz_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_SHORT_RANGE: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mz_mcps; + pdev->tuning_parms.tp_dss_target_histo_mz_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_mz_short_us; + pdev->tuning_parms.tp_phasecal_timeout_mz_short_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_mz_us; + pdev->tuning_parms.tp_mm_timeout_mz_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_mz_us; + pdev->tuning_parms.tp_range_timeout_mz_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MULTIZONE_LONG_RANGE: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mz_mcps; + pdev->tuning_parms.tp_dss_target_histo_mz_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_mz_long_us; + pdev->tuning_parms.tp_phasecal_timeout_mz_long_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_mz_us; + pdev->tuning_parms.tp_mm_timeout_mz_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_mz_us; + pdev->tuning_parms.tp_range_timeout_mz_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_RANGING_SHORT_TIMING: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mcps; + pdev->tuning_parms.tp_dss_target_histo_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; + pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_histo_us; + pdev->tuning_parms.tp_mm_timeout_histo_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_histo_us; + pdev->tuning_parms.tp_range_timeout_histo_us; break; case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE: case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM1: case VL53L1_DEVICEPRESETMODE_HISTOGRAM_MEDIUM_RANGE_MM2: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_histo_mcps; + pdev->tuning_parms.tp_dss_target_histo_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_hist_med_us; + pdev->tuning_parms.tp_phasecal_timeout_hist_med_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_histo_us; + pdev->tuning_parms.tp_mm_timeout_histo_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_histo_us; + pdev->tuning_parms.tp_range_timeout_histo_us; break; @@ -1766,7 +1779,7 @@ VL53L1_Error VL53L1_get_preset_mode_timing_cfg( *pdss_config__target_total_rate_mcps = pdev->tuning_parms.tp_dss_target_histo_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; + pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; *pmm_config_timeout_us = pdev->tuning_parms.tp_mm_timeout_histo_us; *prange_config_timeout_us = @@ -1775,13 +1788,13 @@ VL53L1_Error VL53L1_get_preset_mode_timing_cfg( case VL53L1_DEVICEPRESETMODE_SPECIAL_HISTOGRAM_SHORT_RANGE: *pdss_config__target_total_rate_mcps = - pdev->tuning_parms.tp_dss_target_very_short_mcps; + pdev->tuning_parms.tp_dss_target_very_short_mcps; *pphasecal_config_timeout_us = - pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; + pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; *pmm_config_timeout_us = - pdev->tuning_parms.tp_mm_timeout_histo_us; + pdev->tuning_parms.tp_mm_timeout_histo_us; *prange_config_timeout_us = - pdev->tuning_parms.tp_range_timeout_histo_us; + pdev->tuning_parms.tp_range_timeout_histo_us; break; default: @@ -2545,9 +2558,11 @@ VL53L1_Error VL53L1_set_zone_preset( if (pzone_cfg->active_zones == 0) pdev->gen_cfg.global_config__stream_divider = 0; else if (pzone_cfg->active_zones < VL53L1_MAX_USER_ZONES) - pdev->gen_cfg.global_config__stream_divider = pzone_cfg->active_zones + 1; + pdev->gen_cfg.global_config__stream_divider = + pzone_cfg->active_zones + 1; else - pdev->gen_cfg.global_config__stream_divider = VL53L1_MAX_USER_ZONES + 1; + pdev->gen_cfg.global_config__stream_divider = + VL53L1_MAX_USER_ZONES + 1; LOG_FUNCTION_END(status); @@ -2570,58 +2585,61 @@ VL53L1_Error VL53L1_enable_xtalk_compensation( uint32_t tempu32; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); LOG_FUNCTION_START(""); tempu32 = VL53L1_calc_crosstalk_plane_offset_with_margin( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.lite_mode_crosstalk_margin_kcps); - if (tempu32 > 0xFFFF) { + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->lite_mode_crosstalk_margin_kcps); + if (tempu32 > 0xFFFF) tempu32 = 0xFFFF; - } - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps = + + pN->algo__crosstalk_compensation_plane_offset_kcps = (uint16_t)tempu32; - pdev->customer.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; + pN->algo__crosstalk_compensation_x_plane_gradient_kcps = + pC->algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->customer.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; + pN->algo__crosstalk_compensation_y_plane_gradient_kcps = + pC->algo__crosstalk_compensation_y_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_plane_offset_kcps = + pHP->algo__crosstalk_compensation_plane_offset_kcps = VL53L1_calc_crosstalk_plane_offset_with_margin( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps); + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->histogram_mode_crosstalk_margin_kcps); - pdev->histpostprocess.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_x_plane_gradient_kcps + = pC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_y_plane_gradient_kcps + = pC->algo__crosstalk_compensation_y_plane_gradient_kcps; - pdev->xtalk_cfg.global_crosstalk_compensation_enable = 0x01; + pC->global_crosstalk_compensation_enable = 0x01; - pdev->histpostprocess.algo__crosstalk_compensation_enable = - pdev->xtalk_cfg.global_crosstalk_compensation_enable; + pHP->algo__crosstalk_compensation_enable = + pC->global_crosstalk_compensation_enable; if (status == VL53L1_ERROR_NONE) { - pdev->xtalk_cfg.crosstalk_range_ignore_threshold_rate_mcps = - VL53L1_calc_range_ignore_threshold( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps, - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps, - pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult); - } + pC->crosstalk_range_ignore_threshold_rate_mcps = + VL53L1_calc_range_ignore_threshold( + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->algo__crosstalk_compensation_x_plane_gradient_kcps, + pC->algo__crosstalk_compensation_y_plane_gradient_kcps, + pC->crosstalk_range_ignore_threshold_mult); +} @@ -2777,15 +2795,16 @@ VL53L1_Error VL53L1_restore_xtalk_nvm_default( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); LOG_FUNCTION_START(""); - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_plane_offset_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_x_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_y_plane_gradient_kcps; + pC->algo__crosstalk_compensation_plane_offset_kcps = + pC->nvm_default__crosstalk_compensation_plane_offset_kcps; + pC->algo__crosstalk_compensation_x_plane_gradient_kcps = + pC->nvm_default__crosstalk_compensation_x_plane_gradient_kcps; + pC->algo__crosstalk_compensation_y_plane_gradient_kcps = + pC->nvm_default__crosstalk_compensation_y_plane_gradient_kcps; LOG_FUNCTION_END(status); @@ -2806,18 +2825,20 @@ VL53L1_Error VL53L1_disable_xtalk_compensation( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); LOG_FUNCTION_START(""); - pdev->customer.algo__crosstalk_compensation_plane_offset_kcps = + pN->algo__crosstalk_compensation_plane_offset_kcps = 0x00; - pdev->customer.algo__crosstalk_compensation_x_plane_gradient_kcps = + pN->algo__crosstalk_compensation_x_plane_gradient_kcps = 0x00; - pdev->customer.algo__crosstalk_compensation_y_plane_gradient_kcps = + pN->algo__crosstalk_compensation_y_plane_gradient_kcps = 0x00; @@ -2825,7 +2846,7 @@ VL53L1_Error VL53L1_disable_xtalk_compensation( pdev->xtalk_cfg.global_crosstalk_compensation_enable = 0x00; - pdev->histpostprocess.algo__crosstalk_compensation_enable = + pHP->algo__crosstalk_compensation_enable = pdev->xtalk_cfg.global_crosstalk_compensation_enable; @@ -2866,11 +2887,12 @@ VL53L1_Error VL53L1_get_histogram_phase_consistency( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); LOG_FUNCTION_START(""); *pphase_consistency = - pdev->histpostprocess.algo__consistency_check__phase_tolerance; + pHP->algo__consistency_check__phase_tolerance; LOG_FUNCTION_END(status); @@ -2920,7 +2942,7 @@ VL53L1_Error VL53L1_get_histogram_event_consistency( LOG_FUNCTION_START(""); *pevent_consistency = - pdev->histpostprocess.algo__consistency_check__event_sigma; + pdev->histpostprocess.algo__consistency_check__event_sigma; LOG_FUNCTION_END(status); @@ -3079,7 +3101,7 @@ VL53L1_Error VL53L1_get_lite_min_count_rate( LOG_FUNCTION_START(""); *plite_mincountrate = - pdev->tim_cfg.range_config__min_count_rate_rtn_limit_mcps; + pdev->tim_cfg.range_config__min_count_rate_rtn_limit_mcps; LOG_FUNCTION_END(status); @@ -3142,13 +3164,13 @@ VL53L1_Error VL53L1_get_xtalk_detect_config( LOG_FUNCTION_START(""); *pmax_valid_range_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_range_mm; + pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_range_mm; *pmin_valid_range_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_min_valid_range_mm; + pdev->xtalk_cfg.algo__crosstalk_detect_min_valid_range_mm; *pmax_valid_rate_kcps = - pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps; + pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps; *pmax_sigma_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; + pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; LOG_FUNCTION_END(status); @@ -3268,9 +3290,9 @@ VL53L1_Error VL53L1_get_dmax_reflectance_values( - for (i = 0 ; i < VL53L1_MAX_AMBIENT_DMAX_VALUES ; i++) { + for (i = 0; i < VL53L1_MAX_AMBIENT_DMAX_VALUES; i++) { pdmax_reflectances->target_reflectance_for_dmax[i] = - pdev->dmax_cfg.target_reflectance_for_dmax_calc[i]; + pdev->dmax_cfg.target_reflectance_for_dmax_calc[i]; } LOG_FUNCTION_END(status); @@ -3299,9 +3321,9 @@ VL53L1_Error VL53L1_set_dmax_reflectance_values( - for (i = 0 ; i < VL53L1_MAX_AMBIENT_DMAX_VALUES ; i++) { + for (i = 0; i < VL53L1_MAX_AMBIENT_DMAX_VALUES; i++) { pdev->dmax_cfg.target_reflectance_for_dmax_calc[i] = - pdmax_reflectances->target_reflectance_for_dmax[i]; + pdmax_reflectances->target_reflectance_for_dmax[i]; } LOG_FUNCTION_END(status); @@ -3327,7 +3349,8 @@ VL53L1_Error VL53L1_get_vhv_loopbound( LOG_FUNCTION_START(""); - *pvhv_loopbound = pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound / 4 ; + *pvhv_loopbound = + pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound / 4; LOG_FUNCTION_END(status); @@ -3359,8 +3382,8 @@ VL53L1_Error VL53L1_set_vhv_loopbound( LOG_FUNCTION_START(""); pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound = - (pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound & 0x03) + - (vhv_loopbound * 4); + (pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound & 0x03) + + (vhv_loopbound * 4); LOG_FUNCTION_END(status); @@ -3474,6 +3497,7 @@ VL53L1_Error VL53L1_init_and_start_range( VL53L1_system_control_t *psystem = &(pdev->sys_ctrl); VL53L1_ll_driver_state_t *pstate = &(pdev->ll_state); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); uint8_t *pbuffer = &buffer[0]; uint16_t i = 0; @@ -3502,8 +3526,8 @@ VL53L1_Error VL53L1_init_and_start_range( status = VL53L1_set_user_zone( - Dev, - &(pdev->zone_cfg.user_zones[pdev->ll_state.cfg_zone_id])); + Dev, + &(pdev->zone_cfg.user_zones[pdev->ll_state.cfg_zone_id])); @@ -3511,9 +3535,10 @@ VL53L1_Error VL53L1_init_and_start_range( if (pdev->zone_cfg.active_zones > 0) { status = - VL53L1_set_zone_dss_config( - Dev, - &(pres->zone_dyn_cfgs.VL53L1_PRM_00005[pdev->ll_state.cfg_zone_id])); + VL53L1_set_zone_dss_config( + Dev, + &(pres->zone_dyn_cfgs.VL53L1_p_002[pdev->ll_state.cfg_zone_id]) + ); } @@ -3522,10 +3547,11 @@ VL53L1_Error VL53L1_init_and_start_range( if (((pdev->sys_ctrl.system__mode_start & - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM) == 0x00) && - (pdev->xtalk_cfg.global_crosstalk_compensation_enable == 0x01)) { + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM) == 0x00) && + (pdev->xtalk_cfg.global_crosstalk_compensation_enable + == 0x01)) { pdev->stat_cfg.algo__range_ignore_threshold_mcps = - pdev->xtalk_cfg.crosstalk_range_ignore_threshold_rate_mcps; + pdev->xtalk_cfg.crosstalk_range_ignore_threshold_rate_mcps; } @@ -3535,9 +3561,8 @@ VL53L1_Error VL53L1_init_and_start_range( - if (pdev->low_power_auto_data.low_power_auto_range_count == 0xFF) { + if (pdev->low_power_auto_data.low_power_auto_range_count == 0xFF) pdev->low_power_auto_data.low_power_auto_range_count = 0x0; - } @@ -3555,10 +3580,10 @@ VL53L1_Error VL53L1_init_and_start_range( if ((pdev->dyn_cfg.system__sequence_config & ( VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_MM2_EN)) == 0x0) { - pdev->customer.algo__part_to_part_range_offset_mm = - (pdev->customer.mm_config__outer_offset_mm << 2); + pN->algo__part_to_part_range_offset_mm = + (pN->mm_config__outer_offset_mm << 2); } else { - pdev->customer.algo__part_to_part_range_offset_mm = 0x0; + pN->algo__part_to_part_range_offset_mm = 0x0; } @@ -3590,9 +3615,8 @@ VL53L1_Error VL53L1_init_and_start_range( - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) status = VL53L1_save_cfg_data(Dev); - } @@ -3626,18 +3650,17 @@ VL53L1_Error VL53L1_init_and_start_range( - i2c_buffer_size_bytes = \ + i2c_buffer_size_bytes = (VL53L1_SYSTEM_CONTROL_I2C_INDEX + - VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES) - - i2c_index; + VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES) - + i2c_index; pbuffer = &buffer[0]; - for (i = 0 ; i < i2c_buffer_size_bytes ; i++) { + for (i = 0; i < i2c_buffer_size_bytes; i++) *pbuffer++ = 0; - } @@ -3645,7 +3668,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (device_config_level >= VL53L1_DEVICECONFIGLEVEL_FULL && status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_STATIC_NVM_MANAGED_I2C_INDEX - i2c_index; status = @@ -3658,7 +3681,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (device_config_level >= VL53L1_DEVICECONFIGLEVEL_CUSTOMER_ONWARDS && status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_CUSTOMER_NVM_MANAGED_I2C_INDEX - i2c_index; status = @@ -3671,7 +3694,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (device_config_level >= VL53L1_DEVICECONFIGLEVEL_STATIC_ONWARDS && status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_STATIC_CONFIG_I2C_INDEX - i2c_index; status = @@ -3697,7 +3720,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (device_config_level >= VL53L1_DEVICECONFIGLEVEL_TIMING_ONWARDS && status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_TIMING_CONFIG_I2C_INDEX - i2c_index; status = @@ -3710,7 +3733,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (device_config_level >= VL53L1_DEVICECONFIGLEVEL_DYNAMIC_ONWARDS && status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_DYNAMIC_CONFIG_I2C_INDEX - i2c_index; @@ -3718,9 +3741,12 @@ VL53L1_Error VL53L1_init_and_start_range( if ((psystem->system__mode_start & VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK) == VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK) { - pdynamic->system__grouped_parameter_hold_0 = pstate->cfg_gph_id | 0x01; - pdynamic->system__grouped_parameter_hold_1 = pstate->cfg_gph_id | 0x01; - pdynamic->system__grouped_parameter_hold = pstate->cfg_gph_id; + pdynamic->system__grouped_parameter_hold_0 = + pstate->cfg_gph_id | 0x01; + pdynamic->system__grouped_parameter_hold_1 = + pstate->cfg_gph_id | 0x01; + pdynamic->system__grouped_parameter_hold = + pstate->cfg_gph_id; } status = VL53L1_i2c_encode_dynamic_config( @@ -3731,7 +3757,7 @@ VL53L1_Error VL53L1_init_and_start_range( if (status == VL53L1_ERROR_NONE) { - i2c_buffer_offset_bytes = \ + i2c_buffer_offset_bytes = VL53L1_SYSTEM_CONTROL_I2C_INDEX - i2c_index; status = @@ -3789,7 +3815,8 @@ VL53L1_Error VL53L1_stop_range( pdev->sys_ctrl.system__mode_start = - (pdev->sys_ctrl.system__mode_start & VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK) | + (pdev->sys_ctrl.system__mode_start & + VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK) | VL53L1_DEVICEMEASUREMENTMODE_ABORT; status = VL53L1_set_system_control( @@ -3799,7 +3826,8 @@ VL53L1_Error VL53L1_stop_range( pdev->sys_ctrl.system__mode_start = - (pdev->sys_ctrl.system__mode_start & VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK); + (pdev->sys_ctrl.system__mode_start & + VL53L1_DEVICEMEASUREMENTMODE_STOP_MASK); @@ -3953,16 +3981,29 @@ VL53L1_Error VL53L1_get_device_results( VL53L1_LLDriverResults_t *pres = VL53L1DevStructGetLLResultsHandle(Dev); - VL53L1_range_results_t *presults = &(pres->range_results); - VL53L1_zone_objects_t *pobjects = &(pres->zone_results.VL53L1_PRM_00005[0]); - VL53L1_ll_driver_state_t *pstate = &(pdev->ll_state); - VL53L1_zone_config_t *pzone_cfg = &(pdev->zone_cfg); - VL53L1_zone_hist_info_t *phist_info = &(pres->zone_hists.VL53L1_PRM_00005[0]); + VL53L1_range_results_t *presults = + &(pres->range_results); + VL53L1_zone_objects_t *pobjects = + &(pres->zone_results.VL53L1_p_002[0]); + VL53L1_ll_driver_state_t *pstate = + &(pdev->ll_state); + VL53L1_zone_config_t *pzone_cfg = + &(pdev->zone_cfg); + VL53L1_zone_hist_info_t *phist_info = + &(pres->zone_hists.VL53L1_p_002[0]); VL53L1_dmax_calibration_data_t dmax_cal; VL53L1_dmax_calibration_data_t *pdmax_cal = &dmax_cal; + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_xtalk_config_t *pC = &(pdev->xtalk_cfg); + VL53L1_low_power_auto_data_t *pL = &(pdev->low_power_auto_data); + VL53L1_histogram_bin_data_t *pHD = &(pdev->hist_data); + VL53L1_customer_nvm_managed_t *pN = &(pdev->customer); + VL53L1_zone_histograms_t *pZH = &(pres->zone_hists); uint8_t i; + uint8_t tmp8; + uint8_t zid; LOG_FUNCTION_START(""); @@ -3978,11 +4019,10 @@ VL53L1_Error VL53L1_get_device_results( - if (status == VL53L1_ERROR_NONE) + status = VL53L1_get_histogram_bin_data( + Dev, + &(pdev->hist_data)); - status = VL53L1_get_histogram_bin_data( - Dev, - &(pdev->hist_data)); @@ -3990,111 +4030,11 @@ VL53L1_Error VL53L1_get_device_results( if (status == VL53L1_ERROR_NONE && - pdev->hist_data.number_of_ambient_bins == 0) + pHD->number_of_ambient_bins == 0) { + zid = pdev->ll_state.rd_zone_id; status = VL53L1_hist_copy_and_scale_ambient_info( - &(pres->zone_hists.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]), - &(pdev->hist_data)); - - - - - - - - if (status == VL53L1_ERROR_NONE) { - - pdev->histpostprocess.gain_factor = - pdev->gain_cal.histogram_ranging_gain_factor; - - pdev->histpostprocess.algo__crosstalk_compensation_plane_offset_kcps = - VL53L1_calc_crosstalk_plane_offset_with_margin( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps, - pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps); - - pdev->histpostprocess.algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->histpostprocess.algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; - - pdev->dmax_cfg.ambient_thresh_sigma = - pdev->histpostprocess.ambient_thresh_sigma1; - pdev->dmax_cfg.min_ambient_thresh_events = - pdev->histpostprocess.min_ambient_thresh_events; - pdev->dmax_cfg.signal_total_events_limit = - pdev->histpostprocess.signal_total_events_limit; - pdev->dmax_cfg.dss_config__target_total_rate_mcps = - pdev->stat_cfg.dss_config__target_total_rate_mcps; - pdev->dmax_cfg.dss_config__aperture_attenuation = - pdev->gen_cfg.dss_config__aperture_attenuation; - - pdev->histpostprocess.algo__crosstalk_detect_max_valid_range_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_range_mm; - pdev->histpostprocess.algo__crosstalk_detect_min_valid_range_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_min_valid_range_mm; - pdev->histpostprocess.algo__crosstalk_detect_max_valid_rate_kcps = - pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps; - pdev->histpostprocess.algo__crosstalk_detect_max_sigma_mm = - pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; - - - - - VL53L1_copy_rtn_good_spads_to_buffer( - &(pdev->nvm_copy_data), - &(pdev->rtn_good_spads[0])); - - - - - switch (pdev->offset_correction_mode) { - - case VL53L1_OFFSETCORRECTIONMODE__MM1_MM2_OFFSETS: - - VL53L1_hist_combine_mm1_mm2_offsets( - pdev->customer.mm_config__inner_offset_mm, - pdev->customer.mm_config__outer_offset_mm, - pdev->nvm_copy_data.roi_config__mode_roi_centre_spad, - pdev->nvm_copy_data.roi_config__mode_roi_xy_size, - pdev->hist_data.roi_config__user_roi_centre_spad, - pdev->hist_data.roi_config__user_roi_requested_global_xy_size, - &(pdev->add_off_cal_data), - &(pdev->rtn_good_spads[0]), - (uint16_t)pdev->gen_cfg.dss_config__aperture_attenuation, - &(pdev->histpostprocess.range_offset_mm)); - - break; - - case VL53L1_OFFSETCORRECTIONMODE__PER_ZONE_OFFSETS: - pdev->histpostprocess.range_offset_mm = - (int16_t)pres->zone_cal.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id].range_mm_offset; - break; - - default: - pdev->histpostprocess.range_offset_mm = 0; - break; - - } - } - - - - - - if (status == VL53L1_ERROR_NONE) { - - VL53L1_calc_max_effective_spads( - pdev->hist_data.roi_config__user_roi_centre_spad, - pdev->hist_data.roi_config__user_roi_requested_global_xy_size, - &(pdev->rtn_good_spads[0]), - (uint16_t)pdev->gen_cfg.dss_config__aperture_attenuation, - &(pdev->dmax_cfg.max_effective_spads)); - - status = - VL53L1_get_dmax_calibration_data( - Dev, - pdev->dmax_mode, - pdev->ll_state.rd_zone_id, - pdmax_cal); + &(pZH->VL53L1_p_002[zid]), + &(pdev->hist_data)); } @@ -4102,83 +4042,78 @@ VL53L1_Error VL53L1_get_device_results( - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_ipp_hist_process_data( - Dev, - pdmax_cal, - &(pdev->dmax_cfg), - &(pdev->histpostprocess), - &(pdev->hist_data), - &(pdev->xtalk_shapes), - presults); + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + + pHP->gain_factor = + pdev->gain_cal.histogram_ranging_gain_factor; + + pHP->algo__crosstalk_compensation_plane_offset_kcps = + VL53L1_calc_crosstalk_plane_offset_with_margin( + pC->algo__crosstalk_compensation_plane_offset_kcps, + pC->histogram_mode_crosstalk_margin_kcps); + + pHP->algo__crosstalk_compensation_x_plane_gradient_kcps = + pC->algo__crosstalk_compensation_x_plane_gradient_kcps; + pHP->algo__crosstalk_compensation_y_plane_gradient_kcps = + pC->algo__crosstalk_compensation_y_plane_gradient_kcps; + + pdev->dmax_cfg.ambient_thresh_sigma = + pHP->ambient_thresh_sigma1; + pdev->dmax_cfg.min_ambient_thresh_events = + pHP->min_ambient_thresh_events; + pdev->dmax_cfg.signal_total_events_limit = + pHP->signal_total_events_limit; + pdev->dmax_cfg.dss_config__target_total_rate_mcps = + pdev->stat_cfg.dss_config__target_total_rate_mcps; + pdev->dmax_cfg.dss_config__aperture_attenuation = + pdev->gen_cfg.dss_config__aperture_attenuation; + + pHP->algo__crosstalk_detect_max_valid_range_mm = + pC->algo__crosstalk_detect_max_valid_range_mm; + pHP->algo__crosstalk_detect_min_valid_range_mm = + pC->algo__crosstalk_detect_min_valid_range_mm; + pHP->algo__crosstalk_detect_max_valid_rate_kcps = + pC->algo__crosstalk_detect_max_valid_rate_kcps; + pHP->algo__crosstalk_detect_max_sigma_mm = + pC->algo__crosstalk_detect_max_sigma_mm; - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_hist_wrap_dmax( - &(pdev->histpostprocess), - &(pdev->hist_data), - &(presults->wrap_dmax_mm)); + VL53L1_copy_rtn_good_spads_to_buffer( + &(pdev->nvm_copy_data), + &(pdev->rtn_good_spads[0])); - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_hist_phase_consistency_check( - Dev, - &(pres->zone_hists.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]), - &(pres->zone_results.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]), - presults); + switch (pdev->offset_correction_mode) { + case VL53L1_OFFSETCORRECTIONMODE__MM1_MM2_OFFSETS: + tmp8 = pdev->gen_cfg.dss_config__aperture_attenuation; - - - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_hist_xmonitor_consistency_check( - Dev, - &(pres->zone_hists.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]), - &(pres->zone_results.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]), - &(presults->xmonitor)); - - - - - - - if (status == VL53L1_ERROR_NONE) { - - pres->zone_hists.max_zones = VL53L1_MAX_USER_ZONES; - pres->zone_hists.active_zones = pdev->zone_cfg.active_zones+1; - pdev->hist_data.zone_id = pdev->ll_state.rd_zone_id; - - if (pdev->ll_state.rd_zone_id < pres->zone_results.max_zones) { - - phist_info = - &(pres->zone_hists.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]); - - phist_info->rd_device_state = - pdev->hist_data.rd_device_state; - - phist_info->number_of_ambient_bins = - pdev->hist_data.number_of_ambient_bins; - - phist_info->result__dss_actual_effective_spads = - pdev->hist_data.result__dss_actual_effective_spads; - - phist_info->VL53L1_PRM_00008 = - pdev->hist_data.VL53L1_PRM_00008; - - phist_info->total_periods_elapsed = - pdev->hist_data.total_periods_elapsed; - - phist_info->ambient_events_sum = - pdev->hist_data.ambient_events_sum; - } + VL53L1_hist_combine_mm1_mm2_offsets( + pN->mm_config__inner_offset_mm, + pN->mm_config__outer_offset_mm, + pdev->nvm_copy_data.roi_config__mode_roi_centre_spad, + pdev->nvm_copy_data.roi_config__mode_roi_xy_size, + pHD->roi_config__user_roi_centre_spad, + pHD->roi_config__user_roi_requested_global_xy_size, + &(pdev->add_off_cal_data), + &(pdev->rtn_good_spads[0]), + (uint16_t)tmp8, + &(pHP->range_offset_mm)); + break; + case VL53L1_OFFSETCORRECTIONMODE__PER_ZONE_OFFSETS: + zid = pdev->ll_state.rd_zone_id; + pHP->range_offset_mm = (int16_t)( + pres->zone_cal.VL53L1_p_002[zid].range_mm_offset); + break; + default: + pHP->range_offset_mm = 0; + break; } @@ -4187,13 +4122,113 @@ VL53L1_Error VL53L1_get_device_results( + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; - if (status == VL53L1_ERROR_NONE) - VL53L1_hist_copy_results_to_sys_and_core( - &(pdev->hist_data), - presults, - &(pdev->sys_results), - &(pdev->core_results)); + + VL53L1_calc_max_effective_spads( + pHD->roi_config__user_roi_centre_spad, + pHD->roi_config__user_roi_requested_global_xy_size, + &(pdev->rtn_good_spads[0]), + (uint16_t)pdev->gen_cfg.dss_config__aperture_attenuation, + &(pdev->dmax_cfg.max_effective_spads)); + + status = + VL53L1_get_dmax_calibration_data( + Dev, + pdev->dmax_mode, + pdev->ll_state.rd_zone_id, + pdmax_cal); + + + + + + + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + status = VL53L1_ipp_hist_process_data( + Dev, + pdmax_cal, + &(pdev->dmax_cfg), + &(pdev->histpostprocess), + &(pdev->hist_data), + &(pdev->xtalk_shapes), + presults); + + + + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + status = VL53L1_hist_wrap_dmax( + &(pdev->histpostprocess), + &(pdev->hist_data), + &(presults->wrap_dmax_mm)); + + + + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + zid = pdev->ll_state.rd_zone_id; + status = VL53L1_hist_phase_consistency_check( + Dev, + &(pZH->VL53L1_p_002[zid]), + &(pres->zone_results.VL53L1_p_002[zid]), + presults); + + + + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + zid = pdev->ll_state.rd_zone_id; + status = VL53L1_hist_xmonitor_consistency_check( + Dev, + &(pZH->VL53L1_p_002[zid]), + &(pres->zone_results.VL53L1_p_002[zid]), + &(presults->xmonitor)); + + + + + + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + + zid = pdev->ll_state.rd_zone_id; + pZH->max_zones = VL53L1_MAX_USER_ZONES; + pZH->active_zones = + pdev->zone_cfg.active_zones+1; + pHD->zone_id = zid; + + if (zid < + pres->zone_results.max_zones) { + + phist_info = + &(pZH->VL53L1_p_002[zid]); + + phist_info->rd_device_state = + pHD->rd_device_state; + + phist_info->number_of_ambient_bins = + pHD->number_of_ambient_bins; + + phist_info->result__dss_actual_effective_spads = + pHD->result__dss_actual_effective_spads; + + phist_info->VL53L1_p_009 = + pHD->VL53L1_p_009; + + phist_info->total_periods_elapsed = + pHD->total_periods_elapsed; + + phist_info->ambient_events_sum = + pHD->ambient_events_sum; + } @@ -4201,6 +4236,21 @@ VL53L1_Error VL53L1_get_device_results( + if (status != VL53L1_ERROR_NONE) + goto UPDATE_DYNAMIC_CONFIG; + + VL53L1_hist_copy_results_to_sys_and_core( + &(pdev->hist_data), + presults, + &(pdev->sys_results), + &(pdev->core_results)); + + + + + + +UPDATE_DYNAMIC_CONFIG: if (pzone_cfg->active_zones > 0) { if (pstate->rd_device_state != VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { @@ -4216,9 +4266,10 @@ VL53L1_Error VL53L1_get_device_results( for (i = 0; i < VL53L1_MAX_USER_ZONES; i++) { pzone_cfg->bin_config[i] = - ((pdev->ll_state.cfg_internal_stream_count) & 0x01) ? - VL53L1_ZONECONFIG_BINCONFIG__HIGHAMB : - VL53L1_ZONECONFIG_BINCONFIG__LOWAMB; + ((pdev->ll_state.cfg_internal_stream_count) + & 0x01) ? + VL53L1_ZONECONFIG_BINCONFIG__HIGHAMB : + VL53L1_ZONECONFIG_BINCONFIG__LOWAMB; } if (status == VL53L1_ERROR_NONE) @@ -4230,9 +4281,8 @@ VL53L1_Error VL53L1_get_device_results( - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) status = VL53L1_dynamic_xtalk_correction_corrector(Dev); - } #ifdef VL53L1_LOG_ENABLE if (status == VL53L1_ERROR_NONE) @@ -4252,38 +4302,38 @@ VL53L1_Error VL53L1_get_device_results( if (status == VL53L1_ERROR_NONE) VL53L1_copy_sys_and_core_results_to_range_results( - (int32_t)pdev->gain_cal.standard_ranging_gain_factor, - &(pdev->sys_results), - &(pdev->core_results), - presults); + (int32_t)pdev->gain_cal.standard_ranging_gain_factor, + &(pdev->sys_results), + &(pdev->core_results), + presults); - if (pdev->low_power_auto_data.is_low_power_auto_mode == 1) { + if (pL->is_low_power_auto_mode == 1) { if ((status == VL53L1_ERROR_NONE) && - (pdev->low_power_auto_data.low_power_auto_range_count == 0)) { + (pL->low_power_auto_range_count == 0)) { - status = VL53L1_low_power_auto_setup_manual_calibration( + status = + VL53L1_low_power_auto_setup_manual_calibration( Dev); - pdev->low_power_auto_data.low_power_auto_range_count = 1; + pL->low_power_auto_range_count = 1; } else if ((status == VL53L1_ERROR_NONE) && - (pdev->low_power_auto_data.low_power_auto_range_count == 1)) { - pdev->low_power_auto_data.low_power_auto_range_count = 2; + (pL->low_power_auto_range_count == 1)) { + pL->low_power_auto_range_count = 2; } - if ((pdev->low_power_auto_data.low_power_auto_range_count != 0xFF) && + if ((pL->low_power_auto_range_count != 0xFF) && (status == VL53L1_ERROR_NONE)) { status = VL53L1_low_power_auto_update_DSS( Dev); } - } @@ -4301,13 +4351,15 @@ VL53L1_Error VL53L1_get_device_results( pres->zone_results.max_zones = VL53L1_MAX_USER_ZONES; pres->zone_results.active_zones = pdev->zone_cfg.active_zones+1; + zid = pdev->ll_state.rd_zone_id; - if (pdev->ll_state.rd_zone_id < pres->zone_results.max_zones) { + if (zid < pres->zone_results.max_zones) { pobjects = - &(pres->zone_results.VL53L1_PRM_00005[pdev->ll_state.rd_zone_id]); + &(pres->zone_results.VL53L1_p_002[zid]); - pobjects->cfg_device_state = presults->cfg_device_state; + pobjects->cfg_device_state = + presults->cfg_device_state; pobjects->rd_device_state = presults->rd_device_state; pobjects->zone_id = presults->zone_id; pobjects->stream_count = presults->stream_count; @@ -4315,12 +4367,12 @@ VL53L1_Error VL53L1_get_device_results( - pobjects->xmonitor.VL53L1_PRM_00017 = - presults->xmonitor.VL53L1_PRM_00017; - pobjects->xmonitor.VL53L1_PRM_00018 = - presults->xmonitor.VL53L1_PRM_00018; - pobjects->xmonitor.VL53L1_PRM_00013 = - presults->xmonitor.VL53L1_PRM_00013; + pobjects->xmonitor.VL53L1_p_020 = + presults->xmonitor.VL53L1_p_020; + pobjects->xmonitor.VL53L1_p_021 = + presults->xmonitor.VL53L1_p_021; + pobjects->xmonitor.VL53L1_p_014 = + presults->xmonitor.VL53L1_p_014; pobjects->xmonitor.range_status = presults->xmonitor.range_status; @@ -4328,14 +4380,14 @@ VL53L1_Error VL53L1_get_device_results( pobjects->active_objects = presults->active_results; for (i = 0; i < presults->active_results; i++) { - pobjects->VL53L1_PRM_00005[i].VL53L1_PRM_00017 = - presults->VL53L1_PRM_00005[i].VL53L1_PRM_00017; - pobjects->VL53L1_PRM_00005[i].VL53L1_PRM_00018 = - presults->VL53L1_PRM_00005[i].VL53L1_PRM_00018; - pobjects->VL53L1_PRM_00005[i].VL53L1_PRM_00013 = - presults->VL53L1_PRM_00005[i].VL53L1_PRM_00013; - pobjects->VL53L1_PRM_00005[i].range_status = - presults->VL53L1_PRM_00005[i].range_status; + pobjects->VL53L1_p_002[i].VL53L1_p_020 = + presults->VL53L1_p_002[i].VL53L1_p_020; + pobjects->VL53L1_p_002[i].VL53L1_p_021 = + presults->VL53L1_p_002[i].VL53L1_p_021; + pobjects->VL53L1_p_002[i].VL53L1_p_014 = + presults->VL53L1_p_002[i].VL53L1_p_014; + pobjects->VL53L1_p_002[i].range_status = + presults->VL53L1_p_002[i].range_status; } @@ -4406,9 +4458,9 @@ VL53L1_Error VL53L1_clear_interrupt_and_enable_next_range( if (status == VL53L1_ERROR_NONE) status = VL53L1_init_and_start_range( - Dev, - measurement_mode, - VL53L1_DEVICECONFIGLEVEL_GENERAL_ONWARDS); + Dev, + measurement_mode, + VL53L1_DEVICECONFIGLEVEL_GENERAL_ONWARDS); LOG_FUNCTION_END(status); @@ -4483,8 +4535,8 @@ VL53L1_Error VL53L1_get_histogram_bin_data( - i2c_buffer_offset_bytes = \ - VL53L1_PHASECAL_RESULT__REFERENCE_PHASE - \ + i2c_buffer_offset_bytes = + VL53L1_PHASECAL_RESULT__REFERENCE_PHASE - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; pbuffer = &buffer[i2c_buffer_offset_bytes]; @@ -4492,8 +4544,8 @@ VL53L1_Error VL53L1_get_histogram_bin_data( pdata->phasecal_result__reference_phase = VL53L1_i2c_decode_uint16_t(2, pbuffer); - i2c_buffer_offset_bytes = \ - VL53L1_PHASECAL_RESULT__VCSEL_START - \ + i2c_buffer_offset_bytes = + VL53L1_PHASECAL_RESULT__VCSEL_START - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; pdata->phasecal_result__vcsel_start = buffer[i2c_buffer_offset_bytes]; @@ -4512,20 +4564,20 @@ VL53L1_Error VL53L1_get_histogram_bin_data( - i2c_buffer_offset_bytes = \ - VL53L1_RESULT__HISTOGRAM_BIN_23_0_MSB - \ + i2c_buffer_offset_bytes = + VL53L1_RESULT__HISTOGRAM_BIN_23_0_MSB - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; bin_23_0 = buffer[i2c_buffer_offset_bytes] << 2; - i2c_buffer_offset_bytes = \ - VL53L1_RESULT__HISTOGRAM_BIN_23_0_LSB - \ + i2c_buffer_offset_bytes = + VL53L1_RESULT__HISTOGRAM_BIN_23_0_LSB - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; bin_23_0 += buffer[i2c_buffer_offset_bytes]; - i2c_buffer_offset_bytes = \ - VL53L1_RESULT__HISTOGRAM_BIN_23_0 - \ + i2c_buffer_offset_bytes = + VL53L1_RESULT__HISTOGRAM_BIN_23_0 - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; buffer[i2c_buffer_offset_bytes] = bin_23_0; @@ -4536,23 +4588,23 @@ VL53L1_Error VL53L1_get_histogram_bin_data( - i2c_buffer_offset_bytes = \ - VL53L1_RESULT__HISTOGRAM_BIN_0_2 - \ + i2c_buffer_offset_bytes = + VL53L1_RESULT__HISTOGRAM_BIN_0_2 - VL53L1_HISTOGRAM_BIN_DATA_I2C_INDEX; pbuffer = &buffer[i2c_buffer_offset_bytes]; - for (bin = 0 ; bin < VL53L1_HISTOGRAM_BUFFER_SIZE ; bin++) { + for (bin = 0; bin < VL53L1_HISTOGRAM_BUFFER_SIZE; bin++) { pdata->bin_data[bin] = - (int32_t)VL53L1_i2c_decode_uint32_t(3, pbuffer); + (int32_t)VL53L1_i2c_decode_uint32_t(3, pbuffer); pbuffer += 3; } pdata->zone_id = pdev->ll_state.rd_zone_id; - pdata->VL53L1_PRM_00019 = 0; - pdata->VL53L1_PRM_00020 = VL53L1_HISTOGRAM_BUFFER_SIZE; - pdata->VL53L1_PRM_00021 = VL53L1_HISTOGRAM_BUFFER_SIZE; + pdata->VL53L1_p_022 = 0; + pdata->VL53L1_p_023 = VL53L1_HISTOGRAM_BUFFER_SIZE; + pdata->VL53L1_p_024 = VL53L1_HISTOGRAM_BUFFER_SIZE; pdata->cal_config__vcsel_start = pgen_cfg->cal_config__vcsel_start; @@ -4566,7 +4618,7 @@ VL53L1_Error VL53L1_get_histogram_bin_data( - pdata->VL53L1_PRM_00022 = + pdata->VL53L1_p_019 = pstat_nvm->osc_measured__fast_osc__frequency; @@ -4581,16 +4633,16 @@ VL53L1_Error VL53L1_get_histogram_bin_data( if (pdev->ll_state.rd_timing_status == 0) { - encoded_timeout = \ - (ptim_cfg->range_config__timeout_macrop_a_hi << 8) \ + encoded_timeout = + (ptim_cfg->range_config__timeout_macrop_a_hi << 8) + ptim_cfg->range_config__timeout_macrop_a_lo; - pdata->VL53L1_PRM_00008 = ptim_cfg->range_config__vcsel_period_a; + pdata->VL53L1_p_009 = ptim_cfg->range_config__vcsel_period_a; } else { - encoded_timeout = \ - (ptim_cfg->range_config__timeout_macrop_b_hi << 8) \ - + ptim_cfg->range_config__timeout_macrop_b_lo; - pdata->VL53L1_PRM_00008 = ptim_cfg->range_config__vcsel_period_b; + encoded_timeout = + (ptim_cfg->range_config__timeout_macrop_b_hi << 8) + + ptim_cfg->range_config__timeout_macrop_b_lo; + pdata->VL53L1_p_009 = ptim_cfg->range_config__vcsel_period_b; } @@ -4599,10 +4651,9 @@ VL53L1_Error VL53L1_get_histogram_bin_data( pdata->number_of_ambient_bins = 0; for (i = 0; i < 6; i++) { - if ((pdata->bin_seq[i] & 0x07) == 0x07) { + if ((pdata->bin_seq[i] & 0x07) == 0x07) pdata->number_of_ambient_bins = pdata->number_of_ambient_bins + 0x04; - } } pdata->total_periods_elapsed = @@ -4615,7 +4666,7 @@ VL53L1_Error VL53L1_get_histogram_bin_data( pll_period_us = - VL53L1_calc_pll_period_us(pdata->VL53L1_PRM_00022); + VL53L1_calc_pll_period_us(pdata->VL53L1_p_019); @@ -4657,12 +4708,12 @@ VL53L1_Error VL53L1_get_histogram_bin_data( - pzone_dyn_cfg = &(pres->zone_dyn_cfgs.VL53L1_PRM_00005[pdata->zone_id]); + pzone_dyn_cfg = &(pres->zone_dyn_cfgs.VL53L1_p_002[pdata->zone_id]); pdata->roi_config__user_roi_centre_spad = - pzone_dyn_cfg->roi_config__user_roi_centre_spad; + pzone_dyn_cfg->roi_config__user_roi_centre_spad; pdata->roi_config__user_roi_requested_global_xy_size = - pzone_dyn_cfg->roi_config__user_roi_requested_global_xy_size; + pzone_dyn_cfg->roi_config__user_roi_requested_global_xy_size; @@ -4709,6 +4760,9 @@ void VL53L1_copy_sys_and_core_results_to_range_results( VL53L1_range_data_t *pdata; int32_t range_mm = 0; uint32_t tmpu32 = 0; + uint16_t rpscr_crosstalk_corrected_mcps_sd0; + uint16_t rmmo_effective_spads_sd0; + uint16_t rmmi_effective_spads_sd0; LOG_FUNCTION_START(""); @@ -4720,50 +4774,60 @@ void VL53L1_copy_sys_and_core_results_to_range_results( presults->wrap_dmax_mm = 0; presults->max_results = VL53L1_MAX_RANGE_RESULTS; presults->active_results = 1; + rpscr_crosstalk_corrected_mcps_sd0 = + psys->result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; + rmmo_effective_spads_sd0 = + psys->result__mm_outer_actual_effective_spads_sd0; + rmmi_effective_spads_sd0 = + psys->result__mm_inner_actual_effective_spads_sd0; - for (i = 0 ; i < VL53L1_MAX_AMBIENT_DMAX_VALUES ; i++) - presults->VL53L1_PRM_00006[i] = 0; + for (i = 0; i < VL53L1_MAX_AMBIENT_DMAX_VALUES; i++) + presults->VL53L1_p_007[i] = 0; - pdata = &(presults->VL53L1_PRM_00005[0]); + pdata = &(presults->VL53L1_p_002[0]); - for (i = 0 ; i < 2 ; i++) { + for (i = 0; i < 2; i++) { pdata->range_id = i; pdata->time_stamp = 0; if ((psys->result__stream_count == 0) && - ((psys->result__range_status & VL53L1_RANGE_STATUS__RANGE_STATUS_MASK) == + ((psys->result__range_status & + VL53L1_RANGE_STATUS__RANGE_STATUS_MASK) == VL53L1_DEVICEERROR_RANGECOMPLETE)) { - pdata->range_status = VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK; + pdata->range_status = + VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK; } else { pdata->range_status = - psys->result__range_status & VL53L1_RANGE_STATUS__RANGE_STATUS_MASK; + psys->result__range_status & + VL53L1_RANGE_STATUS__RANGE_STATUS_MASK; } - pdata->VL53L1_PRM_00014 = 0; - pdata->VL53L1_PRM_00019 = 0; - pdata->VL53L1_PRM_00023 = 0; - pdata->VL53L1_PRM_00024 = 0; - pdata->VL53L1_PRM_00015 = 0; - pdata->VL53L1_PRM_00025 = 0; + pdata->VL53L1_p_015 = 0; + pdata->VL53L1_p_022 = 0; + pdata->VL53L1_p_025 = 0; + pdata->VL53L1_p_026 = 0; + pdata->VL53L1_p_016 = 0; + pdata->VL53L1_p_027 = 0; switch (i) { case 0: - - if (psys->result__report_status == VL53L1_DEVICEREPORTSTATUS_MM1) - pdata->VL53L1_PRM_00004 = - psys->result__mm_inner_actual_effective_spads_sd0; - else if (psys->result__report_status == VL53L1_DEVICEREPORTSTATUS_MM2) - pdata->VL53L1_PRM_00004 = - psys->result__mm_outer_actual_effective_spads_sd0; + if (psys->result__report_status == + VL53L1_DEVICEREPORTSTATUS_MM1) + pdata->VL53L1_p_006 = + rmmi_effective_spads_sd0; + else if (psys->result__report_status == + VL53L1_DEVICEREPORTSTATUS_MM2) + pdata->VL53L1_p_006 = + rmmo_effective_spads_sd0; else - pdata->VL53L1_PRM_00004 = - psys->result__dss_actual_effective_spads_sd0; + pdata->VL53L1_p_006 = + psys->result__dss_actual_effective_spads_sd0; pdata->peak_signal_count_rate_mcps = - psys->result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0; + rpscr_crosstalk_corrected_mcps_sd0; pdata->avg_signal_count_rate_mcps = psys->result__avg_signal_count_rate_mcps_sd0; pdata->ambient_count_rate_mcps = @@ -4775,19 +4839,19 @@ void VL53L1_copy_sys_and_core_results_to_range_results( tmpu32 = ((uint32_t)psys->result__sigma_sd0 << 5); - if (tmpu32 > 0xFFFF) { + if (tmpu32 > 0xFFFF) tmpu32 = 0xFFFF; - } - pdata->VL53L1_PRM_00003 = (uint16_t)tmpu32; + + pdata->VL53L1_p_005 = (uint16_t)tmpu32; - pdata->VL53L1_PRM_00013 = + pdata->VL53L1_p_014 = psys->result__phase_sd0; - range_mm = - (int32_t)psys->result__final_crosstalk_corrected_range_mm_sd0; + range_mm = (int32_t)( + psys->result__final_crosstalk_corrected_range_mm_sd0); @@ -4797,19 +4861,19 @@ void VL53L1_copy_sys_and_core_results_to_range_results( pdata->median_range_mm = (int16_t)range_mm; - pdata->VL53L1_PRM_00018 = + pdata->VL53L1_p_021 = pcore->result_core__ranging_total_events_sd0; - pdata->VL53L1_PRM_00012 = + pdata->VL53L1_p_013 = pcore->result_core__signal_total_events_sd0; pdata->total_periods_elapsed = pcore->result_core__total_periods_elapsed_sd0; - pdata->VL53L1_PRM_00017 = + pdata->VL53L1_p_020 = pcore->result_core__ambient_window_events_sd0; break; case 1: - pdata->VL53L1_PRM_00004 = + pdata->VL53L1_p_006 = psys->result__dss_actual_effective_spads_sd1; pdata->peak_signal_count_rate_mcps = psys->result__peak_signal_count_rate_mcps_sd1; @@ -4824,19 +4888,19 @@ void VL53L1_copy_sys_and_core_results_to_range_results( tmpu32 = ((uint32_t)psys->result__sigma_sd1 << 5); - if (tmpu32 > 0xFFFF) { + if (tmpu32 > 0xFFFF) tmpu32 = 0xFFFF; - } - pdata->VL53L1_PRM_00003 = (uint16_t)tmpu32; + + pdata->VL53L1_p_005 = (uint16_t)tmpu32; - pdata->VL53L1_PRM_00013 = + pdata->VL53L1_p_014 = psys->result__phase_sd1; - range_mm = - (int32_t)psys->result__final_crosstalk_corrected_range_mm_sd1; + range_mm = (int32_t)( + psys->result__final_crosstalk_corrected_range_mm_sd1); @@ -4846,13 +4910,13 @@ void VL53L1_copy_sys_and_core_results_to_range_results( pdata->median_range_mm = (int16_t)range_mm; - pdata->VL53L1_PRM_00018 = + pdata->VL53L1_p_021 = pcore->result_core__ranging_total_events_sd1; - pdata->VL53L1_PRM_00012 = + pdata->VL53L1_p_013 = pcore->result_core__signal_total_events_sd1; pdata->total_periods_elapsed = pcore->result_core__total_periods_elapsed_sd1; - pdata->VL53L1_PRM_00017 = + pdata->VL53L1_p_020 = pcore->result_core__ambient_window_events_sd1; break; @@ -4862,8 +4926,8 @@ void VL53L1_copy_sys_and_core_results_to_range_results( - pdata->VL53L1_PRM_00026 = pdata->VL53L1_PRM_00013; - pdata->VL53L1_PRM_00027 = pdata->VL53L1_PRM_00013; + pdata->VL53L1_p_028 = pdata->VL53L1_p_014; + pdata->VL53L1_p_029 = pdata->VL53L1_p_014; pdata->min_range_mm = pdata->median_range_mm; pdata->max_range_mm = pdata->median_range_mm; @@ -4896,7 +4960,8 @@ void VL53L1_copy_sys_and_core_results_to_range_results( presults->device_status = (psys->result__range_status & VL53L1_RANGE_STATUS__RANGE_STATUS_MASK); - presults->VL53L1_PRM_00005[0].range_status = VL53L1_DEVICEERROR_NOUPDATE; + presults->VL53L1_p_002[0].range_status = + VL53L1_DEVICEERROR_NOUPDATE; break; } @@ -4924,11 +4989,11 @@ VL53L1_Error VL53L1_set_zone_dss_config( if (pstate->cfg_device_state == VL53L1_DEVICESTATE_RANGING_DSS_MANUAL) { - pdev->gen_cfg.dss_config__roi_mode_control = + pdev->gen_cfg.dss_config__roi_mode_control = VL53L1_DSS_CONTROL__MODE_EFFSPADS; pdev->gen_cfg.dss_config__manual_effective_spads_select = pzone_dyn_cfg->dss_requested_effective_spad_count; - } else { + } else { pdev->gen_cfg.dss_config__roi_mode_control = VL53L1_DSS_CONTROL__MODE_TARGET_RATE; } @@ -5006,7 +5071,8 @@ VL53L1_Error VL53L1_set_GPIO_interrupt_config( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - VL53L1_GPIO_interrupt_config_t *pintconf = &(pdev->gpio_interrupt_config); + VL53L1_GPIO_interrupt_config_t *pintconf = + &(pdev->gpio_interrupt_config); LOG_FUNCTION_START(""); @@ -5050,7 +5116,8 @@ VL53L1_Error VL53L1_set_GPIO_interrupt_config_struct( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - VL53L1_GPIO_interrupt_config_t *pintconf = &(pdev->gpio_interrupt_config); + VL53L1_GPIO_interrupt_config_t *pintconf = + &(pdev->gpio_interrupt_config); LOG_FUNCTION_START(""); @@ -5197,13 +5264,13 @@ VL53L1_Error VL53L1_get_dmax_calibration_data( case VL53L1_DEVICEDMAXMODE__PER_ZONE_CAL_DATA: pdmax_cal->ref__actual_effective_spads = - (uint16_t)pres->zone_cal.VL53L1_PRM_00005[zone_id].effective_spads; + (uint16_t)pres->zone_cal.VL53L1_p_002[zone_id].effective_spads; pdmax_cal->ref__peak_signal_count_rate_mcps = - (uint16_t)pres->zone_cal.VL53L1_PRM_00005[zone_id].peak_rate_mcps; + (uint16_t)pres->zone_cal.VL53L1_p_002[zone_id].peak_rate_mcps; pdmax_cal->ref__distance_mm = - pres->zone_cal.cal_distance_mm; + pres->zone_cal.cal_distance_mm; pdmax_cal->ref_reflectance_pc = - pres->zone_cal.cal_reflectance_pc; + pres->zone_cal.cal_reflectance_pc; pdmax_cal->coverglass_transmission = 0x0100; break; @@ -5407,9 +5474,9 @@ VL53L1_Error VL53L1_set_zone_calibration_data( LOG_FUNCTION_START(""); if (pzone_cal->struct_version != - VL53L1_LL_ZONE_CALIBRATION_DATA_STRUCT_VERSION) { + VL53L1_LL_ZONE_CALIBRATION_DATA_STRUCT_VERSION) status = VL53L1_ERROR_INVALID_PARAMS; - } + if (status == VL53L1_ERROR_NONE) @@ -5469,6 +5536,8 @@ VL53L1_Error VL53L1_get_tuning_debug_data( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_xtalkextract_config_t *pXC = &(pdev->xtalk_extract_cfg); LOG_FUNCTION_START(""); @@ -5483,58 +5552,58 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->tuning_parms.tp_tuning_parm_lld_version; ptun_data->vl53l1_tuningparm_hist_algo_select = - pdev->histpostprocess.hist_algo_select; + pHP->hist_algo_select; ptun_data->vl53l1_tuningparm_hist_target_order = - pdev->histpostprocess.hist_target_order; + pHP->hist_target_order; ptun_data->vl53l1_tuningparm_hist_filter_woi_0 = - pdev->histpostprocess.filter_woi0; + pHP->filter_woi0; ptun_data->vl53l1_tuningparm_hist_filter_woi_1 = - pdev->histpostprocess.filter_woi1; + pHP->filter_woi1; ptun_data->vl53l1_tuningparm_hist_amb_est_method = - pdev->histpostprocess.hist_amb_est_method; + pHP->hist_amb_est_method; ptun_data->vl53l1_tuningparm_hist_amb_thresh_sigma_0 = - pdev->histpostprocess.ambient_thresh_sigma0; + pHP->ambient_thresh_sigma0; ptun_data->vl53l1_tuningparm_hist_amb_thresh_sigma_1 = - pdev->histpostprocess.ambient_thresh_sigma1; + pHP->ambient_thresh_sigma1; ptun_data->vl53l1_tuningparm_hist_min_amb_thresh_events = - pdev->histpostprocess.min_ambient_thresh_events; + pHP->min_ambient_thresh_events; ptun_data->vl53l1_tuningparm_hist_amb_events_scaler = - pdev->histpostprocess.ambient_thresh_events_scaler; + pHP->ambient_thresh_events_scaler; ptun_data->vl53l1_tuningparm_hist_noise_threshold = - pdev->histpostprocess.noise_threshold; + pHP->noise_threshold; ptun_data->vl53l1_tuningparm_hist_signal_total_events_limit = - pdev->histpostprocess.signal_total_events_limit; + pHP->signal_total_events_limit; ptun_data->vl53l1_tuningparm_hist_sigma_est_ref_mm = - pdev->histpostprocess.sigma_estimator__sigma_ref_mm; + pHP->sigma_estimator__sigma_ref_mm; ptun_data->vl53l1_tuningparm_hist_sigma_thresh_mm = - pdev->histpostprocess.sigma_thresh; + pHP->sigma_thresh; ptun_data->vl53l1_tuningparm_hist_gain_factor = pdev->gain_cal.histogram_ranging_gain_factor; ptun_data->vl53l1_tuningparm_consistency_hist_phase_tolerance = - pdev->histpostprocess.algo__consistency_check__phase_tolerance; + pHP->algo__consistency_check__phase_tolerance; ptun_data->vl53l1_tuningparm_consistency_hist_min_max_tolerance_mm = - pdev->histpostprocess.algo__consistency_check__min_max_tolerance; + pHP->algo__consistency_check__min_max_tolerance; ptun_data->vl53l1_tuningparm_consistency_hist_event_sigma = - pdev->histpostprocess.algo__consistency_check__event_sigma; + pHP->algo__consistency_check__event_sigma; - ptun_data->vl53l1_tuningparm_consistency_hist_event_sigma_min_spad_limit = - pdev->histpostprocess.algo__consistency_check__event_min_spad_count; + ptun_data->vl53l1_tuningparm_consistency_hist_event_sigma_min_spad_limit + = pHP->algo__consistency_check__event_min_spad_count; ptun_data->vl53l1_tuningparm_initial_phase_rtn_histo_long_range = pdev->tuning_parms.tp_init_phase_rtn_hist_long; @@ -5564,13 +5633,13 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; ptun_data->vl53l1_tuningparm_xtalk_detect_min_max_tolerance = - pdev->histpostprocess.algo__crosstalk_detect_min_max_tolerance; + pHP->algo__crosstalk_detect_min_max_tolerance; ptun_data->vl53l1_tuningparm_xtalk_detect_max_valid_rate_kcps = pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps; ptun_data->vl53l1_tuningparm_xtalk_detect_event_sigma = - pdev->histpostprocess.algo__crosstalk_detect_event_sigma; + pHP->algo__crosstalk_detect_event_sigma; ptun_data->vl53l1_tuningparm_hist_xtalk_margin_kcps = pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps; @@ -5621,7 +5690,7 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult; ptun_data->vl53l1_tuningparm_lite_seed_config = - pdev->tuning_parms.tp_lite_seed_cfg ; + pdev->tuning_parms.tp_lite_seed_cfg; ptun_data->vl53l1_tuningparm_lite_quantifier = pdev->tuning_parms.tp_lite_quantifier; @@ -5678,7 +5747,7 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->refspadchar.device_test_mode; ptun_data->vl53l1_tuningparm_refspadchar_vcsel_period = - pdev->refspadchar.VL53L1_PRM_00008; + pdev->refspadchar.VL53L1_p_009; ptun_data->vl53l1_tuningparm_refspadchar_phasecal_timeout_us = pdev->refspadchar.timeout_us; @@ -5693,31 +5762,31 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->refspadchar.max_count_rate_limit_mcps; ptun_data->vl53l1_tuningparm_xtalk_extract_num_of_samples = - pdev->xtalk_extract_cfg.num_of_samples; + pXC->num_of_samples; ptun_data->vl53l1_tuningparm_xtalk_extract_min_filter_thresh_mm = - pdev->xtalk_extract_cfg.algo__crosstalk_extract_min_valid_range_mm; + pXC->algo__crosstalk_extract_min_valid_range_mm; ptun_data->vl53l1_tuningparm_xtalk_extract_max_filter_thresh_mm = - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_range_mm; + pXC->algo__crosstalk_extract_max_valid_range_mm; ptun_data->vl53l1_tuningparm_xtalk_extract_dss_rate_mcps = - pdev->xtalk_extract_cfg.dss_config__target_total_rate_mcps; + pXC->dss_config__target_total_rate_mcps; ptun_data->vl53l1_tuningparm_xtalk_extract_phasecal_timeout_us = - pdev->xtalk_extract_cfg.phasecal_config_timeout_us; + pXC->phasecal_config_timeout_us; ptun_data->vl53l1_tuningparm_xtalk_extract_max_valid_rate_kcps = - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_rate_kcps; + pXC->algo__crosstalk_extract_max_valid_rate_kcps; ptun_data->vl53l1_tuningparm_xtalk_extract_sigma_threshold_mm = - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm; + pXC->algo__crosstalk_extract_max_sigma_mm; ptun_data->vl53l1_tuningparm_xtalk_extract_dss_timeout_us = - pdev->xtalk_extract_cfg.mm_config_timeout_us; + pXC->mm_config_timeout_us; ptun_data->vl53l1_tuningparm_xtalk_extract_bin_timeout_us = - pdev->xtalk_extract_cfg.range_config_timeout_us; + pXC->range_config_timeout_us; ptun_data->vl53l1_tuningparm_offset_cal_dss_rate_mcps = pdev->offsetcal_cfg.dss_config__target_total_rate_mcps; @@ -5759,7 +5828,7 @@ VL53L1_Error VL53L1_get_tuning_debug_data( pdev->zonecal_cfg.zone_num_of_samples; ptun_data->vl53l1_tuningparm_spadmap_vcsel_period = - pdev->ssc_cfg.VL53L1_PRM_00008; + pdev->ssc_cfg.VL53L1_p_009; ptun_data->vl53l1_tuningparm_spadmap_vcsel_start = pdev->ssc_cfg.vcsel_start; @@ -5920,6 +5989,8 @@ VL53L1_Error VL53L1_get_tuning_parm( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_xtalkextract_config_t *pXC = &(pdev->xtalk_extract_cfg); LOG_FUNCTION_START(""); @@ -5927,203 +5998,203 @@ VL53L1_Error VL53L1_get_tuning_parm( case VL53L1_TUNINGPARM_VERSION: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_tuning_parm_version; + (int32_t)pdev->tuning_parms.tp_tuning_parm_version; break; case VL53L1_TUNINGPARM_KEY_TABLE_VERSION: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_tuning_parm_key_table_version; + (int32_t)pdev->tuning_parms.tp_tuning_parm_key_table_version; break; case VL53L1_TUNINGPARM_LLD_VERSION: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_tuning_parm_lld_version; + (int32_t)pdev->tuning_parms.tp_tuning_parm_lld_version; break; case VL53L1_TUNINGPARM_HIST_ALGO_SELECT: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.hist_algo_select; + (int32_t)pHP->hist_algo_select; break; case VL53L1_TUNINGPARM_HIST_TARGET_ORDER: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.hist_target_order; + (int32_t)pHP->hist_target_order; break; case VL53L1_TUNINGPARM_HIST_FILTER_WOI_0: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.filter_woi0; + (int32_t)pHP->filter_woi0; break; case VL53L1_TUNINGPARM_HIST_FILTER_WOI_1: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.filter_woi1; + (int32_t)pHP->filter_woi1; break; case VL53L1_TUNINGPARM_HIST_AMB_EST_METHOD: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.hist_amb_est_method; + (int32_t)pHP->hist_amb_est_method; break; case VL53L1_TUNINGPARM_HIST_AMB_THRESH_SIGMA_0: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.ambient_thresh_sigma0; + (int32_t)pHP->ambient_thresh_sigma0; break; case VL53L1_TUNINGPARM_HIST_AMB_THRESH_SIGMA_1: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.ambient_thresh_sigma1; + (int32_t)pHP->ambient_thresh_sigma1; break; case VL53L1_TUNINGPARM_HIST_MIN_AMB_THRESH_EVENTS: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.min_ambient_thresh_events; + (int32_t)pHP->min_ambient_thresh_events; break; case VL53L1_TUNINGPARM_HIST_AMB_EVENTS_SCALER: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.ambient_thresh_events_scaler; + (int32_t)pHP->ambient_thresh_events_scaler; break; case VL53L1_TUNINGPARM_HIST_NOISE_THRESHOLD: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.noise_threshold; + (int32_t)pHP->noise_threshold; break; case VL53L1_TUNINGPARM_HIST_SIGNAL_TOTAL_EVENTS_LIMIT: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.signal_total_events_limit; + (int32_t)pHP->signal_total_events_limit; break; case VL53L1_TUNINGPARM_HIST_SIGMA_EST_REF_MM: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.sigma_estimator__sigma_ref_mm; + (int32_t)pHP->sigma_estimator__sigma_ref_mm; break; case VL53L1_TUNINGPARM_HIST_SIGMA_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.sigma_thresh; + (int32_t)pHP->sigma_thresh; break; case VL53L1_TUNINGPARM_HIST_GAIN_FACTOR: *ptuning_parm_value = - (int32_t)pdev->gain_cal.histogram_ranging_gain_factor; + (int32_t)pdev->gain_cal.histogram_ranging_gain_factor; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_PHASE_TOLERANCE: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__consistency_check__phase_tolerance; + (int32_t)pHP->algo__consistency_check__phase_tolerance; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__consistency_check__min_max_tolerance; + (int32_t)pHP->algo__consistency_check__min_max_tolerance; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__consistency_check__event_sigma; + (int32_t)pHP->algo__consistency_check__event_sigma; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_MIN_SPAD_LIMIT: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__consistency_check__event_min_spad_count; + (int32_t)pHP->algo__consistency_check__event_min_spad_count; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_LONG_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_long; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_long; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_MED_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_med; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_med; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_SHORT_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_short; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_hist_short; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_LONG_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_long; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_long; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_MED_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_med; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_med; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_SHORT_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_short; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_hist_short; break; case VL53L1_TUNINGPARM_XTALK_DETECT_MIN_VALID_RANGE_MM: - *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.algo__crosstalk_detect_min_valid_range_mm; + *ptuning_parm_value = (int32_t)( + pdev->xtalk_cfg.algo__crosstalk_detect_min_valid_range_mm); break; case VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RANGE_MM: - *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_range_mm; + *ptuning_parm_value = (int32_t)( + pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_range_mm); break; case VL53L1_TUNINGPARM_XTALK_DETECT_MAX_SIGMA_MM: *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; + (int32_t)pdev->xtalk_cfg.algo__crosstalk_detect_max_sigma_mm; break; case VL53L1_TUNINGPARM_XTALK_DETECT_MIN_MAX_TOLERANCE: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__crosstalk_detect_min_max_tolerance; + (int32_t)pHP->algo__crosstalk_detect_min_max_tolerance; break; case VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RATE_KCPS: - *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps; + *ptuning_parm_value = (int32_t)( + pdev->xtalk_cfg.algo__crosstalk_detect_max_valid_rate_kcps); break; case VL53L1_TUNINGPARM_XTALK_DETECT_EVENT_SIGMA: *ptuning_parm_value = - (int32_t)pdev->histpostprocess.algo__crosstalk_detect_event_sigma; + (int32_t)pHP->algo__crosstalk_detect_event_sigma; break; case VL53L1_TUNINGPARM_HIST_XTALK_MARGIN_KCPS: *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps; + (int32_t)pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps; break; case VL53L1_TUNINGPARM_CONSISTENCY_LITE_PHASE_TOLERANCE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_consistency_lite_phase_tolerance; + (int32_t)pdev->tuning_parms.tp_consistency_lite_phase_tolerance; break; case VL53L1_TUNINGPARM_PHASECAL_TARGET: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_target; + (int32_t)pdev->tuning_parms.tp_phasecal_target; break; case VL53L1_TUNINGPARM_LITE_CAL_REPEAT_RATE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_cal_repeat_rate; + (int32_t)pdev->tuning_parms.tp_cal_repeat_rate; break; case VL53L1_TUNINGPARM_LITE_RANGING_GAIN_FACTOR: *ptuning_parm_value = - (int32_t)pdev->gain_cal.standard_ranging_gain_factor; + (int32_t)pdev->gain_cal.standard_ranging_gain_factor; break; case VL53L1_TUNINGPARM_LITE_MIN_CLIP_MM: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_min_clip; + (int32_t)pdev->tuning_parms.tp_lite_min_clip; break; case VL53L1_TUNINGPARM_LITE_LONG_SIGMA_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_long_sigma_thresh_mm; + (int32_t)pdev->tuning_parms.tp_lite_long_sigma_thresh_mm; break; case VL53L1_TUNINGPARM_LITE_MED_SIGMA_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_med_sigma_thresh_mm; + (int32_t)pdev->tuning_parms.tp_lite_med_sigma_thresh_mm; break; case VL53L1_TUNINGPARM_LITE_SHORT_SIGMA_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_short_sigma_thresh_mm; + (int32_t)pdev->tuning_parms.tp_lite_short_sigma_thresh_mm; break; case VL53L1_TUNINGPARM_LITE_LONG_MIN_COUNT_RATE_RTN_MCPS: - *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_long_min_count_rate_rtn_mcps; + *ptuning_parm_value = (int32_t)( + pdev->tuning_parms.tp_lite_long_min_count_rate_rtn_mcps); break; case VL53L1_TUNINGPARM_LITE_MED_MIN_COUNT_RATE_RTN_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_med_min_count_rate_rtn_mcps; + (int32_t)pdev->tuning_parms.tp_lite_med_min_count_rate_rtn_mcps; break; case VL53L1_TUNINGPARM_LITE_SHORT_MIN_COUNT_RATE_RTN_MCPS: - *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_short_min_count_rate_rtn_mcps; + *ptuning_parm_value = (int32_t)( + pdev->tuning_parms.tp_lite_short_min_count_rate_rtn_mcps); break; case VL53L1_TUNINGPARM_LITE_SIGMA_EST_PULSE_WIDTH: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_sigma_est_pulse_width_ns; + (int32_t)pdev->tuning_parms.tp_lite_sigma_est_pulse_width_ns; break; case VL53L1_TUNINGPARM_LITE_SIGMA_EST_AMB_WIDTH_NS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_sigma_est_amb_width_ns; + (int32_t)pdev->tuning_parms.tp_lite_sigma_est_amb_width_ns; break; case VL53L1_TUNINGPARM_LITE_SIGMA_REF_MM: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_sigma_ref_mm; + (int32_t)pdev->tuning_parms.tp_lite_sigma_ref_mm; break; case VL53L1_TUNINGPARM_LITE_RIT_MULT: *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult; + (int32_t)pdev->xtalk_cfg.crosstalk_range_ignore_threshold_mult; break; case VL53L1_TUNINGPARM_LITE_SEED_CONFIG: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_seed_cfg ; + (int32_t)pdev->tuning_parms.tp_lite_seed_cfg; break; case VL53L1_TUNINGPARM_LITE_QUANTIFIER: *ptuning_parm_value = @@ -6131,359 +6202,359 @@ VL53L1_Error VL53L1_get_tuning_parm( break; case VL53L1_TUNINGPARM_LITE_FIRST_ORDER_SELECT: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_lite_first_order_select; + (int32_t)pdev->tuning_parms.tp_lite_first_order_select; break; case VL53L1_TUNINGPARM_LITE_XTALK_MARGIN_KCPS: *ptuning_parm_value = - (int32_t)pdev->xtalk_cfg.lite_mode_crosstalk_margin_kcps; + (int32_t)pdev->xtalk_cfg.lite_mode_crosstalk_margin_kcps; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_LONG_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_long; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_long; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_MED_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_med; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_med; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_SHORT_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_short; + (int32_t)pdev->tuning_parms.tp_init_phase_rtn_lite_short; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_LONG_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_long; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_long; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_MED_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_med; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_med; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_SHORT_RANGE: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_short; + (int32_t)pdev->tuning_parms.tp_init_phase_ref_lite_short; break; case VL53L1_TUNINGPARM_TIMED_SEED_CONFIG: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_timed_seed_cfg; + (int32_t)pdev->tuning_parms.tp_timed_seed_cfg; break; case VL53L1_TUNINGPARM_DMAX_CFG_SIGNAL_THRESH_SIGMA: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.signal_thresh_sigma; + (int32_t)pdev->dmax_cfg.signal_thresh_sigma; break; case VL53L1_TUNINGPARM_DMAX_CFG_REFLECTANCE_ARRAY_0: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[0]; + (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[0]; break; case VL53L1_TUNINGPARM_DMAX_CFG_REFLECTANCE_ARRAY_1: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[1]; + (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[1]; break; case VL53L1_TUNINGPARM_DMAX_CFG_REFLECTANCE_ARRAY_2: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[2]; + (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[2]; break; case VL53L1_TUNINGPARM_DMAX_CFG_REFLECTANCE_ARRAY_3: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[3]; + (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[3]; break; case VL53L1_TUNINGPARM_DMAX_CFG_REFLECTANCE_ARRAY_4: *ptuning_parm_value = - (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[4]; + (int32_t)pdev->dmax_cfg.target_reflectance_for_dmax_calc[4]; break; case VL53L1_TUNINGPARM_VHV_LOOPBOUND: *ptuning_parm_value = - (int32_t)pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound; + (int32_t)pdev->stat_nvm.vhv_config__timeout_macrop_loop_bound; break; case VL53L1_TUNINGPARM_REFSPADCHAR_DEVICE_TEST_MODE: *ptuning_parm_value = - (int32_t)pdev->refspadchar.device_test_mode; + (int32_t)pdev->refspadchar.device_test_mode; break; case VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD: *ptuning_parm_value = - (int32_t)pdev->refspadchar.VL53L1_PRM_00008; + (int32_t)pdev->refspadchar.VL53L1_p_009; break; case VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->refspadchar.timeout_us; + (int32_t)pdev->refspadchar.timeout_us; break; case VL53L1_TUNINGPARM_REFSPADCHAR_TARGET_COUNT_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->refspadchar.target_count_rate_mcps; + (int32_t)pdev->refspadchar.target_count_rate_mcps; break; case VL53L1_TUNINGPARM_REFSPADCHAR_MIN_COUNTRATE_LIMIT_MCPS: *ptuning_parm_value = - (int32_t)pdev->refspadchar.min_count_rate_limit_mcps; + (int32_t)pdev->refspadchar.min_count_rate_limit_mcps; break; case VL53L1_TUNINGPARM_REFSPADCHAR_MAX_COUNTRATE_LIMIT_MCPS: *ptuning_parm_value = - (int32_t)pdev->refspadchar.max_count_rate_limit_mcps; + (int32_t)pdev->refspadchar.max_count_rate_limit_mcps; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_NUM_OF_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.num_of_samples; + (int32_t)pXC->num_of_samples; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MIN_FILTER_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_min_valid_range_mm; + (int32_t)pXC->algo__crosstalk_extract_min_valid_range_mm; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_FILTER_THRESH_MM: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_range_mm; + (int32_t)pXC->algo__crosstalk_extract_max_valid_range_mm; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_DSS_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.dss_config__target_total_rate_mcps; + (int32_t)pXC->dss_config__target_total_rate_mcps; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_PHASECAL_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.phasecal_config_timeout_us; + (int32_t)pXC->phasecal_config_timeout_us; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_VALID_RATE_KCPS: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_rate_kcps; + (int32_t)pXC->algo__crosstalk_extract_max_valid_rate_kcps; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_SIGMA_THRESHOLD_MM: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm; + (int32_t)pXC->algo__crosstalk_extract_max_sigma_mm; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_DSS_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.mm_config_timeout_us; + (int32_t)pXC->mm_config_timeout_us; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_BIN_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->xtalk_extract_cfg.range_config_timeout_us; + (int32_t)pXC->range_config_timeout_us; break; case VL53L1_TUNINGPARM_OFFSET_CAL_DSS_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.dss_config__target_total_rate_mcps;; + (int32_t)pdev->offsetcal_cfg.dss_config__target_total_rate_mcps; break; case VL53L1_TUNINGPARM_OFFSET_CAL_PHASECAL_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.phasecal_config_timeout_us; + (int32_t)pdev->offsetcal_cfg.phasecal_config_timeout_us; break; case VL53L1_TUNINGPARM_OFFSET_CAL_MM_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.mm_config_timeout_us; + (int32_t)pdev->offsetcal_cfg.mm_config_timeout_us; break; case VL53L1_TUNINGPARM_OFFSET_CAL_RANGE_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.range_config_timeout_us; + (int32_t)pdev->offsetcal_cfg.range_config_timeout_us; break; case VL53L1_TUNINGPARM_OFFSET_CAL_PRE_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.pre_num_of_samples; + (int32_t)pdev->offsetcal_cfg.pre_num_of_samples; break; case VL53L1_TUNINGPARM_OFFSET_CAL_MM1_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.mm1_num_of_samples; + (int32_t)pdev->offsetcal_cfg.mm1_num_of_samples; break; case VL53L1_TUNINGPARM_OFFSET_CAL_MM2_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->offsetcal_cfg.mm2_num_of_samples; + (int32_t)pdev->offsetcal_cfg.mm2_num_of_samples; break; case VL53L1_TUNINGPARM_ZONE_CAL_DSS_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.dss_config__target_total_rate_mcps; + (int32_t)pdev->zonecal_cfg.dss_config__target_total_rate_mcps; break; case VL53L1_TUNINGPARM_ZONE_CAL_PHASECAL_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.phasecal_config_timeout_us; + (int32_t)pdev->zonecal_cfg.phasecal_config_timeout_us; break; case VL53L1_TUNINGPARM_ZONE_CAL_DSS_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.mm_config_timeout_us; + (int32_t)pdev->zonecal_cfg.mm_config_timeout_us; break; case VL53L1_TUNINGPARM_ZONE_CAL_PHASECAL_NUM_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.phasecal_num_of_samples; + (int32_t)pdev->zonecal_cfg.phasecal_num_of_samples; break; case VL53L1_TUNINGPARM_ZONE_CAL_RANGE_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.range_config_timeout_us; + (int32_t)pdev->zonecal_cfg.range_config_timeout_us; break; case VL53L1_TUNINGPARM_ZONE_CAL_ZONE_NUM_SAMPLES: *ptuning_parm_value = - (int32_t)pdev->zonecal_cfg.zone_num_of_samples; + (int32_t)pdev->zonecal_cfg.zone_num_of_samples; break; case VL53L1_TUNINGPARM_SPADMAP_VCSEL_PERIOD: *ptuning_parm_value = - (int32_t)pdev->ssc_cfg.VL53L1_PRM_00008; + (int32_t)pdev->ssc_cfg.VL53L1_p_009; break; case VL53L1_TUNINGPARM_SPADMAP_VCSEL_START: *ptuning_parm_value = - (int32_t)pdev->ssc_cfg.vcsel_start; + (int32_t)pdev->ssc_cfg.vcsel_start; break; case VL53L1_TUNINGPARM_SPADMAP_RATE_LIMIT_MCPS: *ptuning_parm_value = - (int32_t)pdev->ssc_cfg.rate_limit_mcps; + (int32_t)pdev->ssc_cfg.rate_limit_mcps; break; case VL53L1_TUNINGPARM_LITE_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_dss_target_lite_mcps; + (int32_t)pdev->tuning_parms.tp_dss_target_lite_mcps; break; case VL53L1_TUNINGPARM_RANGING_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_dss_target_histo_mcps; + (int32_t)pdev->tuning_parms.tp_dss_target_histo_mcps; break; case VL53L1_TUNINGPARM_MZ_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_dss_target_histo_mz_mcps; + (int32_t)pdev->tuning_parms.tp_dss_target_histo_mz_mcps; break; case VL53L1_TUNINGPARM_TIMED_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_dss_target_timed_mcps; + (int32_t)pdev->tuning_parms.tp_dss_target_timed_mcps; break; case VL53L1_TUNINGPARM_LITE_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_lite_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_lite_us; break; case VL53L1_TUNINGPARM_RANGING_LONG_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_long_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_long_us; break; case VL53L1_TUNINGPARM_RANGING_MED_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_med_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_med_us; break; case VL53L1_TUNINGPARM_RANGING_SHORT_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_hist_short_us; break; case VL53L1_TUNINGPARM_MZ_LONG_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_long_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_long_us; break; case VL53L1_TUNINGPARM_MZ_MED_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_med_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_med_us; break; case VL53L1_TUNINGPARM_MZ_SHORT_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_short_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_mz_short_us; break; case VL53L1_TUNINGPARM_TIMED_PHASECAL_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_phasecal_timeout_timed_us; + (int32_t)pdev->tuning_parms.tp_phasecal_timeout_timed_us; break; case VL53L1_TUNINGPARM_LITE_MM_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_mm_timeout_lite_us; + (int32_t)pdev->tuning_parms.tp_mm_timeout_lite_us; break; case VL53L1_TUNINGPARM_RANGING_MM_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_mm_timeout_histo_us; + (int32_t)pdev->tuning_parms.tp_mm_timeout_histo_us; break; case VL53L1_TUNINGPARM_MZ_MM_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_mm_timeout_mz_us; + (int32_t)pdev->tuning_parms.tp_mm_timeout_mz_us; break; case VL53L1_TUNINGPARM_TIMED_MM_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_mm_timeout_timed_us; + (int32_t)pdev->tuning_parms.tp_mm_timeout_timed_us; break; case VL53L1_TUNINGPARM_LITE_RANGE_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_range_timeout_lite_us; + (int32_t)pdev->tuning_parms.tp_range_timeout_lite_us; break; case VL53L1_TUNINGPARM_RANGING_RANGE_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_range_timeout_histo_us; + (int32_t)pdev->tuning_parms.tp_range_timeout_histo_us; break; case VL53L1_TUNINGPARM_MZ_RANGE_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_range_timeout_mz_us; + (int32_t)pdev->tuning_parms.tp_range_timeout_mz_us; break; case VL53L1_TUNINGPARM_TIMED_RANGE_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_range_timeout_timed_us; + (int32_t)pdev->tuning_parms.tp_range_timeout_timed_us; break; case VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_MARGIN: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.smudge_margin; + (int32_t)pdev->smudge_correct_config.smudge_margin; break; case VL53L1_TUNINGPARM_DYNXTALK_NOISE_MARGIN: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.noise_margin; + (int32_t)pdev->smudge_correct_config.noise_margin; break; case VL53L1_TUNINGPARM_DYNXTALK_XTALK_OFFSET_LIMIT: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.user_xtalk_offset_limit; + (int32_t)pdev->smudge_correct_config.user_xtalk_offset_limit; break; case VL53L1_TUNINGPARM_DYNXTALK_XTALK_OFFSET_LIMIT_HI: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.user_xtalk_offset_limit_hi; + (int32_t)pdev->smudge_correct_config.user_xtalk_offset_limit_hi; break; case VL53L1_TUNINGPARM_DYNXTALK_SAMPLE_LIMIT: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.sample_limit; + (int32_t)pdev->smudge_correct_config.sample_limit; break; case VL53L1_TUNINGPARM_DYNXTALK_SINGLE_XTALK_DELTA: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.single_xtalk_delta; + (int32_t)pdev->smudge_correct_config.single_xtalk_delta; break; case VL53L1_TUNINGPARM_DYNXTALK_AVERAGED_XTALK_DELTA: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.averaged_xtalk_delta; + (int32_t)pdev->smudge_correct_config.averaged_xtalk_delta; break; case VL53L1_TUNINGPARM_DYNXTALK_CLIP_LIMIT: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.smudge_corr_clip_limit; + (int32_t)pdev->smudge_correct_config.smudge_corr_clip_limit; break; case VL53L1_TUNINGPARM_DYNXTALK_SCALER_CALC_METHOD: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.scaler_calc_method; + (int32_t)pdev->smudge_correct_config.scaler_calc_method; break; case VL53L1_TUNINGPARM_DYNXTALK_XGRADIENT_SCALER: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.x_gradient_scaler; + (int32_t)pdev->smudge_correct_config.x_gradient_scaler; break; case VL53L1_TUNINGPARM_DYNXTALK_YGRADIENT_SCALER: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.y_gradient_scaler; + (int32_t)pdev->smudge_correct_config.y_gradient_scaler; break; case VL53L1_TUNINGPARM_DYNXTALK_USER_SCALER_SET: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.user_scaler_set; + (int32_t)pdev->smudge_correct_config.user_scaler_set; break; case VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_COR_SINGLE_APPLY: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.smudge_corr_single_apply; + (int32_t)pdev->smudge_correct_config.smudge_corr_single_apply; break; case VL53L1_TUNINGPARM_DYNXTALK_XTALK_AMB_THRESHOLD: - *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.smudge_corr_ambient_threshold; + *ptuning_parm_value = (int32_t)( + pdev->smudge_correct_config.smudge_corr_ambient_threshold); break; case VL53L1_TUNINGPARM_DYNXTALK_NODETECT_AMB_THRESHOLD_KCPS: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.nodetect_ambient_threshold; + (int32_t)pdev->smudge_correct_config.nodetect_ambient_threshold; break; case VL53L1_TUNINGPARM_DYNXTALK_NODETECT_SAMPLE_LIMIT: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.nodetect_sample_limit; + (int32_t)pdev->smudge_correct_config.nodetect_sample_limit; break; case VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.nodetect_xtalk_offset; + (int32_t)pdev->smudge_correct_config.nodetect_xtalk_offset; break; case VL53L1_TUNINGPARM_DYNXTALK_NODETECT_MIN_RANGE_MM: *ptuning_parm_value = - (int32_t)pdev->smudge_correct_config.nodetect_min_range_mm; + (int32_t)pdev->smudge_correct_config.nodetect_min_range_mm; break; case VL53L1_TUNINGPARM_LOWPOWERAUTO_VHV_LOOP_BOUND: *ptuning_parm_value = - (int32_t)pdev->low_power_auto_data.vhv_loop_bound; + (int32_t)pdev->low_power_auto_data.vhv_loop_bound; break; case VL53L1_TUNINGPARM_LOWPOWERAUTO_MM_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_mm_timeout_lpa_us; + (int32_t)pdev->tuning_parms.tp_mm_timeout_lpa_us; break; case VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_range_timeout_lpa_us; + (int32_t)pdev->tuning_parms.tp_range_timeout_lpa_us; break; case VL53L1_TUNINGPARM_VERY_SHORT_DSS_RATE_MCPS: *ptuning_parm_value = - (int32_t)pdev->tuning_parms.tp_dss_target_very_short_mcps; + (int32_t)pdev->tuning_parms.tp_dss_target_very_short_mcps; break; @@ -6515,6 +6586,8 @@ VL53L1_Error VL53L1_set_tuning_parm( VL53L1_Error status = VL53L1_ERROR_NONE; VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_hist_post_process_config_t *pHP = &(pdev->histpostprocess); + VL53L1_xtalkextract_config_t *pXC = &(pdev->xtalk_extract_cfg); LOG_FUNCTION_START(""); @@ -6538,64 +6611,64 @@ VL53L1_Error VL53L1_set_tuning_parm( if ((uint16_t)tuning_parm_value - != VL53L1_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT) { + != VL53L1_TUNINGPARM_KEY_TABLE_VERSION_DEFAULT) status = VL53L1_ERROR_TUNING_PARM_KEY_MISMATCH; - } + break; case VL53L1_TUNINGPARM_LLD_VERSION: pdev->tuning_parms.tp_tuning_parm_lld_version = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_ALGO_SELECT: - pdev->histpostprocess.hist_algo_select = + pHP->hist_algo_select = (VL53L1_HistAlgoSelect)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_TARGET_ORDER: - pdev->histpostprocess.hist_target_order = + pHP->hist_target_order = (VL53L1_HistTargetOrder)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_FILTER_WOI_0: - pdev->histpostprocess.filter_woi0 = + pHP->filter_woi0 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_FILTER_WOI_1: - pdev->histpostprocess.filter_woi1 = + pHP->filter_woi1 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_AMB_EST_METHOD: - pdev->histpostprocess.hist_amb_est_method = + pHP->hist_amb_est_method = (VL53L1_HistAmbEstMethod)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_AMB_THRESH_SIGMA_0: - pdev->histpostprocess.ambient_thresh_sigma0 = + pHP->ambient_thresh_sigma0 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_AMB_THRESH_SIGMA_1: - pdev->histpostprocess.ambient_thresh_sigma1 = + pHP->ambient_thresh_sigma1 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_MIN_AMB_THRESH_EVENTS: - pdev->histpostprocess.min_ambient_thresh_events = - (int32_t)tuning_parm_value; + pHP->min_ambient_thresh_events = + (int32_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_AMB_EVENTS_SCALER: - pdev->histpostprocess.ambient_thresh_events_scaler = + pHP->ambient_thresh_events_scaler = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_NOISE_THRESHOLD: - pdev->histpostprocess.noise_threshold = + pHP->noise_threshold = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_SIGNAL_TOTAL_EVENTS_LIMIT: - pdev->histpostprocess.signal_total_events_limit = - (int32_t)tuning_parm_value; + pHP->signal_total_events_limit = + (int32_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_SIGMA_EST_REF_MM: - pdev->histpostprocess.sigma_estimator__sigma_ref_mm = + pHP->sigma_estimator__sigma_ref_mm = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_SIGMA_THRESH_MM: - pdev->histpostprocess.sigma_thresh = + pHP->sigma_thresh = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_GAIN_FACTOR: @@ -6603,19 +6676,19 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_PHASE_TOLERANCE: - pdev->histpostprocess.algo__consistency_check__phase_tolerance = + pHP->algo__consistency_check__phase_tolerance = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM: - pdev->histpostprocess.algo__consistency_check__min_max_tolerance = + pHP->algo__consistency_check__min_max_tolerance = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA: - pdev->histpostprocess.algo__consistency_check__event_sigma = + pHP->algo__consistency_check__event_sigma = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_MIN_SPAD_LIMIT: - pdev->histpostprocess.algo__consistency_check__event_min_spad_count = + pHP->algo__consistency_check__event_min_spad_count = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_LONG_RANGE: @@ -6655,7 +6728,7 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_DETECT_MIN_MAX_TOLERANCE: - pdev->histpostprocess.algo__crosstalk_detect_min_max_tolerance = + pHP->algo__crosstalk_detect_min_max_tolerance = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RATE_KCPS: @@ -6663,8 +6736,8 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_DETECT_EVENT_SIGMA: - pdev->histpostprocess.algo__crosstalk_detect_event_sigma = - (uint8_t)tuning_parm_value;; + pHP->algo__crosstalk_detect_event_sigma = + (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_HIST_XTALK_MARGIN_KCPS: pdev->xtalk_cfg.histogram_mode_crosstalk_margin_kcps = @@ -6807,7 +6880,7 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD: - pdev->refspadchar.VL53L1_PRM_00008 = + pdev->refspadchar.VL53L1_p_009 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US: @@ -6827,39 +6900,39 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_NUM_OF_SAMPLES: - pdev->xtalk_extract_cfg.num_of_samples = + pXC->num_of_samples = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MIN_FILTER_THRESH_MM: - pdev->xtalk_extract_cfg.algo__crosstalk_extract_min_valid_range_mm = + pXC->algo__crosstalk_extract_min_valid_range_mm = (int16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_FILTER_THRESH_MM: - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_range_mm = + pXC->algo__crosstalk_extract_max_valid_range_mm = (int16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_DSS_RATE_MCPS: - pdev->xtalk_extract_cfg.dss_config__target_total_rate_mcps = + pXC->dss_config__target_total_rate_mcps = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_PHASECAL_TIMEOUT_US: - pdev->xtalk_extract_cfg.phasecal_config_timeout_us = + pXC->phasecal_config_timeout_us = (uint32_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_VALID_RATE_KCPS: - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_valid_rate_kcps = + pXC->algo__crosstalk_extract_max_valid_rate_kcps = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_SIGMA_THRESHOLD_MM: - pdev->xtalk_extract_cfg.algo__crosstalk_extract_max_sigma_mm = + pXC->algo__crosstalk_extract_max_sigma_mm = (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_DSS_TIMEOUT_US: - pdev->xtalk_extract_cfg.mm_config_timeout_us = + pXC->mm_config_timeout_us = (uint32_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_XTALK_EXTRACT_BIN_TIMEOUT_US: - pdev->xtalk_extract_cfg.range_config_timeout_us = + pXC->range_config_timeout_us = (uint32_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_OFFSET_CAL_DSS_RATE_MCPS: @@ -6915,7 +6988,7 @@ VL53L1_Error VL53L1_set_tuning_parm( (uint16_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_SPADMAP_VCSEL_PERIOD: - pdev->ssc_cfg.VL53L1_PRM_00008 = + pdev->ssc_cfg.VL53L1_p_009 = (uint8_t)tuning_parm_value; break; case VL53L1_TUNINGPARM_SPADMAP_VCSEL_START: @@ -7311,9 +7384,9 @@ VL53L1_Error VL53L1_get_current_xtalk_settings( pxtalk->algo__crosstalk_compensation_plane_offset_kcps = pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps; pxtalk->algo__crosstalk_compensation_x_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; + pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps; pxtalk->algo__crosstalk_compensation_y_plane_gradient_kcps = - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; + pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps; diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api_debug.c b/drivers/input/misc/vl53L1/src/vl53l1_api_debug.c index d7cf7ca1a248..46f7f0daa5d3 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api_debug.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api_debug.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -240,7 +240,7 @@ VL53L1_Error VL53L1_get_additional_data( status = VL53L1_get_histogram_debug_data( Dev, - &(pdata->VL53L1_PRM_00009)); + &(pdata->VL53L1_p_010)); LOG_FUNCTION_END(status); @@ -530,6 +530,7 @@ void VL53L1_print_customer_nvm_managed( char fp_text[VL53L1_MAX_STRING_LENGTH]; + int16_t tmpi16; trace_print(VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", @@ -597,8 +598,9 @@ void VL53L1_print_customer_nvm_managed( "algo__crosstalk_compensation_plane_offset_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_x_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -609,8 +611,9 @@ void VL53L1_print_customer_nvm_managed( "algo__crosstalk_compensation_x_plane_gradient_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_y_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -1041,22 +1044,22 @@ void VL53L1_print_histogram_bin_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00019", - pdata->VL53L1_PRM_00019); + "VL53L1_p_022", + pdata->VL53L1_p_022); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00020", - pdata->VL53L1_PRM_00020); + "VL53L1_p_023", + pdata->VL53L1_p_023); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00021", - pdata->VL53L1_PRM_00021); + "VL53L1_p_024", + pdata->VL53L1_p_024); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -1065,7 +1068,7 @@ void VL53L1_print_histogram_bin_data( "number_of_ambient_bins", pdata->number_of_ambient_bins); - for (i = 0 ; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; i++) { + for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) { sprintf(ppre_text, "%sbin_seq[%u]", pprefix, i); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -1074,7 +1077,7 @@ void VL53L1_print_histogram_bin_data( pdata->bin_seq[i]); } - for (i = 0 ; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; i++) { + for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) { sprintf(ppre_text, "%sbin_rep[%u]", pprefix, i); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -1083,7 +1086,7 @@ void VL53L1_print_histogram_bin_data( pdata->bin_rep[i]); } - for (i = 0 ; i < pdata->VL53L1_PRM_00021 ; i++) { + for (i = 0; i < pdata->VL53L1_p_024; i++) { sprintf(ppre_text, "%sbin_data[%u]", pprefix, i); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -1177,11 +1180,11 @@ void VL53L1_print_histogram_bin_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00008", - pdata->VL53L1_PRM_00008); + "VL53L1_p_009", + pdata->VL53L1_p_009); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00022, + (int32_t)pdata->VL53L1_p_019, 12, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -1190,7 +1193,7 @@ void VL53L1_print_histogram_bin_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00022", + "VL53L1_p_019", fp_text); trace_print( @@ -1259,8 +1262,8 @@ void VL53L1_print_histogram_bin_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %d\n", pprefix, - "VL53L1_PRM_00028", - pdata->VL53L1_PRM_00028); + "VL53L1_p_004", + pdata->VL53L1_p_004); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -1298,24 +1301,24 @@ void VL53L1_print_xtalk_histogram_shape_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00019", - pdata->VL53L1_PRM_00019); + "VL53L1_p_022", + pdata->VL53L1_p_022); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00020", - pdata->VL53L1_PRM_00020); + "VL53L1_p_023", + pdata->VL53L1_p_023); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00021", - pdata->VL53L1_PRM_00021); + "VL53L1_p_024", + pdata->VL53L1_p_024); - for (i = 0 ; i < pdata->VL53L1_PRM_00021 ; i++) { + for (i = 0; i < pdata->VL53L1_p_024; i++) { sprintf(ppre_text, "%sbin_data[%u]", pprefix, i); @@ -1373,7 +1376,7 @@ void VL53L1_print_xtalk_histogram_shape_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00022, + (int32_t)pdata->VL53L1_p_019, 12, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -1382,7 +1385,7 @@ void VL53L1_print_xtalk_histogram_shape_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00022", + "VL53L1_p_019", fp_text); VL53L1_signed_fixed_point_sprintf( @@ -1459,43 +1462,43 @@ void VL53L1_print_range_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00014", - pdata->VL53L1_PRM_00014); + "VL53L1_p_015", + pdata->VL53L1_p_015); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00019", - pdata->VL53L1_PRM_00019); + "VL53L1_p_022", + pdata->VL53L1_p_022); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00023", - pdata->VL53L1_PRM_00023); + "VL53L1_p_025", + pdata->VL53L1_p_025); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00024", - pdata->VL53L1_PRM_00024); + "VL53L1_p_026", + pdata->VL53L1_p_026); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00015", - pdata->VL53L1_PRM_00015); + "VL53L1_p_016", + pdata->VL53L1_p_016); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00025", - pdata->VL53L1_PRM_00025); + "VL53L1_p_027", + pdata->VL53L1_p_027); VL53L1_signed_fixed_point_sprintf( (int32_t)pdata->width, @@ -1512,8 +1515,8 @@ void VL53L1_print_range_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00029", - pdata->VL53L1_PRM_00029); + "VL53L1_p_030", + pdata->VL53L1_p_030); @@ -1547,7 +1550,7 @@ void VL53L1_print_range_data( VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00004, + (int32_t)pdata->VL53L1_p_006, 8, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( @@ -1582,22 +1585,22 @@ void VL53L1_print_range_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %d\n", pprefix, - "VL53L1_PRM_00017", - pdata->VL53L1_PRM_00017); + "VL53L1_p_020", + pdata->VL53L1_p_020); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %d\n", pprefix, - "VL53L1_PRM_00018", - pdata->VL53L1_PRM_00018); + "VL53L1_p_021", + pdata->VL53L1_p_021); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %d\n", pprefix, - "VL53L1_PRM_00012", - pdata->VL53L1_PRM_00012); + "VL53L1_p_013", + pdata->VL53L1_p_013); @@ -1647,64 +1650,64 @@ void VL53L1_print_range_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00011, + (int32_t)pdata->VL53L1_p_012, 11, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00011", + "VL53L1_p_012", fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00003, + (int32_t)pdata->VL53L1_p_005, 2, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00003", + "VL53L1_p_005", fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00026, + (int32_t)pdata->VL53L1_p_028, 11, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00026", + "VL53L1_p_028", fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00013, + (int32_t)pdata->VL53L1_p_014, 11, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00013", + "VL53L1_p_014", fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00027, + (int32_t)pdata->VL53L1_p_029, 11, VL53L1_MAX_STRING_LENGTH, fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00027", + "VL53L1_p_029", fp_text); @@ -1783,7 +1786,7 @@ void VL53L1_print_range_results( "stream_count", pdata->stream_count); - for (i = 0 ; i < VL53L1_MAX_AMBIENT_DMAX_VALUES ; i++) { + for (i = 0; i < VL53L1_MAX_AMBIENT_DMAX_VALUES; i++) { sprintf( ppre_text, "%sambient_dmax_mm[%u]", @@ -1793,7 +1796,7 @@ void VL53L1_print_range_results( VL53L1_TRACE_LEVEL_INFO, "%s = %u\n", ppre_text, - pdata->VL53L1_PRM_00006[i]); + pdata->VL53L1_p_007[i]); } trace_print( @@ -1824,10 +1827,10 @@ void VL53L1_print_range_results( "active_results", pdata->active_results); - for (i = 0 ; i < pdata->active_results ; i++) { + for (i = 0; i < pdata->active_results; i++) { sprintf(ppre_text, "%sdata[%u].", pprefix, i); VL53L1_print_range_data( - &pdata->VL53L1_PRM_00005[i], + &pdata->VL53L1_p_002[i], ppre_text, trace_flags); } @@ -1902,10 +1905,10 @@ void VL53L1_print_offset_range_results( "active_results", pdata->active_results); - for (i = 0 ; i < pdata->active_results ; i++) { + for (i = 0; i < pdata->active_results; i++) { sprintf(ppre_text, "%sdata[%u].", pprefix, i); VL53L1_print_offset_range_data( - &(pdata->VL53L1_PRM_00005[i]), + &(pdata->VL53L1_p_002[i]), ppre_text, trace_flags); } } @@ -1985,7 +1988,7 @@ void VL53L1_print_offset_range_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00003, + (int32_t)pdata->VL53L1_p_005, 2, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -1994,7 +1997,7 @@ void VL53L1_print_offset_range_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00003", + "VL53L1_p_005", fp_text); trace_print( @@ -2079,8 +2082,8 @@ void VL53L1_print_cal_peak_rate_map( pdata->height); i = 0; - for (y = 0 ; y < pdata->height ; y++) { - for (x = 0 ; x < pdata->width ; x++) { + for (y = 0; y < pdata->height; y++) { + for (x = 0; x < pdata->width; x++) { sprintf(ppre_text, "%speak_rate_mcps[%u]", pprefix, i); @@ -2200,9 +2203,9 @@ void VL53L1_print_additional_data( "dss_config__target_total_rate_mcps", fp_text); - sprintf(ppre_text, "%s VL53L1_PRM_00009.", pprefix); + sprintf(ppre_text, "%s VL53L1_p_010.", pprefix); VL53L1_print_histogram_bin_data( - &pdata->VL53L1_PRM_00009, + &pdata->VL53L1_p_010, ppre_text, trace_flags); @@ -2361,7 +2364,7 @@ void VL53L1_print_zone_calibration_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00013, + (int32_t)pdata->VL53L1_p_014, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -2370,11 +2373,11 @@ void VL53L1_print_zone_calibration_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00013", + "VL53L1_p_014", fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->VL53L1_PRM_00003, + (int32_t)pdata->VL53L1_p_005, 2, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -2383,7 +2386,7 @@ void VL53L1_print_zone_calibration_data( VL53L1_TRACE_LEVEL_INFO, "%s%s = %s\n", pprefix, - "VL53L1_PRM_00003", + "VL53L1_p_005", fp_text); VL53L1_signed_fixed_point_sprintf( @@ -2511,10 +2514,10 @@ void VL53L1_print_zone_calibration_results( "active_zones", pdata->active_zones); - for (i = 0 ; i < pdata->active_zones ; i++) { + for (i = 0; i < pdata->active_zones; i++) { sprintf(ppre_text, "%sdata[%u].", pprefix, i); VL53L1_print_zone_calibration_data( - &(pdata->VL53L1_PRM_00005[i]), + &(pdata->VL53L1_p_002[i]), ppre_text, trace_flags); } } @@ -2577,10 +2580,10 @@ void VL53L1_print_xtalk_range_results( "active_results", pdata->active_results); - for (i = 0 ; i < pdata->active_results ; i++) { + for (i = 0; i < pdata->active_results; i++) { sprintf(ppre_text, "%sdata[%u].", pprefix, i); VL53L1_print_xtalk_range_data( - &(pdata->VL53L1_PRM_00005[i]), + &(pdata->VL53L1_p_002[i]), ppre_text, trace_flags); } @@ -2598,19 +2601,19 @@ void VL53L1_print_xtalk_range_results( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00014", + "VL53L1_p_015", pdata->central_histogram__window_start); trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%s = %u\n", pprefix, - "VL53L1_PRM_00015", + "VL53L1_p_016", pdata->central_histogram__window_end); pbin_data = &(pdata->histogram_avg_1[0]); - for (i = 0 ; i < 5 ; i++) { + for (i = 0; i < 5; i++) { sprintf(ppre_text, "%shistogram_avg_1[%u].", pprefix, i); VL53L1_print_histogram_bin_data( pbin_data, @@ -2620,7 +2623,7 @@ void VL53L1_print_xtalk_range_results( pbin_data = &(pdata->histogram_avg_2[0]); - for (i = 0 ; i < 5 ; i++) { + for (i = 0; i < 5; i++) { sprintf(ppre_text, "%shistogram_avg_2[%u].", pprefix, i); VL53L1_print_histogram_bin_data( pbin_data, @@ -2630,7 +2633,7 @@ void VL53L1_print_xtalk_range_results( pbin_data = &(pdata->xtalk_avg[0]); - for (i = 0 ; i < 5 ; i++) { + for (i = 0; i < 5; i++) { sprintf(ppre_text, "%sxtalk_avg[%u].", pprefix, i); VL53L1_print_histogram_bin_data( pbin_data, @@ -2713,7 +2716,7 @@ void VL53L1_print_xtalk_calibration_results( char fp_text[VL53L1_MAX_STRING_LENGTH]; - + int16_t tmpi16; VL53L1_signed_fixed_point_sprintf( (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps, @@ -2728,8 +2731,9 @@ void VL53L1_print_xtalk_calibration_results( "algo__crosstalk_compensation_plane_offset_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_x_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -2741,8 +2745,9 @@ void VL53L1_print_xtalk_calibration_results( "algo__crosstalk_compensation_x_plane_gradient_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_y_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -2767,6 +2772,7 @@ void VL53L1_print_xtalk_config( char fp_text[VL53L1_MAX_STRING_LENGTH]; + int16_t tmpi16; VL53L1_signed_fixed_point_sprintf( (int32_t)pdata->algo__crosstalk_compensation_plane_offset_kcps, @@ -2781,8 +2787,9 @@ void VL53L1_print_xtalk_config( "algo__crosstalk_compensation_plane_offset_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_x_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_x_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -2794,8 +2801,9 @@ void VL53L1_print_xtalk_config( "algo__crosstalk_compensation_x_plane_gradient_kcps", fp_text); + tmpi16 = pdata->algo__crosstalk_compensation_y_plane_gradient_kcps; VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->algo__crosstalk_compensation_y_plane_gradient_kcps, + (int32_t)tmpi16, 11, VL53L1_MAX_STRING_LENGTH, fp_text); @@ -3492,7 +3500,7 @@ void VL53L1_print_spad_rate_data( char fp_text[VL53L1_MAX_STRING_LENGTH]; - trace_print( + trace_print( VL53L1_TRACE_LEVEL_INFO, "%s%8s,%4s,%4s, %s\n", pprefix, @@ -3501,7 +3509,7 @@ void VL53L1_print_spad_rate_data( "col", "peak_rate_mcps"); - for (spad_no = 0 ; spad_no < pspad_rates->no_of_values ; spad_no++) { + for (spad_no = 0; spad_no < pspad_rates->no_of_values; spad_no++) { @@ -3530,7 +3538,7 @@ void VL53L1_print_spad_rate_data( row, col, fp_text); - } + } } @@ -3559,7 +3567,7 @@ void VL53L1_print_spad_rate_map( pprefix, " "); - for (col = 0 ; col < VL53L1_SPAD_ARRAY_WIDTH ; col++) + for (col = 0; col < VL53L1_SPAD_ARRAY_WIDTH; col++) trace_print( VL53L1_TRACE_LEVEL_INFO, ",%8u", @@ -3572,7 +3580,7 @@ void VL53L1_print_spad_rate_map( - for (row = 0 ; row < VL53L1_SPAD_ARRAY_HEIGHT ; row++) { + for (row = 0; row < VL53L1_SPAD_ARRAY_HEIGHT; row++) { trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -3580,7 +3588,7 @@ void VL53L1_print_spad_rate_map( pprefix, row); - for (col = 0 ; col < VL53L1_SPAD_ARRAY_HEIGHT ; col++) { + for (col = 0; col < VL53L1_SPAD_ARRAY_HEIGHT; col++) { @@ -3611,7 +3619,7 @@ void VL53L1_print_spad_rate_map( trace_print( VL53L1_TRACE_LEVEL_INFO, "\n"); - } + } } diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api_preset_modes.c b/drivers/input/misc/vl53L1/src/vl53l1_api_preset_modes.c index c97490b2a14e..e00f48830d2d 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api_preset_modes.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api_preset_modes.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -113,7 +113,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_API, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_API, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_API,\ + status, fmt, ##__VA_ARGS__) VL53L1_Error VL53L1_init_refspadchar_config_struct( @@ -139,17 +140,17 @@ VL53L1_Error VL53L1_init_refspadchar_config_struct( pdata->device_test_mode = - VL53L1_TUNINGPARM_REFSPADCHAR_DEVICE_TEST_MODE_DEFAULT; - pdata->VL53L1_PRM_00008 = - VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD_DEFAULT; + VL53L1_TUNINGPARM_REFSPADCHAR_DEVICE_TEST_MODE_DEFAULT; + pdata->VL53L1_p_009 = + VL53L1_TUNINGPARM_REFSPADCHAR_VCSEL_PERIOD_DEFAULT; pdata->timeout_us = - VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_REFSPADCHAR_PHASECAL_TIMEOUT_US_DEFAULT; pdata->target_count_rate_mcps = - VL53L1_TUNINGPARM_REFSPADCHAR_TARGET_COUNT_RATE_MCPS_DEFAULT; + VL53L1_TUNINGPARM_REFSPADCHAR_TARGET_COUNT_RATE_MCPS_DEFAULT; pdata->min_count_rate_limit_mcps = - VL53L1_TUNINGPARM_REFSPADCHAR_MIN_COUNTRATE_LIMIT_MCPS_DEFAULT; + VL53L1_TUNINGPARM_REFSPADCHAR_MIN_COUNTRATE_LIMIT_MCPS_DEFAULT; pdata->max_count_rate_limit_mcps = - VL53L1_TUNINGPARM_REFSPADCHAR_MAX_COUNTRATE_LIMIT_MCPS_DEFAULT; + VL53L1_TUNINGPARM_REFSPADCHAR_MAX_COUNTRATE_LIMIT_MCPS_DEFAULT; LOG_FUNCTION_END(status); @@ -180,7 +181,7 @@ VL53L1_Error VL53L1_init_ssc_config_struct( - pdata->VL53L1_PRM_00008 = + pdata->VL53L1_p_009 = VL53L1_TUNINGPARM_SPADMAP_VCSEL_PERIOD_DEFAULT; @@ -190,7 +191,7 @@ VL53L1_Error VL53L1_init_ssc_config_struct( - pdata->vcsel_width = 0x02; + pdata->vcsel_width = 0x02; @@ -267,8 +268,10 @@ VL53L1_Error VL53L1_init_xtalk_config_struct( VL53L1_TUNINGPARM_LITE_RIT_MULT_DEFAULT; if ((pdata->algo__crosstalk_compensation_plane_offset_kcps == 0x00) - && (pdata->algo__crosstalk_compensation_x_plane_gradient_kcps == 0x00) - && (pdata->algo__crosstalk_compensation_y_plane_gradient_kcps == 0x00)) + && (pdata->algo__crosstalk_compensation_x_plane_gradient_kcps + == 0x00) + && (pdata->algo__crosstalk_compensation_y_plane_gradient_kcps + == 0x00)) pdata->global_crosstalk_compensation_enable = 0x00; else pdata->global_crosstalk_compensation_enable = 0x01; @@ -277,11 +280,11 @@ VL53L1_Error VL53L1_init_xtalk_config_struct( if ((status == VL53L1_ERROR_NONE) && (pdata->global_crosstalk_compensation_enable == 0x01)) { pdata->crosstalk_range_ignore_threshold_rate_mcps = - VL53L1_calc_range_ignore_threshold( - pdata->algo__crosstalk_compensation_plane_offset_kcps, - pdata->algo__crosstalk_compensation_x_plane_gradient_kcps, - pdata->algo__crosstalk_compensation_y_plane_gradient_kcps, - pdata->crosstalk_range_ignore_threshold_mult); + VL53L1_calc_range_ignore_threshold( + pdata->algo__crosstalk_compensation_plane_offset_kcps, + pdata->algo__crosstalk_compensation_x_plane_gradient_kcps, + pdata->algo__crosstalk_compensation_y_plane_gradient_kcps, + pdata->crosstalk_range_ignore_threshold_mult); } else { pdata->crosstalk_range_ignore_threshold_rate_mcps = 0; } @@ -333,7 +336,7 @@ VL53L1_Error VL53L1_init_xtalk_extract_config_struct( VL53L1_TUNINGPARM_XTALK_EXTRACT_NUM_OF_SAMPLES_DEFAULT; pdata->phasecal_config_timeout_us = - VL53L1_TUNINGPARM_XTALK_EXTRACT_PHASECAL_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_XTALK_EXTRACT_PHASECAL_TIMEOUT_US_DEFAULT; pdata->range_config_timeout_us = @@ -345,13 +348,13 @@ VL53L1_Error VL53L1_init_xtalk_extract_config_struct( pdata->algo__crosstalk_extract_min_valid_range_mm = - VL53L1_TUNINGPARM_XTALK_EXTRACT_MIN_FILTER_THRESH_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_EXTRACT_MIN_FILTER_THRESH_MM_DEFAULT; pdata->algo__crosstalk_extract_max_valid_range_mm = - VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_FILTER_THRESH_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_FILTER_THRESH_MM_DEFAULT; pdata->algo__crosstalk_extract_max_valid_rate_kcps = - VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_VALID_RATE_KCPS_DEFAULT; + VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_VALID_RATE_KCPS_DEFAULT; pdata->algo__crosstalk_extract_max_sigma_mm = - VL53L1_TUNINGPARM_XTALK_EXTRACT_SIGMA_THRESHOLD_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_EXTRACT_SIGMA_THRESHOLD_MM_DEFAULT; LOG_FUNCTION_END(status); @@ -381,7 +384,7 @@ VL53L1_Error VL53L1_init_offset_cal_config_struct( pdata->phasecal_config_timeout_us = - VL53L1_TUNINGPARM_OFFSET_CAL_PHASECAL_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_OFFSET_CAL_PHASECAL_TIMEOUT_US_DEFAULT; pdata->range_config_timeout_us = @@ -521,10 +524,10 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( pdata->signal_total_events_limit = - VL53L1_TUNINGPARM_HIST_SIGNAL_TOTAL_EVENTS_LIMIT_DEFAULT; + VL53L1_TUNINGPARM_HIST_SIGNAL_TOTAL_EVENTS_LIMIT_DEFAULT; pdata->sigma_estimator__sigma_ref_mm = - VL53L1_TUNINGPARM_HIST_SIGMA_EST_REF_MM_DEFAULT; + VL53L1_TUNINGPARM_HIST_SIGMA_EST_REF_MM_DEFAULT; @@ -562,7 +565,7 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( - pdata->valid_phase_low = 0x08; + pdata->valid_phase_low = 0x08; pdata->valid_phase_high = 0x88; @@ -574,7 +577,7 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( pdata->algo__consistency_check__phase_tolerance = - VL53L1_TUNINGPARM_CONSISTENCY_HIST_PHASE_TOLERANCE_DEFAULT; + VL53L1_TUNINGPARM_CONSISTENCY_HIST_PHASE_TOLERANCE_DEFAULT; @@ -585,19 +588,19 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( pdata->algo__consistency_check__event_sigma = - VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_DEFAULT; + VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_DEFAULT; pdata->algo__consistency_check__event_min_spad_count = - VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_MIN_SPAD_LIMIT_DEFAULT; + VL53L1_TUNINGPARM_CONSISTENCY_HIST_EVENT_SIGMA_MIN_SPAD_LIMIT_DEFAULT; pdata->algo__consistency_check__min_max_tolerance = - VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM_DEFAULT; + VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM_DEFAULT; @@ -614,13 +617,13 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( pdata->algo__crosstalk_detect_min_valid_range_mm = - VL53L1_TUNINGPARM_XTALK_DETECT_MIN_VALID_RANGE_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_MIN_VALID_RANGE_MM_DEFAULT; pdata->algo__crosstalk_detect_max_valid_range_mm = - VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RANGE_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RANGE_MM_DEFAULT; pdata->algo__crosstalk_detect_max_valid_rate_kcps = - VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RATE_KCPS_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RATE_KCPS_DEFAULT; pdata->algo__crosstalk_detect_max_sigma_mm = - VL53L1_TUNINGPARM_XTALK_DETECT_MAX_SIGMA_MM_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_MAX_SIGMA_MM_DEFAULT; @@ -635,14 +638,14 @@ VL53L1_Error VL53L1_init_hist_post_process_config_struct( pdata->algo__crosstalk_detect_event_sigma = - VL53L1_TUNINGPARM_XTALK_DETECT_EVENT_SIGMA_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_EVENT_SIGMA_DEFAULT; pdata->algo__crosstalk_detect_min_max_tolerance = - VL53L1_TUNINGPARM_XTALK_DETECT_MIN_MAX_TOLERANCE_DEFAULT; + VL53L1_TUNINGPARM_XTALK_DETECT_MIN_MAX_TOLERANCE_DEFAULT; @@ -670,22 +673,22 @@ VL53L1_Error VL53L1_init_dmax_calibration_data_struct( - pdata->ref__actual_effective_spads = 0x5F2D; + pdata->ref__actual_effective_spads = 0x5F2D; - pdata->ref__peak_signal_count_rate_mcps = 0x0844; + pdata->ref__peak_signal_count_rate_mcps = 0x0844; - pdata->ref__distance_mm = 0x08A5; + pdata->ref__distance_mm = 0x08A5; - pdata->ref_reflectance_pc = 0x0014; + pdata->ref_reflectance_pc = 0x0014; - pdata->coverglass_transmission = 0x0100; + pdata->coverglass_transmission = 0x0100; LOG_FUNCTION_END(status); @@ -719,31 +722,31 @@ VL53L1_Error VL53L1_init_tuning_parm_storage_struct( pdata->tp_tuning_parm_lld_version = VL53L1_TUNINGPARM_LLD_VERSION_DEFAULT; pdata->tp_init_phase_rtn_lite_long = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_LONG_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_LONG_RANGE_DEFAULT; pdata->tp_init_phase_rtn_lite_med = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_MED_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_MED_RANGE_DEFAULT; pdata->tp_init_phase_rtn_lite_short = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_SHORT_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_LITE_SHORT_RANGE_DEFAULT; pdata->tp_init_phase_ref_lite_long = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_LONG_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_LONG_RANGE_DEFAULT; pdata->tp_init_phase_ref_lite_med = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_MED_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_MED_RANGE_DEFAULT; pdata->tp_init_phase_ref_lite_short = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_SHORT_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_LITE_SHORT_RANGE_DEFAULT; pdata->tp_init_phase_rtn_hist_long = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_LONG_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_LONG_RANGE_DEFAULT; pdata->tp_init_phase_rtn_hist_med = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_MED_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_MED_RANGE_DEFAULT; pdata->tp_init_phase_rtn_hist_short = - VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_SHORT_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_RTN_HISTO_SHORT_RANGE_DEFAULT; pdata->tp_init_phase_ref_hist_long = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_LONG_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_LONG_RANGE_DEFAULT; pdata->tp_init_phase_ref_hist_med = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_MED_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_MED_RANGE_DEFAULT; pdata->tp_init_phase_ref_hist_short = - VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_SHORT_RANGE_DEFAULT; + VL53L1_TUNINGPARM_INITIAL_PHASE_REF_HISTO_SHORT_RANGE_DEFAULT; pdata->tp_consistency_lite_phase_tolerance = - VL53L1_TUNINGPARM_CONSISTENCY_LITE_PHASE_TOLERANCE_DEFAULT; + VL53L1_TUNINGPARM_CONSISTENCY_LITE_PHASE_TOLERANCE_DEFAULT; pdata->tp_phasecal_target = VL53L1_TUNINGPARM_PHASECAL_TARGET_DEFAULT; pdata->tp_cal_repeat_rate = @@ -757,11 +760,11 @@ VL53L1_Error VL53L1_init_tuning_parm_storage_struct( pdata->tp_lite_short_sigma_thresh_mm = VL53L1_TUNINGPARM_LITE_SHORT_SIGMA_THRESH_MM_DEFAULT; pdata->tp_lite_long_min_count_rate_rtn_mcps = - VL53L1_TUNINGPARM_LITE_LONG_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; + VL53L1_TUNINGPARM_LITE_LONG_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; pdata->tp_lite_med_min_count_rate_rtn_mcps = - VL53L1_TUNINGPARM_LITE_MED_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; + VL53L1_TUNINGPARM_LITE_MED_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; pdata->tp_lite_short_min_count_rate_rtn_mcps = - VL53L1_TUNINGPARM_LITE_SHORT_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; + VL53L1_TUNINGPARM_LITE_SHORT_MIN_COUNT_RATE_RTN_MCPS_DEFAULT; pdata->tp_lite_sigma_est_pulse_width_ns = VL53L1_TUNINGPARM_LITE_SIGMA_EST_PULSE_WIDTH_DEFAULT; pdata->tp_lite_sigma_est_amb_width_ns = @@ -783,29 +786,29 @@ VL53L1_Error VL53L1_init_tuning_parm_storage_struct( pdata->tp_dss_target_lite_mcps = - VL53L1_TUNINGPARM_LITE_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; + VL53L1_TUNINGPARM_LITE_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; pdata->tp_dss_target_histo_mcps = - VL53L1_TUNINGPARM_RANGING_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; + VL53L1_TUNINGPARM_RANGING_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; pdata->tp_dss_target_histo_mz_mcps = - VL53L1_TUNINGPARM_MZ_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; + VL53L1_TUNINGPARM_MZ_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; pdata->tp_dss_target_timed_mcps = - VL53L1_TUNINGPARM_TIMED_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; + VL53L1_TUNINGPARM_TIMED_DSS_CONFIG_TARGET_TOTAL_RATE_MCPS_DEFAULT; pdata->tp_phasecal_timeout_lite_us = - VL53L1_TUNINGPARM_LITE_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_LITE_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_hist_long_us = - VL53L1_TUNINGPARM_RANGING_LONG_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_RANGING_LONG_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_hist_med_us = - VL53L1_TUNINGPARM_RANGING_MED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_RANGING_MED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_hist_short_us = - VL53L1_TUNINGPARM_RANGING_SHORT_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_RANGING_SHORT_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_mz_long_us = - VL53L1_TUNINGPARM_MZ_LONG_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_MZ_LONG_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_mz_med_us = - VL53L1_TUNINGPARM_MZ_MED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_MZ_MED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_mz_short_us = - VL53L1_TUNINGPARM_MZ_SHORT_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_MZ_SHORT_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_phasecal_timeout_timed_us = - VL53L1_TUNINGPARM_TIMED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_TIMED_PHASECAL_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_mm_timeout_lite_us = VL53L1_TUNINGPARM_LITE_MM_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_mm_timeout_histo_us = @@ -817,19 +820,19 @@ VL53L1_Error VL53L1_init_tuning_parm_storage_struct( pdata->tp_range_timeout_lite_us = VL53L1_TUNINGPARM_LITE_RANGE_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_range_timeout_histo_us = - VL53L1_TUNINGPARM_RANGING_RANGE_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_RANGING_RANGE_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_range_timeout_mz_us = VL53L1_TUNINGPARM_MZ_RANGE_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_range_timeout_timed_us = - VL53L1_TUNINGPARM_TIMED_RANGE_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_TIMED_RANGE_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_mm_timeout_lpa_us = - VL53L1_TUNINGPARM_LOWPOWERAUTO_MM_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_LOWPOWERAUTO_MM_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_range_timeout_lpa_us = - VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US_DEFAULT; + VL53L1_TUNINGPARM_LOWPOWERAUTO_RANGE_CONFIG_TIMEOUT_US_DEFAULT; pdata->tp_dss_target_very_short_mcps = VL53L1_TUNINGPARM_VERY_SHORT_DSS_RATE_MCPS_DEFAULT; @@ -854,15 +857,15 @@ VL53L1_Error VL53L1_init_hist_gen3_dmax_config_struct( - pdata->dss_config__target_total_rate_mcps = 0x1400; - pdata->dss_config__aperture_attenuation = 0x38; + pdata->dss_config__target_total_rate_mcps = 0x1400; + pdata->dss_config__aperture_attenuation = 0x38; pdata->signal_thresh_sigma = VL53L1_TUNINGPARM_DMAX_CFG_SIGNAL_THRESH_SIGMA_DEFAULT; - pdata->ambient_thresh_sigma = 0x70; + pdata->ambient_thresh_sigma = 0x70; pdata->min_ambient_thresh_events = 16; pdata->signal_total_events_limit = 100; - pdata->max_effective_spads = 0xFFFF; + pdata->max_effective_spads = 0xFFFF; @@ -922,23 +925,23 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - pstatic->dss_config__target_total_rate_mcps = 0x0A00; - pstatic->debug__ctrl = 0x00; - pstatic->test_mode__ctrl = 0x00; - pstatic->clk_gating__ctrl = 0x00; - pstatic->nvm_bist__ctrl = 0x00; - pstatic->nvm_bist__num_nvm_words = 0x00; - pstatic->nvm_bist__start_address = 0x00; - pstatic->host_if__status = 0x00; - pstatic->pad_i2c_hv__config = 0x00; - pstatic->pad_i2c_hv__extsup_config = 0x00; + pstatic->dss_config__target_total_rate_mcps = 0x0A00; + pstatic->debug__ctrl = 0x00; + pstatic->test_mode__ctrl = 0x00; + pstatic->clk_gating__ctrl = 0x00; + pstatic->nvm_bist__ctrl = 0x00; + pstatic->nvm_bist__num_nvm_words = 0x00; + pstatic->nvm_bist__start_address = 0x00; + pstatic->host_if__status = 0x00; + pstatic->pad_i2c_hv__config = 0x00; + pstatic->pad_i2c_hv__extsup_config = 0x00; - pstatic->gpio_hv_pad__ctrl = 0x00; + pstatic->gpio_hv_pad__ctrl = 0x00; @@ -947,15 +950,15 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - pstatic->gpio_hv_mux__ctrl = \ - VL53L1_DEVICEINTERRUPTPOLARITY_ACTIVE_LOW | \ + pstatic->gpio_hv_mux__ctrl = + VL53L1_DEVICEINTERRUPTPOLARITY_ACTIVE_LOW | VL53L1_DEVICEGPIOMODE_OUTPUT_RANGE_AND_ERROR_INTERRUPTS; - pstatic->gpio__tio_hv_status = 0x02; - pstatic->gpio__fio_hv_status = 0x00; - pstatic->ana_config__spad_sel_pswidth = 0x02; - pstatic->ana_config__vcsel_pulse_width_offset = 0x08; - pstatic->ana_config__fast_osc__config_ctrl = 0x00; + pstatic->gpio__tio_hv_status = 0x02; + pstatic->gpio__fio_hv_status = 0x00; + pstatic->ana_config__spad_sel_pswidth = 0x02; + pstatic->ana_config__vcsel_pulse_width_offset = 0x08; + pstatic->ana_config__fast_osc__config_ctrl = 0x00; pstatic->sigma_estimator__effective_pulse_width_ns = ptuning_parms->tp_lite_sigma_est_pulse_width_ns; @@ -965,15 +968,15 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( ptuning_parms->tp_lite_sigma_ref_mm; - pstatic->algo__crosstalk_compensation_valid_height_mm = 0x01; - pstatic->spare_host_config__static_config_spare_0 = 0x00; - pstatic->spare_host_config__static_config_spare_1 = 0x00; + pstatic->algo__crosstalk_compensation_valid_height_mm = 0x01; + pstatic->spare_host_config__static_config_spare_0 = 0x00; + pstatic->spare_host_config__static_config_spare_1 = 0x00; - pstatic->algo__range_ignore_threshold_mcps = 0x0000; + pstatic->algo__range_ignore_threshold_mcps = 0x0000; - pstatic->algo__range_ignore_valid_height_mm = 0xff; + pstatic->algo__range_ignore_valid_height_mm = 0xff; pstatic->algo__range_min_clip = ptuning_parms->tp_lite_min_clip; @@ -984,15 +987,15 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( pstatic->algo__consistency_check__tolerance = ptuning_parms->tp_consistency_lite_phase_tolerance; - pstatic->spare_host_config__static_config_spare_2 = 0x00; - pstatic->sd_config__reset_stages_msb = 0x00; - pstatic->sd_config__reset_stages_lsb = 0x00; + pstatic->spare_host_config__static_config_spare_2 = 0x00; + pstatic->sd_config__reset_stages_msb = 0x00; + pstatic->sd_config__reset_stages_lsb = 0x00; - pgeneral->gph_config__stream_count_update_value = 0x00; - pgeneral->global_config__stream_divider = 0x00; + pgeneral->gph_config__stream_count_update_value = 0x00; + pgeneral->global_config__stream_divider = 0x00; pgeneral->system__interrupt_config_gpio = VL53L1_INTERRUPT_CONFIG_NEW_SAMPLE_READY; - pgeneral->cal_config__vcsel_start = 0x0B; + pgeneral->cal_config__vcsel_start = 0x0B; @@ -1003,25 +1006,25 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( pgeneral->cal_config__repeat_rate = ptuning_parms->tp_cal_repeat_rate; - pgeneral->global_config__vcsel_width = 0x02; + pgeneral->global_config__vcsel_width = 0x02; - pgeneral->phasecal_config__timeout_macrop = 0x0D; + pgeneral->phasecal_config__timeout_macrop = 0x0D; pgeneral->phasecal_config__target = ptuning_parms->tp_phasecal_target; - pgeneral->phasecal_config__override = 0x00; + pgeneral->phasecal_config__override = 0x00; pgeneral->dss_config__roi_mode_control = VL53L1_DEVICEDSSMODE__TARGET_RATE; - pgeneral->system__thresh_rate_high = 0x0000; - pgeneral->system__thresh_rate_low = 0x0000; + pgeneral->system__thresh_rate_high = 0x0000; + pgeneral->system__thresh_rate_low = 0x0000; - pgeneral->dss_config__manual_effective_spads_select = 0x8C00; - pgeneral->dss_config__manual_block_select = 0x00; + pgeneral->dss_config__manual_effective_spads_select = 0x8C00; + pgeneral->dss_config__manual_block_select = 0x00; @@ -1030,33 +1033,33 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - pgeneral->dss_config__aperture_attenuation = 0x38; - pgeneral->dss_config__max_spads_limit = 0xFF; - pgeneral->dss_config__min_spads_limit = 0x01; + pgeneral->dss_config__aperture_attenuation = 0x38; + pgeneral->dss_config__max_spads_limit = 0xFF; + pgeneral->dss_config__min_spads_limit = 0x01; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x1a; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x20; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x1a; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x20; - ptiming->range_config__timeout_macrop_a_hi = 0x01; - ptiming->range_config__timeout_macrop_a_lo = 0xCC; + ptiming->range_config__timeout_macrop_a_hi = 0x01; + ptiming->range_config__timeout_macrop_a_lo = 0xCC; - ptiming->range_config__vcsel_period_a = 0x0B; + ptiming->range_config__vcsel_period_a = 0x0B; - ptiming->range_config__timeout_macrop_b_hi = 0x01; - ptiming->range_config__timeout_macrop_b_lo = 0xF5; + ptiming->range_config__timeout_macrop_b_hi = 0x01; + ptiming->range_config__timeout_macrop_b_lo = 0xF5; - ptiming->range_config__vcsel_period_b = 0x09; + ptiming->range_config__vcsel_period_b = 0x09; @@ -1080,10 +1083,10 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - ptiming->range_config__valid_phase_low = 0x08; - ptiming->range_config__valid_phase_high = 0x78; - ptiming->system__intermeasurement_period = 0x00000000; - ptiming->system__fractional_enable = 0x00; + ptiming->range_config__valid_phase_low = 0x08; + ptiming->range_config__valid_phase_high = 0x78; + ptiming->system__intermeasurement_period = 0x00000000; + ptiming->system__fractional_enable = 0x00; @@ -1112,37 +1115,37 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - phistogram->histogram_config__low_amb_even_bin_0_1 = 0x07; - phistogram->histogram_config__low_amb_even_bin_2_3 = 0x21; - phistogram->histogram_config__low_amb_even_bin_4_5 = 0x43; + phistogram->histogram_config__low_amb_even_bin_0_1 = 0x07; + phistogram->histogram_config__low_amb_even_bin_2_3 = 0x21; + phistogram->histogram_config__low_amb_even_bin_4_5 = 0x43; - phistogram->histogram_config__low_amb_odd_bin_0_1 = 0x10; - phistogram->histogram_config__low_amb_odd_bin_2_3 = 0x32; - phistogram->histogram_config__low_amb_odd_bin_4_5 = 0x54; + phistogram->histogram_config__low_amb_odd_bin_0_1 = 0x10; + phistogram->histogram_config__low_amb_odd_bin_2_3 = 0x32; + phistogram->histogram_config__low_amb_odd_bin_4_5 = 0x54; - phistogram->histogram_config__mid_amb_even_bin_0_1 = 0x07; - phistogram->histogram_config__mid_amb_even_bin_2_3 = 0x21; - phistogram->histogram_config__mid_amb_even_bin_4_5 = 0x43; + phistogram->histogram_config__mid_amb_even_bin_0_1 = 0x07; + phistogram->histogram_config__mid_amb_even_bin_2_3 = 0x21; + phistogram->histogram_config__mid_amb_even_bin_4_5 = 0x43; - phistogram->histogram_config__mid_amb_odd_bin_0_1 = 0x10; - phistogram->histogram_config__mid_amb_odd_bin_2 = 0x02; - phistogram->histogram_config__mid_amb_odd_bin_3_4 = 0x43; - phistogram->histogram_config__mid_amb_odd_bin_5 = 0x05; + phistogram->histogram_config__mid_amb_odd_bin_0_1 = 0x10; + phistogram->histogram_config__mid_amb_odd_bin_2 = 0x02; + phistogram->histogram_config__mid_amb_odd_bin_3_4 = 0x43; + phistogram->histogram_config__mid_amb_odd_bin_5 = 0x05; - phistogram->histogram_config__user_bin_offset = 0x00; + phistogram->histogram_config__user_bin_offset = 0x00; - phistogram->histogram_config__high_amb_even_bin_0_1 = 0x07; - phistogram->histogram_config__high_amb_even_bin_2_3 = 0x21; - phistogram->histogram_config__high_amb_even_bin_4_5 = 0x43; + phistogram->histogram_config__high_amb_even_bin_0_1 = 0x07; + phistogram->histogram_config__high_amb_even_bin_2_3 = 0x21; + phistogram->histogram_config__high_amb_even_bin_4_5 = 0x43; - phistogram->histogram_config__high_amb_odd_bin_0_1 = 0x10; - phistogram->histogram_config__high_amb_odd_bin_2_3 = 0x32; - phistogram->histogram_config__high_amb_odd_bin_4_5 = 0x54; + phistogram->histogram_config__high_amb_odd_bin_0_1 = 0x10; + phistogram->histogram_config__high_amb_odd_bin_2_3 = 0x32; + phistogram->histogram_config__high_amb_odd_bin_4_5 = 0x54; - phistogram->histogram_config__amb_thresh_low = 0xFFFF; - phistogram->histogram_config__amb_thresh_high = 0xFFFF; + phistogram->histogram_config__amb_thresh_low = 0xFFFF; + phistogram->histogram_config__amb_thresh_high = 0xFFFF; - phistogram->histogram_config__spad_array_selection = 0x00; + phistogram->histogram_config__spad_array_selection = 0x00; @@ -1152,36 +1155,36 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( pzone_cfg->max_zones = VL53L1_MAX_USER_ZONES; - pzone_cfg->active_zones = 0x00; - pzone_cfg->user_zones[0].height = 0x0f; - pzone_cfg->user_zones[0].width = 0x0f; - pzone_cfg->user_zones[0].x_centre = 0x08; - pzone_cfg->user_zones[0].y_centre = 0x08; + pzone_cfg->active_zones = 0x00; + pzone_cfg->user_zones[0].height = 0x0f; + pzone_cfg->user_zones[0].width = 0x0f; + pzone_cfg->user_zones[0].x_centre = 0x08; + pzone_cfg->user_zones[0].y_centre = 0x08; - pdynamic->system__grouped_parameter_hold_0 = 0x01; + pdynamic->system__grouped_parameter_hold_0 = 0x01; - pdynamic->system__thresh_high = 0x0000; - pdynamic->system__thresh_low = 0x0000; - pdynamic->system__enable_xtalk_per_quadrant = 0x00; + pdynamic->system__thresh_high = 0x0000; + pdynamic->system__thresh_low = 0x0000; + pdynamic->system__enable_xtalk_per_quadrant = 0x00; pdynamic->system__seed_config = ptuning_parms->tp_lite_seed_cfg; - pdynamic->sd_config__woi_sd0 = 0x0B; + pdynamic->sd_config__woi_sd0 = 0x0B; - pdynamic->sd_config__woi_sd1 = 0x09; + pdynamic->sd_config__woi_sd1 = 0x09; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_lite_med; pdynamic->sd_config__initial_phase_sd1 = - ptuning_parms->tp_init_phase_ref_lite_med;; + ptuning_parms->tp_init_phase_ref_lite_med; - pdynamic->system__grouped_parameter_hold_1 = 0x01; + pdynamic->system__grouped_parameter_hold_1 = 0x01; @@ -1220,34 +1223,34 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging( - pdynamic->roi_config__user_roi_centre_spad = 0xC7; + pdynamic->roi_config__user_roi_centre_spad = 0xC7; pdynamic->roi_config__user_roi_requested_global_xy_size = 0xFF; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; - pdynamic->system__grouped_parameter_hold = 0x02; + pdynamic->system__grouped_parameter_hold = 0x02; - psystem->system__stream_count_ctrl = 0x00; - psystem->firmware__enable = 0x01; - psystem->system__interrupt_clear = \ + psystem->system__stream_count_ctrl = 0x00; + psystem->firmware__enable = 0x01; + psystem->system__interrupt_clear = VL53L1_CLEAR_RANGE_INT; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_STREAMING | \ - VL53L1_DEVICEREADOUTMODE_SINGLE_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_STREAMING | + VL53L1_DEVICEREADOUTMODE_SINGLE_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; LOG_FUNCTION_END(status); @@ -1312,14 +1315,14 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range( - ptiming->range_config__vcsel_period_a = 0x07; - ptiming->range_config__vcsel_period_b = 0x05; + ptiming->range_config__vcsel_period_a = 0x07; + ptiming->range_config__vcsel_period_b = 0x05; ptiming->range_config__sigma_thresh = ptuning_parms->tp_lite_short_sigma_thresh_mm; ptiming->range_config__min_count_rate_rtn_limit_mcps = - ptuning_parms->tp_lite_short_min_count_rate_rtn_mcps; - ptiming->range_config__valid_phase_low = 0x08; - ptiming->range_config__valid_phase_high = 0x38; + ptuning_parms->tp_lite_short_min_count_rate_rtn_mcps; + ptiming->range_config__valid_phase_low = 0x08; + ptiming->range_config__valid_phase_high = 0x38; @@ -1327,8 +1330,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_short_range( - pdynamic->sd_config__woi_sd0 = 0x07; - pdynamic->sd_config__woi_sd1 = 0x05; + pdynamic->sd_config__woi_sd0 = 0x07; + pdynamic->sd_config__woi_sd1 = 0x05; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_lite_short; pdynamic->sd_config__initial_phase_sd1 = @@ -1397,14 +1400,14 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range( - ptiming->range_config__vcsel_period_a = 0x0F; - ptiming->range_config__vcsel_period_b = 0x0D; + ptiming->range_config__vcsel_period_a = 0x0F; + ptiming->range_config__vcsel_period_b = 0x0D; ptiming->range_config__sigma_thresh = ptuning_parms->tp_lite_long_sigma_thresh_mm; ptiming->range_config__min_count_rate_rtn_limit_mcps = - ptuning_parms->tp_lite_long_min_count_rate_rtn_mcps; - ptiming->range_config__valid_phase_low = 0x08; - ptiming->range_config__valid_phase_high = 0xB8; + ptuning_parms->tp_lite_long_min_count_rate_rtn_mcps; + ptiming->range_config__valid_phase_low = 0x08; + ptiming->range_config__valid_phase_high = 0xB8; @@ -1412,8 +1415,8 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_long_range( - pdynamic->sd_config__woi_sd0 = 0x0F; - pdynamic->sd_config__woi_sd1 = 0x0D; + pdynamic->sd_config__woi_sd0 = 0x0F; + pdynamic->sd_config__woi_sd1 = 0x0D; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_lite_long; pdynamic->sd_config__initial_phase_sd1 = @@ -1471,13 +1474,13 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_mm1_cal( if (status == VL53L1_ERROR_NONE) { pgeneral->dss_config__roi_mode_control = - VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; + VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | VL53L1_SEQUENCE_MM1_EN; } @@ -1532,13 +1535,13 @@ VL53L1_Error VL53L1_preset_mode_standard_ranging_mm2_cal( if (status == VL53L1_ERROR_NONE) { pgeneral->dss_config__roi_mode_control = - VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; + VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | VL53L1_SEQUENCE_MM2_EN; } @@ -1604,12 +1607,12 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging( - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0xB1; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0xB1; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0xD4; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0xD4; @@ -1624,8 +1627,8 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging( psystem->system__mode_start = - VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | \ - VL53L1_DEVICEREADOUTMODE_SINGLE_SD | \ + VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | + VL53L1_DEVICEREADOUTMODE_SINGLE_SD | VL53L1_DEVICEMEASUREMENTMODE_TIMED; } @@ -1694,12 +1697,12 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range( - ptiming->range_config__timeout_macrop_a_hi = 0x01; - ptiming->range_config__timeout_macrop_a_lo = 0x84; + ptiming->range_config__timeout_macrop_a_hi = 0x01; + ptiming->range_config__timeout_macrop_a_lo = 0x84; - ptiming->range_config__timeout_macrop_b_hi = 0x01; - ptiming->range_config__timeout_macrop_b_lo = 0xB1; + ptiming->range_config__timeout_macrop_b_hi = 0x01; + ptiming->range_config__timeout_macrop_b_lo = 0xB1; ptiming->system__intermeasurement_period = 0x00000600; pdynamic->system__seed_config = @@ -1711,8 +1714,8 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_short_range( psystem->system__mode_start = - VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | \ - VL53L1_DEVICEREADOUTMODE_SINGLE_SD | \ + VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | + VL53L1_DEVICEREADOUTMODE_SINGLE_SD | VL53L1_DEVICEMEASUREMENTMODE_TIMED; } @@ -1781,12 +1784,12 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range( - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x97; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x97; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0xB1; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0xB1; ptiming->system__intermeasurement_period = 0x00000600; pdynamic->system__seed_config = @@ -1798,8 +1801,8 @@ VL53L1_Error VL53L1_preset_mode_timed_ranging_long_range( psystem->system__mode_start = - VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | \ - VL53L1_DEVICEREADOUTMODE_SINGLE_SD | \ + VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | + VL53L1_DEVICEREADOUTMODE_SINGLE_SD | VL53L1_DEVICEMEASUREMENTMODE_TIMED; } @@ -2050,12 +2053,12 @@ VL53L1_Error VL53L1_preset_mode_singleshot_ranging( - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0xB1; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0xB1; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0xD4; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0xD4; pdynamic->system__seed_config = ptuning_parms->tp_timed_seed_cfg; @@ -2065,9 +2068,9 @@ VL53L1_Error VL53L1_preset_mode_singleshot_ranging( - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | \ - VL53L1_DEVICEREADOUTMODE_SINGLE_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_PSEUDO_SOLO | + VL53L1_DEVICEREADOUTMODE_SINGLE_SD | VL53L1_DEVICEMEASUREMENTMODE_SINGLESHOT; } @@ -2128,7 +2131,7 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( - pstatic->dss_config__target_total_rate_mcps = 0x1400; + pstatic->dss_config__target_total_rate_mcps = 0x1400; @@ -2182,34 +2185,34 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( - ptiming->range_config__vcsel_period_a = 0x09; - ptiming->range_config__vcsel_period_b = 0x0B; - pdynamic->sd_config__woi_sd0 = 0x09; - pdynamic->sd_config__woi_sd1 = 0x0B; + ptiming->range_config__vcsel_period_a = 0x09; + ptiming->range_config__vcsel_period_b = 0x0B; + pdynamic->sd_config__woi_sd0 = 0x09; + pdynamic->sd_config__woi_sd1 = 0x0B; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x20; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x1A; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x20; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x1A; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x28; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x28; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x21; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x21; - pgeneral->phasecal_config__timeout_macrop = 0xF5; + pgeneral->phasecal_config__timeout_macrop = 0xF5; @@ -2218,7 +2221,7 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( - phistpostprocess->valid_phase_low = 0x08; + phistpostprocess->valid_phase_low = 0x08; phistpostprocess->valid_phase_high = 0x88; @@ -2235,11 +2238,11 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | @@ -2250,9 +2253,9 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging( - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -2365,20 +2368,20 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_with_mm1( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -2438,12 +2441,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_with_mm2( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -2544,17 +2547,17 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_mm1_cal( pgeneral->dss_config__roi_mode_control = - VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; + VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -2612,12 +2615,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_mm2_cal( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -2682,7 +2685,7 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_short_timing( - pstatic->dss_config__target_total_rate_mcps = 0x1400; + pstatic->dss_config__target_total_rate_mcps = 0x1400; @@ -2717,18 +2720,18 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_short_timing( - ptiming->range_config__vcsel_period_a = 0x04; - ptiming->range_config__vcsel_period_b = 0x03; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x42; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x42; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x52; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x66; + ptiming->range_config__vcsel_period_a = 0x04; + ptiming->range_config__vcsel_period_b = 0x03; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x42; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x42; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x52; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x66; - pgeneral->cal_config__vcsel_start = 0x04; + pgeneral->cal_config__vcsel_start = 0x04; @@ -2739,16 +2742,16 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_short_timing( - pgeneral->phasecal_config__timeout_macrop = 0xa4; + pgeneral->phasecal_config__timeout_macrop = 0xa4; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | @@ -2759,9 +2762,9 @@ VL53L1_Error VL53L1_preset_mode_histogram_ranging_short_timing( - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -2865,31 +2868,31 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range( - ptiming->range_config__vcsel_period_a = 0x09; - ptiming->range_config__vcsel_period_b = 0x0b; + ptiming->range_config__vcsel_period_a = 0x09; + ptiming->range_config__vcsel_period_b = 0x0b; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x21; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x1b; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x21; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x1b; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x29; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x22; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x29; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x22; - pgeneral->cal_config__vcsel_start = 0x09; + pgeneral->cal_config__vcsel_start = 0x09; @@ -2904,13 +2907,13 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range( - pgeneral->phasecal_config__timeout_macrop = 0xF5; + pgeneral->phasecal_config__timeout_macrop = 0xF5; - pdynamic->sd_config__woi_sd0 = 0x09; - pdynamic->sd_config__woi_sd1 = 0x0B; + pdynamic->sd_config__woi_sd0 = 0x09; + pdynamic->sd_config__woi_sd1 = 0x0B; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_hist_long; pdynamic->sd_config__initial_phase_sd1 = @@ -2923,23 +2926,23 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range( - phistpostprocess->valid_phase_low = 0x08; + phistpostprocess->valid_phase_low = 0x08; phistpostprocess->valid_phase_high = 0x88; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | VL53L1_SEQUENCE_RANGE_EN; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -3041,12 +3044,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range_mm1( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -3106,12 +3109,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_long_range_mm2( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -3214,31 +3217,31 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range( - ptiming->range_config__vcsel_period_a = 0x05; - ptiming->range_config__vcsel_period_b = 0x07; + ptiming->range_config__vcsel_period_a = 0x05; + ptiming->range_config__vcsel_period_b = 0x07; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x36; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x28; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x36; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x28; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x44; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x33; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x44; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x33; - pgeneral->cal_config__vcsel_start = 0x05; + pgeneral->cal_config__vcsel_start = 0x05; @@ -3253,13 +3256,13 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range( - pgeneral->phasecal_config__timeout_macrop = 0xF5; + pgeneral->phasecal_config__timeout_macrop = 0xF5; - pdynamic->sd_config__woi_sd0 = 0x05; - pdynamic->sd_config__woi_sd1 = 0x07; + pdynamic->sd_config__woi_sd0 = 0x05; + pdynamic->sd_config__woi_sd1 = 0x07; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_hist_med; pdynamic->sd_config__initial_phase_sd1 = @@ -3272,23 +3275,23 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range( - phistpostprocess->valid_phase_low = 0x08; + phistpostprocess->valid_phase_low = 0x08; phistpostprocess->valid_phase_high = 0x48; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | VL53L1_SEQUENCE_RANGE_EN; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -3385,12 +3388,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range_mm1( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -3450,12 +3453,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_medium_range_mm2( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -3557,31 +3560,31 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range( - ptiming->range_config__vcsel_period_a = 0x03; - ptiming->range_config__vcsel_period_b = 0x05; + ptiming->range_config__vcsel_period_a = 0x03; + ptiming->range_config__vcsel_period_b = 0x05; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x52; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x37; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x52; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x37; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x66; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x44; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x66; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x44; - pgeneral->cal_config__vcsel_start = 0x03; + pgeneral->cal_config__vcsel_start = 0x03; @@ -3596,13 +3599,13 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range( - pgeneral->phasecal_config__timeout_macrop = 0xF5; + pgeneral->phasecal_config__timeout_macrop = 0xF5; - pdynamic->sd_config__woi_sd0 = 0x03; - pdynamic->sd_config__woi_sd1 = 0x05; + pdynamic->sd_config__woi_sd0 = 0x03; + pdynamic->sd_config__woi_sd1 = 0x05; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_hist_short; pdynamic->sd_config__initial_phase_sd1 = @@ -3614,15 +3617,15 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range( - phistpostprocess->valid_phase_low = 0x08; + phistpostprocess->valid_phase_low = 0x08; phistpostprocess->valid_phase_high = 0x28; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; @@ -3631,9 +3634,9 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range( - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -3737,25 +3740,25 @@ VL53L1_Error VL53L1_preset_mode_special_histogram_short_range( - ptiming->range_config__vcsel_period_a = 0x02; - ptiming->range_config__vcsel_period_b = 0x03; + ptiming->range_config__vcsel_period_a = 0x02; + ptiming->range_config__vcsel_period_b = 0x03; - pgeneral->cal_config__vcsel_start = 0x00; + pgeneral->cal_config__vcsel_start = 0x00; - pgeneral->phasecal_config__target = 0x31; + pgeneral->phasecal_config__target = 0x31; - pdynamic->sd_config__woi_sd0 = 0x02; - pdynamic->sd_config__woi_sd1 = 0x03; + pdynamic->sd_config__woi_sd0 = 0x02; + pdynamic->sd_config__woi_sd1 = 0x03; pdynamic->sd_config__initial_phase_sd0 = ptuning_parms->tp_init_phase_rtn_hist_short; pdynamic->sd_config__initial_phase_sd1 = @@ -3768,7 +3771,7 @@ VL53L1_Error VL53L1_preset_mode_special_histogram_short_range( - phistpostprocess->valid_phase_low = 0x10; + phistpostprocess->valid_phase_low = 0x10; phistpostprocess->valid_phase_high = 0x18; } @@ -3873,12 +3876,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range_mm1( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -3939,12 +3942,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_short_range_mm2( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; } @@ -4001,17 +4004,17 @@ VL53L1_Error VL53L1_preset_mode_histogram_characterisation( - pstatic->debug__ctrl = 0x01; - psystem->power_management__go1_power_force = 0x01; + pstatic->debug__ctrl = 0x01; + psystem->power_management__go1_power_force = 0x01; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | VL53L1_SEQUENCE_RANGE_EN; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_SPLIT_MANUAL | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_SPLIT_MANUAL | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -4084,8 +4087,8 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_planar( - ptiming->range_config__vcsel_period_a = 0x09; - ptiming->range_config__vcsel_period_b = 0x09; + ptiming->range_config__vcsel_period_a = 0x09; + ptiming->range_config__vcsel_period_b = 0x09; @@ -4119,7 +4122,8 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_planar( if (status == VL53L1_ERROR_NONE) { - status = VL53L1_set_histogram_multizone_initial_bin_config( + status = + VL53L1_set_histogram_multizone_initial_bin_config( pzone_cfg, phistogram, &(pzone_cfg->multizone_hist_cfg)); @@ -4238,31 +4242,31 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_mm1( - ptiming->range_config__vcsel_period_a = 0x09; - ptiming->range_config__vcsel_period_b = 0x09; + ptiming->range_config__vcsel_period_a = 0x09; + ptiming->range_config__vcsel_period_b = 0x09; - ptiming->mm_config__timeout_macrop_a_hi = 0x00; - ptiming->mm_config__timeout_macrop_a_lo = 0x21; - ptiming->mm_config__timeout_macrop_b_hi = 0x00; - ptiming->mm_config__timeout_macrop_b_lo = 0x21; + ptiming->mm_config__timeout_macrop_a_hi = 0x00; + ptiming->mm_config__timeout_macrop_a_lo = 0x21; + ptiming->mm_config__timeout_macrop_b_hi = 0x00; + ptiming->mm_config__timeout_macrop_b_lo = 0x21; - ptiming->range_config__timeout_macrop_a_hi = 0x00; - ptiming->range_config__timeout_macrop_a_lo = 0x29; - ptiming->range_config__timeout_macrop_b_hi = 0x00; - ptiming->range_config__timeout_macrop_b_lo = 0x29; + ptiming->range_config__timeout_macrop_a_hi = 0x00; + ptiming->range_config__timeout_macrop_a_lo = 0x29; + ptiming->range_config__timeout_macrop_b_hi = 0x00; + ptiming->range_config__timeout_macrop_b_lo = 0x29; - pgeneral->cal_config__vcsel_start = 0x09; + pgeneral->cal_config__vcsel_start = 0x09; @@ -4276,31 +4280,31 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_mm1( - pgeneral->phasecal_config__timeout_macrop = 0xF5; + pgeneral->phasecal_config__timeout_macrop = 0xF5; - pdynamic->sd_config__woi_sd0 = 0x09; - pdynamic->sd_config__woi_sd1 = 0x09; - pdynamic->sd_config__initial_phase_sd0 = 0x09; - pdynamic->sd_config__initial_phase_sd1 = 0x06; + pdynamic->sd_config__woi_sd0 = 0x09; + pdynamic->sd_config__woi_sd1 = 0x09; + pdynamic->sd_config__initial_phase_sd0 = 0x09; + pdynamic->sd_config__initial_phase_sd1 = 0x06; - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM1_EN | VL53L1_SEQUENCE_RANGE_EN; - psystem->system__mode_start = \ - VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | \ - VL53L1_DEVICEREADOUTMODE_DUAL_SD | \ + psystem->system__mode_start = + VL53L1_DEVICESCHEDULERMODE_HISTOGRAM | + VL53L1_DEVICEREADOUTMODE_DUAL_SD | VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK; } @@ -4353,12 +4357,12 @@ VL53L1_Error VL53L1_preset_mode_histogram_xtalk_mm2( pzone_cfg); - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ - VL53L1_SEQUENCE_DSS2_EN | \ - VL53L1_SEQUENCE_MM2_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | + VL53L1_SEQUENCE_DSS2_EN | + VL53L1_SEQUENCE_MM2_EN | VL53L1_SEQUENCE_RANGE_EN; @@ -4442,7 +4446,8 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone( if (status == VL53L1_ERROR_NONE) { - status = VL53L1_set_histogram_multizone_initial_bin_config ( + status = + VL53L1_set_histogram_multizone_initial_bin_config( pzone_cfg, phistogram, &(pzone_cfg->multizone_hist_cfg)); @@ -4532,7 +4537,8 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone_short_range( if (status == VL53L1_ERROR_NONE) { - status = VL53L1_set_histogram_multizone_initial_bin_config ( + status = + VL53L1_set_histogram_multizone_initial_bin_config( pzone_cfg, phistogram, &(pzone_cfg->multizone_hist_cfg) @@ -4627,7 +4633,8 @@ VL53L1_Error VL53L1_preset_mode_histogram_multizone_long_range( if (status == VL53L1_ERROR_NONE) { - status = VL53L1_set_histogram_multizone_initial_bin_config ( + status = + VL53L1_set_histogram_multizone_initial_bin_config( pzone_cfg, phistogram, &(pzone_cfg->multizone_hist_cfg)); @@ -4690,12 +4697,10 @@ VL53L1_Error VL53L1_preset_mode_olt( - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) - - psystem->system__stream_count_ctrl = 0x01; - } + psystem->system__stream_count_ctrl = 0x01; LOG_FUNCTION_END(status); @@ -4736,7 +4741,8 @@ void VL53L1_copy_hist_cfg_to_static_cfg( phistogram->histogram_config__high_amb_odd_bin_4_5; pstatic->algo__range_ignore_threshold_mcps = - (((uint16_t)phistogram->histogram_config__mid_amb_even_bin_0_1) << 8) + (((uint16_t)phistogram->histogram_config__mid_amb_even_bin_0_1) + << 8) + (uint16_t)phistogram->histogram_config__mid_amb_even_bin_2_3; pstatic->algo__range_ignore_valid_height_mm = @@ -4755,11 +4761,13 @@ void VL53L1_copy_hist_cfg_to_static_cfg( phistogram->histogram_config__user_bin_offset; ptiming->range_config__sigma_thresh = - (((uint16_t)phistogram->histogram_config__low_amb_even_bin_0_1) << 8) + (((uint16_t)phistogram->histogram_config__low_amb_even_bin_0_1) + << 8) + (uint16_t)phistogram->histogram_config__low_amb_even_bin_2_3; ptiming->range_config__min_count_rate_rtn_limit_mcps = - (((uint16_t)phistogram->histogram_config__low_amb_even_bin_4_5) << 8) + (((uint16_t)phistogram->histogram_config__low_amb_even_bin_4_5) + << 8) + (uint16_t)phistogram->histogram_config__low_amb_odd_bin_0_1; ptiming->range_config__valid_phase_low = @@ -4783,8 +4791,7 @@ void VL53L1_copy_hist_cfg_to_static_cfg( void VL53L1_copy_hist_bins_to_static_cfg( VL53L1_histogram_config_t *phistogram, VL53L1_static_config_t *pstatic, - VL53L1_timing_config_t *ptiming - ) + VL53L1_timing_config_t *ptiming) { @@ -4810,7 +4817,8 @@ void VL53L1_copy_hist_bins_to_static_cfg( phistogram->histogram_config__high_amb_odd_bin_4_5; pstatic->algo__range_ignore_threshold_mcps = - (((uint16_t)phistogram->histogram_config__mid_amb_even_bin_0_1) << 8) + (((uint16_t)phistogram->histogram_config__mid_amb_even_bin_0_1) + << 8) + (uint16_t)phistogram->histogram_config__mid_amb_even_bin_2_3; pstatic->algo__range_ignore_valid_height_mm = @@ -4826,11 +4834,13 @@ void VL53L1_copy_hist_bins_to_static_cfg( phistogram->histogram_config__mid_amb_odd_bin_5; ptiming->range_config__sigma_thresh = - (((uint16_t)phistogram->histogram_config__low_amb_even_bin_0_1) << 8) + (((uint16_t)phistogram->histogram_config__low_amb_even_bin_0_1) + << 8) + (uint16_t)phistogram->histogram_config__low_amb_even_bin_2_3; ptiming->range_config__min_count_rate_rtn_limit_mcps = - (((uint16_t)phistogram->histogram_config__low_amb_even_bin_4_5) << 8) + (((uint16_t)phistogram->histogram_config__low_amb_even_bin_4_5) + << 8) + (uint16_t)phistogram->histogram_config__low_amb_odd_bin_0_1; ptiming->range_config__valid_phase_low = diff --git a/drivers/input/misc/vl53L1/src/vl53l1_api_strings.c b/drivers/input/misc/vl53L1/src/vl53l1_api_strings.c index f01c14f53c7b..70266e4418a7 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_api_strings.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_api_strings.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ diff --git a/drivers/input/misc/vl53L1/src/vl53l1_core.c b/drivers/input/misc/vl53L1/src/vl53l1_core.c index f0779812743c..6d1fa6c3117f 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_core.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_core.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -215,11 +215,10 @@ VL53L1_Error VL53L1_update_ll_driver_rd_state( - if (pstate->rd_stream_count == 0xFF) { + if (pstate->rd_stream_count == 0xFF) pstate->rd_stream_count = 0x80; - } else { + else pstate->rd_stream_count++; - } @@ -247,16 +246,15 @@ VL53L1_Error VL53L1_update_ll_driver_rd_state( if ((pdev->dyn_cfg.system__grouped_parameter_hold & VL53L1_GROUPEDPARAMETERHOLD_ID_MASK) > 0) { pstate->rd_device_state = - VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC; + VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC; } else { if (pstate->rd_zone_id >= - pdev->zone_cfg.active_zones) { + pdev->zone_cfg.active_zones) pstate->rd_device_state = - VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA; - } else { + VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA; + else pstate->rd_device_state = - VL53L1_DEVICESTATE_RANGING_GATHER_DATA; - } + VL53L1_DEVICESTATE_RANGING_GATHER_DATA; } pstate->rd_stream_count = 0; @@ -273,25 +271,25 @@ VL53L1_Error VL53L1_update_ll_driver_rd_state( pstate->rd_internal_stream_count_val = 0; pstate->rd_zone_id = 0; if (pstate->rd_zone_id >= - pdev->zone_cfg.active_zones) { + pdev->zone_cfg.active_zones) pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA; - } else { + else pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_GATHER_DATA; - } + break; case VL53L1_DEVICESTATE_RANGING_GATHER_DATA: pstate->rd_zone_id++; if (pstate->rd_zone_id >= - pdev->zone_cfg.active_zones) { + pdev->zone_cfg.active_zones) pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA; - } else { + else pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_GATHER_DATA; - } + break; case VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA: @@ -299,13 +297,12 @@ VL53L1_Error VL53L1_update_ll_driver_rd_state( pstate->rd_timing_status ^= 0x01; if (pstate->rd_zone_id >= - pdev->zone_cfg.active_zones) { + pdev->zone_cfg.active_zones) pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA; - } else { + else pstate->rd_device_state = VL53L1_DEVICESTATE_RANGING_GATHER_DATA; - } break; default: @@ -351,6 +348,7 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( VL53L1_ll_driver_state_t *pstate = &(pdev->ll_state); VL53L1_system_results_t *psys_results = &(pdev->sys_results); VL53L1_histogram_bin_data_t *phist_data = &(pdev->hist_data); + VL53L1_zone_private_dyn_cfgs_t *pZ = &(pres->zone_dyn_cfgs); uint8_t device_range_status = 0; uint8_t device_stream_count = 0; @@ -384,17 +382,17 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( device_gph_id = (psys_results->result__interrupt_status & VL53L1_INTERRUPT_STATUS__GPH_ID_INT_STATUS_MASK) >> 4; - if (histogram_mode) { + if (histogram_mode) device_gph_id = (phist_data->result__interrupt_status & VL53L1_INTERRUPT_STATUS__GPH_ID_INT_STATUS_MASK) >> 4; - } - if ((pdev->sys_ctrl.system__mode_start & + if (!((pdev->sys_ctrl.system__mode_start & VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK) == - VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK) { + VL53L1_DEVICEMEASUREMENTMODE_BACKTOBACK)) + goto ENDFUNC; @@ -409,27 +407,26 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( - if (pstate->rd_device_state == - VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { + if (pstate->rd_device_state == + VL53L1_DEVICESTATE_RANGING_WAIT_GPH_SYNC) { - if (histogram_mode == 0) { - if (device_range_status != - VL53L1_DEVICEERROR_GPHSTREAMCOUNT0READY) { - status = VL53L1_ERROR_GPH_SYNC_CHECK_FAIL; - } - } - } else { - if (pstate->rd_stream_count != device_stream_count) { - status = VL53L1_ERROR_STREAM_COUNT_CHECK_FAIL; - } + if (histogram_mode == 0) { + if (device_range_status != + VL53L1_DEVICEERROR_GPHSTREAMCOUNT0READY) + status = + VL53L1_ERROR_GPH_SYNC_CHECK_FAIL; + } + } else { + if (pstate->rd_stream_count != device_stream_count) + status = VL53L1_ERROR_STREAM_COUNT_CHECK_FAIL; - if (pstate->rd_gph_id != device_gph_id) { - status = VL53L1_ERROR_GPH_ID_CHECK_FAIL; + if (pstate->rd_gph_id != device_gph_id) + status = VL53L1_ERROR_GPH_ID_CHECK_FAIL; @@ -437,7 +434,6 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( - } else { @@ -445,40 +441,39 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( - } - expected_stream_count = - pres->zone_dyn_cfgs.VL53L1_PRM_00005[pstate->rd_zone_id].expected_stream_count; - expected_gph_id = - pres->zone_dyn_cfgs.VL53L1_PRM_00005[pstate->rd_zone_id].expected_gph_id; + expected_stream_count = + pZ->VL53L1_p_002[pstate->rd_zone_id].expected_stream_count; + expected_gph_id = + pZ->VL53L1_p_002[pstate->rd_zone_id].expected_gph_id; - if (expected_stream_count != device_stream_count) { + if (expected_stream_count != device_stream_count) { - if ((pdev->zone_cfg.active_zones == 0) && - (device_stream_count == 255)) { + if (!((pdev->zone_cfg.active_zones == 0) && + (device_stream_count == 255))) + status = + VL53L1_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL; - } else { - status = VL53L1_ERROR_ZONE_STREAM_COUNT_CHECK_FAIL; @@ -486,24 +481,11 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( - } - } - - if (expected_gph_id != device_gph_id) { - status = VL53L1_ERROR_ZONE_GPH_ID_CHECK_FAIL; - - - - - - - - } } @@ -511,6 +493,11 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( + if (expected_gph_id != device_gph_id) + status = VL53L1_ERROR_ZONE_GPH_ID_CHECK_FAIL; + + + @@ -521,8 +508,20 @@ VL53L1_Error VL53L1_check_ll_driver_rd_state( } - LOG_FUNCTION_END(status); + + + + + + + + + + + +ENDFUNC: + LOG_FUNCTION_END(status); return status; } @@ -542,6 +541,7 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( VL53L1DevStructGetLLResultsHandle(Dev); VL53L1_ll_driver_state_t *pstate = &(pdev->ll_state); + VL53L1_zone_private_dyn_cfgs_t *pZ = &(pres->zone_dyn_cfgs); uint8_t prev_cfg_zone_id; uint8_t prev_cfg_gph_id; @@ -584,11 +584,10 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( - if (pstate->cfg_stream_count == 0xFF) { + if (pstate->cfg_stream_count == 0xFF) pstate->cfg_stream_count = 0x80; - } else { + else pstate->cfg_stream_count++; - } @@ -623,14 +622,15 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( } pstate->cfg_stream_count = 1; - if (pdev->gen_cfg.global_config__stream_divider == 0) { + if (pdev->gen_cfg.global_config__stream_divider == 0) { pstate->cfg_internal_stream_count = 1; pstate->cfg_internal_stream_count_val = 0; } else { pstate->cfg_internal_stream_count = 0; pstate->cfg_internal_stream_count_val = 1; } - pstate->cfg_device_state = VL53L1_DEVICESTATE_RANGING_DSS_AUTO; + pstate->cfg_device_state = + VL53L1_DEVICESTATE_RANGING_DSS_AUTO; break; case VL53L1_DEVICESTATE_RANGING_DSS_AUTO: @@ -648,7 +648,7 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( if (pdev->zone_cfg.active_zones > 0) { pstate->cfg_device_state = - VL53L1_DEVICESTATE_RANGING_DSS_MANUAL; + VL53L1_DEVICESTATE_RANGING_DSS_MANUAL; } } break; @@ -663,11 +663,13 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( break; default: - pstate->cfg_device_state = VL53L1_DEVICESTATE_SW_STANDBY; + pstate->cfg_device_state = + VL53L1_DEVICESTATE_SW_STANDBY; pstate->cfg_stream_count = 0; pstate->cfg_internal_stream_count = 0; pstate->cfg_internal_stream_count_val = 0; - pstate->cfg_gph_id = VL53L1_GROUPEDPARAMETERHOLD_ID_MASK; + pstate->cfg_gph_id = + VL53L1_GROUPEDPARAMETERHOLD_ID_MASK; pstate->cfg_timing_status = 0; pstate->cfg_zone_id = 0; break; @@ -678,22 +680,21 @@ VL53L1_Error VL53L1_update_ll_driver_cfg_state( - if (pdev->zone_cfg.active_zones == 0) { - pres->zone_dyn_cfgs.VL53L1_PRM_00005[prev_cfg_zone_id].expected_stream_count = - prev_cfg_stream_count - 1; + pZ->VL53L1_p_002[prev_cfg_zone_id].expected_stream_count + = prev_cfg_stream_count - 1; - pres->zone_dyn_cfgs.VL53L1_PRM_00005[pstate->rd_zone_id].expected_gph_id = + pZ->VL53L1_p_002[pstate->rd_zone_id].expected_gph_id = prev_cfg_gph_id ^ VL53L1_GROUPEDPARAMETERHOLD_ID_MASK; } else { - pres->zone_dyn_cfgs.VL53L1_PRM_00005[prev_cfg_zone_id].expected_stream_count = - prev_cfg_stream_count; - pres->zone_dyn_cfgs.VL53L1_PRM_00005[prev_cfg_zone_id].expected_gph_id = + pZ->VL53L1_p_002[prev_cfg_zone_id].expected_stream_count + = prev_cfg_stream_count; + pZ->VL53L1_p_002[prev_cfg_zone_id].expected_gph_id = prev_cfg_gph_id; } @@ -805,8 +806,8 @@ void V53L1_init_zone_results_structure( pdata->max_zones = VL53L1_MAX_USER_ZONES; pdata->active_zones = active_zones; - for (z = 0 ; z < pdata->max_zones ; z++) { - pobjects = &(pdata->VL53L1_PRM_00005[z]); + for (z = 0; z < pdata->max_zones; z++) { + pobjects = &(pdata->VL53L1_p_002[z]); pobjects->cfg_device_state = VL53L1_DEVICESTATE_SW_STANDBY; pobjects->rd_device_state = VL53L1_DEVICESTATE_SW_STANDBY; pobjects->max_objects = VL53L1_MAX_RANGE_RESULTS; @@ -827,9 +828,10 @@ void V53L1_init_zone_dss_configs( uint8_t max_zones = VL53L1_MAX_USER_ZONES; VL53L1_zone_private_dyn_cfgs_t *pdata = &(pres->zone_dyn_cfgs); - for (z = 0 ; z < max_zones ; z++) { - pdata->VL53L1_PRM_00005[z].dss_mode = VL53L1_DSS_CONTROL__MODE_TARGET_RATE; - pdata->VL53L1_PRM_00005[z].dss_requested_effective_spad_count = 0; + for (z = 0; z < max_zones; z++) { + pdata->VL53L1_p_002[z].dss_mode = + VL53L1_DSS_CONTROL__MODE_TARGET_RATE; + pdata->VL53L1_p_002[z].dss_requested_effective_spad_count = 0; } } @@ -855,32 +857,49 @@ void VL53L1_init_histogram_config_structure( - pdata->histogram_config__low_amb_even_bin_0_1 = (even_bin1 << 4) + even_bin0; - pdata->histogram_config__low_amb_even_bin_2_3 = (even_bin3 << 4) + even_bin2; - pdata->histogram_config__low_amb_even_bin_4_5 = (even_bin5 << 4) + even_bin4; + pdata->histogram_config__low_amb_even_bin_0_1 = + (even_bin1 << 4) + even_bin0; + pdata->histogram_config__low_amb_even_bin_2_3 = + (even_bin3 << 4) + even_bin2; + pdata->histogram_config__low_amb_even_bin_4_5 = + (even_bin5 << 4) + even_bin4; - pdata->histogram_config__low_amb_odd_bin_0_1 = (odd_bin1 << 4) + odd_bin0; - pdata->histogram_config__low_amb_odd_bin_2_3 = (odd_bin3 << 4) + odd_bin2; - pdata->histogram_config__low_amb_odd_bin_4_5 = (odd_bin5 << 4) + odd_bin4; + pdata->histogram_config__low_amb_odd_bin_0_1 = + (odd_bin1 << 4) + odd_bin0; + pdata->histogram_config__low_amb_odd_bin_2_3 = + (odd_bin3 << 4) + odd_bin2; + pdata->histogram_config__low_amb_odd_bin_4_5 = + (odd_bin5 << 4) + odd_bin4; - pdata->histogram_config__mid_amb_even_bin_0_1 = pdata->histogram_config__low_amb_even_bin_0_1; - pdata->histogram_config__mid_amb_even_bin_2_3 = pdata->histogram_config__low_amb_even_bin_2_3; - pdata->histogram_config__mid_amb_even_bin_4_5 = pdata->histogram_config__low_amb_even_bin_4_5; + pdata->histogram_config__mid_amb_even_bin_0_1 = + pdata->histogram_config__low_amb_even_bin_0_1; + pdata->histogram_config__mid_amb_even_bin_2_3 = + pdata->histogram_config__low_amb_even_bin_2_3; + pdata->histogram_config__mid_amb_even_bin_4_5 = + pdata->histogram_config__low_amb_even_bin_4_5; - pdata->histogram_config__mid_amb_odd_bin_0_1 = pdata->histogram_config__low_amb_odd_bin_0_1; + pdata->histogram_config__mid_amb_odd_bin_0_1 = + pdata->histogram_config__low_amb_odd_bin_0_1; pdata->histogram_config__mid_amb_odd_bin_2 = odd_bin2; - pdata->histogram_config__mid_amb_odd_bin_3_4 = (odd_bin4 << 4) + odd_bin3; + pdata->histogram_config__mid_amb_odd_bin_3_4 = + (odd_bin4 << 4) + odd_bin3; pdata->histogram_config__mid_amb_odd_bin_5 = odd_bin5; pdata->histogram_config__user_bin_offset = 0x00; - pdata->histogram_config__high_amb_even_bin_0_1 = pdata->histogram_config__low_amb_even_bin_0_1; - pdata->histogram_config__high_amb_even_bin_2_3 = pdata->histogram_config__low_amb_even_bin_2_3; - pdata->histogram_config__high_amb_even_bin_4_5 = pdata->histogram_config__low_amb_even_bin_4_5; + pdata->histogram_config__high_amb_even_bin_0_1 = + pdata->histogram_config__low_amb_even_bin_0_1; + pdata->histogram_config__high_amb_even_bin_2_3 = + pdata->histogram_config__low_amb_even_bin_2_3; + pdata->histogram_config__high_amb_even_bin_4_5 = + pdata->histogram_config__low_amb_even_bin_4_5; - pdata->histogram_config__high_amb_odd_bin_0_1 = pdata->histogram_config__low_amb_odd_bin_0_1; - pdata->histogram_config__high_amb_odd_bin_2_3 = pdata->histogram_config__low_amb_odd_bin_2_3; - pdata->histogram_config__high_amb_odd_bin_4_5 = pdata->histogram_config__low_amb_odd_bin_4_5; + pdata->histogram_config__high_amb_odd_bin_0_1 = + pdata->histogram_config__low_amb_odd_bin_0_1; + pdata->histogram_config__high_amb_odd_bin_2_3 = + pdata->histogram_config__low_amb_odd_bin_2_3; + pdata->histogram_config__high_amb_odd_bin_4_5 = + pdata->histogram_config__low_amb_odd_bin_4_5; @@ -917,42 +936,49 @@ void VL53L1_init_histogram_multizone_config_structure( - pdata->histogram_config__low_amb_even_bin_0_1 = (even_bin1 << 4) + even_bin0; - pdata->histogram_config__low_amb_even_bin_2_3 = (even_bin3 << 4) + even_bin2; - pdata->histogram_config__low_amb_even_bin_4_5 = (even_bin5 << 4) + even_bin4; + pdata->histogram_config__low_amb_even_bin_0_1 = + (even_bin1 << 4) + even_bin0; + pdata->histogram_config__low_amb_even_bin_2_3 = + (even_bin3 << 4) + even_bin2; + pdata->histogram_config__low_amb_even_bin_4_5 = + (even_bin5 << 4) + even_bin4; pdata->histogram_config__low_amb_odd_bin_0_1 = - pdata->histogram_config__low_amb_even_bin_0_1; + pdata->histogram_config__low_amb_even_bin_0_1; pdata->histogram_config__low_amb_odd_bin_2_3 - = pdata->histogram_config__low_amb_even_bin_2_3; + = pdata->histogram_config__low_amb_even_bin_2_3; pdata->histogram_config__low_amb_odd_bin_4_5 - = pdata->histogram_config__low_amb_even_bin_4_5; + = pdata->histogram_config__low_amb_even_bin_4_5; pdata->histogram_config__mid_amb_even_bin_0_1 = - pdata->histogram_config__low_amb_even_bin_0_1; + pdata->histogram_config__low_amb_even_bin_0_1; pdata->histogram_config__mid_amb_even_bin_2_3 - = pdata->histogram_config__low_amb_even_bin_2_3; + = pdata->histogram_config__low_amb_even_bin_2_3; pdata->histogram_config__mid_amb_even_bin_4_5 - = pdata->histogram_config__low_amb_even_bin_4_5; + = pdata->histogram_config__low_amb_even_bin_4_5; pdata->histogram_config__mid_amb_odd_bin_0_1 - = pdata->histogram_config__low_amb_odd_bin_0_1; + = pdata->histogram_config__low_amb_odd_bin_0_1; pdata->histogram_config__mid_amb_odd_bin_2 = odd_bin2; - pdata->histogram_config__mid_amb_odd_bin_3_4 = (odd_bin4 << 4) + odd_bin3; + pdata->histogram_config__mid_amb_odd_bin_3_4 = + (odd_bin4 << 4) + odd_bin3; pdata->histogram_config__mid_amb_odd_bin_5 = odd_bin5; pdata->histogram_config__user_bin_offset = 0x00; - pdata->histogram_config__high_amb_even_bin_0_1 = (odd_bin1 << 4) + odd_bin0; - pdata->histogram_config__high_amb_even_bin_2_3 = (odd_bin3 << 4) + odd_bin2; - pdata->histogram_config__high_amb_even_bin_4_5 = (odd_bin5 << 4) + odd_bin4; + pdata->histogram_config__high_amb_even_bin_0_1 = + (odd_bin1 << 4) + odd_bin0; + pdata->histogram_config__high_amb_even_bin_2_3 = + (odd_bin3 << 4) + odd_bin2; + pdata->histogram_config__high_amb_even_bin_4_5 = + (odd_bin5 << 4) + odd_bin4; pdata->histogram_config__high_amb_odd_bin_0_1 - = pdata->histogram_config__high_amb_even_bin_0_1; + = pdata->histogram_config__high_amb_even_bin_0_1; pdata->histogram_config__high_amb_odd_bin_2_3 - = pdata->histogram_config__high_amb_even_bin_2_3; + = pdata->histogram_config__high_amb_even_bin_2_3; pdata->histogram_config__high_amb_odd_bin_4_5 - = pdata->histogram_config__high_amb_even_bin_4_5; + = pdata->histogram_config__high_amb_even_bin_4_5; @@ -969,7 +995,7 @@ void VL53L1_init_histogram_multizone_config_structure( void VL53L1_init_xtalk_bin_data_struct( uint32_t bin_value, - uint16_t VL53L1_PRM_00021, + uint16_t VL53L1_p_024, VL53L1_xtalk_histogram_shape_t *pdata) { @@ -983,25 +1009,24 @@ void VL53L1_init_xtalk_bin_data_struct( pdata->zone_id = 0; pdata->time_stamp = 0; - pdata->VL53L1_PRM_00019 = 0; - pdata->VL53L1_PRM_00020 = VL53L1_XTALK_HISTO_BINS; - pdata->VL53L1_PRM_00021 = (uint8_t)VL53L1_PRM_00021; + pdata->VL53L1_p_022 = 0; + pdata->VL53L1_p_023 = VL53L1_XTALK_HISTO_BINS; + pdata->VL53L1_p_024 = (uint8_t)VL53L1_p_024; pdata->phasecal_result__reference_phase = 0; pdata->phasecal_result__vcsel_start = 0; pdata->cal_config__vcsel_start = 0; pdata->vcsel_width = 0; - pdata->VL53L1_PRM_00022 = 0; + pdata->VL53L1_p_019 = 0; pdata->zero_distance_phase = 0; - for (i = 0 ; i < VL53L1_XTALK_HISTO_BINS; i++) { - if (i < VL53L1_PRM_00021) { + for (i = 0; i < VL53L1_XTALK_HISTO_BINS; i++) { + if (i < VL53L1_p_024) pdata->bin_data[i] = bin_value; - } else { + else pdata->bin_data[i] = 0; - } } } @@ -1018,13 +1043,13 @@ void VL53L1_i2c_encode_uint16_t( uint16_t i = 0; - uint16_t VL53L1_PRM_00005 = 0; + uint16_t VL53L1_p_002 = 0; - VL53L1_PRM_00005 = ip_value; + VL53L1_p_002 = ip_value; - for (i = 0; i < count ; i++) { - pbuffer[count-i-1] = (uint8_t)(VL53L1_PRM_00005 & 0x00FF); - VL53L1_PRM_00005 = VL53L1_PRM_00005 >> 8; + for (i = 0; i < count; i++) { + pbuffer[count-i-1] = (uint8_t)(VL53L1_p_002 & 0x00FF); + VL53L1_p_002 = VL53L1_p_002 >> 8; } } @@ -1040,9 +1065,8 @@ uint16_t VL53L1_i2c_decode_uint16_t( uint16_t value = 0x00; - while (count-- > 0) { + while (count-- > 0) value = (value << 8) | (uint16_t)*pbuffer++; - } return value; } @@ -1060,13 +1084,13 @@ void VL53L1_i2c_encode_int16_t( uint16_t i = 0; - int16_t VL53L1_PRM_00005 = 0; + int16_t VL53L1_p_002 = 0; - VL53L1_PRM_00005 = ip_value; + VL53L1_p_002 = ip_value; - for (i = 0; i < count ; i++) { - pbuffer[count-i-1] = (uint8_t)(VL53L1_PRM_00005 & 0x00FF); - VL53L1_PRM_00005 = VL53L1_PRM_00005 >> 8; + for (i = 0; i < count; i++) { + pbuffer[count-i-1] = (uint8_t)(VL53L1_p_002 & 0x00FF); + VL53L1_p_002 = VL53L1_p_002 >> 8; } } @@ -1084,13 +1108,11 @@ int16_t VL53L1_i2c_decode_int16_t( - if (*pbuffer >= 0x80) { + if (*pbuffer >= 0x80) value = 0xFFFF; - } - while (count-- > 0) { + while (count-- > 0) value = (value << 8) | (int16_t)*pbuffer++; - } return value; } @@ -1107,13 +1129,13 @@ void VL53L1_i2c_encode_uint32_t( uint16_t i = 0; - uint32_t VL53L1_PRM_00005 = 0; + uint32_t VL53L1_p_002 = 0; - VL53L1_PRM_00005 = ip_value; + VL53L1_p_002 = ip_value; - for (i = 0; i < count ; i++) { - pbuffer[count-i-1] = (uint8_t)(VL53L1_PRM_00005 & 0x00FF); - VL53L1_PRM_00005 = VL53L1_PRM_00005 >> 8; + for (i = 0; i < count; i++) { + pbuffer[count-i-1] = (uint8_t)(VL53L1_p_002 & 0x00FF); + VL53L1_p_002 = VL53L1_p_002 >> 8; } } @@ -1129,9 +1151,8 @@ uint32_t VL53L1_i2c_decode_uint32_t( uint32_t value = 0x00; - while (count-- > 0) { + while (count-- > 0) value = (value << 8) | (uint32_t)*pbuffer++; - } return value; } @@ -1154,16 +1175,14 @@ uint32_t VL53L1_i2c_decode_with_mask( - while (count-- > 0) { + while (count-- > 0) value = (value << 8) | (uint32_t)*pbuffer++; - } value = value & bit_mask; - if (down_shift > 0) { + if (down_shift > 0) value = value >> down_shift; - } @@ -1185,13 +1204,13 @@ void VL53L1_i2c_encode_int32_t( uint16_t i = 0; - int32_t VL53L1_PRM_00005 = 0; + int32_t VL53L1_p_002 = 0; - VL53L1_PRM_00005 = ip_value; + VL53L1_p_002 = ip_value; - for (i = 0; i < count ; i++) { - pbuffer[count-i-1] = (uint8_t)(VL53L1_PRM_00005 & 0x00FF); - VL53L1_PRM_00005 = VL53L1_PRM_00005 >> 8; + for (i = 0; i < count; i++) { + pbuffer[count-i-1] = (uint8_t)(VL53L1_p_002 & 0x00FF); + VL53L1_p_002 = VL53L1_p_002 >> 8; } } @@ -1209,13 +1228,11 @@ int32_t VL53L1_i2c_decode_int32_t( - if (*pbuffer >= 0x80) { + if (*pbuffer >= 0x80) value = 0xFFFFFFFF; - } - while (count-- > 0) { + while (count-- > 0) value = (value << 8) | (int32_t)*pbuffer++; - } return value; } @@ -1389,9 +1406,9 @@ VL53L1_Error VL53L1_clear_interrupt( pdev->sys_ctrl.system__interrupt_clear = VL53L1_CLEAR_RANGE_INT; status = VL53L1_WrByte( - Dev, - VL53L1_SYSTEM__INTERRUPT_CLEAR, - pdev->sys_ctrl.system__interrupt_clear); + Dev, + VL53L1_SYSTEM__INTERRUPT_CLEAR, + pdev->sys_ctrl.system__interrupt_clear); LOG_FUNCTION_END(status); @@ -1409,10 +1426,9 @@ VL53L1_Error VL53L1_force_shadow_stream_count_to_zero( VL53L1_Error status = VL53L1_ERROR_NONE; - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) status = VL53L1_disable_firmware(Dev); - } if (status == VL53L1_ERROR_NONE) { status = VL53L1_WrByte( @@ -1421,9 +1437,8 @@ VL53L1_Error VL53L1_force_shadow_stream_count_to_zero( 0x00); } - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) status = VL53L1_enable_firmware(Dev); - } return status; } @@ -1431,7 +1446,7 @@ VL53L1_Error VL53L1_force_shadow_stream_count_to_zero( uint32_t VL53L1_calc_macro_period_us( uint16_t fast_osc_frequency, - uint8_t VL53L1_PRM_00008) + uint8_t VL53L1_p_009) { @@ -1442,7 +1457,7 @@ uint32_t VL53L1_calc_macro_period_us( uint32_t pll_period_us = 0; - uint8_t VL53L1_PRM_00030 = 0; + uint8_t VL53L1_p_031 = 0; uint32_t macro_period_us = 0; LOG_FUNCTION_START(""); @@ -1459,7 +1474,7 @@ uint32_t VL53L1_calc_macro_period_us( - VL53L1_PRM_00030 = VL53L1_decode_vcsel_period(VL53L1_PRM_00008); + VL53L1_p_031 = VL53L1_decode_vcsel_period(VL53L1_p_009); @@ -1479,7 +1494,7 @@ uint32_t VL53L1_calc_macro_period_us( pll_period_us; macro_period_us = macro_period_us >> 6; - macro_period_us = macro_period_us * (uint32_t)VL53L1_PRM_00030; + macro_period_us = macro_period_us * (uint32_t)VL53L1_p_031; macro_period_us = macro_period_us >> 6; @@ -1534,13 +1549,11 @@ uint16_t VL53L1_calc_range_ignore_threshold( central_rate_int = ((int32_t)central_rate * (1 << 4)) / (1000); - if (x_gradient < 0) { + if (x_gradient < 0) x_gradient_int = x_gradient * -1; - } - if (y_gradient < 0) { + if (y_gradient < 0) y_gradient_int = y_gradient * -1; - } @@ -1549,7 +1562,8 @@ uint16_t VL53L1_calc_range_ignore_threshold( - range_ignore_thresh_int = (8 * x_gradient_int * 4) + (8 * y_gradient_int * 4); + range_ignore_thresh_int = (8 * x_gradient_int * 4) + + (8 * y_gradient_int * 4); @@ -1571,11 +1585,10 @@ uint16_t VL53L1_calc_range_ignore_threshold( - if (range_ignore_thresh_int > 0xFFFF) { + if (range_ignore_thresh_int > 0xFFFF) range_ignore_thresh_kcps = 0xFFFF; - } else { + else range_ignore_thresh_kcps = (uint16_t)range_ignore_thresh_int; - } @@ -1710,13 +1723,11 @@ uint32_t VL53L1_calc_crosstalk_plane_offset_with_margin( (int32_t)plane_offset_kcps + (int32_t)margin_offset_kcps; - if (plane_offset_kcps_temp < 0) { + if (plane_offset_kcps_temp < 0) plane_offset_kcps_temp = 0; - } else { - if (plane_offset_kcps_temp > 0x3FFFF) { + else + if (plane_offset_kcps_temp > 0x3FFFF) plane_offset_kcps_temp = 0x3FFFF; - } - } plane_offset_with_margin = (uint32_t) plane_offset_kcps_temp; @@ -1912,7 +1923,7 @@ VL53L1_Error VL53L1_calc_timeout_register_values( } -uint8_t VL53L1_encode_vcsel_period(uint8_t VL53L1_PRM_00030) +uint8_t VL53L1_encode_vcsel_period(uint8_t VL53L1_p_031) { @@ -1922,7 +1933,7 @@ uint8_t VL53L1_encode_vcsel_period(uint8_t VL53L1_PRM_00030) uint8_t vcsel_period_reg = 0; - vcsel_period_reg = (VL53L1_PRM_00030 >> 1) - 1; + vcsel_period_reg = (VL53L1_p_031 >> 1) - 1; return vcsel_period_reg; } @@ -1940,9 +1951,8 @@ uint32_t VL53L1_decode_unsigned_integer( uint8_t i = 0; uint32_t decoded_value = 0; - for (i = 0 ; i < no_of_bytes ; i++) { + for (i = 0; i < no_of_bytes; i++) decoded_value = (decoded_value << 8) + (uint32_t)pbuffer[i]; - } return decoded_value; } @@ -1959,12 +1969,12 @@ void VL53L1_encode_unsigned_integer( uint8_t i = 0; - uint32_t VL53L1_PRM_00005 = 0; + uint32_t VL53L1_p_002 = 0; - VL53L1_PRM_00005 = ip_value; - for (i = 0; i < no_of_bytes ; i++) { - pbuffer[no_of_bytes-i-1] = VL53L1_PRM_00005 & 0x00FF; - VL53L1_PRM_00005 = VL53L1_PRM_00005 >> 8; + VL53L1_p_002 = ip_value; + for (i = 0; i < no_of_bytes; i++) { + pbuffer[no_of_bytes-i-1] = VL53L1_p_002 & 0x00FF; + VL53L1_p_002 = VL53L1_p_002 >> 8; } } @@ -1981,7 +1991,7 @@ VL53L1_Error VL53L1_hist_copy_and_scale_ambient_info( VL53L1_Error status = VL53L1_ERROR_NONE; - int64_t VL53L1_PRM_00007 = 0; + int64_t VL53L1_p_008 = 0; int64_t tmpi = 0; int64_t tmpo = 0; @@ -2004,30 +2014,34 @@ VL53L1_Error VL53L1_hist_copy_and_scale_ambient_info( tmpo = 1 + (int64_t)podata->total_periods_elapsed; - tmpo *= (int64_t)podata->result__dss_actual_effective_spads; + tmpo *= + (int64_t)podata->result__dss_actual_effective_spads; tmpi = 1 + (int64_t)pidata->total_periods_elapsed; - tmpi *= (int64_t)pidata->result__dss_actual_effective_spads; + tmpi *= + (int64_t)pidata->result__dss_actual_effective_spads; - VL53L1_PRM_00007 = tmpo * (int64_t)pidata->ambient_events_sum; - VL53L1_PRM_00007 += (tmpi/2); + VL53L1_p_008 = tmpo * + (int64_t)pidata->ambient_events_sum; + VL53L1_p_008 += (tmpi/2); - VL53L1_PRM_00007 = do_division_s(VL53L1_PRM_00007, tmpi); + VL53L1_p_008 = do_division_s(VL53L1_p_008, tmpi); - podata->ambient_events_sum = (int32_t)VL53L1_PRM_00007; + podata->ambient_events_sum = (int32_t)VL53L1_p_008; - podata->VL53L1_PRM_00028 = podata->ambient_events_sum; - podata->VL53L1_PRM_00028 += - ((int32_t)pidata->number_of_ambient_bins / 2); - podata->VL53L1_PRM_00028 /= + podata->VL53L1_p_004 = + podata->ambient_events_sum; + podata->VL53L1_p_004 += + ((int32_t)pidata->number_of_ambient_bins / 2); + podata->VL53L1_p_004 /= (int32_t)pidata->number_of_ambient_bins; } } @@ -2077,99 +2091,128 @@ void VL53L1_hist_get_bin_sequence_config( if ((pdev->ll_state.rd_stream_count & 0x01) == 0) { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_4_5 >> 4; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_4_5 >> 4; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_4_5 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_4_5 & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_2_3 >> 4; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_2_3 >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_2_3 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_2_3 & 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_0_1 >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__mid_amb_even_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_even_bin_0_1 & 0x0F; if (pdata->ambient_events_sum > amb_thresh_high) { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_4_5 >> 4; + pdev->hist_cfg.histogram_config__high_amb_even_bin_4_5 + >> 4; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_4_5 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_even_bin_4_5 + & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_2_3 >> 4; + pdev->hist_cfg.histogram_config__high_amb_even_bin_2_3 + >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_2_3 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_even_bin_2_3 + & 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__high_amb_even_bin_0_1 + >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__high_amb_even_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_even_bin_0_1 + & 0x0F; } if (pdata->ambient_events_sum < amb_thresh_low) { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_4_5 >> 4; + pdev->hist_cfg.histogram_config__low_amb_even_bin_4_5 + >> 4; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_4_5 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_even_bin_4_5 + & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_2_3 >> 4; + pdev->hist_cfg.histogram_config__low_amb_even_bin_2_3 + >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_2_3 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_even_bin_2_3 + & 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__low_amb_even_bin_0_1 + >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__low_amb_even_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_even_bin_0_1 + & 0x0F; } } else { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_5 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_5 + & 0x0F; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_3_4 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_3_4 + & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_3_4 >> 4; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_3_4 + >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_2 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_2 & + 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_0_1 + >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__mid_amb_odd_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__mid_amb_odd_bin_0_1 + & 0x0F; if (pdata->ambient_events_sum > amb_thresh_high) { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_4_5 >> 4; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_4_5 + >> 4; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_4_5 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_4_5 + & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_2_3 >> 4; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_2_3 + >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_2_3 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_2_3 + & 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_0_1 + >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__high_amb_odd_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__high_amb_odd_bin_0_1 + & 0x0F; } if (pdata->ambient_events_sum < amb_thresh_low) { pdata->bin_seq[5] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_4_5 >> 4; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_4_5 + >> 4; pdata->bin_seq[4] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_4_5 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_4_5 + & 0x0F; pdata->bin_seq[3] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_2_3 >> 4; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_2_3 + >> 4; pdata->bin_seq[2] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_2_3 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_2_3 + & 0x0F; pdata->bin_seq[1] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_0_1 >> 4; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_0_1 + >> 4; pdata->bin_seq[0] = - pdev->hist_cfg.histogram_config__low_amb_odd_bin_0_1 & 0x0F; + pdev->hist_cfg.histogram_config__low_amb_odd_bin_0_1 + & 0x0F; } } - for (i = 0 ; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; i++) { + for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) pdata->bin_rep[i] = 1; - } LOG_FUNCTION_END(0); @@ -2193,7 +2236,7 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - uint8_t VL53L1_PRM_00001 = 0; + uint8_t lc = 0; uint8_t p = 0; uint16_t phase_delta = 0; @@ -2202,38 +2245,52 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( int32_t events_delta = 0; int32_t events_tolerance = 0; + + + uint8_t event_sigma; + uint16_t event_min_spad_count; + uint16_t min_max_tolerance; + uint8_t pht; + VL53L1_DeviceError range_status = 0; LOG_FUNCTION_START(""); + event_sigma = + pdev->histpostprocess.algo__consistency_check__event_sigma; + event_min_spad_count = + pdev->histpostprocess.algo__consistency_check__event_min_spad_count; + min_max_tolerance = + pdev->histpostprocess.algo__consistency_check__min_max_tolerance; - phase_tolerance = - (uint16_t)pdev->histpostprocess.algo__consistency_check__phase_tolerance; + pht = pdev->histpostprocess.algo__consistency_check__phase_tolerance; + phase_tolerance = (uint16_t)pht; phase_tolerance = phase_tolerance << 8; - if (prange_prev->rd_device_state != VL53L1_DEVICESTATE_RANGING_GATHER_DATA && - prange_prev->rd_device_state != VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA) { + if (prange_prev->rd_device_state != + VL53L1_DEVICESTATE_RANGING_GATHER_DATA && + prange_prev->rd_device_state != + VL53L1_DEVICESTATE_RANGING_OUTPUT_DATA) return status; - } - if (phase_tolerance == 0) { + if (phase_tolerance == 0) return status; - } - for (VL53L1_PRM_00001 = 0 ; VL53L1_PRM_00001 < prange_curr->active_results ; VL53L1_PRM_00001++) { + for (lc = 0; lc < prange_curr->active_results; lc++) { - if ((prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].range_status == + if (!((prange_curr->VL53L1_p_002[lc].range_status == VL53L1_DEVICEERROR_RANGECOMPLETE) || - (prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].range_status == - VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK)) { + (prange_curr->VL53L1_p_002[lc].range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK))) + continue; @@ -2241,12 +2298,13 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( - if (prange_prev->active_objects == 0) - prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].range_status = - VL53L1_DEVICEERROR_PREV_RANGE_NO_TARGETS; - else - prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].range_status = - VL53L1_DEVICEERROR_PHASECONSISTENCY; + + if (prange_prev->active_objects == 0) + prange_curr->VL53L1_p_002[lc].range_status = + VL53L1_DEVICEERROR_PREV_RANGE_NO_TARGETS; + else + prange_curr->VL53L1_p_002[lc].range_status = + VL53L1_DEVICEERROR_PHASECONSISTENCY; @@ -2257,20 +2315,20 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( - for (p = 0 ; p < prange_prev->active_objects ; p++) { + for (p = 0; p < prange_prev->active_objects; p++) { - if (prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].VL53L1_PRM_00013 > - prange_prev->VL53L1_PRM_00005[p].VL53L1_PRM_00013) { - phase_delta = - prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].VL53L1_PRM_00013 - - prange_prev->VL53L1_PRM_00005[p].VL53L1_PRM_00013; - } else { - phase_delta = - prange_prev->VL53L1_PRM_00005[p].VL53L1_PRM_00013 - - prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].VL53L1_PRM_00013; - } + if (prange_curr->VL53L1_p_002[lc].VL53L1_p_014 > + prange_prev->VL53L1_p_002[p].VL53L1_p_014) { + phase_delta = + prange_curr->VL53L1_p_002[lc].VL53L1_p_014 - + prange_prev->VL53L1_p_002[p].VL53L1_p_014; + } else { + phase_delta = + prange_prev->VL53L1_p_002[p].VL53L1_p_014 - + prange_curr->VL53L1_p_002[lc].VL53L1_p_014; + } - if (phase_delta < phase_tolerance) { + if (phase_delta < phase_tolerance) { @@ -2281,18 +2339,17 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( - - if (status == VL53L1_ERROR_NONE) - status = - VL53L1_hist_events_consistency_check( - pdev->histpostprocess.algo__consistency_check__event_sigma, - pdev->histpostprocess.algo__consistency_check__event_min_spad_count, - phist_prev, - &(prange_prev->VL53L1_PRM_00005[p]), - &(prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001]), - &events_tolerance, - &events_delta, - &range_status); + if (status == VL53L1_ERROR_NONE) + status = + VL53L1_hist_events_consistency_check( + event_sigma, + event_min_spad_count, + phist_prev, + &(prange_prev->VL53L1_p_002[p]), + &(prange_curr->VL53L1_p_002[lc]), + &events_tolerance, + &events_delta, + &range_status); @@ -2302,19 +2359,20 @@ VL53L1_Error VL53L1_hist_phase_consistency_check( - if (status == VL53L1_ERROR_NONE && - range_status == VL53L1_DEVICEERROR_RANGECOMPLETE) - status = - VL53L1_hist_merged_pulse_check( - pdev->histpostprocess.algo__consistency_check__min_max_tolerance, - &(prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001]), - &range_status); + if (status == VL53L1_ERROR_NONE && + range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE) + status = + VL53L1_hist_merged_pulse_check( + min_max_tolerance, + &(prange_curr->VL53L1_p_002[lc]), + &range_status); - prange_curr->VL53L1_PRM_00005[VL53L1_PRM_00001].range_status = - range_status; - } + prange_curr->VL53L1_p_002[lc].range_status = + range_status; } } + } LOG_FUNCTION_END(status); @@ -2374,7 +2432,7 @@ VL53L1_Error VL53L1_hist_events_consistency_check( tmpc = 1 + (int64_t)prange_curr->total_periods_elapsed; - tmpc *= (int64_t)prange_curr->VL53L1_PRM_00004; + tmpc *= (int64_t)prange_curr->VL53L1_p_006; @@ -2390,19 +2448,19 @@ VL53L1_Error VL53L1_hist_events_consistency_check( - c_signal_events = (int64_t)prange_curr->VL53L1_PRM_00018; - c_signal_events -= (int64_t)prange_curr->VL53L1_PRM_00017; + c_signal_events = (int64_t)prange_curr->VL53L1_p_021; + c_signal_events -= (int64_t)prange_curr->VL53L1_p_020; c_signal_events *= (int64_t)events_scaler; c_signal_events += 2048; c_signal_events /= 4096; c_sig_noise_sq = (int64_t)events_scaler_sq; - c_sig_noise_sq *= (int64_t)prange_curr->VL53L1_PRM_00018; + c_sig_noise_sq *= (int64_t)prange_curr->VL53L1_p_021; c_sig_noise_sq += 2048; c_sig_noise_sq /= 4096; c_amb_noise_sq = (int64_t)events_scaler_sq; - c_amb_noise_sq *= (int64_t)prange_curr->VL53L1_PRM_00017; + c_amb_noise_sq *= (int64_t)prange_curr->VL53L1_p_020; c_amb_noise_sq += 2048; c_amb_noise_sq /= 4096; @@ -2418,7 +2476,7 @@ VL53L1_Error VL53L1_hist_events_consistency_check( p_amb_noise_sq = - (int64_t)prange_prev->VL53L1_PRM_00017; + (int64_t)prange_prev->VL53L1_p_020; @@ -2426,7 +2484,7 @@ VL53L1_Error VL53L1_hist_events_consistency_check( p_amb_noise_sq /= 4; noise_sq_sum = - (uint32_t)prange_prev->VL53L1_PRM_00018 + + (uint32_t)prange_prev->VL53L1_p_021 + (uint32_t)c_sig_noise_sq + (uint32_t)p_amb_noise_sq + (uint32_t)c_amb_noise_sq; @@ -2438,19 +2496,18 @@ VL53L1_Error VL53L1_hist_events_consistency_check( *pevents_tolerance += 32; *pevents_tolerance /= 64; - p_signal_events = (int32_t)prange_prev->VL53L1_PRM_00018; - p_signal_events -= (int32_t)prange_prev->VL53L1_PRM_00017; + p_signal_events = (int32_t)prange_prev->VL53L1_p_021; + p_signal_events -= (int32_t)prange_prev->VL53L1_p_020; - if ((int32_t)c_signal_events > p_signal_events) { + if ((int32_t)c_signal_events > p_signal_events) *pevents_delta = (int32_t)c_signal_events - p_signal_events; - } else { + else *pevents_delta = p_signal_events - (int32_t)c_signal_events; - } if (*pevents_delta > *pevents_tolerance && - prange_curr->VL53L1_PRM_00004 > min_effective_spad_count) + prange_curr->VL53L1_p_006 > min_effective_spad_count) *prange_status = VL53L1_DEVICEERROR_EVENTCONSISTENCY; else *prange_status = VL53L1_DEVICEERROR_RANGECOMPLETE; @@ -2518,7 +2575,7 @@ VL53L1_Error VL53L1_hist_merged_pulse_check( VL53L1_Error status = VL53L1_ERROR_NONE; - int16_t delta_mm = 0; + int16_t delta_mm = 0; if (pdata->max_range_mm > pdata->min_range_mm) delta_mm = @@ -2568,21 +2625,33 @@ VL53L1_Error VL53L1_hist_xmonitor_consistency_check( int32_t events_delta = 0; int32_t events_tolerance = 0; + uint8_t event_sigma; + uint16_t min_spad_count; + + event_sigma = pdev->histpostprocess.algo__crosstalk_detect_event_sigma; + min_spad_count = + pdev->histpostprocess.algo__consistency_check__event_min_spad_count; if (prange_curr->range_status == VL53L1_DEVICEERROR_RANGECOMPLETE || - prange_curr->range_status == VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK || - prange_curr->range_status == VL53L1_DEVICEERROR_EVENTCONSISTENCY) { + prange_curr->range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK || + prange_curr->range_status == + VL53L1_DEVICEERROR_EVENTCONSISTENCY) { - if (prange_prev->xmonitor.range_status == VL53L1_DEVICEERROR_RANGECOMPLETE || - prange_prev->xmonitor.range_status == VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK || - prange_prev->xmonitor.range_status == VL53L1_DEVICEERROR_EVENTCONSISTENCY) { + if (prange_prev->xmonitor.range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE || + prange_prev->xmonitor.range_status == + VL53L1_DEVICEERROR_RANGECOMPLETE_NO_WRAP_CHECK || + prange_prev->xmonitor.range_status == + VL53L1_DEVICEERROR_EVENTCONSISTENCY) { - prange_curr->range_status = VL53L1_DEVICEERROR_RANGECOMPLETE; + prange_curr->range_status = + VL53L1_DEVICEERROR_RANGECOMPLETE; status = VL53L1_hist_events_consistency_check( - pdev->histpostprocess.algo__crosstalk_detect_event_sigma, - pdev->histpostprocess.algo__consistency_check__event_min_spad_count, + event_sigma, + min_spad_count, phist_prev, &(prange_prev->xmonitor), prange_curr, @@ -2622,14 +2691,14 @@ VL53L1_Error VL53L1_hist_wrap_dmax( *pwrap_dmax_mm = 0; - if (pcurrent->VL53L1_PRM_00022 != 0) { + if (pcurrent->VL53L1_p_019 != 0) { pll_period_mm = VL53L1_calc_pll_period_mm( - pcurrent->VL53L1_PRM_00022); + pcurrent->VL53L1_p_019); @@ -2721,11 +2790,13 @@ void VL53L1_hist_combine_mm1_mm2_offsets( - scaled_mm1_peak_rate_mcps = (uint32_t)pcal_data->result__mm_inner_peak_signal_count_rtn_mcps; + scaled_mm1_peak_rate_mcps = + (uint32_t)pcal_data->result__mm_inner_peak_signal_count_rtn_mcps; scaled_mm1_peak_rate_mcps *= (uint32_t)mm_inner_effective_spads; scaled_mm1_peak_rate_mcps /= (uint32_t)max_mm_inner_effective_spads; - scaled_mm2_peak_rate_mcps = (uint32_t)pcal_data->result__mm_outer_peak_signal_count_rtn_mcps; + scaled_mm2_peak_rate_mcps = + (uint32_t)pcal_data->result__mm_outer_peak_signal_count_rtn_mcps; scaled_mm2_peak_rate_mcps *= (uint32_t)mm_outer_effective_spads; scaled_mm2_peak_rate_mcps /= (uint32_t)max_mm_outer_effective_spads; @@ -2743,15 +2814,537 @@ void VL53L1_hist_combine_mm1_mm2_offsets( - if (tmp1 != 0) { + if (tmp1 != 0) tmp0 = (tmp0 * 4) / tmp1; - } *prange_offset_mm = (int16_t)tmp0; } +VL53L1_Error VL53L1_hist_xtalk_extract_calc_window( + int16_t target_distance_mm, + uint16_t target_width_oversize, + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data) +{ + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + LOG_FUNCTION_START(""); + + + + pxtalk_data->pll_period_mm = + VL53L1_calc_pll_period_mm(phist_bins->VL53L1_p_019); + + + + pxtalk_data->xtalk_width_phase = + (int32_t)phist_bins->vcsel_width * 128; + pxtalk_data->target_width_phase = + pxtalk_data->xtalk_width_phase + + (int32_t)target_width_oversize * 128; + + + + + + + + pxtalk_data->xtalk_start_phase = + (int32_t)phist_bins->zero_distance_phase - + (pxtalk_data->xtalk_width_phase / 2); + pxtalk_data->xtalk_end_phase = + (int32_t)pxtalk_data->xtalk_start_phase + + pxtalk_data->xtalk_width_phase; + + if (pxtalk_data->xtalk_start_phase < 0) + pxtalk_data->xtalk_start_phase = 0; + + + + + + + + + pxtalk_data->VL53L1_p_015 = + (uint8_t)(pxtalk_data->xtalk_start_phase / 2048); + + + + pxtalk_data->VL53L1_p_016 = + (uint8_t)((pxtalk_data->xtalk_end_phase + 2047) / 2048); + + + + + + + + pxtalk_data->target_start_phase = + (int32_t)target_distance_mm * 2048 * 16; + pxtalk_data->target_start_phase += + ((int32_t)pxtalk_data->pll_period_mm / 2); + pxtalk_data->target_start_phase /= (int32_t)pxtalk_data->pll_period_mm; + pxtalk_data->target_start_phase += + (int32_t)phist_bins->zero_distance_phase; + + + + + + + pxtalk_data->target_start_phase -= + (pxtalk_data->target_width_phase / 2); + pxtalk_data->target_end_phase = + (int32_t)pxtalk_data->target_start_phase + + pxtalk_data->target_width_phase; + + if (pxtalk_data->target_start_phase < 0) + pxtalk_data->target_start_phase = 0; + + + + pxtalk_data->target_start = + (uint8_t)(pxtalk_data->target_start_phase / 2048); + + + + if (pxtalk_data->VL53L1_p_016 > (pxtalk_data->target_start-1)) + pxtalk_data->VL53L1_p_016 = pxtalk_data->target_start-1; + + + + pxtalk_data->effective_width = + (2048 * ((int32_t)pxtalk_data->VL53L1_p_016+1)); + pxtalk_data->effective_width -= pxtalk_data->xtalk_start_phase; + + + + + + if (pxtalk_data->effective_width > pxtalk_data->xtalk_width_phase) + pxtalk_data->effective_width = pxtalk_data->xtalk_width_phase; + + if (pxtalk_data->effective_width < 1) + pxtalk_data->effective_width = 1; + + + + pxtalk_data->event_scaler = pxtalk_data->xtalk_width_phase * 1000; + pxtalk_data->event_scaler += (pxtalk_data->effective_width / 2); + pxtalk_data->event_scaler /= pxtalk_data->effective_width; + + + + + + if (pxtalk_data->event_scaler < 1000) + pxtalk_data->event_scaler = 1000; + + if (pxtalk_data->event_scaler > 4000) + pxtalk_data->event_scaler = 4000; + + + + pxtalk_data->event_scaler_sum += pxtalk_data->event_scaler; + + + + pxtalk_data->peak_duration_us_sum += + (uint32_t)phist_bins->peak_duration_us; + + + + pxtalk_data->effective_spad_count_sum += + (uint32_t)phist_bins->result__dss_actual_effective_spads; + + + + pxtalk_data->zero_distance_phase_sum += + (uint32_t)phist_bins->zero_distance_phase; + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_event_sums( + VL53L1_histogram_bin_data_t *phist_bins, + VL53L1_hist_xtalk_extract_data_t *pxtalk_data) +{ + + + + + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + uint8_t lb = 0; + uint8_t i = 0; + + LOG_FUNCTION_START(""); + + + + + for (lb = pxtalk_data->VL53L1_p_015; + lb <= pxtalk_data->VL53L1_p_016; + lb++) { + + + + i = (lb + phist_bins->number_of_ambient_bins + + phist_bins->VL53L1_p_024) % + phist_bins->VL53L1_p_024; + + + + pxtalk_data->signal_events_sum += phist_bins->bin_data[i]; + pxtalk_data->signal_events_sum -= + phist_bins->VL53L1_p_004; + } + + + + + for (lb = 0; lb < VL53L1_XTALK_HISTO_BINS && + lb < phist_bins->VL53L1_p_024; lb++) { + + + + i = (lb + phist_bins->number_of_ambient_bins + + phist_bins->VL53L1_p_024) % + phist_bins->VL53L1_p_024; + + + + pxtalk_data->bin_data_sums[lb] += phist_bins->bin_data[i]; + pxtalk_data->bin_data_sums[lb] -= + phist_bins->VL53L1_p_004; + } + + pxtalk_data->sample_count += 1; + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_rate_per_spad( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data) +{ + + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + uint64_t tmp64_0 = 0; + uint64_t tmp64_1 = 0; + uint64_t xtalk_per_spad = 0; + + LOG_FUNCTION_START(""); + + + + + + + + + + + + + + + + + + tmp64_0 = + ((uint64_t)pxtalk_data->signal_events_sum * + (uint64_t)pxtalk_data->sample_count * + (uint64_t)pxtalk_data->event_scaler_avg * 256U) << 9U; + tmp64_1 = + (uint64_t)pxtalk_data->effective_spad_count_sum * + (uint64_t)pxtalk_data->peak_duration_us_sum; + + + + + if (tmp64_1 > 0U) { + + + tmp64_0 = tmp64_0 + (tmp64_1 >> 1U); + xtalk_per_spad = do_division_u(tmp64_0, tmp64_1); + } else { + xtalk_per_spad = (uint64_t)tmp64_0; + } + + pxtalk_data->xtalk_rate_kcps_per_spad = (uint32_t)xtalk_per_spad; + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_hist_xtalk_extract_calc_shape( + VL53L1_hist_xtalk_extract_data_t *pxtalk_data, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape) +{ + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + int32_t lb = 0; + uint64_t total_events = 0U; + uint64_t tmp64_0 = 0U; + int32_t remaining_area = 1024; + + LOG_FUNCTION_START(""); + + + + + pxtalk_shape->VL53L1_p_022 = 0; + pxtalk_shape->VL53L1_p_023 = VL53L1_XTALK_HISTO_BINS; + pxtalk_shape->VL53L1_p_024 = VL53L1_XTALK_HISTO_BINS; + + pxtalk_shape->zero_distance_phase = + (uint16_t)pxtalk_data->zero_distance_phase_avg; + pxtalk_shape->phasecal_result__reference_phase = + (uint16_t)pxtalk_data->zero_distance_phase_avg + (3*2048); + + + + + if (pxtalk_data->signal_events_sum > 0) + total_events = + (uint64_t)pxtalk_data->signal_events_sum * + (uint64_t)pxtalk_data->event_scaler_avg; + else + total_events = 1; + + + + remaining_area = 1024; + pxtalk_data->max_shape_value = 0; + + for (lb = 0; lb < VL53L1_XTALK_HISTO_BINS; lb++) { + + if ((lb < (int32_t)pxtalk_data->VL53L1_p_015 || + lb > (int32_t)pxtalk_data->VL53L1_p_016) || + pxtalk_data->bin_data_sums[lb] < 0) { + + + + + + + if (remaining_area > 0 && remaining_area < 1024) { + if (remaining_area > + pxtalk_data->max_shape_value) { + pxtalk_shape->bin_data[lb] = + (uint32_t)pxtalk_data->max_shape_value; + remaining_area -= + pxtalk_data->max_shape_value; + } else { + pxtalk_shape->bin_data[lb] = + (uint32_t)remaining_area; + remaining_area = 0; + } + } else { + pxtalk_shape->bin_data[lb] = 0; + } + + } else { + + + + + tmp64_0 = + (uint64_t)pxtalk_data->bin_data_sums[lb] + * 1024U * 1000U; + tmp64_0 += (total_events >> 1); + tmp64_0 = do_division_u(tmp64_0, total_events); + if (tmp64_0 > 0xFFFFU) + tmp64_0 = 0xFFFFU; + + pxtalk_shape->bin_data[lb] = (uint32_t)tmp64_0; + + + + + + if ((int32_t)pxtalk_shape->bin_data[lb] > + pxtalk_data->max_shape_value) + pxtalk_data->max_shape_value = + (int32_t)pxtalk_shape->bin_data[lb]; + + remaining_area -= (int32_t)pxtalk_shape->bin_data[lb]; + } + } + + LOG_FUNCTION_END(status); + + return status; +} + + +VL53L1_Error VL53L1_hist_xtalk_shape_model( + uint16_t events_per_bin, + uint16_t pulse_centre, + uint16_t pulse_width, + VL53L1_xtalk_histogram_shape_t *pxtalk_shape) +{ + + + + + + VL53L1_Error status = VL53L1_ERROR_NONE; + + uint32_t phase_start = 0; + uint32_t phase_stop = 0; + uint32_t phase_bin = 0; + + uint32_t bin_start = 0; + uint32_t bin_stop = 0; + + uint32_t lb = 0; + uint16_t VL53L1_p_008 = 0; + + LOG_FUNCTION_START(""); + + + + + pxtalk_shape->VL53L1_p_022 = 0; + pxtalk_shape->VL53L1_p_023 = VL53L1_XTALK_HISTO_BINS; + pxtalk_shape->VL53L1_p_024 = VL53L1_XTALK_HISTO_BINS; + + pxtalk_shape->zero_distance_phase = pulse_centre; + pxtalk_shape->phasecal_result__reference_phase = + pulse_centre + (3*2048); + + + + if (pulse_centre > (pulse_width >> 1)) + phase_start = (uint32_t)pulse_centre - + ((uint32_t)pulse_width >> 1); + else + phase_start = 0; + + phase_stop = (uint32_t)pulse_centre + + ((uint32_t)pulse_width >> 1); + + + + bin_start = (phase_start / 2048); + bin_stop = (phase_stop / 2048); + + for (lb = 0; lb < VL53L1_XTALK_HISTO_BINS; lb++) { + VL53L1_p_008 = 0; + + + + if (lb == bin_start && lb == bin_stop) { + VL53L1_p_008 = + VL53L1_hist_xtalk_shape_model_interp( + events_per_bin, + phase_stop - phase_start); + + } else if (lb > bin_start && lb < bin_stop) { + + + + VL53L1_p_008 = events_per_bin; + + } else if (lb == bin_start) { + + + + phase_bin = (lb + 1) * 2048; + VL53L1_p_008 = + VL53L1_hist_xtalk_shape_model_interp( + events_per_bin, + (phase_bin - phase_start)); + + } else if (lb == bin_stop) { + + + + phase_bin = lb * 2048; + VL53L1_p_008 = + VL53L1_hist_xtalk_shape_model_interp( + events_per_bin, + (phase_stop - phase_bin)); + } + + pxtalk_shape->bin_data[lb] = VL53L1_p_008; + } + + LOG_FUNCTION_END(status); + + return status; +} + + +uint16_t VL53L1_hist_xtalk_shape_model_interp( + uint16_t events_per_bin, + uint32_t phase_delta) +{ + + + + + + + + + + uint32_t VL53L1_p_008 = 0; + + LOG_FUNCTION_START(""); + + + + VL53L1_p_008 = (uint32_t)events_per_bin * phase_delta; + VL53L1_p_008 += 1024; + VL53L1_p_008 /= 2048; + + + + if (VL53L1_p_008 > 0xFFFFU) + VL53L1_p_008 = 0xFFFFU; + + LOG_FUNCTION_END(0); + + return (uint16_t)VL53L1_p_008; +} + + void VL53L1_spad_number_to_byte_bit_index( uint8_t spad_number, uint8_t *pbyte_index, @@ -2768,9 +3361,9 @@ void VL53L1_spad_number_to_byte_bit_index( - *pbyte_index = spad_number >> 3; - *pbit_index = spad_number & 0x07; - *pbit_mask = 0x01 << *pbit_index; + *pbyte_index = spad_number >> 3; + *pbit_index = spad_number & 0x07; + *pbit_mask = 0x01 << *pbit_index; } @@ -2785,11 +3378,11 @@ void VL53L1_encode_row_col( - if (row > 7) { + if (row > 7) *pspad_number = 128 + (col << 3) + (15-row); - } else { + else *pspad_number = ((15-col) << 3) + row; - } + } @@ -2961,8 +3554,8 @@ void VL53L1_calc_max_effective_spads( *pmax_effective_spads = 0; - for (y = zone_y_ll ; y <= zone_y_ur ; y++) { - for (x = zone_x_ll ; x <= zone_x_ur ; x++) { + for (y = zone_y_ll; y <= zone_y_ur; y++) { + for (x = zone_x_ll; x <= zone_x_ur; x++) { @@ -2997,7 +3590,8 @@ void VL53L1_calc_max_effective_spads( (uint8_t)x); if (is_aperture > 0) - *pmax_effective_spads += aperture_attenuation; + *pmax_effective_spads += + aperture_attenuation; else *pmax_effective_spads += 0x0100; @@ -3075,8 +3669,8 @@ void VL53L1_calc_mm_effective_spads( *pmm_inner_effective_spads = 0; *pmm_outer_effective_spads = 0; - for (y = zone_y_ll ; y <= zone_y_ur ; y++) { - for (x = zone_x_ll ; x <= zone_x_ur ; x++) { + for (y = zone_y_ll; y <= zone_y_ur; y++) { + for (x = zone_x_ll; x <= zone_x_ur; x++) { @@ -3164,61 +3758,61 @@ void VL53L1_hist_copy_results_to_sys_and_core( psys->result__report_status = pbins->result__report_status; psys->result__stream_count = pbins->result__stream_count; - pdata = &(phist->VL53L1_PRM_00005[0]); + pdata = &(phist->VL53L1_p_002[0]); - for (i = 0 ; i < phist->active_results ; i++) { + for (i = 0; i < phist->active_results; i++) { switch (i) { case 0: - psys->result__dss_actual_effective_spads_sd0 = \ - pdata->VL53L1_PRM_00004; - psys->result__peak_signal_count_rate_mcps_sd0 = \ + psys->result__dss_actual_effective_spads_sd0 = + pdata->VL53L1_p_006; + psys->result__peak_signal_count_rate_mcps_sd0 = pdata->peak_signal_count_rate_mcps; - psys->result__avg_signal_count_rate_mcps_sd0 = \ + psys->result__avg_signal_count_rate_mcps_sd0 = pdata->avg_signal_count_rate_mcps; - psys->result__ambient_count_rate_mcps_sd0 = \ + psys->result__ambient_count_rate_mcps_sd0 = pdata->ambient_count_rate_mcps; - psys->result__sigma_sd0 = pdata->VL53L1_PRM_00003; - psys->result__phase_sd0 = pdata->VL53L1_PRM_00013; + psys->result__sigma_sd0 = pdata->VL53L1_p_005; + psys->result__phase_sd0 = pdata->VL53L1_p_014; - psys->result__final_crosstalk_corrected_range_mm_sd0 = \ + psys->result__final_crosstalk_corrected_range_mm_sd0 = (uint16_t)pdata->median_range_mm; psys->result__phase_sd1 = pdata->zero_distance_phase; - pcore->result_core__ranging_total_events_sd0 = \ - pdata->VL53L1_PRM_00018; - pcore->result_core__signal_total_events_sd0 = \ - pdata->VL53L1_PRM_00012; - pcore->result_core__total_periods_elapsed_sd0 = \ + pcore->result_core__ranging_total_events_sd0 = + pdata->VL53L1_p_021; + pcore->result_core__signal_total_events_sd0 = + pdata->VL53L1_p_013; + pcore->result_core__total_periods_elapsed_sd0 = pdata->total_periods_elapsed; - pcore->result_core__ambient_window_events_sd0 = \ - pdata->VL53L1_PRM_00017; + pcore->result_core__ambient_window_events_sd0 = + pdata->VL53L1_p_020; break; case 1: - psys->result__dss_actual_effective_spads_sd1 = \ - pdata->VL53L1_PRM_00004; - psys->result__peak_signal_count_rate_mcps_sd1 = \ + psys->result__dss_actual_effective_spads_sd1 = + pdata->VL53L1_p_006; + psys->result__peak_signal_count_rate_mcps_sd1 = pdata->peak_signal_count_rate_mcps; - psys->result__ambient_count_rate_mcps_sd1 = \ + psys->result__ambient_count_rate_mcps_sd1 = pdata->ambient_count_rate_mcps; - psys->result__sigma_sd1 = pdata->VL53L1_PRM_00003; - psys->result__phase_sd1 = pdata->VL53L1_PRM_00013; + psys->result__sigma_sd1 = pdata->VL53L1_p_005; + psys->result__phase_sd1 = pdata->VL53L1_p_014; - psys->result__final_crosstalk_corrected_range_mm_sd1 = \ + psys->result__final_crosstalk_corrected_range_mm_sd1 = (uint16_t)pdata->median_range_mm; - pcore->result_core__ranging_total_events_sd1 = \ - pdata->VL53L1_PRM_00018; - pcore->result_core__signal_total_events_sd1 = \ - pdata->VL53L1_PRM_00012; - pcore->result_core__total_periods_elapsed_sd1 = \ + pcore->result_core__ranging_total_events_sd1 = + pdata->VL53L1_p_021; + pcore->result_core__signal_total_events_sd1 = + pdata->VL53L1_p_013; + pcore->result_core__total_periods_elapsed_sd1 = pdata->total_periods_elapsed; - pcore->result_core__ambient_window_events_sd1 = \ - pdata->VL53L1_PRM_00017; + pcore->result_core__ambient_window_events_sd1 = + pdata->VL53L1_p_020; break; } @@ -3230,7 +3824,7 @@ void VL53L1_hist_copy_results_to_sys_and_core( } -VL53L1_Error VL53L1_sum_histogram_data ( +VL53L1_Error VL53L1_sum_histogram_data( VL53L1_histogram_bin_data_t *phist_input, VL53L1_histogram_bin_data_t *phist_output) { @@ -3253,11 +3847,11 @@ VL53L1_Error VL53L1_sum_histogram_data ( if (status == VL53L1_ERROR_NONE) { - if (phist_output->VL53L1_PRM_00021 >= phist_input->VL53L1_PRM_00021) { - smallest_bin_num = phist_input->VL53L1_PRM_00021; - } else { - smallest_bin_num = phist_output->VL53L1_PRM_00021; - } + if (phist_output->VL53L1_p_024 >= + phist_input->VL53L1_p_024) + smallest_bin_num = phist_input->VL53L1_p_024; + else + smallest_bin_num = phist_output->VL53L1_p_024; } @@ -3267,22 +3861,18 @@ VL53L1_Error VL53L1_sum_histogram_data ( - if (status == VL53L1_ERROR_NONE) { - - for (i = 0 ; i < smallest_bin_num ; i++) { - + if (status == VL53L1_ERROR_NONE) + for (i = 0; i < smallest_bin_num; i++) phist_output->bin_data[i] += phist_input->bin_data[i]; - } - } - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) + + phist_output->VL53L1_p_004 += + phist_input->VL53L1_p_004; - phist_output->VL53L1_PRM_00028 += - phist_input->VL53L1_PRM_00028; - } LOG_FUNCTION_END(status); @@ -3317,29 +3907,29 @@ VL53L1_Error VL53L1_avg_histogram_data( if (status == VL53L1_ERROR_NONE) { - for (i = 0 ; i < phist_sum->VL53L1_PRM_00021 ; i++) { + for (i = 0; i < phist_sum->VL53L1_p_024; i++) { - if (no_of_samples > 0) { - phist_avg->bin_data[i] = phist_sum->bin_data[i] / + if (no_of_samples > 0) + phist_avg->bin_data[i] = + phist_sum->bin_data[i] / (int32_t)no_of_samples; - } else { + else phist_avg->bin_data[i] = phist_sum->bin_data[i]; - } } } if (status == VL53L1_ERROR_NONE) { - if (no_of_samples > 0) { - phist_avg->VL53L1_PRM_00028 = - phist_sum->VL53L1_PRM_00028 / (int32_t)no_of_samples; - } else { - phist_avg->VL53L1_PRM_00028 = - phist_sum->VL53L1_PRM_00028; - } + if (no_of_samples > 0) + phist_avg->VL53L1_p_004 = + phist_sum->VL53L1_p_004 / + (int32_t)no_of_samples; + else + phist_avg->VL53L1_p_004 = + phist_sum->VL53L1_p_004; } LOG_FUNCTION_END(status); @@ -3368,7 +3958,8 @@ VL53L1_Error VL53L1_save_cfg_data( LOG_FUNCTION_START(""); - pzone_dyn_cfg = &(pres->zone_dyn_cfgs.VL53L1_PRM_00005[pdev->ll_state.cfg_zone_id]); + pzone_dyn_cfg = + &(pres->zone_dyn_cfgs.VL53L1_p_002[pdev->ll_state.cfg_zone_id]); pzone_dyn_cfg->expected_stream_count = pdev->ll_state.cfg_stream_count; @@ -3403,28 +3994,37 @@ VL53L1_Error VL53L1_dynamic_zone_update( VL53L1DevStructGetLLDriverHandle(Dev); VL53L1_LLDriverResults_t *pres = VL53L1DevStructGetLLResultsHandle(Dev); + VL53L1_zone_private_dyn_cfgs_t *pZ = &(pres->zone_dyn_cfgs); uint8_t zone_id = pdev->ll_state.rd_zone_id; uint8_t i; uint16_t max_total_rate_per_spads; - uint16_t target_rate = pdev->stat_cfg.dss_config__target_total_rate_mcps; + uint16_t target_rate = + pdev->stat_cfg.dss_config__target_total_rate_mcps; uint32_t temp = 0xFFFF; +#ifdef VL53L1_LOG_ENABLE + uint16_t eff_spad_cnt = + pZ->VL53L1_p_002[zone_id].dss_requested_effective_spad_count; +#endif LOG_FUNCTION_START(""); - pres->zone_dyn_cfgs.VL53L1_PRM_00005[zone_id].dss_requested_effective_spad_count = 0; + pZ->VL53L1_p_002[zone_id].dss_requested_effective_spad_count = 0; trace_print(VL53L1_TRACE_LEVEL_DEBUG, - " DYNZONEUPDATE: peak signal count rate mcps:\ - %u actual effective spads: %u\n", - presults->VL53L1_PRM_00005[0].peak_signal_count_rate_mcps, - presults->VL53L1_PRM_00005[0].VL53L1_PRM_00004); + " DYNZONEUPDATE: peak signal count rate mcps:"); + + trace_print(VL53L1_TRACE_LEVEL_DEBUG, + "%u actual effective spads: %u\n", + presults->VL53L1_p_002[0].peak_signal_count_rate_mcps, + presults->VL53L1_p_002[0].VL53L1_p_006); trace_print(VL53L1_TRACE_LEVEL_DEBUG, " DYNZONEUPDATE: active results: %u\n", presults->active_results); - max_total_rate_per_spads = presults->VL53L1_PRM_00005[0].total_rate_per_spad_mcps; + max_total_rate_per_spads = + presults->VL53L1_p_002[0].total_rate_per_spad_mcps; trace_print(VL53L1_TRACE_LEVEL_DEBUG, " DYNZONEUPDATE: max total rate per spad at start: %u\n", @@ -3432,16 +4032,18 @@ VL53L1_Error VL53L1_dynamic_zone_update( for (i = 1; i < presults->active_results; i++) { trace_print(VL53L1_TRACE_LEVEL_DEBUG, - " DYNZONEUPDATE: zone total rate per spad: zone_id: %u,\ - total rate per spad: %u\n", - i, - presults->VL53L1_PRM_00005[i].total_rate_per_spad_mcps); + " DYNZONEUPDATE: zone total rate per spad: zone_id: %u,", + i); + + trace_print(VL53L1_TRACE_LEVEL_DEBUG, + "total rate per spad: %u\n", + presults->VL53L1_p_002[i].total_rate_per_spad_mcps); + + if (presults->VL53L1_p_002[i].total_rate_per_spad_mcps > + max_total_rate_per_spads) + max_total_rate_per_spads = + presults->VL53L1_p_002[i].total_rate_per_spad_mcps; - if (presults->VL53L1_PRM_00005[i].total_rate_per_spad_mcps > - max_total_rate_per_spads) { - max_total_rate_per_spads = - presults->VL53L1_PRM_00005[i].total_rate_per_spad_mcps; - } } if (max_total_rate_per_spads == 0) { @@ -3476,25 +4078,26 @@ VL53L1_Error VL53L1_dynamic_zone_update( - if (temp > 0xFFFF) { + if (temp > 0xFFFF) temp = 0xFFFF; - } trace_print(VL53L1_TRACE_LEVEL_DEBUG, " DYNZONEUPDATE: 3: temp: %u\n", temp); } - pres->zone_dyn_cfgs.VL53L1_PRM_00005[zone_id].dss_requested_effective_spad_count = + pZ->VL53L1_p_002[zone_id].dss_requested_effective_spad_count = (uint16_t)temp; trace_print(VL53L1_TRACE_LEVEL_DEBUG, - " DYNZONEUPDATE: zone_id: %u, target_rate: %u,\ - max_total_rate_per_spads: %u, requested_spads: %u\n", + " DYNZONEUPDATE: zone_id: %u, target_rate: %u,", zone_id, - target_rate, + target_rate); + + trace_print(VL53L1_TRACE_LEVEL_DEBUG, + "max_total_rate_per_spads: %u, requested_spads: %u\n", max_total_rate_per_spads, - pres->zone_dyn_cfgs.VL53L1_PRM_00005[zone_id].dss_requested_effective_spad_count); + eff_spad_cnt); LOG_FUNCTION_END(status); @@ -3531,7 +4134,8 @@ VL53L1_Error VL53L1_multizone_hist_bins_update( VL53L1_ll_driver_state_t *pstate = &(pdev->ll_state); VL53L1_zone_config_t *pzone_cfg = &(pdev->zone_cfg); VL53L1_histogram_config_t *phist_cfg = &(pdev->hist_cfg); - VL53L1_histogram_config_t *pmulti_hist = &(pzone_cfg->multizone_hist_cfg); + VL53L1_histogram_config_t *pmulti_hist = + &(pzone_cfg->multizone_hist_cfg); uint8_t next_range_is_odd_timing = (pstate->cfg_stream_count) % 2; @@ -3545,24 +4149,24 @@ VL53L1_Error VL53L1_multizone_hist_bins_update( VL53L1_ZONECONFIG_BINCONFIG__LOWAMB) { if (!next_range_is_odd_timing) { trace_print (VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting LOWAMB EVEN timing\n"); + " HISTBINCONFIGUPDATE: Setting LOWAMB EVEN timing\n"); phist_cfg->histogram_config__low_amb_even_bin_0_1 = - pmulti_hist->histogram_config__low_amb_even_bin_0_1; + pmulti_hist->histogram_config__low_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_even_bin_2_3 = - pmulti_hist->histogram_config__low_amb_even_bin_2_3; + pmulti_hist->histogram_config__low_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_even_bin_4_5 = - pmulti_hist->histogram_config__low_amb_even_bin_4_5; + pmulti_hist->histogram_config__low_amb_even_bin_4_5; } if (next_range_is_odd_timing) { trace_print (VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting LOWAMB ODD timing\n"); + " HISTBINCONFIGUPDATE: Setting LOWAMB ODD timing\n"); phist_cfg->histogram_config__low_amb_odd_bin_0_1 = - pmulti_hist->histogram_config__low_amb_even_bin_0_1; + pmulti_hist->histogram_config__low_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_odd_bin_2_3 = - pmulti_hist->histogram_config__low_amb_even_bin_2_3; + pmulti_hist->histogram_config__low_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_odd_bin_4_5 = - pmulti_hist->histogram_config__low_amb_even_bin_4_5; + pmulti_hist->histogram_config__low_amb_even_bin_4_5; } } else if (pzone_cfg->bin_config[pdev->ll_state.cfg_zone_id] == VL53L1_ZONECONFIG_BINCONFIG__MIDAMB) { @@ -3571,47 +4175,48 @@ VL53L1_Error VL53L1_multizone_hist_bins_update( " HISTBINCONFIGUPDATE: Setting MIDAMB timing\n"); if (!next_range_is_odd_timing) { trace_print(VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting MIDAMB EVEN timing\n"); + " HISTBINCONFIGUPDATE: Setting MIDAMB EVEN timing\n"); phist_cfg->histogram_config__low_amb_even_bin_0_1 = - pmulti_hist->histogram_config__mid_amb_even_bin_0_1; + pmulti_hist->histogram_config__mid_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_even_bin_2_3 = - pmulti_hist->histogram_config__mid_amb_even_bin_2_3; + pmulti_hist->histogram_config__mid_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_even_bin_4_5 = - pmulti_hist->histogram_config__mid_amb_even_bin_4_5; + pmulti_hist->histogram_config__mid_amb_even_bin_4_5; } if (next_range_is_odd_timing) { trace_print (VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting MIDAMB ODD timing\n"); + " HISTBINCONFIGUPDATE: Setting MIDAMB ODD timing\n"); phist_cfg->histogram_config__low_amb_odd_bin_0_1 = - pmulti_hist->histogram_config__mid_amb_even_bin_0_1; + pmulti_hist->histogram_config__mid_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_odd_bin_2_3 = - pmulti_hist->histogram_config__mid_amb_even_bin_2_3; + pmulti_hist->histogram_config__mid_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_odd_bin_4_5 = - pmulti_hist->histogram_config__mid_amb_even_bin_4_5; + pmulti_hist->histogram_config__mid_amb_even_bin_4_5; } } else if (pzone_cfg->bin_config[pdev->ll_state.cfg_zone_id] == VL53L1_ZONECONFIG_BINCONFIG__HIGHAMB) { if (!next_range_is_odd_timing) { trace_print (VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting HIGHAMB EVEN timing\n"); + " HISTBINCONFIGUPDATE: Setting HIGHAMB EVEN timing\n" + ); phist_cfg->histogram_config__low_amb_even_bin_0_1 = - pmulti_hist->histogram_config__high_amb_even_bin_0_1; + pmulti_hist->histogram_config__high_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_even_bin_2_3 = - pmulti_hist->histogram_config__high_amb_even_bin_2_3; + pmulti_hist->histogram_config__high_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_even_bin_4_5 = - pmulti_hist->histogram_config__high_amb_even_bin_4_5; + pmulti_hist->histogram_config__high_amb_even_bin_4_5; } if (next_range_is_odd_timing) { trace_print (VL53L1_TRACE_LEVEL_DEBUG, - " HISTBINCONFIGUPDATE: Setting HIGHAMB ODD timing\n"); + " HISTBINCONFIGUPDATE: Setting HIGHAMB ODD timing\n"); phist_cfg->histogram_config__low_amb_odd_bin_0_1 = - pmulti_hist->histogram_config__high_amb_even_bin_0_1; + pmulti_hist->histogram_config__high_amb_even_bin_0_1; phist_cfg->histogram_config__low_amb_odd_bin_2_3 = - pmulti_hist->histogram_config__high_amb_even_bin_2_3; + pmulti_hist->histogram_config__high_amb_even_bin_2_3; phist_cfg->histogram_config__low_amb_odd_bin_4_5 = - pmulti_hist->histogram_config__high_amb_even_bin_4_5; + pmulti_hist->histogram_config__high_amb_even_bin_4_5; } } @@ -3680,11 +4285,10 @@ VL53L1_Error VL53L1_update_internal_stream_counters( - if (*pinternal_stream_count == 0xFF) { + if (*pinternal_stream_count == 0xFF) *pinternal_stream_count = 0x80; - } else { + else *pinternal_stream_count = *pinternal_stream_count + 1; - } @@ -3702,9 +4306,11 @@ VL53L1_Error VL53L1_update_internal_stream_counters( } trace_print(VL53L1_TRACE_LEVEL_DEBUG, - "UPDINTSTREAMCOUNT internal_steam_count: %d,\ - internal_stream_count_val: %d, divider: %d\n", - *pinternal_stream_count, + "UPDINTSTREAMCOUNT internal_steam_count: %d,", + *pinternal_stream_count); + + trace_print(VL53L1_TRACE_LEVEL_DEBUG, + "internal_stream_count_val: %d, divider: %d\n", *pinternal_stream_count_val, stream_divider); @@ -3722,8 +4328,7 @@ VL53L1_Error VL53L1_update_internal_stream_counters( VL53L1_Error VL53L1_set_histogram_multizone_initial_bin_config( VL53L1_zone_config_t *pzone_cfg, VL53L1_histogram_config_t *phist_cfg, - VL53L1_histogram_config_t *pmulti_hist - ) + VL53L1_histogram_config_t *pmulti_hist) { VL53L1_Error status = VL53L1_ERROR_NONE; @@ -4021,9 +4626,9 @@ VL53L1_Error VL53L1_set_ref_spad_char_config( if (status == VL53L1_ERROR_NONE) status = VL53L1_WrWord( - Dev, - VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS, - min_count_rate_rtn_limit_mcps); + Dev, + VL53L1_RANGE_CONFIG__MIN_COUNT_RATE_RTN_LIMIT_MCPS, + min_count_rate_rtn_limit_mcps); LOG_FUNCTION_END(status); @@ -4060,7 +4665,7 @@ VL53L1_Error VL53L1_set_ssc_config( macro_period_us = VL53L1_calc_macro_period_us( fast_osc_frequency, - pssc_cfg->VL53L1_PRM_00008); + pssc_cfg->VL53L1_p_009); @@ -4091,11 +4696,11 @@ VL53L1_Error VL53L1_set_ssc_config( - buffer[0] = (uint8_t)((timeout_encoded & 0x0000FF00) >> 8); - buffer[1] = (uint8_t) (timeout_encoded & 0x000000FF); - buffer[2] = pssc_cfg->VL53L1_PRM_00008; - buffer[3] = (uint8_t)((pssc_cfg->rate_limit_mcps & 0x0000FF00) >> 8); - buffer[4] = (uint8_t) (pssc_cfg->rate_limit_mcps & 0x000000FF); + buffer[0] = (uint8_t)((timeout_encoded & 0x0000FF00) >> 8); + buffer[1] = (uint8_t) (timeout_encoded & 0x000000FF); + buffer[2] = pssc_cfg->VL53L1_p_009; + buffer[3] = (uint8_t)((pssc_cfg->rate_limit_mcps & 0x0000FF00) >> 8); + buffer[4] = (uint8_t) (pssc_cfg->rate_limit_mcps & 0x000000FF); if (status == VL53L1_ERROR_NONE) status = @@ -4111,8 +4716,8 @@ VL53L1_Error VL53L1_set_ssc_config( - buffer[0] = pssc_cfg->VL53L1_PRM_00008; - buffer[1] = pssc_cfg->VL53L1_PRM_00008; + buffer[0] = pssc_cfg->VL53L1_p_009; + buffer[1] = pssc_cfg->VL53L1_p_009; if (status == VL53L1_ERROR_NONE) status = @@ -4151,10 +4756,10 @@ VL53L1_Error VL53L1_get_spad_rate_data( VL53L1_Error status = VL53L1_ERROR_NONE; - int i = 0; + int i = 0; - uint8_t VL53L1_PRM_00005[512]; - uint8_t *pdata = &VL53L1_PRM_00005[0]; + uint8_t VL53L1_p_002[512]; + uint8_t *pdata = &VL53L1_p_002[0]; LOG_FUNCTION_START(""); @@ -4180,19 +4785,19 @@ VL53L1_Error VL53L1_get_spad_rate_data( - pdata = &VL53L1_PRM_00005[0]; - for (i = 0 ; i < VL53L1_NO_OF_SPAD_ENABLES ; i++) { + pdata = &VL53L1_p_002[0]; + for (i = 0; i < VL53L1_NO_OF_SPAD_ENABLES; i++) { pspad_rates->rate_data[i] = (uint16_t)VL53L1_decode_unsigned_integer(pdata, 2); pdata += 2; - } + } - pspad_rates->VL53L1_PRM_00020 = VL53L1_NO_OF_SPAD_ENABLES; - pspad_rates->no_of_values = VL53L1_NO_OF_SPAD_ENABLES; - pspad_rates->fractional_bits = 15; + pspad_rates->VL53L1_p_023 = VL53L1_NO_OF_SPAD_ENABLES; + pspad_rates->no_of_values = VL53L1_NO_OF_SPAD_ENABLES; + pspad_rates->fractional_bits = 15; @@ -4237,12 +4842,12 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_required_samples( LOG_FUNCTION_START(""); - temp64a = pxmonitor->VL53L1_PRM_00018 + - pxmonitor->VL53L1_PRM_00017; + temp64a = pxmonitor->VL53L1_p_021 + + pxmonitor->VL53L1_p_020; temp64a = do_division_u((temp64a * 1000), peak_duration_us); temp64a = do_division_u((temp64a * 1000), peak_duration_us); - temp64z = pconfig->noise_margin * pxmonitor->VL53L1_PRM_00004; + temp64z = pconfig->noise_margin * pxmonitor->VL53L1_p_006; temp64a = temp64a * 1000 * 256; temp64a = do_division_u(temp64a, temp64z); temp64a = temp64a * 1000 * 256; @@ -4252,9 +4857,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_required_samples( - if (pint->required_samples < 2) { + if (pint->required_samples < 2) pint->required_samples = 2; - } LOG_FUNCTION_END(status); @@ -4262,10 +4866,10 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_required_samples( } VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( - VL53L1_DEV Dev, + VL53L1_DEV Dev, uint32_t xtalk_offset_out, - VL53L1_smudge_corrector_config_t *pconfig, - VL53L1_smudge_corrector_data_t *pout, + VL53L1_smudge_corrector_config_t *pconfig, + VL53L1_smudge_corrector_data_t *pout, uint8_t add_smudge, uint8_t soft_update ) @@ -4286,6 +4890,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( int16_t orig_x_gradient; int16_t orig_y_gradient; int32_t itemp32; + VL53L1_xtalk_config_t *pX = &(pdev->xtalk_cfg); + VL53L1_xtalk_calibration_results_t *pC = &(pdev->xtalk_cal); LOG_FUNCTION_START(""); @@ -4303,46 +4909,46 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( orig_xtalk_offset = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_plane_offset_kcps; + pX->nvm_default__crosstalk_compensation_plane_offset_kcps; orig_x_gradient = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_x_plane_gradient_kcps; + pX->nvm_default__crosstalk_compensation_x_plane_gradient_kcps; orig_y_gradient = - pdev->xtalk_cfg.nvm_default__crosstalk_compensation_y_plane_gradient_kcps; + pX->nvm_default__crosstalk_compensation_y_plane_gradient_kcps; if (((pconfig->user_scaler_set == 0) || (pconfig->scaler_calc_method == 1)) && - (pdev->xtalk_cal.algo__crosstalk_compensation_plane_offset_kcps + (pC->algo__crosstalk_compensation_plane_offset_kcps != 0)) { orig_xtalk_offset = - pdev->xtalk_cal.algo__crosstalk_compensation_plane_offset_kcps; + pC->algo__crosstalk_compensation_plane_offset_kcps; orig_x_gradient = - pdev->xtalk_cal.algo__crosstalk_compensation_x_plane_gradient_kcps; + pC->algo__crosstalk_compensation_x_plane_gradient_kcps; orig_y_gradient = - pdev->xtalk_cal.algo__crosstalk_compensation_y_plane_gradient_kcps; + pC->algo__crosstalk_compensation_y_plane_gradient_kcps; } - if ((pconfig->user_scaler_set == 0) && (orig_x_gradient == 0)) { + if ((pconfig->user_scaler_set == 0) && (orig_x_gradient == 0)) pout->gradient_zero_flag |= 0x01; - } - if ((pconfig->user_scaler_set == 0) && (orig_y_gradient == 0)) { + + if ((pconfig->user_scaler_set == 0) && (orig_y_gradient == 0)) pout->gradient_zero_flag |= 0x02; - } - if (orig_xtalk_offset == 0) { + + if (orig_xtalk_offset == 0) orig_xtalk_offset = 1; - } + @@ -4378,9 +4984,9 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( pout->algo__crosstalk_compensation_plane_offset_kcps * x_gradient_scaler); itemp32 = itemp32 >> 6; - if (itemp32 > 0xFFFF) { + if (itemp32 > 0xFFFF) itemp32 = 0xFFFF; - } + pout->algo__crosstalk_compensation_x_plane_gradient_kcps = (int16_t)itemp32; @@ -4388,9 +4994,9 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( pout->algo__crosstalk_compensation_plane_offset_kcps * y_gradient_scaler); itemp32 = itemp32 >> 6; - if (itemp32 > 0xFFFF) { + if (itemp32 > 0xFFFF) itemp32 = 0xFFFF; - } + pout->algo__crosstalk_compensation_y_plane_gradient_kcps = (int16_t)itemp32; } else if (pconfig->scaler_calc_method == 1) { @@ -4404,9 +5010,9 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( itemp32 = (int32_t)(do_division_s(itemp32, 16)); itemp32 = itemp32 << 2; itemp32 = itemp32 + (int32_t)(orig_x_gradient); - if (itemp32 > 0xFFFF) { + if (itemp32 > 0xFFFF) itemp32 = 0xFFFF; - } + pout->algo__crosstalk_compensation_x_plane_gradient_kcps = (int16_t)itemp32; @@ -4415,9 +5021,9 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( itemp32 = (int32_t)(do_division_s(itemp32, 80)); itemp32 = itemp32 << 2; itemp32 = itemp32 + (int32_t)(orig_y_gradient); - if (itemp32 > 0xFFFF) { + if (itemp32 > 0xFFFF) itemp32 = 0xFFFF; - } + pout->algo__crosstalk_compensation_y_plane_gradient_kcps = (int16_t)itemp32; } @@ -4433,12 +5039,12 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( - pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps = + pX->algo__crosstalk_compensation_plane_offset_kcps = pout->algo__crosstalk_compensation_plane_offset_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_x_plane_gradient_kcps = - pout->algo__crosstalk_compensation_x_plane_gradient_kcps; - pdev->xtalk_cfg.algo__crosstalk_compensation_y_plane_gradient_kcps = - pout->algo__crosstalk_compensation_y_plane_gradient_kcps; + pX->algo__crosstalk_compensation_x_plane_gradient_kcps = + pout->algo__crosstalk_compensation_x_plane_gradient_kcps; + pX->algo__crosstalk_compensation_y_plane_gradient_kcps = + pout->algo__crosstalk_compensation_y_plane_gradient_kcps; @@ -4452,9 +5058,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( - if (soft_update != 1) { + if (soft_update != 1) pout->smudge_corr_valid = 1; - } LOG_FUNCTION_END(status); @@ -4464,7 +5069,7 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_calc_new_xtalk( #define CONT_CONTINUE 0 #define CONT_NEXT_LOOP 1 #define CONT_RESET 2 -VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( +VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector( VL53L1_DEV Dev ) { @@ -4484,6 +5089,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( &(pdev->smudge_corrector_internals); VL53L1_smudge_corrector_data_t *pout = &(pres->range_results.smudge_corrector_data); + VL53L1_range_results_t *pR = &(pres->range_results); + VL53L1_xtalk_config_t *pX = &(pdev->xtalk_cfg); uint8_t run_smudge_detection = 0; uint8_t run_nodetect = 0; @@ -4497,6 +5104,10 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( uint32_t smudge_margin_adjusted = 0; uint8_t i = 0; uint8_t nodetect_index = 0; + uint16_t amr; + + uint32_t cco; + LOG_FUNCTION_START(""); @@ -4509,29 +5120,30 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( ambient_check = (pconfig->smudge_corr_ambient_threshold == 0) || (pconfig->smudge_corr_ambient_threshold > - ((uint32_t)pres->range_results.xmonitor.ambient_count_rate_mcps)); + ((uint32_t)pR->xmonitor.ambient_count_rate_mcps)); run_smudge_detection = (pconfig->smudge_corr_enabled == 1) && ambient_check && - (pres->range_results.xmonitor.range_status + (pR->xmonitor.range_status == VL53L1_DEVICEERROR_RANGECOMPLETE); - if ((pres->range_results.xmonitor.range_status + if ((pR->xmonitor.range_status != VL53L1_DEVICEERROR_RANGECOMPLETE) && (pconfig->smudge_corr_enabled == 1)) { run_nodetect = 2; - for (i = 0; i < pres->range_results.active_results; i++) { - if (pres->range_results.VL53L1_PRM_00005[i].range_status == + for (i = 0; i < pR->active_results; i++) { + if (pR->VL53L1_p_002[i].range_status == VL53L1_DEVICEERROR_RANGECOMPLETE) { - if (pres->range_results.VL53L1_PRM_00005[i].median_range_mm <= + if (pR->VL53L1_p_002[i].median_range_mm + <= pconfig->nodetect_min_range_mm) { run_nodetect = 0; } else { @@ -4543,11 +5155,13 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( } } - if (run_nodetect == 2) { + if (run_nodetect == 2) run_nodetect = 0; - } + + amr = + pR->VL53L1_p_002[nodetect_index].ambient_count_rate_mcps; if (run_nodetect == 1) { @@ -4557,8 +5171,7 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( - utemp64 = 1000 * - ((uint64_t)pres->range_results.VL53L1_PRM_00005[nodetect_index].ambient_count_rate_mcps); + utemp64 = 1000 * ((uint64_t)amr); @@ -4566,11 +5179,10 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( - if (utemp64 < pconfig->nodetect_ambient_threshold) { + if (utemp64 < pconfig->nodetect_ambient_threshold) run_nodetect = 1; - } else { + else run_nodetect = 0; - } } } @@ -4588,30 +5200,31 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( xtalk_offset_in = - pres->range_results.xmonitor.VL53L1_PRM_00011; + pR->xmonitor.VL53L1_p_012; - current_xtalk = - ((uint32_t)pdev->xtalk_cfg.algo__crosstalk_compensation_plane_offset_kcps) - << 2; + cco = pX->algo__crosstalk_compensation_plane_offset_kcps; + current_xtalk = ((uint32_t)cco) << 2; - smudge_margin_adjusted = ((uint32_t)(pconfig->smudge_margin)) << 2; + smudge_margin_adjusted = + ((uint32_t)(pconfig->smudge_margin)) << 2; itemp32 = xtalk_offset_in - current_xtalk + smudge_margin_adjusted; - if (itemp32 < 0) { + if (itemp32 < 0) itemp32 = itemp32 * (-1); - } + if (itemp32 > ((int32_t)pconfig->single_xtalk_delta)) { if ((int32_t)xtalk_offset_in > - ((int32_t)current_xtalk - (int32_t)smudge_margin_adjusted)) { + ((int32_t)current_xtalk - + (int32_t)smudge_margin_adjusted)) { pout->single_xtalk_delta_flag = 1; } else { pout->single_xtalk_delta_flag = 2; @@ -4633,9 +5246,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( xtalk_offset_in; } - if (pint->current_samples < pint->required_samples) { + if (pint->current_samples < pint->required_samples) continue_processing = CONT_NEXT_LOOP; - } @@ -4648,28 +5260,27 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( itemp32 = xtalk_offset_out - current_xtalk + smudge_margin_adjusted; - if (itemp32 < 0) { + if (itemp32 < 0) itemp32 = itemp32 * (-1); - } if (continue_processing == CONT_CONTINUE && (itemp32 >= ((int32_t)(pconfig->averaged_xtalk_delta))) ) { if ((int32_t)xtalk_offset_out > - ((int32_t)current_xtalk - (int32_t)smudge_margin_adjusted)) { + ((int32_t)current_xtalk - + (int32_t)smudge_margin_adjusted)) pout->averaged_xtalk_delta_flag = 1; - } else { + else pout->averaged_xtalk_delta_flag = 2; - } } if (continue_processing == CONT_CONTINUE && (itemp32 < ((int32_t)(pconfig->averaged_xtalk_delta))) - ) { + ) continue_processing = CONT_RESET; - } + @@ -4689,26 +5300,25 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( if (pconfig->user_xtalk_offset_limit_hi && (xtalk_offset_out > - pconfig->user_xtalk_offset_limit)) { + pconfig->user_xtalk_offset_limit)) xtalk_offset_out = pconfig->user_xtalk_offset_limit; - } + if ((pconfig->user_xtalk_offset_limit_hi == 0) && (xtalk_offset_out < - pconfig->user_xtalk_offset_limit)) { + pconfig->user_xtalk_offset_limit)) xtalk_offset_out = pconfig->user_xtalk_offset_limit; - } + xtalk_offset_out = xtalk_offset_out >> 2; - if (xtalk_offset_out > 0x3FFFF) { + if (xtalk_offset_out > 0x3FFFF) xtalk_offset_out = 0x3FFFF; - } @@ -4762,9 +5372,8 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( - if (pint->nodetect_counter < pconfig->nodetect_sample_limit) { + if (pint->nodetect_counter < pconfig->nodetect_sample_limit) continue_processing = CONT_NEXT_LOOP; - } @@ -4820,7 +5429,7 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_corrector ( return status; } -VL53L1_Error VL53L1_dynamic_xtalk_correction_data_init ( +VL53L1_Error VL53L1_dynamic_xtalk_correction_data_init( VL53L1_DEV Dev ) { @@ -4845,7 +5454,7 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_data_init ( pdev->smudge_correct_config.smudge_corr_enabled = 1; pdev->smudge_correct_config.smudge_corr_apply_enabled = 1; pdev->smudge_correct_config.smudge_corr_single_apply = - VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_COR_SINGLE_APPLY_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_COR_SINGLE_APPLY_DEFAULT; pdev->smudge_correct_config.smudge_margin = VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_MARGIN_DEFAULT; @@ -4854,7 +5463,7 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_data_init ( pdev->smudge_correct_config.user_xtalk_offset_limit = VL53L1_TUNINGPARM_DYNXTALK_XTALK_OFFSET_LIMIT_DEFAULT; pdev->smudge_correct_config.user_xtalk_offset_limit_hi = - VL53L1_TUNINGPARM_DYNXTALK_XTALK_OFFSET_LIMIT_HI_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_XTALK_OFFSET_LIMIT_HI_DEFAULT; pdev->smudge_correct_config.sample_limit = VL53L1_TUNINGPARM_DYNXTALK_SAMPLE_LIMIT_DEFAULT; pdev->smudge_correct_config.single_xtalk_delta = @@ -4875,13 +5484,13 @@ VL53L1_Error VL53L1_dynamic_xtalk_correction_data_init ( pdev->smudge_correct_config.user_scaler_set = VL53L1_TUNINGPARM_DYNXTALK_USER_SCALER_SET_DEFAULT; pdev->smudge_correct_config.nodetect_ambient_threshold = - VL53L1_TUNINGPARM_DYNXTALK_NODETECT_AMB_THRESHOLD_KCPS_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_AMB_THRESHOLD_KCPS_DEFAULT; pdev->smudge_correct_config.nodetect_sample_limit = - VL53L1_TUNINGPARM_DYNXTALK_NODETECT_SAMPLE_LIMIT_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_SAMPLE_LIMIT_DEFAULT; pdev->smudge_correct_config.nodetect_xtalk_offset = - VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS_DEFAULT; pdev->smudge_correct_config.nodetect_min_range_mm = - VL53L1_TUNINGPARM_DYNXTALK_NODETECT_MIN_RANGE_MM_DEFAULT; + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_MIN_RANGE_MM_DEFAULT; @@ -5085,10 +5694,10 @@ VL53L1_Error VL53L1_config_low_power_auto_mode( - pdynamic->system__sequence_config = \ - VL53L1_SEQUENCE_VHV_EN | \ - VL53L1_SEQUENCE_PHASECAL_EN | \ - VL53L1_SEQUENCE_DSS1_EN | \ + pdynamic->system__sequence_config = + VL53L1_SEQUENCE_VHV_EN | + VL53L1_SEQUENCE_PHASECAL_EN | + VL53L1_SEQUENCE_DSS1_EN | @@ -5165,6 +5774,8 @@ VL53L1_Error VL53L1_low_power_auto_update_DSS( VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); + VL53L1_system_results_t *pS = &(pdev->sys_results); + VL53L1_Error status = VL53L1_ERROR_NONE; @@ -5178,8 +5789,9 @@ VL53L1_Error VL53L1_low_power_auto_update_DSS( - utemp32a = pdev->sys_results.result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 + - pdev->sys_results.result__ambient_count_rate_mcps_sd0; + utemp32a = + pS->result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 + + pS->result__ambient_count_rate_mcps_sd0; @@ -5195,12 +5807,12 @@ VL53L1_Error VL53L1_low_power_auto_update_DSS( if (pdev->sys_results.result__dss_actual_effective_spads_sd0 == 0) - status = VL53L1_ERROR_DIVISION_BY_ZERO; + status = VL53L1_ERROR_DIVISION_BY_ZERO; else { utemp32a = utemp32a / - pdev->sys_results.result__dss_actual_effective_spads_sd0; + pdev->sys_results.result__dss_actual_effective_spads_sd0; pdev->low_power_auto_data.dss__total_rate_per_spad_mcps = @@ -5214,14 +5826,15 @@ VL53L1_Error VL53L1_low_power_auto_update_DSS( - if (pdev->low_power_auto_data.dss__total_rate_per_spad_mcps == 0) + if (pdev->low_power_auto_data.dss__total_rate_per_spad_mcps + == 0) status = VL53L1_ERROR_DIVISION_BY_ZERO; else { utemp32a = utemp32a / - pdev->low_power_auto_data.dss__total_rate_per_spad_mcps; + pdev->low_power_auto_data.dss__total_rate_per_spad_mcps; @@ -5235,10 +5848,10 @@ VL53L1_Error VL53L1_low_power_auto_update_DSS( - pdev->gen_cfg.dss_config__manual_effective_spads_select = - pdev->low_power_auto_data.dss__required_spads; + pdev->gen_cfg.dss_config__manual_effective_spads_select + = pdev->low_power_auto_data.dss__required_spads; pdev->gen_cfg.dss_config__roi_mode_control = - VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; + VL53L1_DEVICEDSSMODE__REQUESTED_EFFFECTIVE_SPADS; } } diff --git a/drivers/input/misc/vl53L1/src/vl53l1_core_support.c b/drivers/input/misc/vl53L1/src/vl53l1_core_support.c index 1b917a2d6a91..8a8947b6cfe2 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_core_support.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_core_support.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -220,9 +220,8 @@ uint32_t VL53L1_duration_maths( - if (tmp_long_int > 0xFFFFFFFF) { + if (tmp_long_int > 0xFFFFFFFF) tmp_long_int = 0xFFFFFFFF; - } duration_us = (uint32_t)tmp_long_int; @@ -231,7 +230,7 @@ uint32_t VL53L1_duration_maths( uint32_t VL53L1_events_per_spad_maths( - int32_t VL53L1_PRM_00012, + int32_t VL53L1_p_013, uint16_t num_spads, uint32_t duration) { @@ -255,7 +254,7 @@ uint32_t VL53L1_events_per_spad_maths( - uint64_t dividend = ((uint64_t)VL53L1_PRM_00012 + uint64_t dividend = ((uint64_t)VL53L1_p_013 * 1000 * 256); total_hist_counts = do_division_u(dividend, (uint64_t)num_spads); @@ -302,9 +301,8 @@ uint32_t VL53L1_isqrt(uint32_t num) - while (bit > num) { + while (bit > num) bit >>= 2; - } while (bit != 0) { if (num >= res + bit) { @@ -330,21 +328,21 @@ void VL53L1_hist_calc_zero_distance_phase( uint32_t period = 0; - uint32_t VL53L1_PRM_00016 = 0; + uint32_t VL53L1_p_017 = 0; LOG_FUNCTION_START(""); period = 2048 * - (uint32_t)VL53L1_decode_vcsel_period(pdata->VL53L1_PRM_00008); + (uint32_t)VL53L1_decode_vcsel_period(pdata->VL53L1_p_009); - VL53L1_PRM_00016 = period; - VL53L1_PRM_00016 += (uint32_t)pdata->phasecal_result__reference_phase; - VL53L1_PRM_00016 += (2048 * (uint32_t)pdata->phasecal_result__vcsel_start); - VL53L1_PRM_00016 -= (2048 * (uint32_t)pdata->cal_config__vcsel_start); + VL53L1_p_017 = period; + VL53L1_p_017 += (uint32_t)pdata->phasecal_result__reference_phase; + VL53L1_p_017 += (2048 * (uint32_t)pdata->phasecal_result__vcsel_start); + VL53L1_p_017 -= (2048 * (uint32_t)pdata->cal_config__vcsel_start); - VL53L1_PRM_00016 = VL53L1_PRM_00016 % period; + VL53L1_p_017 = VL53L1_p_017 % period; - pdata->zero_distance_phase = (uint16_t)VL53L1_PRM_00016; + pdata->zero_distance_phase = (uint16_t)VL53L1_p_017; LOG_FUNCTION_END(0); } @@ -364,7 +362,7 @@ void VL53L1_hist_estimate_ambient_from_thresholded_bins( uint8_t bin = 0; - int32_t VL53L1_PRM_00031 = 0; + int32_t VL53L1_p_032 = 0; LOG_FUNCTION_START(""); @@ -381,11 +379,12 @@ void VL53L1_hist_estimate_ambient_from_thresholded_bins( - VL53L1_PRM_00031 = (int32_t)VL53L1_isqrt((uint32_t)pdata->min_bin_value); - VL53L1_PRM_00031 *= ambient_threshold_sigma; - VL53L1_PRM_00031 += 0x07; - VL53L1_PRM_00031 = VL53L1_PRM_00031 >> 4; - VL53L1_PRM_00031 += pdata->min_bin_value; + VL53L1_p_032 = + (int32_t)VL53L1_isqrt((uint32_t)pdata->min_bin_value); + VL53L1_p_032 *= ambient_threshold_sigma; + VL53L1_p_032 += 0x07; + VL53L1_p_032 = VL53L1_p_032 >> 4; + VL53L1_p_032 += pdata->min_bin_value; @@ -395,12 +394,11 @@ void VL53L1_hist_estimate_ambient_from_thresholded_bins( pdata->number_of_ambient_samples = 0; pdata->ambient_events_sum = 0; - for (bin = 0 ; bin < pdata->VL53L1_PRM_00021 ; bin++) { - if (pdata->bin_data[bin] < VL53L1_PRM_00031) { + for (bin = 0; bin < pdata->VL53L1_p_024; bin++) + if (pdata->bin_data[bin] < VL53L1_p_032) { pdata->ambient_events_sum += pdata->bin_data[bin]; pdata->number_of_ambient_samples++; } - } @@ -408,9 +406,12 @@ void VL53L1_hist_estimate_ambient_from_thresholded_bins( if (pdata->number_of_ambient_samples > 0) { - pdata->VL53L1_PRM_00028 = pdata->ambient_events_sum; - pdata->VL53L1_PRM_00028 += ((int32_t)pdata->number_of_ambient_samples/2); - pdata->VL53L1_PRM_00028 /= (int32_t)pdata->number_of_ambient_samples; + pdata->VL53L1_p_004 = + pdata->ambient_events_sum; + pdata->VL53L1_p_004 += + ((int32_t)pdata->number_of_ambient_samples/2); + pdata->VL53L1_p_004 /= + (int32_t)pdata->number_of_ambient_samples; } LOG_FUNCTION_END(0); @@ -428,7 +429,7 @@ void VL53L1_hist_remove_ambient_bins( uint8_t bin = 0; - uint8_t VL53L1_PRM_00001 = 0; + uint8_t lc = 0; uint8_t i = 0; @@ -437,10 +438,10 @@ void VL53L1_hist_remove_ambient_bins( if ((pdata->bin_seq[0] & 0x07) == 0x07) { i = 0; - for (VL53L1_PRM_00001 = 0 ; VL53L1_PRM_00001 < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; VL53L1_PRM_00001++) { - if ((pdata->bin_seq[VL53L1_PRM_00001] & 0x07) != 0x07) { - pdata->bin_seq[i] = pdata->bin_seq[VL53L1_PRM_00001]; - pdata->bin_rep[i] = pdata->bin_rep[VL53L1_PRM_00001]; + for (lc = 0; lc < VL53L1_MAX_BIN_SEQUENCE_LENGTH; lc++) { + if ((pdata->bin_seq[lc] & 0x07) != 0x07) { + pdata->bin_seq[i] = pdata->bin_seq[lc]; + pdata->bin_rep[i] = pdata->bin_rep[lc]; i++; } } @@ -450,9 +451,9 @@ void VL53L1_hist_remove_ambient_bins( - for (VL53L1_PRM_00001 = i ; VL53L1_PRM_00001 < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; VL53L1_PRM_00001++) { - pdata->bin_seq[VL53L1_PRM_00001] = VL53L1_MAX_BIN_SEQUENCE_CODE + 1; - pdata->bin_rep[VL53L1_PRM_00001] = 0; + for (lc = i; lc < VL53L1_MAX_BIN_SEQUENCE_LENGTH; lc++) { + pdata->bin_seq[lc] = VL53L1_MAX_BIN_SEQUENCE_CODE + 1; + pdata->bin_rep[lc] = 0; } } @@ -460,16 +461,16 @@ void VL53L1_hist_remove_ambient_bins( - for (bin = pdata->number_of_ambient_bins ; - bin < pdata->VL53L1_PRM_00020 ; bin++) { + for (bin = pdata->number_of_ambient_bins; + bin < pdata->VL53L1_p_023; bin++) { pdata->bin_data[bin-pdata->number_of_ambient_bins] = pdata->bin_data[bin]; } - pdata->VL53L1_PRM_00021 = - pdata->VL53L1_PRM_00021 - + pdata->VL53L1_p_024 = + pdata->VL53L1_p_024 - pdata->number_of_ambient_bins; pdata->number_of_ambient_bins = 0; } @@ -523,7 +524,7 @@ uint32_t VL53L1_calc_pll_period_mm( uint16_t VL53L1_rate_maths( - int32_t VL53L1_PRM_00007, + int32_t VL53L1_p_008, uint32_t time_us) { @@ -548,11 +549,10 @@ uint16_t VL53L1_rate_maths( - if (VL53L1_PRM_00007 > VL53L1_SPAD_TOTAL_COUNT_MAX) { + if (VL53L1_p_008 > VL53L1_SPAD_TOTAL_COUNT_MAX) tmp_int = VL53L1_SPAD_TOTAL_COUNT_MAX; - } else if (VL53L1_PRM_00007 > 0) { - tmp_int = (uint32_t)VL53L1_PRM_00007; - } + else if (VL53L1_p_008 > 0) + tmp_int = (uint32_t)VL53L1_p_008; @@ -560,11 +560,11 @@ uint16_t VL53L1_rate_maths( - if (VL53L1_PRM_00007 > VL53L1_SPAD_TOTAL_COUNT_RES_THRES) { + + if (VL53L1_p_008 > VL53L1_SPAD_TOTAL_COUNT_RES_THRES) frac_bits = 3; - } else { + else frac_bits = 7; - } @@ -572,17 +572,15 @@ uint16_t VL53L1_rate_maths( - if (time_us > 0) { + if (time_us > 0) tmp_int = ((tmp_int << frac_bits) + (time_us / 2)) / time_us; - } - if (VL53L1_PRM_00007 > VL53L1_SPAD_TOTAL_COUNT_RES_THRES) { + if (VL53L1_p_008 > VL53L1_SPAD_TOTAL_COUNT_RES_THRES) tmp_int = tmp_int << 4; - } @@ -590,9 +588,8 @@ uint16_t VL53L1_rate_maths( - if (tmp_int > 0xFFFF) { + if (tmp_int > 0xFFFF) tmp_int = 0xFFFF; - } rate_mcps = (uint16_t)tmp_int; @@ -623,7 +620,9 @@ uint16_t VL53L1_rate_per_spad_maths( if (num_spads > 0) { tmp_int = (peak_count_rate << 8) << frac_bits; - tmp_int = (tmp_int + ((uint32_t)num_spads / 2)) / (uint32_t)num_spads; + tmp_int = (tmp_int + + ((uint32_t)num_spads / 2)) / + (uint32_t)num_spads; } else { tmp_int = ((peak_count_rate) << frac_bits); } @@ -631,9 +630,8 @@ uint16_t VL53L1_rate_per_spad_maths( - if (tmp_int > max_output_value) { + if (tmp_int > max_output_value) tmp_int = max_output_value; - } rate_per_spad = (uint16_t)tmp_int; @@ -643,7 +641,7 @@ uint16_t VL53L1_rate_per_spad_maths( int32_t VL53L1_range_maths( uint16_t fast_osc_frequency, - uint16_t VL53L1_PRM_00016, + uint16_t VL53L1_p_017, uint16_t zero_distance_phase, uint8_t fractional_bits, int32_t gain_factor, @@ -658,6 +656,7 @@ int32_t VL53L1_range_maths( int64_t tmp_long_int = 0; int32_t range_mm = 0; + int32_t range_mm_10 = 0; @@ -673,7 +672,7 @@ int32_t VL53L1_range_maths( - tmp_long_int = (int64_t)VL53L1_PRM_00016 - (int64_t)zero_distance_phase; + tmp_long_int = (int64_t)VL53L1_p_017 - (int64_t)zero_distance_phase; @@ -724,9 +723,14 @@ int32_t VL53L1_range_maths( - if (fractional_bits == 0) - range_mm = range_mm / (0x01 << 2); - else if (fractional_bits == 1) + if (fractional_bits == 0) { + range_mm_10 = range_mm * 10; + range_mm_10 = range_mm_10 / (0x01 << 2); + if ((range_mm_10 % 10) < 5) + range_mm = (int16_t)(range_mm_10 / 10); + else + range_mm = (int16_t)(range_mm_10 / 10 + 1); + } else if (fractional_bits == 1) range_mm = range_mm / (0x01 << 1); return range_mm; @@ -741,11 +745,11 @@ uint8_t VL53L1_decode_vcsel_period(uint8_t vcsel_period_reg) - uint8_t VL53L1_PRM_00030 = 0; + uint8_t VL53L1_p_031 = 0; - VL53L1_PRM_00030 = (vcsel_period_reg + 1) << 1; + VL53L1_p_031 = (vcsel_period_reg + 1) << 1; - return VL53L1_PRM_00030; + return VL53L1_p_031; } @@ -761,10 +765,10 @@ void VL53L1_copy_xtalk_bin_data_to_histogram_data_struct( phist->cal_config__vcsel_start = pxtalk->cal_config__vcsel_start; - phist->VL53L1_PRM_00022 = - pxtalk->VL53L1_PRM_00022; - phist->VL53L1_PRM_00019 = - pxtalk->VL53L1_PRM_00019; + phist->VL53L1_p_019 = + pxtalk->VL53L1_p_019; + phist->VL53L1_p_022 = + pxtalk->VL53L1_p_022; phist->phasecal_result__reference_phase = pxtalk->phasecal_result__reference_phase; @@ -777,14 +781,14 @@ void VL53L1_copy_xtalk_bin_data_to_histogram_data_struct( pxtalk->zero_distance_phase; phist->zone_id = pxtalk->zone_id; - phist->VL53L1_PRM_00020 = pxtalk->VL53L1_PRM_00020; + phist->VL53L1_p_023 = pxtalk->VL53L1_p_023; phist->time_stamp = pxtalk->time_stamp; } void VL53L1_init_histogram_bin_data_struct( int32_t bin_value, - uint16_t VL53L1_PRM_00021, + uint16_t VL53L1_p_024, VL53L1_histogram_bin_data_t *pdata) { @@ -801,9 +805,9 @@ void VL53L1_init_histogram_bin_data_struct( pdata->zone_id = 0; pdata->time_stamp = 0; - pdata->VL53L1_PRM_00019 = 0; - pdata->VL53L1_PRM_00020 = VL53L1_HISTOGRAM_BUFFER_SIZE; - pdata->VL53L1_PRM_00021 = (uint8_t)VL53L1_PRM_00021; + pdata->VL53L1_p_022 = 0; + pdata->VL53L1_p_023 = VL53L1_HISTOGRAM_BUFFER_SIZE; + pdata->VL53L1_p_024 = (uint8_t)VL53L1_p_024; pdata->number_of_ambient_bins = 0; pdata->result__interrupt_status = 0; @@ -817,8 +821,8 @@ void VL53L1_init_histogram_bin_data_struct( pdata->cal_config__vcsel_start = 0; pdata->vcsel_width = 0; - pdata->VL53L1_PRM_00008 = 0; - pdata->VL53L1_PRM_00022 = 0; + pdata->VL53L1_p_009 = 0; + pdata->VL53L1_p_019 = 0; pdata->total_periods_elapsed = 0; pdata->min_bin_value = 0; @@ -827,22 +831,22 @@ void VL53L1_init_histogram_bin_data_struct( pdata->zero_distance_phase = 0; pdata->number_of_ambient_samples = 0; pdata->ambient_events_sum = 0; - pdata->VL53L1_PRM_00028 = 0; + pdata->VL53L1_p_004 = 0; - for (i = 0 ; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; i++) { + for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) pdata->bin_seq[i] = (uint8_t)i; - } - for (i = 0 ; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH ; i++) { - pdata->bin_rep[i] = 1; - } - for (i = 0 ; i < VL53L1_HISTOGRAM_BUFFER_SIZE ; i++) { - if (i < VL53L1_PRM_00021) { + for (i = 0; i < VL53L1_MAX_BIN_SEQUENCE_LENGTH; i++) + pdata->bin_rep[i] = 1; + + + for (i = 0; i < VL53L1_HISTOGRAM_BUFFER_SIZE; i++) + if (i < VL53L1_p_024) pdata->bin_data[i] = bin_value; - } else { + else pdata->bin_data[i] = 0; - } - } + + } @@ -880,15 +884,14 @@ void VL53L1_hist_find_min_max_bin_values( LOG_FUNCTION_START(""); - for (bin = 0 ; bin < pdata->VL53L1_PRM_00021 ; bin++) { + for (bin = 0; bin < pdata->VL53L1_p_024; bin++) { - if (bin == 0 || pdata->min_bin_value >= pdata->bin_data[bin]) { + if (bin == 0 || pdata->min_bin_value >= pdata->bin_data[bin]) pdata->min_bin_value = pdata->bin_data[bin]; - } - if (bin == 0 || pdata->max_bin_value <= pdata->bin_data[bin]) { + if (bin == 0 || pdata->max_bin_value <= pdata->bin_data[bin]) pdata->max_bin_value = pdata->bin_data[bin]; - } + } LOG_FUNCTION_END(0); @@ -918,14 +921,13 @@ void VL53L1_hist_estimate_ambient_from_ambient_bins( pdata->ambient_events_sum = 0; - for (bin = 0 ; bin < pdata->number_of_ambient_bins ; bin++) { + for (bin = 0; bin < pdata->number_of_ambient_bins; bin++) pdata->ambient_events_sum += pdata->bin_data[bin]; - } - pdata->VL53L1_PRM_00028 = pdata->ambient_events_sum; - pdata->VL53L1_PRM_00028 += + pdata->VL53L1_p_004 = pdata->ambient_events_sum; + pdata->VL53L1_p_004 += ((int32_t)pdata->number_of_ambient_bins / 2); - pdata->VL53L1_PRM_00028 /= + pdata->VL53L1_p_004 /= (int32_t)pdata->number_of_ambient_bins; } diff --git a/drivers/input/misc/vl53L1/src/vl53l1_error_strings.c b/drivers/input/misc/vl53L1/src/vl53l1_error_strings.c index 9873eb8fbc28..e8e9920e4a36 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_error_strings.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_error_strings.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -284,17 +284,17 @@ VL53L1_Error VL53L1_get_pal_error_string( break; case VL53L1_WARNING_XTALK_MISSING_SAMPLES: - VL53L1_COPYSTRING(pPalErrorString, - VL53L1_STRING_WARNING_XTALK_MISSING_SAMPLES); - break; + VL53L1_COPYSTRING(pPalErrorString, + VL53L1_STRING_WARNING_XTALK_MISSING_SAMPLES); + break; case VL53L1_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT: - VL53L1_COPYSTRING(pPalErrorString, - VL53L1_STRING_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT); - break; + VL53L1_COPYSTRING(pPalErrorString, + VL53L1_STRING_WARNING_XTALK_NO_SAMPLES_FOR_GRADIENT); + break; case VL53L1_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT: - VL53L1_COPYSTRING(pPalErrorString, - VL53L1_STRING_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT); - break; + VL53L1_COPYSTRING(pPalErrorString, + VL53L1_STRING_WARNING_XTALK_SIGMA_LIMIT_FOR_GRADIENT); + break; case VL53L1_ERROR_DEVICE_FIRMWARE_TOO_OLD: VL53L1_COPYSTRING(pPalErrorString, diff --git a/drivers/input/misc/vl53L1/src/vl53l1_fpga_core.c b/drivers/input/misc/vl53L1/src/vl53l1_fpga_core.c deleted file mode 100644 index 194eb570c306..000000000000 --- a/drivers/input/misc/vl53L1/src/vl53l1_fpga_core.c +++ /dev/null @@ -1,167 +0,0 @@ - -/* -* Copyright (c) 2016, 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/sla0044 -* -* 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. -* -* -******************************************************************************** -* -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#include "vl53l1_ll_def.h" -#include "vl53l1_platform.h" -#include "vl53l1_register_map.h" -#include "vl53l1_core.h" -#include "vl53l1_fpga_core.h" - - -#define LOG_FUNCTION_START(fmt, ...) \ - _LOG_FUNCTION_START(VL53L1_TRACE_MODULE_CORE, fmt, ##__VA_ARGS__) -#define LOG_FUNCTION_END(status, ...) \ - _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__) -#define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE, status, fmt, ##__VA_ARGS__) - - -VL53L1_Error VL53L1_is_firmware_ready_fpga( - VL53L1_DEV Dev, - uint8_t *pready) -{ - - - - - - - - - VL53L1_Error status = VL53L1_ERROR_NONE; - VL53L1_LLDriverData_t *pdev = VL53L1DevStructGetLLDriverHandle(Dev); - - uint8_t comms_buffer[5]; - - LOG_FUNCTION_START(""); - - - - - status = VL53L1_ReadMulti( - Dev, - VL53L1_INTERRUPT_MANAGER__ENABLES, - comms_buffer, - 5); - - if (status == VL53L1_ERROR_NONE) { - - pdev->dbg_results.interrupt_manager__enables = - comms_buffer[0]; - pdev->dbg_results.interrupt_manager__clear = - comms_buffer[1]; - pdev->dbg_results.interrupt_manager__status = - comms_buffer[2]; - pdev->dbg_results.mcu_to_host_bank__wr_access_en = - comms_buffer[3]; - pdev->dbg_results.power_management__go1_reset_status = - comms_buffer[4]; - - if (((pdev->dbg_results.interrupt_manager__enables & 0x1F) == 0x1F) && - ((pdev->dbg_results.interrupt_manager__clear & 0x1F) == 0x1F)) - *pready = 0x01; - else - *pready = 0x00; - } - - LOG_FUNCTION_END(status); - - return status; -} - diff --git a/drivers/input/misc/vl53L1/src/vl53l1_hist_char.c b/drivers/input/misc/vl53L1/src/vl53l1_hist_char.c index 9e9fe711584f..5f13482e28e5 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_hist_char.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_hist_char.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -117,7 +117,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_HISTOGRAM, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_HISTOGRAM, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_HISTOGRAM,\ + status, fmt, ##__VA_ARGS__) VL53L1_Error VL53L1_set_calib_config( @@ -142,14 +143,12 @@ VL53L1_Error VL53L1_set_calib_config( - if (status == VL53L1_ERROR_NONE) { + status = VL53L1_enable_powerforce(Dev); - status = VL53L1_enable_powerforce(Dev); - } - if (status == VL53L1_ERROR_NONE) { + if (status == VL53L1_ERROR_NONE) status = VL53L1_disable_firmware(Dev); - } + diff --git a/drivers/input/misc/vl53L1/src/vl53l1_nvm.c b/drivers/input/misc/vl53L1/src/vl53l1_nvm.c index 61ff25749192..1a0175fa6a3f 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_nvm.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_nvm.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -125,7 +125,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_NVM, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_NVM, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_NVM,\ + status, fmt, ##__VA_ARGS__) #define trace_print(level, ...) \ _LOG_TRACE_PRINT(VL53L1_TRACE_MODULE_NVM, \ @@ -174,8 +175,8 @@ VL53L1_Error VL53L1_nvm_enable( if (status == VL53L1_ERROR_NONE) status = VL53L1_WaitUs( - Dev, - VL53L1_ENABLE_POWERFORCE_SETTLING_TIME_US); + Dev, + VL53L1_ENABLE_POWERFORCE_SETTLING_TIME_US); @@ -214,9 +215,9 @@ VL53L1_Error VL53L1_nvm_enable( if (status == VL53L1_ERROR_NONE) status = VL53L1_WrWord( - Dev, - VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_MSB, - nvm_ctrl_pulse_width); + Dev, + VL53L1_RANGING_CORE__NVM_CTRL__PULSE_WIDTH_MSB, + nvm_ctrl_pulse_width); LOG_FUNCTION_END(status); @@ -256,53 +257,54 @@ VL53L1_Error VL53L1_nvm_read( "%-12s = 0x%02X (%3u)\n", "count", count, count); - for (nvm_addr = start_address; nvm_addr < (start_address+count) ; nvm_addr++) { + for (nvm_addr = start_address; + nvm_addr < (start_address+count) ; nvm_addr++) { if (status == VL53L1_ERROR_NONE) status = VL53L1_WrByte( - Dev, - VL53L1_RANGING_CORE__NVM_CTRL__ADDR, - nvm_addr); + Dev, + VL53L1_RANGING_CORE__NVM_CTRL__ADDR, + nvm_addr); if (status == VL53L1_ERROR_NONE) status = VL53L1_WrByte( - Dev, - VL53L1_RANGING_CORE__NVM_CTRL__READN, - 0x00); + Dev, + VL53L1_RANGING_CORE__NVM_CTRL__READN, + 0x00); if (status == VL53L1_ERROR_NONE) status = VL53L1_WaitUs( - Dev, - VL53L1_NVM_READ_TRIGGER_DELAY_US); + Dev, + VL53L1_NVM_READ_TRIGGER_DELAY_US); if (status == VL53L1_ERROR_NONE) status = VL53L1_WrByte( - Dev, - VL53L1_RANGING_CORE__NVM_CTRL__READN, - 0x01); + Dev, + VL53L1_RANGING_CORE__NVM_CTRL__READN, + 0x01); if (status == VL53L1_ERROR_NONE) status = VL53L1_ReadMulti( - Dev, - VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_MMM, - pdata, - 4); + Dev, + VL53L1_RANGING_CORE__NVM_CTRL__DATAOUT_MMM, + pdata, + 4); trace_print( - VL53L1_TRACE_LEVEL_INFO, - "NVM address : 0x%02X = 0x%02X%02X%02X%02X\n", - nvm_addr, *pdata, *(pdata+1), *(pdata+2), *(pdata+3)); + VL53L1_TRACE_LEVEL_INFO, + "NVM address : 0x%02X = 0x%02X%02X%02X%02X\n", + nvm_addr, *pdata, *(pdata+1), *(pdata+2), *(pdata+3)); @@ -386,7 +388,7 @@ VL53L1_Error VL53L1_nvm_format_decode( LOG_FUNCTION_START(""); - if (VL53L1_NVM_SIZE_IN_BYTES > buf_size) + if (buf_size < VL53L1_NVM_SIZE_IN_BYTES) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->nvm__identification_model_id = @@ -434,7 +436,8 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__ews__fast_osc_frequency = (uint16_t)VL53L1_i2c_decode_with_mask( 2, - pbuffer + VL53L1_NVM__EWS__OSC_MEASURED__FAST_OSC_FREQUENCY, + pbuffer + + VL53L1_NVM__EWS__OSC_MEASURED__FAST_OSC_FREQUENCY, 0x0000FFFF, 0, 0); @@ -462,7 +465,8 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__fmt__fast_osc_frequency = (uint16_t)VL53L1_i2c_decode_with_mask( 2, - pbuffer + VL53L1_NVM__FMT__OSC_MEASURED__FAST_OSC_FREQUENCY, + pbuffer + + VL53L1_NVM__FMT__OSC_MEASURED__FAST_OSC_FREQUENCY, 0x0000FFFF, 0, 0); @@ -525,14 +529,16 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__vhv_timeout__macrop = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, + pbuffer + + VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, 0x00000003, 0, 0); pdata->nvm__vhv_loop_bound = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, + pbuffer + + VL53L1_NVM__VHV_CONFIG__TIMEOUT_MACROP_LOOP_BOUND, 0x000000FC, 2, 0); @@ -691,14 +697,16 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__fmt__roi_config__mode_roi_centre_spad = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_CENTRE_SPAD, + pbuffer + + VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_CENTRE_SPAD, 0x000000FF, 0, 0); pdata->nvm__fmt__roi_config__mode_roi_x_size = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_XY_SIZE, + pbuffer + + VL53L1_NVM__FMT__ROI_CONFIG__MODE_ROI_XY_SIZE, 0x000000F0, 4, 0); @@ -712,7 +720,8 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__fmt__ref_spad_apply__num_requested_ref_spad = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__FMT__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD, + pbuffer + + VL53L1_NVM__FMT__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD, 0x000000FF, 0, 0); @@ -740,42 +749,48 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__fmt__algo_part_to_part_range_offset_mm = (uint16_t)VL53L1_i2c_decode_with_mask( 2, - pbuffer + VL53L1_NVM__FMT__ALGO__PART_TO_PART_RANGE_OFFSET_MM, + pbuffer + + VL53L1_NVM__FMT__ALGO__PART_TO_PART_RANGE_OFFSET_MM, 0x00000FFF, 0, 0); pdata->nvm__fmt__algo__crosstalk_compensation_plane_offset_kcps = (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, - 0x0000FFFF, - 0, - 0); + 2, + pbuffer + + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__fmt__algo__crosstalk_compensation_x_plane_gradient_kcps = - (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS, - 0x0000FFFF, - 0, - 0); + (uint16_t)VL53L1_i2c_decode_with_mask( + 2, + pbuffer + + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__fmt__algo__crosstalk_compensation_y_plane_gradient_kcps = - (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS, - 0x0000FFFF, - 0, - 0); + (uint16_t)VL53L1_i2c_decode_with_mask( + 2, + pbuffer + + VL53L1_NVM__FMT__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__fmt__spare__host_config__nvm_config_spare_0 = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0, + pbuffer + + VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0, 0x000000FF, 0, 0); pdata->nvm__fmt__spare__host_config__nvm_config_spare_1 = (uint8_t)VL53L1_i2c_decode_with_mask( 1, - pbuffer + VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1, + pbuffer + + VL53L1_NVM__FMT__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1, 0x000000FF, 0, 0); @@ -795,11 +810,12 @@ VL53L1_Error VL53L1_nvm_format_decode( 0); pdata->nvm__cust__ref_spad_apply__num_requested_ref_spad = (uint8_t)VL53L1_i2c_decode_with_mask( - 1, - pbuffer + VL53L1_NVM__CUST__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD, - 0x000000FF, - 0, - 0); + 1, + pbuffer + + VL53L1_NVM__CUST__REF_SPAD_APPLY__NUM_REQUESTED_REF_SPAD, + 0x000000FF, + 0, + 0); pdata->nvm__cust__ref_spad_man__ref_location = (uint8_t)VL53L1_i2c_decode_with_mask( 1, @@ -824,75 +840,81 @@ VL53L1_Error VL53L1_nvm_format_decode( pdata->nvm__cust__algo_part_to_part_range_offset_mm = (uint16_t)VL53L1_i2c_decode_with_mask( 2, - pbuffer + VL53L1_NVM__CUST__ALGO__PART_TO_PART_RANGE_OFFSET_MM, + pbuffer + + VL53L1_NVM__CUST__ALGO__PART_TO_PART_RANGE_OFFSET_MM, 0x00000FFF, 0, 0); pdata->nvm__cust__algo__crosstalk_compensation_plane_offset_kcps = - (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, - 0x0000FFFF, - 0, - 0); + (uint16_t)VL53L1_i2c_decode_with_mask( + 2, + pbuffer + + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_PLANE_OFFSET_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__cust__algo__crosstalk_compensation_x_plane_gradient_kcps = - (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS, - 0x0000FFFF, - 0, - 0); + (uint16_t)VL53L1_i2c_decode_with_mask( + 2, + pbuffer + + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_X_PLANE_GRADIENT_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__cust__algo__crosstalk_compensation_y_plane_gradient_kcps = - (uint16_t)VL53L1_i2c_decode_with_mask( - 2, - pbuffer + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS, - 0x0000FFFF, - 0, - 0); + (uint16_t)VL53L1_i2c_decode_with_mask( + 2, + pbuffer + + VL53L1_NVM__CUST__ALGO__CROSSTALK_COMPENSATION_Y_PLANE_GRADIENT_KCPS, + 0x0000FFFF, + 0, + 0); pdata->nvm__cust__spare__host_config__nvm_config_spare_0 = - (uint8_t)VL53L1_i2c_decode_with_mask( - 1, - pbuffer + VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0, - 0x000000FF, - 0, - 0); + (uint8_t)VL53L1_i2c_decode_with_mask( + 1, + pbuffer + VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_0, + 0x000000FF, + 0, + 0); pdata->nvm__cust__spare__host_config__nvm_config_spare_1 = (uint8_t)VL53L1_i2c_decode_with_mask( - 1, - pbuffer + VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1, - 0x000000FF, - 0, - 0); + 1, + pbuffer + + VL53L1_NVM__CUST__SPARE_HOST_CONFIG__NVM_CONFIG_SPARE_1, + 0x000000FF, + 0, + 0); if (status == VL53L1_ERROR_NONE) status = - VL53L1_nvm_decode_optical_centre( - buf_size, - pbuffer + VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX, - &(pdata->fmt_optical_centre)); + VL53L1_nvm_decode_optical_centre( + buf_size, + pbuffer + VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX, + &(pdata->fmt_optical_centre)); if (status == VL53L1_ERROR_NONE) status = - VL53L1_nvm_decode_cal_peak_rate_map( - buf_size, - pbuffer + VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX, - &(pdata->fmt_peak_rate_map)); + VL53L1_nvm_decode_cal_peak_rate_map( + buf_size, + pbuffer + VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX, + &(pdata->fmt_peak_rate_map)); if (status == VL53L1_ERROR_NONE) status = - VL53L1_nvm_decode_additional_offset_cal_data( - buf_size, - pbuffer + VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX, - &(pdata->fmt_add_offset_data)); + VL53L1_nvm_decode_additional_offset_cal_data( + buf_size, + pbuffer + + VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX, + &(pdata->fmt_add_offset_data)); @@ -943,7 +965,7 @@ VL53L1_Error VL53L1_nvm_decode_optical_centre( uint16_t tmp = 0; - if (VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_SIZE > buf_size) + if (buf_size < VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_SIZE) return VL53L1_ERROR_BUFFER_TOO_SMALL; @@ -973,7 +995,7 @@ VL53L1_Error VL53L1_nvm_decode_cal_peak_rate_map( uint8_t *ptmp = NULL; uint8_t i = 0; - if (VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_SIZE > buf_size) + if (buf_size < VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_SIZE) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->cal_distance_mm = @@ -1007,7 +1029,7 @@ VL53L1_Error VL53L1_nvm_decode_additional_offset_cal_data( VL53L1_Error status = VL53L1_ERROR_NONE; - if (VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_SIZE > buf_size) + if (buf_size < VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_SIZE) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->result__mm_inner_actual_effective_spads = @@ -1034,7 +1056,7 @@ VL53L1_Error VL53L1_nvm_decode_fmt_range_results_data( VL53L1_Error status = VL53L1_ERROR_NONE; - if (VL53L1_NVM__FMT__RANGE_RESULTS__SIZE_BYTES > buf_size) + if (buf_size < VL53L1_NVM__FMT__RANGE_RESULTS__SIZE_BYTES) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->result__actual_effective_rtn_spads = @@ -1076,7 +1098,7 @@ VL53L1_Error VL53L1_nvm_decode_fmt_info( VL53L1_Error status = VL53L1_ERROR_NONE; - if (VL53L1_NVM_SIZE_IN_BYTES > buf_size) + if (buf_size < VL53L1_NVM_SIZE_IN_BYTES) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->nvm__fmt__fgc[0] = @@ -1297,7 +1319,7 @@ VL53L1_Error VL53L1_nvm_decode_ews_info( VL53L1_Error status = VL53L1_ERROR_NONE; - if (VL53L1_NVM_SIZE_IN_BYTES > buf_size) + if (buf_size < VL53L1_NVM_SIZE_IN_BYTES) return VL53L1_ERROR_BUFFER_TOO_SMALL; pdata->nvm__ews__test_program_major = @@ -1559,8 +1581,10 @@ VL53L1_Error VL53L1_read_nvm_optical_centre( status = VL53L1_read_nvm_raw_data( Dev, - (uint8_t)(VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX >> 2), - (uint8_t)(VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_SIZE >> 2), + (uint8_t)(VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_INDEX + >> 2), + (uint8_t)(VL53L1_NVM__FMT__OPTICAL_CENTRE_DATA_SIZE + >> 2), nvm_data); @@ -1603,8 +1627,10 @@ VL53L1_Error VL53L1_read_nvm_cal_peak_rate_map( status = VL53L1_read_nvm_raw_data( Dev, - (uint8_t)(VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX >> 2), - (uint8_t)(VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_SIZE >> 2), + (uint8_t)(VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_INDEX + >> 2), + (uint8_t)(VL53L1_NVM__FMT__CAL_PEAK_RATE_MAP_DATA_SIZE + >> 2), nvm_data); @@ -1652,8 +1678,10 @@ VL53L1_Error VL53L1_read_nvm_additional_offset_cal_data( status = VL53L1_read_nvm_raw_data( Dev, - (uint8_t)(VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX >> 2), - (uint8_t)(VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_SIZE >> 2), + (uint8_t)( + VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_INDEX >> 2), + (uint8_t)( + VL53L1_NVM__FMT__ADDITIONAL_OFFSET_CAL_DATA_SIZE >> 2), nvm_data); diff --git a/drivers/input/misc/vl53L1/src/vl53l1_nvm_debug.c b/drivers/input/misc/vl53L1/src/vl53l1_nvm_debug.c index a14e5eeeaa3f..b1acfd144577 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_nvm_debug.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_nvm_debug.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -109,7 +109,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_NVM, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_NVM, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_NVM,\ + status, fmt, ##__VA_ARGS__) #define trace_print(level, ...) \ _LOG_TRACE_PRINT(trace_flags, \ @@ -607,10 +608,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->nvm__fmt__algo__crosstalk_compensation_plane_offset_kcps, - 9, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (int32_t)( + pdata->nvm__fmt__algo__crosstalk_compensation_plane_offset_kcps), + 9, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -620,10 +622,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->nvm__fmt__algo__crosstalk_compensation_x_plane_gradient_kcps, - 11, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (int32_t)( + pdata->nvm__fmt__algo__crosstalk_compensation_x_plane_gradient_kcps), + 11, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -633,10 +636,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->nvm__fmt__algo__crosstalk_compensation_y_plane_gradient_kcps, - 11, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (int32_t)( + pdata->nvm__fmt__algo__crosstalk_compensation_y_plane_gradient_kcps), + 11, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -715,10 +719,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (uint32_t)pdata->nvm__cust__algo__crosstalk_compensation_plane_offset_kcps, - 9, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (uint32_t)( + pdata->nvm__cust__algo__crosstalk_compensation_plane_offset_kcps), + 9, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -728,10 +733,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->nvm__cust__algo__crosstalk_compensation_x_plane_gradient_kcps, - 11, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (int32_t)( + pdata->nvm__cust__algo__crosstalk_compensation_x_plane_gradient_kcps), + 11, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, @@ -741,10 +747,11 @@ void VL53L1_print_decoded_nvm_data( fp_text); VL53L1_signed_fixed_point_sprintf( - (int32_t)pdata->nvm__cust__algo__crosstalk_compensation_y_plane_gradient_kcps, - 11, - VL53L1_MAX_STRING_LENGTH, - fp_text); + (int32_t)( + pdata->nvm__cust__algo__crosstalk_compensation_y_plane_gradient_kcps), + 11, + VL53L1_MAX_STRING_LENGTH, + fp_text); trace_print( VL53L1_TRACE_LEVEL_INFO, diff --git a/drivers/input/misc/vl53L1/src/vl53l1_register_funcs.c b/drivers/input/misc/vl53L1/src/vl53l1_register_funcs.c index 7be45cbe8f36..21d886e8ae77 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_register_funcs.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_register_funcs.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -112,7 +112,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_REGISTERS, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_REGISTERS, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_REGISTERS,\ + status, fmt, ##__VA_ARGS__) VL53L1_Error VL53L1_i2c_encode_static_nvm_managed( @@ -130,7 +131,7 @@ VL53L1_Error VL53L1_i2c_encode_static_nvm_managed( LOG_FUNCTION_START(""); - if (VL53L1_STATIC_NVM_MANAGED_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_STATIC_NVM_MANAGED_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -177,7 +178,7 @@ VL53L1_Error VL53L1_i2c_decode_static_nvm_managed( LOG_FUNCTION_START(""); - if (VL53L1_STATIC_NVM_MANAGED_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_STATIC_NVM_MANAGED_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->i2c_slave__device_address = @@ -292,7 +293,7 @@ VL53L1_Error VL53L1_i2c_encode_customer_nvm_managed( LOG_FUNCTION_START(""); - if (VL53L1_CUSTOMER_NVM_MANAGED_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_CUSTOMER_NVM_MANAGED_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -363,7 +364,7 @@ VL53L1_Error VL53L1_i2c_decode_customer_nvm_managed( LOG_FUNCTION_START(""); - if (VL53L1_CUSTOMER_NVM_MANAGED_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_CUSTOMER_NVM_MANAGED_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->global_config__spad_enables_ref_0 = @@ -490,7 +491,7 @@ VL53L1_Error VL53L1_i2c_encode_static_config( LOG_FUNCTION_START(""); - if (VL53L1_STATIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_STATIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint16_t( @@ -579,7 +580,7 @@ VL53L1_Error VL53L1_i2c_decode_static_config( LOG_FUNCTION_START(""); - if (VL53L1_STATIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_STATIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->dss_config__target_total_rate_mcps = @@ -734,7 +735,7 @@ VL53L1_Error VL53L1_i2c_encode_general_config( LOG_FUNCTION_START(""); - if (VL53L1_GENERAL_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GENERAL_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -801,7 +802,7 @@ VL53L1_Error VL53L1_i2c_decode_general_config( LOG_FUNCTION_START(""); - if (VL53L1_GENERAL_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GENERAL_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->gph_config__stream_count_update_value = @@ -930,7 +931,7 @@ VL53L1_Error VL53L1_i2c_encode_timing_config( LOG_FUNCTION_START(""); - if (VL53L1_TIMING_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_TIMING_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -993,7 +994,7 @@ VL53L1_Error VL53L1_i2c_decode_timing_config( LOG_FUNCTION_START(""); - if (VL53L1_TIMING_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_TIMING_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->mm_config__timeout_macrop_a_hi = @@ -1120,7 +1121,7 @@ VL53L1_Error VL53L1_i2c_encode_dynamic_config( LOG_FUNCTION_START(""); - if (VL53L1_DYNAMIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_DYNAMIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -1181,7 +1182,7 @@ VL53L1_Error VL53L1_i2c_decode_dynamic_config( LOG_FUNCTION_START(""); - if (VL53L1_DYNAMIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_DYNAMIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->system__grouped_parameter_hold_0 = @@ -1308,7 +1309,7 @@ VL53L1_Error VL53L1_i2c_encode_system_control( LOG_FUNCTION_START(""); - if (VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -1343,7 +1344,7 @@ VL53L1_Error VL53L1_i2c_decode_system_control( LOG_FUNCTION_START(""); - if (VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SYSTEM_CONTROL_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->power_management__go1_power_force = @@ -1448,7 +1449,7 @@ VL53L1_Error VL53L1_i2c_encode_system_results( LOG_FUNCTION_START(""); - if (VL53L1_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -1484,9 +1485,9 @@ VL53L1_Error VL53L1_i2c_encode_system_results( 2, pbuffer + 14); VL53L1_i2c_encode_uint16_t( - pdata->result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, - 2, - pbuffer + 16); + pdata->result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, + 2, + pbuffer + 16); VL53L1_i2c_encode_uint16_t( pdata->result__mm_inner_actual_effective_spads_sd0, 2, @@ -1561,7 +1562,7 @@ VL53L1_Error VL53L1_i2c_decode_system_results( LOG_FUNCTION_START(""); - if (VL53L1_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->result__interrupt_status = @@ -1706,7 +1707,7 @@ VL53L1_Error VL53L1_i2c_encode_core_results( LOG_FUNCTION_START(""); - if (VL53L1_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint32_t( @@ -1765,7 +1766,7 @@ VL53L1_Error VL53L1_i2c_decode_core_results( LOG_FUNCTION_START(""); - if (VL53L1_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->result_core__ambient_window_events_sd0 = @@ -1884,7 +1885,7 @@ VL53L1_Error VL53L1_i2c_encode_debug_results( LOG_FUNCTION_START(""); - if (VL53L1_DEBUG_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_DEBUG_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint16_t( @@ -2009,7 +2010,7 @@ VL53L1_Error VL53L1_i2c_decode_debug_results( LOG_FUNCTION_START(""); - if (VL53L1_DEBUG_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_DEBUG_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->phasecal_result__reference_phase = @@ -2196,7 +2197,7 @@ VL53L1_Error VL53L1_i2c_encode_nvm_copy_data( LOG_FUNCTION_START(""); - if (VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -2319,7 +2320,7 @@ VL53L1_Error VL53L1_i2c_decode_nvm_copy_data( LOG_FUNCTION_START(""); - if (VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_NVM_COPY_DATA_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->identification__model_id = @@ -2516,7 +2517,7 @@ VL53L1_Error VL53L1_i2c_encode_prev_shadow_system_results( LOG_FUNCTION_START(""); - if (VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -2548,13 +2549,13 @@ VL53L1_Error VL53L1_i2c_encode_prev_shadow_system_results( 2, pbuffer + 12); VL53L1_i2c_encode_uint16_t( - pdata->prev_shadow_result__final_crosstalk_corrected_range_mm_sd0, - 2, - pbuffer + 14); + pdata->prev_shadow_result__final_crosstalk_corrected_range_mm_sd0, + 2, + pbuffer + 14); VL53L1_i2c_encode_uint16_t( - pdata->prev_shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, - 2, - pbuffer + 16); + pdata->psr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, + 2, + pbuffer + 16); VL53L1_i2c_encode_uint16_t( pdata->prev_shadow_result__mm_inner_actual_effective_spads_sd0, 2, @@ -2588,9 +2589,9 @@ VL53L1_Error VL53L1_i2c_encode_prev_shadow_system_results( 2, pbuffer + 32); VL53L1_i2c_encode_uint16_t( - pdata->prev_shadow_result__final_crosstalk_corrected_range_mm_sd1, - 2, - pbuffer + 34); + pdata->prev_shadow_result__final_crosstalk_corrected_range_mm_sd1, + 2, + pbuffer + 34); VL53L1_i2c_encode_uint16_t( pdata->prev_shadow_result__spare_0_sd1, 2, @@ -2629,7 +2630,7 @@ VL53L1_Error VL53L1_i2c_decode_prev_shadow_system_results( LOG_FUNCTION_START(""); - if (VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PREV_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->prev_shadow_result__interrupt_status = @@ -2652,7 +2653,7 @@ VL53L1_Error VL53L1_i2c_decode_prev_shadow_system_results( (VL53L1_i2c_decode_uint16_t(2, pbuffer + 12)); pdata->prev_shadow_result__final_crosstalk_corrected_range_mm_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 14)); - pdata->prev_shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 = + pdata->psr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 16)); pdata->prev_shadow_result__mm_inner_actual_effective_spads_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 18)); @@ -2784,7 +2785,7 @@ VL53L1_Error VL53L1_i2c_encode_prev_shadow_core_results( LOG_FUNCTION_START(""); - if (VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint32_t( @@ -2843,7 +2844,7 @@ VL53L1_Error VL53L1_i2c_decode_prev_shadow_core_results( LOG_FUNCTION_START(""); - if (VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->prev_shadow_result_core__ambient_window_events_sd0 = @@ -2898,10 +2899,10 @@ VL53L1_Error VL53L1_set_prev_shadow_core_results( if (status == VL53L1_ERROR_NONE) status = VL53L1_WriteMulti( - Dev, - VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0, - comms_buffer, - VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES); + Dev, + VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0, + comms_buffer, + VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES); if (status == VL53L1_ERROR_NONE) status = VL53L1_enable_firmware(Dev); @@ -2933,10 +2934,10 @@ VL53L1_Error VL53L1_get_prev_shadow_core_results( if (status == VL53L1_ERROR_NONE) status = VL53L1_ReadMulti( - Dev, - VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0, - comms_buffer, - VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES); + Dev, + VL53L1_PREV_SHADOW_RESULT_CORE__AMBIENT_WINDOW_EVENTS_SD0, + comms_buffer, + VL53L1_PREV_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES); if (status == VL53L1_ERROR_NONE) status = VL53L1_enable_firmware(Dev); @@ -2968,7 +2969,7 @@ VL53L1_Error VL53L1_i2c_encode_patch_debug( LOG_FUNCTION_START(""); - if (VL53L1_PATCH_DEBUG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PATCH_DEBUG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -2997,7 +2998,7 @@ VL53L1_Error VL53L1_i2c_decode_patch_debug( LOG_FUNCTION_START(""); - if (VL53L1_PATCH_DEBUG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PATCH_DEBUG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->result__debug_status = @@ -3108,7 +3109,7 @@ VL53L1_Error VL53L1_i2c_encode_gph_general_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_GENERAL_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_GENERAL_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint16_t( @@ -3143,7 +3144,7 @@ VL53L1_Error VL53L1_i2c_decode_gph_general_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_GENERAL_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_GENERAL_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->gph__system__thresh_rate_high = @@ -3256,7 +3257,7 @@ VL53L1_Error VL53L1_i2c_encode_gph_static_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_STATIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_STATIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -3293,7 +3294,7 @@ VL53L1_Error VL53L1_i2c_decode_gph_static_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_STATIC_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_STATIC_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->gph__dss_config__roi_mode_control = @@ -3410,7 +3411,7 @@ VL53L1_Error VL53L1_i2c_encode_gph_timing_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_TIMING_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_TIMING_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -3467,7 +3468,7 @@ VL53L1_Error VL53L1_i2c_decode_gph_timing_config( LOG_FUNCTION_START(""); - if (VL53L1_GPH_TIMING_CONFIG_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_GPH_TIMING_CONFIG_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->gph__mm_config__timeout_macrop_a_hi = @@ -3602,7 +3603,7 @@ VL53L1_Error VL53L1_i2c_encode_fw_internal( LOG_FUNCTION_START(""); - if (VL53L1_FW_INTERNAL_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_FW_INTERNAL_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -3631,7 +3632,7 @@ VL53L1_Error VL53L1_i2c_decode_fw_internal( LOG_FUNCTION_START(""); - if (VL53L1_FW_INTERNAL_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_FW_INTERNAL_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->firmware__internal_stream_count_div = @@ -3742,7 +3743,7 @@ VL53L1_Error VL53L1_i2c_encode_patch_results( LOG_FUNCTION_START(""); - if (VL53L1_PATCH_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PATCH_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -3915,7 +3916,7 @@ VL53L1_Error VL53L1_i2c_decode_patch_results( LOG_FUNCTION_START(""); - if (VL53L1_PATCH_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_PATCH_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->dss_calc__roi_ctrl = @@ -4142,7 +4143,7 @@ VL53L1_Error VL53L1_i2c_encode_shadow_system_results( LOG_FUNCTION_START(""); - if (VL53L1_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; *(pbuffer + 0) = @@ -4180,7 +4181,7 @@ VL53L1_Error VL53L1_i2c_encode_shadow_system_results( 2, pbuffer + 16); VL53L1_i2c_encode_uint16_t( - pdata->shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, + pdata->shr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0, 2, pbuffer + 18); VL53L1_i2c_encode_uint16_t( @@ -4261,7 +4262,7 @@ VL53L1_Error VL53L1_i2c_decode_shadow_system_results( LOG_FUNCTION_START(""); - if (VL53L1_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SHADOW_SYSTEM_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->shadow_phasecal_result__vcsel_start = @@ -4286,7 +4287,7 @@ VL53L1_Error VL53L1_i2c_decode_shadow_system_results( (VL53L1_i2c_decode_uint16_t(2, pbuffer + 14)); pdata->shadow_result__final_crosstalk_corrected_range_mm_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 16)); - pdata->shadow_result__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 = + pdata->shr__peak_signal_count_rate_crosstalk_corrected_mcps_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 18)); pdata->shadow_result__mm_inner_actual_effective_spads_sd0 = (VL53L1_i2c_decode_uint16_t(2, pbuffer + 20)); @@ -4424,7 +4425,7 @@ VL53L1_Error VL53L1_i2c_encode_shadow_core_results( LOG_FUNCTION_START(""); - if (VL53L1_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; VL53L1_i2c_encode_uint32_t( @@ -4483,7 +4484,7 @@ VL53L1_Error VL53L1_i2c_decode_shadow_core_results( LOG_FUNCTION_START(""); - if (VL53L1_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES > buf_size) + if (buf_size < VL53L1_SHADOW_CORE_RESULTS_I2C_SIZE_BYTES) return VL53L1_ERROR_COMMS_BUFFER_TOO_SMALL; pdata->shadow_result_core__ambient_window_events_sd0 = diff --git a/drivers/input/misc/vl53L1/src/vl53l1_silicon_core.c b/drivers/input/misc/vl53L1/src/vl53l1_silicon_core.c index 0f038abdf362..2c3112b841bd 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_silicon_core.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_silicon_core.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -110,7 +110,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE,\ + status, fmt, ##__VA_ARGS__) VL53L1_Error VL53L1_is_firmware_ready_silicon( @@ -136,44 +137,49 @@ VL53L1_Error VL53L1_is_firmware_ready_silicon( status = VL53L1_ReadMulti( - Dev, - VL53L1_INTERRUPT_MANAGER__ENABLES, - comms_buffer, - 5); + Dev, + VL53L1_INTERRUPT_MANAGER__ENABLES, + comms_buffer, + 5); - if (status == VL53L1_ERROR_NONE) { + if (status != VL53L1_ERROR_NONE) + goto ENDFUNC; - pdev->dbg_results.interrupt_manager__enables = - comms_buffer[0]; - pdev->dbg_results.interrupt_manager__clear = - comms_buffer[1]; - pdev->dbg_results.interrupt_manager__status = - comms_buffer[2]; - pdev->dbg_results.mcu_to_host_bank__wr_access_en = - comms_buffer[3]; - pdev->dbg_results.power_management__go1_reset_status = - comms_buffer[4]; + pdev->dbg_results.interrupt_manager__enables = + comms_buffer[0]; + pdev->dbg_results.interrupt_manager__clear = + comms_buffer[1]; + pdev->dbg_results.interrupt_manager__status = + comms_buffer[2]; + pdev->dbg_results.mcu_to_host_bank__wr_access_en = + comms_buffer[3]; + pdev->dbg_results.power_management__go1_reset_status = + comms_buffer[4]; - if ((pdev->sys_ctrl.power_management__go1_power_force & 0x01) == 0x01) { + if ((pdev->sys_ctrl.power_management__go1_power_force & 0x01) + == 0x01) { - if (((pdev->dbg_results.interrupt_manager__enables & 0x1F) == 0x1F) && - ((pdev->dbg_results.interrupt_manager__clear & 0x1F) == 0x1F)) - *pready = 0x01; - else - *pready = 0x00; + if (((pdev->dbg_results.interrupt_manager__enables & + 0x1F) == 0x1F) && + ((pdev->dbg_results.interrupt_manager__clear + & 0x1F) == 0x1F)) + *pready = 0x01; + else + *pready = 0x00; - } else { + } else { - if ((pdev->dbg_results.power_management__go1_reset_status & 0x01) == 0x00) - *pready = 0x01; - else - *pready = 0x00; - } - + if ((pdev->dbg_results.power_management__go1_reset_status + & 0x01) == 0x00) + *pready = 0x01; + else + *pready = 0x00; } + +ENDFUNC: LOG_FUNCTION_END(status); return status; diff --git a/drivers/input/misc/vl53L1/src/vl53l1_wait.c b/drivers/input/misc/vl53L1/src/vl53l1_wait.c index 497a5200af1f..083e53d584a3 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_wait.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_wait.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -207,9 +207,9 @@ VL53L1_Error VL53L1_wait_for_firmware_ready( status = - VL53L1_poll_for_firmware_ready( - Dev, - VL53L1_RANGE_COMPLETION_POLLING_TIMEOUT_MS); + VL53L1_poll_for_firmware_ready( + Dev, + VL53L1_RANGE_COMPLETION_POLLING_TIMEOUT_MS); } else { @@ -217,7 +217,8 @@ VL53L1_Error VL53L1_wait_for_firmware_ready( fw_ready = 0; - while (fw_ready == 0x00 && status == VL53L1_ERROR_NONE) { + while (fw_ready == 0x00 && status == + VL53L1_ERROR_NONE) { status = VL53L1_is_firmware_ready( Dev, &fw_ready); diff --git a/drivers/input/misc/vl53L1/src/vl53l1_zone_presets.c b/drivers/input/misc/vl53L1/src/vl53l1_zone_presets.c index aa0d1468a92c..e35f395a233f 100644 --- a/drivers/input/misc/vl53L1/src/vl53l1_zone_presets.c +++ b/drivers/input/misc/vl53L1/src/vl53l1_zone_presets.c @@ -1,65 +1,65 @@ -/* -* Copyright (c) 2016, 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. -* +/******************************************************************************* + * 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' -* + + 'STMicroelectronics Proprietary license' + ******************************************************************************** -* -* License terms: STMicroelectronics Proprietary in accordance with licensing -* terms at www.st.com/sla0044 -* -* STMicroelectronics confidential -* Reproduction and Communication of this document is strictly prohibited unless -* specifically authorized in writing by STMicroelectronics. -* -* + + 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 : -* + + 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. -* -* + + 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. + + ******************************************************************************** -* + */ @@ -108,7 +108,8 @@ #define LOG_FUNCTION_END(status, ...) \ _LOG_FUNCTION_END(VL53L1_TRACE_MODULE_CORE, status, ##__VA_ARGS__) #define LOG_FUNCTION_END_FMT(status, fmt, ...) \ - _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE, status, fmt, ##__VA_ARGS__) + _LOG_FUNCTION_END_FMT(VL53L1_TRACE_MODULE_CORE,\ + status, fmt, ##__VA_ARGS__) VL53L1_Error VL53L1_init_zone_config_structure( @@ -147,18 +148,18 @@ VL53L1_Error VL53L1_init_zone_config_structure( pdata->active_zones = (uint8_t)i; pdata->user_zones[i].height = height; pdata->user_zones[i].width = width; - pdata->user_zones[i].x_centre = x_off + (x * x_inc); - pdata->user_zones[i].y_centre = y_off + (y * y_inc); + pdata->user_zones[i].x_centre = + x_off + (x * x_inc); + pdata->user_zones[i].y_centre = + y_off + (y * y_inc); } i++; } } - if (status == VL53L1_ERROR_NONE) { + status = VL53L1_init_zone_config_histogram_bins(pdata); - status = VL53L1_init_zone_config_histogram_bins(pdata); - } LOG_FUNCTION_END(status); @@ -219,10 +220,8 @@ VL53L1_Error VL53L1_zone_preset_xtalk_planar( pzone_cfg->user_zones[4].x_centre = 8; pzone_cfg->user_zones[4].y_centre = 8; - if (status == VL53L1_ERROR_NONE) { + status = VL53L1_init_zone_config_histogram_bins(pzone_cfg); - status = VL53L1_init_zone_config_histogram_bins(pzone_cfg); - } LOG_FUNCTION_END(status); diff --git a/drivers/input/misc/vl53L1/stmvl53l1-i2c.h b/drivers/input/misc/vl53L1/stmvl53l1-i2c.h index e68ca420783d..726c73e01519 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1-i2c.h +++ b/drivers/input/misc/vl53L1/stmvl53l1-i2c.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1-i2c.h * Linux kernel i2c/cci wrapper for ST VL53L1 sensor i2c interface @@ -52,13 +52,13 @@ struct i2c_data { /*!< power enable gpio number * * if -1 no gpio if vdd not avl pwr is not controllable - */ + */ int pwren_gpio; /*!< xsdn reset (low active) gpio number to device * * -1 mean none assume no "resetable" - */ + */ int xsdn_gpio; /*!< intr gpio number to device @@ -67,7 +67,7 @@ struct i2c_data { * * -1 mean none assume use polling * @warning if the dev tree and intr gpio is require please adapt code - */ + */ int intr_gpio; /*!< device boot i2c register address @@ -87,7 +87,7 @@ struct i2c_data { /** the irq vectore assigned to gpio * -1 if no irq hanled - */ + */ int irq; struct msgtctrl_t { @@ -96,14 +96,14 @@ struct i2c_data { }; int stmvl53l1_init_i2c(void); -void __exit stmvl53l1_exit_i2c(void *); -int stmvl53l1_power_up_i2c(void *); -int stmvl53l1_power_down_i2c(void *); -int stmvl53l1_reset_release_i2c(void *); -int stmvl53l1_reset_hold_i2c(void *); +void __exit stmvl53l1_exit_i2c(void *arg); +int stmvl53l1_power_up_i2c(void *arg); +int stmvl53l1_power_down_i2c(void *arg); +int stmvl53l1_reset_release_i2c(void *arg); +int stmvl53l1_reset_hold_i2c(void *arg); void stmvl53l1_clean_up_i2c(void); int stmvl53l1_start_intr(void *object, int *poll_mode); -void *stmvl53l1_get(void *); -void stmvl53l1_put(void *); +void *stmvl53l1_get(void *arg); +void stmvl53l1_put(void *arg); #endif /* STMVL53L1_I2C_H */ diff --git a/drivers/input/misc/vl53L1/stmvl53l1.h b/drivers/input/misc/vl53L1/stmvl53l1.h index 83ff6460ef3e..09fc5ad7b011 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1.h +++ b/drivers/input/misc/vl53L1/stmvl53l1.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1.h header for vl53l1 sensor driver */ @@ -57,7 +57,9 @@ /** * Configure the Netlink-id use */ -#define STMVL531_CFG_NETLINK_USER 23 +#ifndef STMVL531_CFG_NETLINK_USER +#define STMVL531_CFG_NETLINK_USER 29 +#endif #define STMVL53L1_MAX_CCI_XFER_SZ 256 #define STMVL53L1_DRV_NAME "stmvl53l1" @@ -69,7 +71,7 @@ */ /* define CFG_STMVL53L1_HAVE_REGULATOR */ -#define DRIVER_VERSION "12.13.0" +#define DRIVER_VERSION "13.1.0" /** @ingroup vl53l1_config * @{ @@ -97,12 +99,12 @@ extern int stmvl53l1_enable_debug; #define vl53l1_dbgmsg(str, ...) do { \ if (stmvl53l1_enable_debug) \ pr_info("%s: " str, __func__, ##__VA_ARGS__); \ - } while (0) +} while (0) # else #define vl53l1_dbgmsg(str, ...) do { \ if (stmvl53l1_enable_debug) \ pr_debug("%s: " str, __func__, ##__VA_ARGS__); \ - } while (0) +} while (0) # endif #else # define vl53l1_dbgmsg(...) (void)0 @@ -114,13 +116,13 @@ extern int stmvl53l1_enable_debug; #define WORK_DEBUG 0 #if WORK_DEBUG # define work_dbg(msg, ...)\ - printk("[D WK53L1] :" msg "\n", ##__VA_ARGS__) + printk("[D WK53L1] :" msg "\n", ##__VA_ARGS__) #else # define work_dbg(...) (void)0 #endif #define vl53l1_info(str, args...) \ - pr_info("%s: " str, __func__, ##args) + pr_info("%s: " str "\n", __func__, ##args) #define vl53l1_errmsg(str, args...) \ pr_err("%s: " str, __func__, ##args) @@ -152,21 +154,22 @@ struct ipp_data_t { struct ipp_work_t work; struct ipp_work_t work_out; int test_n; - int buzy; /*!< buzy state 0 is idle - * any other value do not try to use (state value defined in source) - */ + /*!< buzy state 0 is idle + *any other value do not try to use (state value defined in source) + */ + int buzy; int waited_xfer_id; /*!< when buzy is set that is the id we are expecting * note that value 0 is reserved and stand for "not waiting" * as such never id 0 will be in any round trip exchange * it's ok for daemon to use 0 in "ping" when it identify himself - */ + */ int status; /** if that is not 0 do not look at out work data */ wait_queue_head_t waitq; /*!< ipp caller are put in that queue wait while job is posted to user * @warning ipp and dev mutex will be released before waiting * see @ref ipp_abort - */ + */ #if IPP_LOG_TIMING struct timeval start_tv, stop_tv; #endif @@ -183,7 +186,6 @@ struct stmvl53l1_waiters { struct stmvl53l1_data { int id; /*!< multiple device id 0 based*/ char name[64]; /*!< misc device name */ - int32_t hw_rev; /*!< hardware revision number*/ VL53L1_DevData_t stdev; /*!ipp.stop_tv) + do_gettimeofday(&data->ipp.stop_tv) # define stmvl531_ipp_tim_start(data)\ - do_gettimeofday(&data->ipp.start_tv) + do_gettimeofday(&data->ipp.start_tv) # define stmvl531_ipp_time(data)\ - stmvl53l1_tv_dif(&data->ipp.start_tv, &data->ipp.stop_tv) + stmvl53l1_tv_dif(&data->ipp.start_tv, &data->ipp.stop_tv) # define stmvl531_ipp_stat(data, fmt, ...)\ - vl53l1_dbgmsg("IPPSTAT " fmt "\n", ##__VA_ARGS__) + vl53l1_dbgmsg("IPPSTAT " fmt "\n", ##__VA_ARGS__) #else # define stmvl531_ipp_tim_stop(data) (void)0 # define stmvl531_ipp_tim_start(data) (void)0 @@ -335,9 +325,11 @@ extern struct stmvl53l1_data *stmvl53l1_dev_table[]; int stmvl53l1_setup(struct stmvl53l1_data *data); void stmvl53l1_cleanup(struct stmvl53l1_data *data); +#ifdef CONFIG_PM_SLEEP +void stmvl53l1_pm_suspend_stop(struct stmvl53l1_data *data); +#endif int stmvl53l1_intr_handler(struct stmvl53l1_data *data); -int stmvl53l1_sysfs_laser(struct stmvl53l1_data *data, bool create); /** * request ipp to abort or stop diff --git a/drivers/input/misc/vl53L1/stmvl53l1_i2c.c b/drivers/input/misc/vl53L1/stmvl53l1_i2c.c index fb63b07e49d8..440604f67510 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_i2c.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_i2c.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1_i2c.c vl53l1 linux native i2c interface @@ -37,8 +37,6 @@ #include "stmvl53l1-i2c.h" #include - - #if STMVL53L1_LOG_POLL_TIMING /** * helper to elapse time in polling @@ -46,7 +44,7 @@ */ # define poll_timing_log(ptv) \ - vl53l1_dbgmsg("poll in %d us\n", tv_elapsed_us(ptv)) + vl53l1_dbgmsg("poll in %d us\n", tv_elapsed_us(ptv)) #else # define poll_timing_log(...) (void)0 #endif @@ -68,15 +66,16 @@ static uint32_t tv_elapsed_us(struct timeval *tv) struct timeval now; do_gettimeofday(&now); - return (now.tv_sec - tv->tv_sec)*1000000 + (now.tv_usec - tv->tv_usec); + return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - + tv->tv_usec); } # define cci_access_var struct timeval cci_log_start_tv # define cci_access_start()\ - do_gettimeofday(&cci_log_start_tv) + do_gettimeofday(&cci_log_start_tv) # define cci_access_over(fmt, ...) \ - vl53l1_dbgmsg("cci_timing %d us" fmt "\n", \ - tv_elapsed_us(&cci_log_start_tv), ##__VA_ARGS__) + vl53l1_dbgmsg("cci_timing %d us" fmt "\n", \ + tv_elapsed_us(&cci_log_start_tv), ##__VA_ARGS__) #else # define cci_access_var # define cci_access_start(...) (void)0 @@ -89,12 +88,12 @@ static uint32_t tv_elapsed_us(struct timeval *tv) # define i2c_debug(fmt, ...) (void)0 #endif - VL53L1_Error VL53L1_GetTickCount(uint32_t *ptime_ms) { (void)ptime_ms; BUG_ON(1); } + /** * compute elapsed time in in milli sec based on do_gettimeofday * @param tv pointer to start time_val @@ -110,13 +109,12 @@ static uint32_t tv_elapsed_ms(struct timeval *tv) } static int cci_write(struct stmvl53l1_data *dev, int index, - uint8_t *data, uint16_t len){ - uint8_t buffer[STMVL53L1_MAX_CCI_XFER_SZ+2]; + uint8_t *data, uint16_t len) +{ + uint8_t buffer[STMVL53L1_MAX_CCI_XFER_SZ + 2]; struct i2c_msg msg; - struct i2c_data *i2c_client_obj = - (struct i2c_data *) dev->client_object; - struct i2c_client *client = - (struct i2c_client *) i2c_client_obj->client; + struct i2c_data *i2c_client_obj = (struct i2c_data *)dev->client_object; + struct i2c_client *client = (struct i2c_client *)i2c_client_obj->client; int rc; cci_access_var; @@ -129,17 +127,17 @@ static int cci_write(struct stmvl53l1_data *dev, int index, buffer[0] = (index >> 8) & 0xFF; buffer[1] = (index >> 0) & 0xFF; /* copy write data to buffer after index */ - memcpy(buffer+2, data, len); + memcpy(buffer + 2, data, len); /* set i2c msg */ msg.addr = client->addr; msg.flags = client->flags; msg.buf = buffer; - msg.len = len+2; + msg.len = len + 2; rc = i2c_transfer(client->adapter, &msg, 1); if (rc != 1) { vl53l1_errmsg("wr i2c_transfer err:%d, index 0x%x len %d\n", - rc, index, len); + rc, index, len); } cci_access_over("rd status %d long %d ", rc != 1, len); return rc != 1; @@ -150,10 +148,8 @@ static int cci_read(struct stmvl53l1_data *dev, int index, { uint8_t buffer[2]; struct i2c_msg msg[2]; - struct i2c_data *i2c_client_obj = - (struct i2c_data *) dev->client_object; - struct i2c_client *client = - (struct i2c_client *) i2c_client_obj->client; + struct i2c_data *i2c_client_obj = (struct i2c_data *)dev->client_object; + struct i2c_client *client = (struct i2c_client *)i2c_client_obj->client; int rc; cci_access_var; @@ -168,51 +164,46 @@ static int cci_read(struct stmvl53l1_data *dev, int index, buffer[1] = (index >> 0) & 0xFF; msg[0].addr = client->addr; - msg[0].flags = client->flags;/* Write */ + msg[0].flags = client->flags; /* Write */ msg[0].buf = buffer; msg[0].len = 2; /* read part of the i2c transaction */ msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD|client->flags; + msg[1].flags = I2C_M_RD | client->flags; msg[1].buf = data; msg[1].len = len; rc = i2c_transfer(client->adapter, msg, 2); if (rc != 2) { pr_err("%s: i2c_transfer :%d, @%x index 0x%x len %d\n", - __func__, rc, client->addr, index, len); + __func__, rc, client->addr, index, len); } cci_access_over(" wr len %d status %d", rc != 2, len); return rc != 2; } - -VL53L1_Error VL53L1_WrByte(VL53L1_DEV pdev, - uint16_t index, - uint8_t data) +VL53L1_Error VL53L1_WrByte(VL53L1_DEV pdev, uint16_t index, uint8_t data) { struct stmvl53l1_data *dev; dev = (struct stmvl53l1_data *)container_of(pdev, - struct stmvl53l1_data, stdev); + struct stmvl53l1_data, + stdev); - return cci_write(dev, index, &data, 1); + return cci_write(dev, index, &data, 1); } - -VL53L1_Error VL53L1_RdByte( - VL53L1_DEV pdev, - uint16_t index, - uint8_t *pdata) +VL53L1_Error VL53L1_RdByte(VL53L1_DEV pdev, uint16_t index, uint8_t *pdata) { struct stmvl53l1_data *dev; - dev = (struct stmvl53l1_data *) container_of(pdev, - struct stmvl53l1_data, stdev); + dev = (struct stmvl53l1_data *)container_of(pdev, + struct stmvl53l1_data, + stdev); - return cci_read(dev, index, pdata, 1) ? + return cci_read(dev, index, pdata, 1) ? VL53L1_ERROR_CONTROL_INTERFACE : VL53L1_ERROR_NONE; } @@ -226,13 +217,12 @@ VL53L1_Error VL53L1_WrWord(VL53L1_DEV pdev, uint16_t index, uint16_t data) buffer[0] = (uint8_t) (data >> 8); buffer[1] = (uint8_t) (data & 0x00FF); i2c_debug(" @%x d= %x => [ %x , %x ] ", index, data, buffer[0], - buffer[1]); + buffer[1]); status = VL53L1_WriteMulti(pdev, index, buffer, 2); return status; } - VL53L1_Error VL53L1_RdWord(VL53L1_DEV pdev, uint16_t index, uint16_t *pdata) { VL53L1_Error status; @@ -245,7 +235,6 @@ VL53L1_Error VL53L1_RdWord(VL53L1_DEV pdev, uint16_t index, uint16_t *pdata) return status; } - VL53L1_Error VL53L1_WrDWord(VL53L1_DEV pdev, uint16_t index, uint32_t data) { VL53L1_Error status = VL53L1_ERROR_NONE; @@ -270,7 +259,7 @@ VL53L1_Error VL53L1_RdDWord(VL53L1_DEV pdev, uint16_t index, uint32_t *pdata) status = VL53L1_ReadMulti(pdev, index, buffer, 4); *pdata = ((uint32_t) buffer[0] << 24) + ((uint32_t) buffer[1] << 16) - + ((uint32_t) buffer[2] << 8) + (uint32_t) buffer[3]; + + ((uint32_t) buffer[2] << 8) + (uint32_t) buffer[3]; return status; } @@ -280,11 +269,12 @@ VL53L1_Error VL53L1_WriteMulti(VL53L1_DEV pdev, uint16_t index, { struct stmvl53l1_data *dev; - dev = (struct stmvl53l1_data *) container_of(pdev, - struct stmvl53l1_data, stdev); + dev = (struct stmvl53l1_data *)container_of(pdev, + struct stmvl53l1_data, + stdev); return cci_write(dev, index, pdata, count) ? - VL53L1_ERROR_CONTROL_INTERFACE : VL53L1_ERROR_NONE; + VL53L1_ERROR_CONTROL_INTERFACE : VL53L1_ERROR_NONE; } VL53L1_Error VL53L1_ReadMulti(VL53L1_DEV pdev, uint16_t index, @@ -292,11 +282,12 @@ VL53L1_Error VL53L1_ReadMulti(VL53L1_DEV pdev, uint16_t index, { struct stmvl53l1_data *dev; - dev = (struct stmvl53l1_data *) container_of(pdev, - struct stmvl53l1_data, stdev); + dev = (struct stmvl53l1_data *)container_of(pdev, + struct stmvl53l1_data, + stdev); return cci_read(dev, index, pdata, count) ? - VL53L1_ERROR_CONTROL_INTERFACE : VL53L1_ERROR_NONE; + VL53L1_ERROR_CONTROL_INTERFACE : VL53L1_ERROR_NONE; } static int is_time_over(struct timeval *tv, uint32_t msec) @@ -304,21 +295,20 @@ static int is_time_over(struct timeval *tv, uint32_t msec) return tv_elapsed_ms(tv) >= msec; } -VL53L1_Error VL53L1_WaitValueMaskEx( - VL53L1_DEV pdev, - uint32_t timeout_ms, - uint16_t index, - uint8_t value, - uint8_t mask, - uint32_t poll_delay_ms) +VL53L1_Error VL53L1_WaitValueMaskEx(VL53L1_DEV pdev, + uint32_t timeout_ms, + uint16_t index, + uint8_t value, + uint8_t mask, uint32_t poll_delay_ms) { struct timeval start_tv; struct stmvl53l1_data *dev; int rc, time_over; uint8_t rd_val; - dev = (struct stmvl53l1_data *) container_of(pdev, - struct stmvl53l1_data, stdev); + dev = (struct stmvl53l1_data *)container_of(pdev, + struct stmvl53l1_data, + stdev); do_gettimeofday(&start_tv); do { @@ -343,8 +333,9 @@ VL53L1_Error VL53L1_WaitUs(VL53L1_DEV pdev, int32_t wait_us) { struct stmvl53l1_data *data; - data = (struct stmvl53l1_data *) container_of(pdev, - struct stmvl53l1_data, stdev); + data = (struct stmvl53l1_data *)container_of(pdev, + struct stmvl53l1_data, + stdev); if (!data->is_delay_allowed) return VL53L1_ERROR_PLATFORM_SPECIFIC_START; diff --git a/drivers/input/misc/vl53L1/stmvl53l1_if.h b/drivers/input/misc/vl53L1/stmvl53l1_if.h index cf72213e2e3d..429fce426719 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_if.h +++ b/drivers/input/misc/vl53L1/stmvl53l1_if.h @@ -1,39 +1,39 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1_if.h vl53l1 kernel driver user interface * - * @note to use this header in a user space application it requires + * @note to use this header in a user space application it requires * all st bare/ll driver platform wrapper files (for data struct def) * this files (types etc ..) shall be same or compliant with bar driver version * used in the kernel module @@ -57,7 +57,7 @@ * @li stmvl53l1_ranging1 * @li stmvl53l1_ranging2 */ -#define VL53L1_MISC_DEV_NAME "laser" +#define VL53L1_MISC_DEV_NAME "stmvl53l1_ranging" /** * register data use for simple/single ranging data @ref VL53L1_IOCTL_GETDATAS * @@ -100,8 +100,19 @@ enum __stmv53l1_parameter_name_e { */ VL53L1_TIMINGBUDGET_PAR = 11, /*!< VL53L1_TIMINGBUDGET_PAR - * @ref stmvl53l1_parameter.value field is timing budget in micro second - */ + * @ref stmvl53l1_parameter.value field is timing budget in micro second + * + * @note Please refer to VL53L1 user manual for minimum timing budget according to the selected mode + * + * Mode / timing budget | Min | Typical + * ------------------------------------- | ----- | ------- + * VL53L1_PRESETMODE_RANGING | 8 ms | 16 ms + * VL53L1_PRESETMODE_MULTIZONES_SCANNING | 8 ms | 16 ms + * VL53L1_PRESETMODE_AUTONOMOUS | 41 ms | 76 ms + * VL53L1_PRESETMODE_LITE_RANGING | 17 ms | 66 ms + * VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS | 20 ms | 20 ms + * + */ VL53L1_DISTANCEMODE_PAR = 12, /*!< VL53L1_DISTANCEMODE_PAR @@ -204,18 +215,6 @@ enum __stmv53l1_parameter_name_e { * @li 0 Xtalk values has not been changed. * @li 1 Xtalk values has been changed. */ - - VL53L1_CAMERAMODE_PAR = 23, - /*!< VL53L1_CAMERAMODE_PAR - * valid camera mode value : - * @li 0 device is out of camera mode. - * @li 1 device is in camera mode. - */ - - VL53L1_HWREV_PAR = 24, - /*!< VL53L1_HWREV_PAR - * This is a read only parameter. It will return HW revision number - */ }; #define stmv53l1_parameter_name_e enum __stmv53l1_parameter_name_e @@ -224,10 +223,10 @@ enum __stmv53l1_parameter_name_e { */ struct stmvl53l1_parameter { uint32_t is_read; /*!< [in] 1: Get 0: Set*/ - stmv53l1_parameter_name_e name; /*!< [in] parameter to set/get - * see @ref stmv53l1_parameter_name_e - */ - + /*!< [in] parameter to set/get + * see @ref stmv53l1_parameter_name_e + */ + stmv53l1_parameter_name_e name; int32_t value; /*!< [in/out] value to set /get */ int32_t value2; /*!< [in/out] optional 2nd value */ int32_t status; /*!< [out] status of the operation */ @@ -245,7 +244,7 @@ struct stmvl53l1_roi_t { /*!< specify roi transfer direction \n * @li 0 to get roi * @li !0 to set roi - */ + */ /*! roi data and count type use in @ VL53L1_IOCTL_ROI */ struct roi_cfg_t { uint8_t NumberOfRoi; @@ -259,7 +258,7 @@ struct stmvl53l1_roi_t { * [in] max number provided\n * [out] number of ROI copied back to user\n * @warning 0 will not return any roi datas! - */ + */ VL53L1_UserRoi_t UserRois[1]; /*!< roi data array length definition is 1 but * NumberOfRoi+ FirstRoiToScan in array are required @@ -283,7 +282,7 @@ struct stmvl53l1_roi_full_t { /*!< specify roi transfer direction \n * @li 0 to get roi * @li !0 to set roi - */ + */ VL53L1_RoiConfig_t roi_cfg; /*!< roi data array of max length but only requested copy to/from user * space effectively used @@ -333,6 +332,9 @@ struct stmvl53l1_ioctl_zone_calibration_data_t { /** Select crosstalk calibration in @ref VL53L1_IOCTL_PERFORM_CALIBRATION. * * param1 is calibration method. param2 and param3 not use. + * @li VL53L1_XTALKCALIBRATIONMODE_NO_TARGET + * @li VL53L1_XTALKCALIBRATIONMODE_SINGLE_TARGET + * @li VL53L1_XTALKCALIBRATIONMODE_FULL_ROI */ #define VL53L1_CALIBRATION_CROSSTALK 1 @@ -490,7 +492,7 @@ int smtvl53l1_stop(int fd){ * to ensure race free usage acquiring mutex and/or locks. */ #define VL53L1_IOCTL_GETDATAS \ - _IOWR('p', 0x0b, stmvl531_range_data_t) + _IOWR('p', 0x0b, stmvl531_range_data_t) /** * set or get parameter @@ -507,7 +509,7 @@ int smtvl53l1_stop(int fd){ * @note a set parameter may not be absorbed straight aways ! */ #define VL53L1_IOCTL_PARAMETER \ - _IOWR('p', 0x0d, struct stmvl53l1_parameter) + _IOWR('p', 0x0d, struct stmvl53l1_parameter) /** @@ -538,7 +540,7 @@ int smtvl53l1_stop(int fd){ * @li other errno code could be ll driver specific */ #define VL53L1_IOCTL_ROI\ - _IOWR('p', 0x0e, struct stmvl53l1_roi_t) + _IOWR('p', 0x0e, struct stmvl53l1_roi_t) /** * Get multi object/zone ranging data @@ -556,7 +558,7 @@ int smtvl53l1_stop(int fd){ * as in that case MZ data may not be fully valid */ #define VL53L1_IOCTL_MZ_DATA\ - _IOR('p', 0x0f, VL53L1_MultiRangingData_t) + _IOR('p', 0x0f, VL53L1_MultiRangingData_t) /** * get single ranging data @sa for multi zone/objet @@ -573,7 +575,7 @@ int smtvl53l1_stop(int fd){ * @li -ERESTARTSYS interrupt while sleeping. */ #define VL53L1_IOCTL_GETDATAS_BLOCKING\ - _IOWR('p', 0x10, stmvl531_range_data_t) + _IOWR('p', 0x10, stmvl531_range_data_t) /** * Get multi object/zone ranging data @@ -592,7 +594,7 @@ int smtvl53l1_stop(int fd){ * as in that case MZ data may not be fully valid */ #define VL53L1_IOCTL_MZ_DATA_BLOCKING\ - _IOR('p', 0x11, VL53L1_MultiRangingData_t) + _IOR('p', 0x11, VL53L1_MultiRangingData_t) /** * Get / set calibration data @@ -676,34 +678,5 @@ int smtvl53l1_stop(int fd){ #define VL53L1_IOCTL_AUTONOMOUS_CONFIG\ _IOWR('p', 0x14, struct stmvl53l1_autonomous_config_t) -/** - * suspend ranging (no argument) - - * @note sysfs and ioctl control are assumed mutual exclusive use - * control from ioctl execute action with no consideration of sysfs path. - * - * @return - * @li 0 on success - * @li -EBUSY if it was already - * @li other specific error code shall be >0 - * - * c example userland : - @code -int smtvl53l1_stop(int fd){ - int rc; - rc= ioctl(fd, VL53L1_IOCTL_SUSPEND,NULL); - if( rc ){ - if( errno == EBUSY ){ - ioctl_warn("already suspended"); - return errno; - } - ioctl_error("%d %s", rc,strerror(errno)); - } - return rc; -} -@endcode - */ -#define VL53L1_IOCTL_SUSPEND _IO('p', 0x15) - /** @} */ /* ioctl group */ -#endif /* STMVL53L1_IF_H */ +#endif /* STMVL53L1_IF_H */ \ No newline at end of file diff --git a/drivers/input/misc/vl53L1/stmvl53l1_internal_if.h b/drivers/input/misc/vl53L1/stmvl53l1_internal_if.h index 1cd8afe6ce00..5a4c004c1ffd 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_internal_if.h +++ b/drivers/input/misc/vl53L1/stmvl53l1_internal_if.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef STMVL53L1_INTERNAL_IF_H #define STMVL53L1_INTERNAL_IF_H @@ -49,14 +49,17 @@ struct stmvl53l1_register { uint8_t b; /*!< single data byte*/ uint16_t w; /*!< single data word (16 bits)*/ uint32_t dw; /*!< single data dword (32 bits)*/ - uint8_t bytes[256]; /*!< any size byte array - * @note only effectively used array size is needed and will be - * set/used another possible register definition is - * @ref stmvl53l1_register_flexi - */ - } data; /*!< data only *@warning device is big endian and - * no endianess adaptation is performed by @ref VL53L1_IOCTL_REGISTER - */ + /*!< any size byte array + * @note only effectively used array size is needed and will be + * set/used another possible register definition is + * @ref stmvl53l1_register_flexi + */ + uint8_t bytes[256]; + /*!< data only *@warning device is big endian and + * no endianess adaptation is performed by + * @ref VL53L1_IOCTL_REGISTER + */ + } data; }; struct stmvl53l1_register_flexi { @@ -66,8 +69,8 @@ struct stmvl53l1_register_flexi { int32_t status; /*!< [out] operation status 0 ok else error */ uint8_t data[]; /*!< [in/out] flexible array size data */ /*!< data only *@warning device is big endian and - * no endianess adaptation is performed by @ref VL53L1_IOCTL_REGISTER - */ + * no endianess adaptation is performed by @ref VL53L1_IOCTL_REGISTER + */ }; #define VL53L1_IOCTL_REGISTER _IOWR('p', 0x0c, struct stmvl53l1_register) diff --git a/drivers/input/misc/vl53L1/stmvl53l1_ipp.h b/drivers/input/misc/vl53L1/stmvl53l1_ipp.h index cd8bc0b48b78..31e75a196deb 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_ipp.h +++ b/drivers/input/misc/vl53L1/stmvl53l1_ipp.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1_ipp.h @@ -319,7 +319,7 @@ struct ipp_work_t { * * we substract size of of item above * must be lesss than one netlink packet -*/ + */ #define MAX_IPP_DATA ((4096-4*3)/8) ipp_arg_t data[MAX_IPP_DATA]; /*!< [in][out] */ }; @@ -327,7 +327,7 @@ struct ipp_work_t { /** * size of header only message ( no payload) * require \#include in user land -*/ + */ #define IPP_WORK_HDR_SIZE (offsetof(struct ipp_work_t, data[0])) /** * max payload per ipp transfer diff --git a/drivers/input/misc/vl53L1/stmvl53l1_ipp_nl.c b/drivers/input/misc/vl53L1/stmvl53l1_ipp_nl.c index ccf1ec687552..af4dc93bf0cc 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_ipp_nl.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_ipp_nl.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1_ipp_nl.c vl53l1 ipp proxy over netlink kernel side @@ -153,6 +153,9 @@ int ipp_in_process(struct ipp_work_t *pwork) /* work id check already done */ data = stmvl53l1_dev_table[pwork->dev_id]; ipp_dbg("to lock "); + /* Release now useless ipp_mutex for below work since we may deadlock + * with irq path. + */ mutex_unlock(&ipp_mutex); mutex_lock(&data->work_mutex); if (data->ipp.buzy == IPP_STATE_PENDING) { @@ -280,7 +283,7 @@ static void stmvl53l1_nl_recv_msg(struct sk_buff *skb_in) mutex_lock(&ipp_mutex); - if (pwork->dev_id >= STMVL53L1_CFG_MAX_DEV) { + if ((pwork->dev_id >= STMVL53L1_CFG_MAX_DEV) || (pwork->dev_id < 0)) { ipp_err("invalid dev id on msg %d", pwork->dev_id); _ipp_dump_work(pwork, IPP_WORK_MAX_PAYLOAD, STMVL53L1_CFG_MAX_DEV); diff --git a/drivers/input/misc/vl53L1/stmvl53l1_log.c b/drivers/input/misc/vl53L1/stmvl53l1_log.c index 6a10fe3cf289..ecedcb446dda 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_log.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_log.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 /stmvl53l1_module.c vl53l1_module ST VL53L1 linux kernel module * diff --git a/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c b/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c index 161b4e646f81..f35424f759fc 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_module-i2c.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 stmvl53l1_module-i2c.c @@ -109,7 +109,7 @@ static struct i2c_client *stm_test_i2c_client; * panda * insmod stmvl53l1.ko force_device=1 adapter_nb=4 xsdn_gpio_nb=56 * intr_gpio_nb=59 pwren_gpio_nb=55 -*/ + */ static int force_device; static int adapter_nb = -1; @@ -117,19 +117,19 @@ static int xsdn_gpio_nb = -1; static int pwren_gpio_nb = -1; static int intr_gpio_nb = -1; -module_param(force_device, int, 0); +module_param(force_device, int, 0000); MODULE_PARM_DESC(force_device, "force device insertion at module init"); -module_param(adapter_nb, int, 0); +module_param(adapter_nb, int, 0000); MODULE_PARM_DESC(adapter_nb, "i2c adapter to use"); -module_param(xsdn_gpio_nb, int, 0); +module_param(xsdn_gpio_nb, int, 0000); MODULE_PARM_DESC(xsdn_gpio_nb, "select gpio numer to use for vl53l1 reset"); -module_param(pwren_gpio_nb, int, 0); +module_param(pwren_gpio_nb, int, 0000); MODULE_PARM_DESC(pwren_gpio_nb, "select gpio numer to use for vl53l1 power"); -module_param(intr_gpio_nb, int, 0); +module_param(intr_gpio_nb, int, 0000); MODULE_PARM_DESC(intr_gpio_nb, "select gpio numer to use for vl53l1 interrupt"); /** @@ -157,12 +157,6 @@ MODULE_PARM_DESC(intr_gpio_nb, "select gpio numer to use for vl53l1 interrupt"); # define modi2c_dbg(...) (void)0 #endif -struct vl53l1_pinctrl_info { - struct pinctrl *pinctrl; - struct pinctrl_state *gpio_state_active; - struct pinctrl_state *gpio_state_suspend; -} g_pinctrl_info; - static int insert_device(void) { int ret = 0; @@ -335,35 +329,6 @@ static void put_intr(struct i2c_data *i2c_data) i2c_data->intr_gpio = -1; } -static int get_dt_xtalk_data(struct device_node *of_node, - struct stmvl53l1_data *vl53l1_data) -{ - int rc = 0; - uint32_t x_array[3] = {0}; - - if(of_node == NULL || vl53l1_data == NULL) - return -EINVAL; - - rc = of_property_read_u32_array(of_node, "st,xtalkval", - x_array, 3); - if (rc) { - vl53l1_errmsg("failed to read xtalk-offset\n"); - vl53l1_data->xtalk_offset = 0; - vl53l1_data->xtalk_x = 0; - vl53l1_data->xtalk_y = 0; - } else { - vl53l1_data->xtalk_offset = (uint16_t)x_array[0] & 0xFFFF; - vl53l1_data->xtalk_x = (int16_t)(x_array[1] & 0xFFFF); - vl53l1_data->xtalk_y = (int16_t)(x_array[2] & 0xFFFF); - } - - vl53l1_info("xtalk info: %u %d %d\n", - vl53l1_data->xtalk_offset, - vl53l1_data->xtalk_x, - vl53l1_data->xtalk_y); - return rc; -} - /** * parse dev tree for all platform specific input */ @@ -385,7 +350,7 @@ static int stmvl53l1_parse_tree(struct device *dev, struct i2c_data *i2c_data) i2c_data->intr_gpio = intr_gpio_nb; } else if (dev->of_node) { /* power : either vdd or pwren_gpio. try reulator first */ - i2c_data->vdd = regulator_get(dev, "vdd-vl53l1"); + i2c_data->vdd = regulator_get_optional(dev, "vdd"); if (IS_ERR(i2c_data->vdd) || i2c_data->vdd == NULL) { i2c_data->vdd = NULL; /* try gpio */ @@ -397,40 +362,19 @@ static int stmvl53l1_parse_tree(struct device *dev, struct i2c_data *i2c_data) "no regulator, nor power gpio => power ctrl disabled"); } } - - g_pinctrl_info.pinctrl = devm_pinctrl_get(dev); - if (!IS_ERR_OR_NULL(g_pinctrl_info.pinctrl)) { - g_pinctrl_info.gpio_state_active = - pinctrl_lookup_state(g_pinctrl_info.pinctrl, - "laser_default"); - - g_pinctrl_info.gpio_state_suspend = - pinctrl_lookup_state(g_pinctrl_info.pinctrl, - "laser_suspend"); - } else - vl53l1_errmsg("Getting pinctrl handle failed\n"); - rc = of_property_read_u32_array(dev->of_node, "xsdn-gpio", &i2c_data->xsdn_gpio, 1); if (rc) { vl53l1_wanrmsg("Unable to find xsdn-gpio %d %d", rc, i2c_data->xsdn_gpio); - if (of_gpio_count(dev->of_node) >= 2) - i2c_data->xsdn_gpio = of_get_gpio(dev->of_node, - 0); - else - i2c_data->xsdn_gpio = -1; + i2c_data->xsdn_gpio = -1; } rc = of_property_read_u32_array(dev->of_node, "intr-gpio", &i2c_data->intr_gpio, 1); if (rc) { vl53l1_wanrmsg("Unable to find intr-gpio %d %d", rc, i2c_data->intr_gpio); - if (of_gpio_count(dev->of_node) >= 2) - i2c_data->intr_gpio = of_get_gpio(dev->of_node, - 1); - else - i2c_data->intr_gpio = -1; + i2c_data->intr_gpio = -1; } rc = of_property_read_u32_array(dev->of_node, "boot-reg", &i2c_data->boot_reg, 1); @@ -439,8 +383,6 @@ static int stmvl53l1_parse_tree(struct device *dev, struct i2c_data *i2c_data) rc, i2c_data->boot_reg); i2c_data->boot_reg = STMVL53L1_SLAVE_ADDR; } - - get_dt_xtalk_data(dev->of_node, i2c_data->vl53l1_data); } /* configure gpios */ @@ -522,11 +464,6 @@ static int stmvl53l1_probe(struct i2c_client *client, /* end up by core driver setup */ rc = stmvl53l1_setup(vl53l1_data); - if (rc) - goto release_gpios; - - vl53l1_data->sysfs_base = i2c_data->client->addr; - rc = stmvl53l1_sysfs_laser(vl53l1_data, true); if (rc) goto release_gpios; vl53l1_dbgmsg("End\n"); @@ -553,9 +490,6 @@ static int stmvl53l1_remove(struct i2c_client *client) vl53l1_dbgmsg("Enter\n"); mutex_lock(&data->work_mutex); - - stmvl53l1_sysfs_laser(data, false); - /* main driver cleanup */ stmvl53l1_cleanup(data); @@ -571,6 +505,48 @@ static int stmvl53l1_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM_SLEEP +static int stmvl53l1_suspend(struct device *dev) +{ + struct stmvl53l1_data *data = i2c_get_clientdata(to_i2c_client(dev)); + + vl53l1_dbgmsg("Enter\n"); + mutex_lock(&data->work_mutex); + /* Stop ranging */ + stmvl53l1_pm_suspend_stop(data); + + mutex_unlock(&data->work_mutex); + + vl53l1_dbgmsg("End\n"); + + return 0; +} + +static int stmvl53l1_resume(struct device *dev) +{ +#if 0 + struct stmvl53l1_data *data = i2c_get_clientdata(to_i2c_client(dev)); + + vl53l1_dbgmsg("Enter\n"); + + mutex_lock(&data->work_mutex); + + /* do nothing user will restart measurements */ + + mutex_unlock(&data->work_mutex); + + vl53l1_dbgmsg("End\n"); +#else + vl53l1_dbgmsg("Enter\n"); + vl53l1_dbgmsg("End\n"); +#endif + return 0; +} +#endif + + +static SIMPLE_DEV_PM_OPS(stmvl53l1_pm_ops, stmvl53l1_suspend, stmvl53l1_resume); + static const struct i2c_device_id stmvl53l1_id[] = { { STMVL53L1_DRV_NAME, 0 }, { }, @@ -587,6 +563,7 @@ static struct i2c_driver stmvl53l1_driver = { .name = STMVL53L1_DRV_NAME, .owner = THIS_MODULE, .of_match_table = st_stmvl53l1_dt_match, + .pm = &stmvl53l1_pm_ops, }, .probe = stmvl53l1_probe, .remove = stmvl53l1_remove, @@ -725,8 +702,6 @@ int stmvl53l1_reset_release_i2c(void *i2c_object) vl53l1_dbgmsg("Enter\n"); rc = release_reset(data); - pinctrl_select_state(g_pinctrl_info.pinctrl, - g_pinctrl_info.gpio_state_active); if (rc) goto error; @@ -761,9 +736,6 @@ int stmvl53l1_reset_hold_i2c(void *i2c_object) gpio_set_value(data->xsdn_gpio, 0); - pinctrl_select_state(g_pinctrl_info.pinctrl, - g_pinctrl_info.gpio_state_suspend); - vl53l1_dbgmsg("End\n"); return 0; diff --git a/drivers/input/misc/vl53L1/stmvl53l1_module.c b/drivers/input/misc/vl53L1/stmvl53l1_module.c index e1e020ef333a..0f32db9b6ec6 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_module.c +++ b/drivers/input/misc/vl53L1/stmvl53l1_module.c @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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 /stmvl53l1_module.c vl53l1_module ST VL53L1 linux kernel module * @@ -88,7 +88,6 @@ * Can be change at run time via @ref vl53l1_ioctl or @ref sysfs_attrib */ #define STMVL53L1_CFG_TIMING_BUDGET_US 16000 -#define STMVL53L1_CFG_SAR_MODE_TIMING_BUDGET_US 76000 /** default preset ranging mode */ #define STMVL53L1_CFG_DEFAULT_MODE VL53L1_PRESETMODE_RANGING @@ -97,13 +96,7 @@ #define STMVL53L1_CFG_DEFAULT_DISTANCE_MODE VL53L1_DISTANCEMODE_LONG /** default crosstalk enable */ -#define STMVL53L1_CFG_DEFAULT_CROSSTALK_ENABLE 1 - -/** default crosstalk for autonomous mode */ -#define STMVL53L1_CFG_DEFAULT_CROSSTALK_AUTONOMOUS 1000 - -/** max distance value mm */ -#define STMVL53L1_MAX_DISTANCE 0x1FFF +#define STMVL53L1_CFG_DEFAULT_CROSSTALK_ENABLE 0 /** default output mode */ #define STMVL53L1_CFG_DEFAULT_OUTPUT_MODE VL53L1_OUTPUTMODE_NEAREST @@ -141,6 +134,26 @@ struct timeval start_tv, stop_tv; #endif +/* Set special tuning parameters for VL53L3 (ticket 513812) */ +static const int tunings_L3[][2] = { + {VL53L1_TUNINGPARM_HIST_AMB_THRESH_SIGMA_1, 80}, + {VL53L1_TUNINGPARM_HIST_SIGNAL_TOTAL_EVENTS_LIMIT, 50}, + {VL53L1_TUNINGPARM_HIST_SIGMA_THRESH_MM, 180}, + {VL53L1_TUNINGPARM_CONSISTENCY_HIST_MIN_MAX_TOLERANCE_MM, 0}, + {VL53L1_TUNINGPARM_XTALK_DETECT_MAX_VALID_RATE_KCPS, 400}, + {VL53L1_TUNINGPARM_HIST_XTALK_MARGIN_KCPS, 0}, + {VL53L1_TUNINGPARM_XTALK_EXTRACT_NUM_OF_SAMPLES, 13}, + {VL53L1_TUNINGPARM_XTALK_EXTRACT_MAX_VALID_RATE_KCPS, 640}, + {VL53L1_TUNINGPARM_DYNXTALK_SMUDGE_MARGIN, 0}, + {VL53L1_TUNINGPARM_DYNXTALK_NOISE_MARGIN, 100}, + {VL53L1_TUNINGPARM_DYNXTALK_SINGLE_XTALK_DELTA, 2048}, + {VL53L1_TUNINGPARM_DYNXTALK_AVERAGED_XTALK_DELTA, 308}, + {VL53L1_TUNINGPARM_DYNXTALK_CLIP_LIMIT, 10240}, + {VL53L1_TUNINGPARM_DYNXTALK_XTALK_AMB_THRESHOLD, 128}, + {VL53L1_TUNINGPARM_DYNXTALK_NODETECT_SAMPLE_LIMIT, 40} +}; +/* End of Set special tuning parameters for VL53L3 (ticket 513812) */ + /* Set default value to 1 to allow to see module insertion debug messages */ int stmvl53l1_enable_debug = 1; @@ -152,12 +165,6 @@ static int stmvl53l1_open(struct inode *inode, struct file *file); static int stmvl53l1_release(struct inode *inode, struct file *file); static int ctrl_start(struct stmvl53l1_data *data); static int ctrl_stop(struct stmvl53l1_data *data); -static int ctrl_suspend(struct stmvl53l1_data *data); - -#ifdef CONFIG_COMPAT -static long stmvl53l1_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg); -#endif static bool force_device_on_en_default = true; @@ -317,9 +324,6 @@ struct stmvl53l1_data *stmvl53l1_dev_table[STMVL53L1_CFG_MAX_DEV]; static const struct file_operations stmvl53l1_ranging_fops = { .owner = THIS_MODULE, .unlocked_ioctl = stmvl53l1_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = stmvl53l1_compat_ioctl, -#endif .open = stmvl53l1_open, .release = stmvl53l1_release, /* .flush = stmvl53l0_flush, */ @@ -420,13 +424,6 @@ static int reset_release(struct stmvl53l1_data *data) if (!data->reset_state) return 0; - vl53l1_dbgmsg("turn on vdd\n"); - rc = stmvl53l1_module_func_tbl.power_up(data->client_object); - if (rc) { - vl53l1_errmsg("%d,error rc %d\n", __LINE__, rc); - return rc; - } - rc = stmvl53l1_module_func_tbl.reset_release(data->client_object); if (rc) vl53l1_errmsg("reset release fail rc=%d\n", rc); @@ -450,13 +447,6 @@ static int reset_hold(struct stmvl53l1_data *data) if (!rc) data->reset_state = 1; - vl53l1_dbgmsg("turn off vdd\n"); - rc = stmvl53l1_module_func_tbl.power_down(data->client_object); - if (rc) { - vl53l1_errmsg("%d,error rc %d\n", __LINE__, rc); - return rc; - } - return rc; } @@ -500,7 +490,7 @@ static void dump_roi(VL53L1_UserRoi_t *rois, uint32_t n) # define dump_roi(...) (void)0 #endif -static int setup_tunings(struct stmvl53l1_data *data) +static int setup_tunings(struct stmvl53l1_data *data, uint8_t ProductType) { int rc = 0; int i; @@ -514,6 +504,40 @@ static int setup_tunings(struct stmvl53l1_data *data) } } + /* Set special tuning parameters for VL53L3 (ticket 513812) */ + if ((!rc) && (ProductType == 0xAA)) + { + for (i = 0; i < ARRAY_SIZE(tunings_L3); i++) { + rc = VL53L1_SetTuningParameter(&data->stdev, tunings_L3[i][0], + tunings_L3[i][1]); + if (rc) { + rc = store_last_error(data, rc); + break; + } + } + + if (!rc) { + /* Special setting forbidden by VL53L1_SetTuningParameter + * (ticket 487847) + * Use VL53L1_set_tuning_parm to force a specific value */ + rc = VL53L1_set_tuning_parm(&data->stdev, + VL53L1_TUNINGPARM_DYNXTALK_NODETECT_XTALK_OFFSET_KCPS, + 410); + if (rc) + rc = store_last_error(data, rc); + } + + if (!rc) { + /*Some default settings here for VL53L3*/ + data->timing_budget = 30000; + data->crosstalk_enable = 1; + data->dmax_mode = VL53L1_DMAXMODE_CUSTCAL_DATA; + data->smudge_correction_mode = VL53L1_SMUDGE_CORRECTION_CONTINUOUS; + data->dmax_reflectance = (5 << 16); + } + } + /* End of Set special tuning parameters for VL53L3 (ticket 513812) */ + return rc; } @@ -581,33 +605,15 @@ static int stmvl53l1_check_calibration_id(struct stmvl53l1_data *data) } /** - * start sensor - * - * @warning must be used if only stopped - * @param data device data - * @return 0 on sucess - */ -static int stmvl53l1_start(struct stmvl53l1_data *data) + * send params to sensor + * + * @warning must be used if only stopped + * @param data device data + * @return 0 on sucess + */ +static int stmvl53l1_sendparams(struct stmvl53l1_data *data) { int rc; - VL53L1_CalibrationData_t cali; - - data->is_first_irq = true; - data->is_data_valid = false; - data->is_xtalk_value_changed = false; - - rc = reset_release(data); - if (rc) - goto done; - - /* full setup when out of reset or power up */ - rc = VL53L1_StaticInit(&data->stdev); - if (rc) { - vl53l1_errmsg("VL53L1_StaticInit @%d fail %d\n", - __LINE__, rc); - rc = store_last_error(data, rc); - goto done; - } /* activated stored or last request defined mode */ rc = VL53L1_SetPresetMode(&data->stdev, data->preset_mode); @@ -618,20 +624,6 @@ static int stmvl53l1_start(struct stmvl53l1_data *data) goto done; } - if (data->preset_mode == VL53L1_PRESETMODE_AUTONOMOUS) { - /* disable xtalk and set short distance mode - * for autonomous mode */ - data->crosstalk_enable = 0; - data->distance_mode = VL53L1_DISTANCEMODE_SHORT; - } else { - /* restore xtalk and distance mode to default - * values for non-autonomous mode */ - data->crosstalk_enable = - STMVL53L1_CFG_DEFAULT_CROSSTALK_ENABLE; - data->distance_mode = - STMVL53L1_CFG_DEFAULT_DISTANCE_MODE; - } - rc = VL53L1_SetXTalkCompensationEnable(&data->stdev, data->crosstalk_enable); if (rc) { @@ -723,6 +715,62 @@ static int stmvl53l1_start(struct stmvl53l1_data *data) vl53l1_dbgmsg("using default ROI\n"); } + /* set autonomous mode configuration */ + if ((data->preset_mode == VL53L1_PRESETMODE_AUTONOMOUS) || + (data->preset_mode == VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS)) { + rc = VL53L1_SetInterMeasurementPeriodMilliSeconds(&data->stdev, + data->auto_pollingTimeInMs); + if (rc) { + vl53l1_errmsg("Fail to set auto period %d\n", rc); + rc = store_last_error(data, rc); + goto done; + } + rc = VL53L1_SetThresholdConfig(&data->stdev, + &data->auto_config); + if (rc) { + vl53l1_errmsg("Fail to set auto config %d\n", rc); + rc = store_last_error(data, rc); + goto done; + } + } + +done: + + return rc; +} + +/** + * start sensor + * + * @warning must be used if only stopped + * @param data device data + * @return 0 on sucess + */ +static int stmvl53l1_start(struct stmvl53l1_data *data) +{ + int rc; + + data->is_first_irq = true; + data->is_data_valid = false; + data->is_xtalk_value_changed = false; + + rc = reset_release(data); + if (rc) + goto done; + + /* full setup when out of reset or power up */ + rc = VL53L1_StaticInit(&data->stdev); + if (rc) { + vl53l1_errmsg("VL53L1_StaticInit @%d fail %d\n", + __LINE__, rc); + rc = store_last_error(data, rc); + goto done; + } + + rc = stmvl53l1_sendparams(data); + if (rc) + goto done; + /* init the timing */ do_gettimeofday(&data->start_tv); data->meas.start_tv = data->start_tv; @@ -732,69 +780,6 @@ static int stmvl53l1_start(struct stmvl53l1_data *data) memset(&data->meas.single_range_data, 0, sizeof(VL53L1_RangingMeasurementData_t)); - memset(&cali, 0, sizeof(cali)); - rc = VL53L1_GetCalibrationData(&data->stdev, &cali); - if (rc) { - vl53l1_errmsg("VL53L1_GetCalibrationData fail\n"); - rc = store_last_error(data, rc); - goto done; - } - - /* set autonomous mode configuration */ - if ((data->preset_mode == VL53L1_PRESETMODE_AUTONOMOUS) || - (data->preset_mode == VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS)) { - if (data->cam_mode == 0) { - rc = VL53L1_SetInterMeasurementPeriodMilliSeconds( - &data->stdev, - data->auto_pollingTimeInMs); - if (rc) { - vl53l1_errmsg("Fail to set auto period %d\n", - rc); - rc = store_last_error(data, rc); - goto done; - } - rc = VL53L1_SetThresholdConfig(&data->stdev, - &data->auto_config); - if (rc) { - vl53l1_errmsg("Fail to set auto config %d\n", - rc); - rc = store_last_error(data, rc); - goto done; - } - } else { - /* set camera autonomous configration */ - rc = VL53L1_SetInterMeasurementPeriodMilliSeconds( - &data->stdev, - data->auto_pollingTimeInMs_cam); - if (rc) { - vl53l1_errmsg("Fail to set auto period %d\n", - rc); - rc = store_last_error(data, rc); - goto done; - } - rc = VL53L1_SetThresholdConfig(&data->stdev, - &data->auto_config_cam); - if (rc) { - vl53l1_errmsg("Fail to set auto config %d\n", - rc); - rc = store_last_error(data, rc); - goto done; - } - } - cali.customer.algo__crosstalk_compensation_plane_offset_kcps - = STMVL53L1_CFG_DEFAULT_CROSSTALK_AUTONOMOUS; - } else { - cali.customer.algo__crosstalk_compensation_plane_offset_kcps - = data->xtalk_offset; - } - - rc = VL53L1_SetCalibrationData(&data->stdev, &cali); - if (rc) { - vl53l1_errmsg("VL53L1_SetCalibrationData fail\n"); - rc = store_last_error(data, rc); - goto done; - } - data->allow_hidden_start_stop = false; /* kick off ranging */ rc = VL53L1_StartMeasurement(&data->stdev); @@ -857,54 +842,6 @@ static int stmvl53l1_stop(struct stmvl53l1_data *data) return rc; } -static int activate_sar_mode(struct stmvl53l1_data *data) -{ - int rc = VL53L1_ERROR_NONE; - - if (data == NULL) - return -EFAULT; - - if (data->enable_sensor == 0 && - !data->is_calibrating && - data->sar_mode == 1 && - data->cam_mode != 1) { - data->preset_mode = VL53L1_PRESETMODE_AUTONOMOUS; - data->timing_budget = STMVL53L1_CFG_SAR_MODE_TIMING_BUDGET_US; - rc = stmvl53l1_start(data); - if (rc == VL53L1_ERROR_NONE) - vl53l1_info("sensor in sar mode!\n"); - else - vl53l1_errmsg("fail to active sar err %d\n", rc); - } else - vl53l1_info("skip sar activation\n"); - - return rc; -} - -static int deactivate_sar_mode(struct stmvl53l1_data *data) -{ - int rc = VL53L1_ERROR_NONE; - - if (data == NULL) - return -EFAULT; - - if (data->enable_sensor == 1 && - !data->is_calibrating && - data->preset_mode == VL53L1_PRESETMODE_AUTONOMOUS && - data->cam_mode != 1) { - rc = stmvl53l1_stop(data); - if (rc == VL53L1_ERROR_NONE) { - vl53l1_info("sensor is out of sar mode!\n"); - /* set preset mode back to default ranging mode */ - data->preset_mode = VL53L1_PRESETMODE_RANGING; - } else - vl53l1_errmsg("fail to deactivate sar err %d\n", rc); - } else - vl53l1_info("sar is not actived, skip deactivation\n"); - - return rc; -} - /* * SysFS support */ @@ -921,7 +858,7 @@ static ssize_t stmvl53l1_store_enable_ps_sensor(struct device *dev, size_t count) { struct stmvl53l1_data *data = dev_get_drvdata(dev); - int rc; + int rc = 0; unsigned long val; rc = kstrtoul(buf, 10, &val); @@ -929,11 +866,40 @@ static ssize_t stmvl53l1_store_enable_ps_sensor(struct device *dev, vl53l1_errmsg("enable sensor syntax in %s\n", buf); return -EINVAL; } - val = val ? 1 : 0; - vl53l1_dbgmsg("enable_sensor is %d => %d\n", - data->enable_sensor, (int)val); + if (val == 1) { + rc = ctrl_start(data); + } else if (val == 0) { + rc = ctrl_stop(data); + } else { + //TODO: Remove this workaround after investigation + //see Codex - 479397 for details + vl53l1_dbgmsg("Unclog Input sub-system\n"); + /* Unclog the input device sub-system */ + input_report_abs(data->input_dev_ps, ABS_HAT0X, -1); + input_report_abs(data->input_dev_ps, ABS_HAT0Y, -1); + input_report_abs(data->input_dev_ps, ABS_HAT1X, -1); + input_report_abs(data->input_dev_ps, ABS_HAT1Y, -1); + input_report_abs(data->input_dev_ps, ABS_HAT2X, -1); + input_report_abs(data->input_dev_ps, ABS_HAT2Y, -1); + input_report_abs(data->input_dev_ps, ABS_HAT3X, -1); + input_report_abs(data->input_dev_ps, ABS_HAT3Y, -1); + input_report_abs(data->input_dev_ps, ABS_WHEEL, -1); + input_report_abs(data->input_dev_ps, ABS_BRAKE, -1); + input_report_abs(data->input_dev_ps, ABS_GAS, -1); + input_report_abs(data->input_dev_ps, ABS_TILT_X, -1); + input_report_abs(data->input_dev_ps, ABS_TILT_Y, -1); + input_report_abs(data->input_dev_ps, ABS_TOOL_WIDTH, -1); + input_report_abs(data->input_dev_ps, ABS_DISTANCE, -1); + input_report_abs(data->input_dev_ps, ABS_THROTTLE, -1); + input_report_abs(data->input_dev_ps, ABS_RUDDER, -1); + input_report_abs(data->input_dev_ps, ABS_MISC, -1); + input_report_abs(data->input_dev_ps, ABS_VOLUME, + -1); + input_sync(data->input_dev_ps); + vl53l1_dbgmsg("Unclog the input sub-system\n"); + rc = 0; + } - rc = val == 1 ? ctrl_start(data) : ctrl_stop(data); vl53l1_dbgmsg("End\n"); return rc ? rc : count; @@ -1395,13 +1361,15 @@ static DEVICE_ATTR(offset_correction_mode, 0660/*S_IWUGO | S_IRUGO*/, stmvl53l1_store_offset_correction_mode); static ssize_t stmvl53l1_do_flush(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) { + struct device_attribute *attr, const char *buf, size_t count) +{ struct stmvl53l1_data *data = dev_get_drvdata(dev); mutex_lock(&data->work_mutex); data->flush_todo_counter++; - stmvl53l1_insert_flush_events_lock(data); + if (data->enable_sensor == 0) + stmvl53l1_insert_flush_events_lock(data); mutex_unlock(&data->work_mutex); @@ -1574,6 +1542,9 @@ static ssize_t stmvl53l1_store_autonomous_config(struct device *dev, mutex_lock(&data->work_mutex); + if (data->enable_sensor) + goto busy; + buf = parse_integer(buf, &pollingTimeInMs); if (!buf) goto invalid; @@ -1616,6 +1587,11 @@ static ssize_t stmvl53l1_store_autonomous_config(struct device *dev, return count; +busy: + vl53l1_errmsg("can't change config while ranging"); + rc = -EBUSY; + goto error; + invalid: vl53l1_errmsg("invalid syntax in %s", buf_ori); rc = -EINVAL; @@ -1813,8 +1789,15 @@ static int stmvl53l1_set_tuning(struct stmvl53l1_data *data, int key, { int rc; - if (data->is_first_start_done) + if (data->enable_sensor) { + vl53l1_errmsg("can't change tuning params while ranging\n"); return -EBUSY; + } + + if (data->is_calibrating) { + vl53l1_errmsg("can't change tuning params while calibrating\n"); + return -EBUSY; + } if (key & ~0xffff) return -EINVAL; @@ -2000,142 +1983,6 @@ static DEVICE_ATTR(is_xtalk_value_changed, 0440/*S_IRUGO*/, stmvl53l1_show_is_xtalk_value_changed_config, NULL); -static ssize_t stmvl53l1_show_enable_sar(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct stmvl53l1_data *data = dev_get_drvdata(dev); - - return scnprintf(buf, PAGE_SIZE, "%d\n", data->sar_mode); -} - -static ssize_t stmvl53l1_store_enable_sar(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct stmvl53l1_data *data = dev_get_drvdata(dev); - int rc = 0; - int mode; - - mutex_lock(&data->work_mutex); - - if (kstrtoint(buf, 0, &mode)) { - vl53l1_errmsg("invalid syntax in %s\n", buf); - rc = -EINVAL; - } else { - data->sar_mode = mode?1:0; - vl53l1_dbgmsg("sar mode is set to %d\n", data->sar_mode); - - if (data->sar_mode == 1) { - if (mode == 1) { - /* report far distance as initial value */ - struct input_dev *input = data->input_dev_ps; - - input_report_abs(input, ABS_HAT1X, 100); - input_report_abs(input, ABS_HAT1X, 101); - input_report_abs(input, ABS_HAT1X, 100); - input_sync(input); - } - activate_sar_mode(data); - } else - deactivate_sar_mode(data); - } - - mutex_unlock(&data->work_mutex); - - return rc ? rc : count; -} - -/** - * sysfs attribute "enable_sar" [rd/wr] - * - * To enable/disable the sar mode - * @li 0 disable sar mode - * @li 1 enable sar mode - * - * @ingroup sysfs_attrib - */ -static DEVICE_ATTR(enable_sar, 0660/*S_IWUGO | S_IRUGO*/, - stmvl53l1_show_enable_sar, - stmvl53l1_store_enable_sar); - -static ssize_t stmvl53l1_show_offset(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct stmvl53l1_data *data = dev_get_drvdata(dev); - - return scnprintf(buf, PAGE_SIZE, "%d,%d\n", - data->inner_offset, data->outer_offset); -} - -static ssize_t stmvl53l1_store_offset(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct stmvl53l1_data *data = dev_get_drvdata(dev); - VL53L1_CalibrationData_t cali_data; - int rc = 0; - int n = 0; - int inner = 0; - int outer = 0; - - mutex_lock(&data->work_mutex); - - if (data->enable_sensor) { - vl53l1_errmsg("can't set offset while ranging\n"); - rc = -EBUSY; - goto finish; - } - - n = sscanf(buf, "%d,%d", &inner, &outer); - if(n != 2) { - vl53l1_errmsg("wrong offset syntax around %s\n", buf); - rc = -EINVAL; - goto finish; - } - - memset(&cali_data, 0, sizeof(cali_data)); - rc = VL53L1_GetCalibrationData(&data->stdev, &cali_data); - if (rc) { - vl53l1_errmsg("VL53L1_GetCalibrationData fail\n"); - rc = -EINVAL; - goto finish; - } - - /* update offset values */ - vl53l1_info("previous offset is %d,%d\n", - cali_data.customer.mm_config__inner_offset_mm, - cali_data.customer.mm_config__outer_offset_mm); - cali_data.customer.mm_config__inner_offset_mm = inner; - cali_data.customer.mm_config__outer_offset_mm = outer; - - rc = VL53L1_SetCalibrationData(&data->stdev, &cali_data); - if (rc) { - vl53l1_errmsg("VL53L1_SetCalibrationData fail\n"); - rc = -EINVAL; - goto finish; - } - - data->inner_offset = (int16_t)inner; - data->outer_offset = (int16_t)outer; - vl53l1_info("offset is set to %d,%d\n", inner, outer); -finish: - mutex_unlock(&data->work_mutex); - return rc ? rc : count; -} - -/** - * sysfs attribute "enable_sar" [rd/wr] - * - * To enable/disable the sar mode - * @li 0 disable sar mode - * @li 1 enable sar mode - * - * @ingroup sysfs_attrib - */ -static DEVICE_ATTR(offset, 0660/*S_IWUGO | S_IRUGO*/, - stmvl53l1_show_offset, - stmvl53l1_store_offset); - static struct attribute *stmvl53l1_attributes[] = { &dev_attr_enable_ps_sensor.attr, &dev_attr_set_delay_ms.attr, @@ -2158,8 +2005,6 @@ static struct attribute *stmvl53l1_attributes[] = { &dev_attr_tuning_status.attr, &dev_attr_smudge_correction_mode.attr, &dev_attr_is_xtalk_value_changed.attr, - &dev_attr_enable_sar.attr, - &dev_attr_offset.attr, NULL }; @@ -2512,44 +2357,6 @@ static int ctrl_stop(struct stmvl53l1_data *data) mutex_lock(&data->work_mutex); - if (data->is_device_remove) { - rc = -ENODEV; - goto done; - } - if (data->enable_sensor) { - rc = _ctrl_stop(data); - - if (data->cam_mode == 1) { - /* only restore sar mode when - it quits from camera mode */ - data->cam_mode = 0; - - if (data->sar_mode == 1) { - vl53l1_info("restore sar mode\n"); - activate_sar_mode(data); - } - } - } else - rc = -EBUSY; - -done: - mutex_unlock(&data->work_mutex); - - return rc; -} - -/** - * get work lock and suspend sensor without checking sar mode - * - * @param data device - * @return 0 on success EBUSY if arleady off - */ -static int ctrl_suspend(struct stmvl53l1_data *data) -{ - int rc; - - mutex_lock(&data->work_mutex); - vl53l1_info("enter ctrl_suspend\n"); if (data->is_device_remove) { rc = -ENODEV; goto done; @@ -2712,9 +2519,8 @@ static int ctrl_mz_data_blocking_common(struct stmvl53l1_data *data, goto done; } /* sleep if data already read */ - if (!is_new_data_for_me(data, pid, &data->mz_data_reader_list)) { + if (!is_new_data_for_me(data, pid, &data->mz_data_reader_list)) rc = sleep_for_data(data, pid, &data->mz_data_reader_list); - } if (rc) goto done; @@ -2851,38 +2657,6 @@ static int ctrl_param_is_xtalk_value_changed(struct stmvl53l1_data *data, return 0; } -static int ctrl_param_camera_mode(struct stmvl53l1_data *data, - struct stmvl53l1_parameter *param) -{ - if (param->is_read) { - param->value = data->cam_mode; - param->status = 0; - vl53l1_dbgmsg("get camera mode %d", param->value); - } else { - data->cam_mode = param->value; - vl53l1_dbgmsg("set camera mode %d", param->value); - } - - return 0; -} - -static int ctrl_param_hw_rev(struct stmvl53l1_data *data, - struct stmvl53l1_parameter *param) -{ - int rc; - - if (param->is_read) { - param->value = data->hw_rev; - param->status = 0; - vl53l1_dbgmsg("get hw rev %d", param->value); - rc = 0; - } else { - rc = -EINVAL; - } - - return rc; -} - /** * handle ioctl set param mode * @@ -2953,12 +2727,6 @@ static int ctrl_params(struct stmvl53l1_data *data, void __user *p) case VL53L1_ISXTALKVALUECHANGED_PAR: rc = ctrl_param_is_xtalk_value_changed(data, ¶m); break; - case VL53L1_CAMERAMODE_PAR: - rc = ctrl_param_camera_mode(data, ¶m); - break; - case VL53L1_HWREV_PAR: - rc = ctrl_param_hw_rev(data, ¶m); - break; default: vl53l1_errmsg("unknown or unsupported %d\n", param.name); rc = -EINVAL; @@ -3091,46 +2859,6 @@ done: return rc; } -static int ctrl_autonomous_config_cam(struct stmvl53l1_data *data, - void __user *p) -{ - int rc = 0; - struct stmvl53l1_autonomous_config_t full; - - mutex_lock(&data->work_mutex); - if (data->is_device_remove) { - rc = -ENODEV; - goto done; - } - /* first copy all data */ - rc = copy_from_user(&full, p, sizeof(full)); - if (rc) { - rc = -EFAULT; - goto done; - } - - if (full.is_read) { - full.pollingTimeInMs = data->auto_pollingTimeInMs_cam; - full.config = data->auto_config_cam; - rc = copy_to_user(p, &full, sizeof(full)); - if (rc) - rc = -EFAULT; - } else { - if (data->enable_sensor) { - rc = -EBUSY; - vl53l1_errmsg("can't change config while ranging\n"); - goto done; - } - data->auto_pollingTimeInMs_cam = full.pollingTimeInMs; - data->auto_config_cam = full.config; - } - -done: - mutex_unlock(&data->work_mutex); - - return rc; -} - static int ctrl_calibration_data(struct stmvl53l1_data *data, void __user *p) { int rc; @@ -3269,18 +2997,15 @@ static int ctrl_perform_calibration_crosstalk_lock(struct stmvl53l1_data *data, struct stmvl53l1_ioctl_perform_calibration_t *calib) { int rc = 0; + /* Set the preset mode passed on param2 */ + data->preset_mode = (VL53L1_PresetModes)(calib->param2); - rc = VL53L1_SetPresetMode(&data->stdev, - (VL53L1_PresetModes)(calib->param2)); - - if (rc) { - vl53l1_errmsg("VL53L1_SetPresetMode fail => %d", rc); - rc = store_last_error(data, rc); + rc = stmvl53l1_sendparams(data); + if (rc) goto done; - } - rc = VL53L1_PerformXTalkCalibration(&data->stdev, calib->param1); + rc = VL53L1_PerformXTalkCalibration(&data->stdev, calib->param1); if (rc) { vl53l1_errmsg("VL53L1_PerformXTalkCalibration fail => %d", rc); rc = store_last_error(data, rc); @@ -3387,6 +3112,11 @@ static int ctrl_perform_simple_calibration_offset_lock( /* finally perform calibration */ /* allow delay add after stop in VL53L1_run__calibration */ data->is_delay_allowed = 1; + + rc = stmvl53l1_sendparams(data); + if (rc) + goto done; + rc = VL53L1_PerformOffsetSimpleCalibration(&data->stdev, calib->param1); data->is_delay_allowed = 0; if (rc) { @@ -3395,6 +3125,7 @@ static int ctrl_perform_simple_calibration_offset_lock( rc = store_last_error(data, rc); } +done: return rc; } @@ -3490,11 +3221,6 @@ static int stmvl53l1_ioctl_handler( rc = ctrl_stop(data); break; - case VL53L1_IOCTL_SUSPEND: - vl53l1_dbgmsg("VL53L1_IOCTL_SUSPEND\n"); - rc = ctrl_suspend(data); - break; - case VL53L1_IOCTL_GETDATAS: /* vl53l1_dbgmsg("VL53L1_IOCTL_GETDATAS\n"); */ rc = ctrl_getdata(data, p); @@ -3538,10 +3264,7 @@ static int stmvl53l1_ioctl_handler( break; case VL53L1_IOCTL_AUTONOMOUS_CONFIG: vl53l1_dbgmsg("VL53L1_IOCTL_AUTONOMOUS_CONFIG\n"); - if (data->cam_mode == 0) - rc = ctrl_autonomous_config(data, p); - else - rc = ctrl_autonomous_config_cam(data, p); + rc = ctrl_autonomous_config(data, p); break; case VL53L1_IOCTL_ZONE_CALIBRATION_DATA: vl53l1_dbgmsg("VL53L1_IOCTL_ZONE_CALIBRATION_DATA\n"); @@ -3617,6 +3340,8 @@ static void stmvl53l1_on_newdata_event(struct stmvl53l1_data *data) VL53L1_RangingMeasurementData_t *pmsinglerange; VL53L1_MultiRangingData_t *pmrange; VL53L1_MultiRangingData_t *tmprange; + VL53L1_TargetRangeData_t RangeData[VL53L1_MAX_RANGE_RESULTS]; + VL53L1_RangingMeasurementData_t singledata; long ts_msec; int i; @@ -3626,6 +3351,13 @@ static void stmvl53l1_on_newdata_event(struct stmvl53l1_data *data) pmrange = &data->meas.multi_range_data; tmprange = &data->meas.tmp_range_data; pmsinglerange = &data->meas.single_range_data; + + memcpy(&singledata, pmsinglerange, + sizeof(VL53L1_RangingMeasurementData_t)); + for (i = 0; i < VL53L1_MAX_RANGE_RESULTS; i++) + memcpy(&RangeData[i], &pmrange->RangeData[i], + sizeof(VL53L1_TargetRangeData_t)); + data->meas.intr++; /* use get data method based on active mode */ @@ -3638,11 +3370,11 @@ static void stmvl53l1_on_newdata_event(struct stmvl53l1_data *data) break; case VL53L1_PRESETMODE_RANGING: case VL53L1_PRESETMODE_MULTIZONES_SCANNING: - /* IMPORTANT : during VL53L1_GetMultiRangingData() call - * work_mutex is release during ipp. This is why we use - * tmp_range_data which is not access somewhere else. When we are - * back we then copy tmp_range_data in multi_range_data. - */ + /* IMPORTANT : during VL53L1_GetMultiRangingData() call + * work_mutex is release during ipp. This is why we use + * tmp_range_data which is not access somewhere else. When we are + * back we then copy tmp_range_data in multi_range_data. + */ rc = VL53L1_GetMultiRangingData(&data->stdev, &data->meas.tmp_range_data); @@ -3768,12 +3500,13 @@ static int stmvl53l1_intr_process(struct stmvl53l1_data *data) * if using interrupt and sure we have * no false interrupt to handle or no to do any timing check */ - long poll_ms; + long poll_us; do_gettimeofday(&tv_now); - poll_ms = stmvl53l1_tv_dif(&data->meas.start_tv, &tv_now)/1000; - if (poll_ms > data->timing_budget*4) { - vl53l1_errmsg("we're polling %ld too long\n", poll_ms); + poll_us = stmvl53l1_tv_dif(&data->meas.start_tv, &tv_now); + if (poll_us > data->timing_budget*4) { + vl53l1_errmsg("we're polling %ld ms too long\n", + poll_us/1000); /* fixme stop or just warn ? */ goto stop_io; } @@ -3783,9 +3516,26 @@ static int stmvl53l1_intr_process(struct stmvl53l1_data *data) } /* we have data to handle */ /* first irq after reset has no data so we skip it */ - if (data->is_first_irq) + if (data->is_first_irq) { data->is_first_irq = false; - else + + if (data->preset_mode == + VL53L1_PRESETMODE_LOWPOWER_AUTONOMOUS) { + /* + * If VL53L1_GetRangingMeasurementData() + * is not called after + * for the first ranging measurement, + * the thresholds do not seem + * to work for ALP mode + */ + VL53L1_RangingMeasurementData_t RangingMeasurementData; + + /* printk("Test Workaround for ALP mode\n"); */ + VL53L1_GetRangingMeasurementData(&data->stdev, + &RangingMeasurementData); + } + + } else stmvl53l1_on_newdata_event(data); /* enable_sensor could change on event handling check again */ if (data->enable_sensor) { @@ -3812,7 +3562,7 @@ stop_io: * any new i/o */ vl53l1_errmsg("GetDatardy fail stop\n"); - data->enable_sensor = 0; + _ctrl_stop(data); return rc; } @@ -3840,11 +3590,12 @@ static void stmvl53l1_input_push_data_singleobject(struct stmvl53l1_data *data) FixPoint1616_t LimitCheckCurrent; VL53L1_Error st = VL53L1_ERROR_NONE; - /* set the distance value to max if range - * status is invalid in autonomous mode */ - if (data->preset_mode == VL53L1_PRESETMODE_AUTONOMOUS && - meas->RangeStatus != VL53L1_RANGESTATUS_RANGE_VALID) - meas->RangeMilliMeter = STMVL53L1_MAX_DISTANCE; + vl53l1_dbgmsg("******* FIXME!!! ************\n"); + vl53l1_dbgmsg("Sensor HAL in Lite ranging mode not yet updated\n"); + vl53l1_dbgmsg("******* FIXME!!! ************\n"); + + /* Do not send the events till this if fixed properly */ + return; input_report_abs(input, ABS_DISTANCE, (meas->RangeMilliMeter + 5) / 10); input_report_abs(input, ABS_HAT0X, meas->TimeStamp / 1000); @@ -3858,7 +3609,7 @@ static void stmvl53l1_input_push_data_singleobject(struct stmvl53l1_data *data) VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE, &LimitCheckCurrent); if (st == VL53L1_ERROR_NONE) input_report_abs(input, ABS_WHEEL, LimitCheckCurrent); - input_report_abs(input, ABS_MISC, meas->EffectiveSpadRtnCount); + input_report_abs(input, ABS_TILT_Y, meas->EffectiveSpadRtnCount); input_report_abs(input, ABS_TOOL_WIDTH, meas->RangeQualityLevel); input_sync(input); @@ -3867,47 +3618,177 @@ static void stmvl53l1_input_push_data_singleobject(struct stmvl53l1_data *data) static void stmvl53l1_input_push_data_multiobject(struct stmvl53l1_data *data) { VL53L1_MultiRangingData_t *mmeas = &data->meas.multi_range_data; - int obj_number = mmeas->NumberOfObjectsFound; int i; - VL53L1_TargetRangeData_t *meas; + int rc; + VL53L1_TargetRangeData_t *meas_array[4]; + VL53L1_CalibrationData_t calibration_data; + struct timeval tv; struct input_dev *input = data->input_dev_ps; - FixPoint1616_t LimitCheckCurrent; - int roi = mmeas->RoiNumber; - VL53L1_Error st = VL53L1_ERROR_NONE; - /* be sure there is at least one object */ - obj_number = obj_number ? obj_number : 1; + do_gettimeofday(&tv); - for (i = 0; i < obj_number; i++) { - meas = &mmeas->RangeData[i]; - input_report_abs(input, ABS_DISTANCE, - (meas->RangeMilliMeter + 5) / 10); - input_report_abs(input, ABS_HAT0X, mmeas->TimeStamp / 1000); - input_report_abs(input, ABS_HAT0Y, (mmeas->TimeStamp % 1000) - * 1000); - input_report_abs(input, ABS_HAT1X, meas->RangeMilliMeter); - input_report_abs(input, ABS_HAT1Y, meas->RangeStatus); - input_report_abs(input, ABS_HAT2X, meas->SignalRateRtnMegaCps); - input_report_abs(input, ABS_HAT2Y, meas->AmbientRateRtnMegaCps); - input_report_abs(input, ABS_HAT3X, meas->SigmaMilliMeter); - input_report_abs(input, ABS_HAT3Y, mmeas->DmaxMilliMeter); - st = VL53L1_GetLimitCheckCurrent(&data->stdev, - VL53L1_CHECKENABLE_SIGMA_FINAL_RANGE, - &LimitCheckCurrent); - if (st == VL53L1_ERROR_NONE) - input_report_abs(input, ABS_WHEEL, LimitCheckCurrent); - input_report_abs(input, ABS_MISC, - mmeas->EffectiveSpadRtnCount); - input_report_abs(input, ABS_BRAKE, (mmeas->RoiStatus << 24) | - (roi << 16) | (obj_number << 8) | i); - input_report_abs(input, ABS_TILT_X, - (meas->RangeMaxMilliMeter << 16) | - meas->RangeMinMilliMeter); - input_report_abs(input, ABS_TOOL_WIDTH, - meas->RangeQualityLevel); + for (i = 0; i < 4; i++) + meas_array[i] = &mmeas->RangeData[i]; - input_sync(input); + /************************************************************* + * INPUT EVENT CODE L1/L3 Data + ABS_HAT0X Time in Sec(32) + ABS_HAT0Y Time in uSec(32) + ABS_HAT1X Obj0_Distance(16) : Obj0_Sigma(16) + ABS_HAT1Y Obj0_MinRange(16) : Obj0_MaxRange(16) + ABS_HAT2X Obj1_Distance(16) : Obj1_Sigma(16) + ABS_HAT2Y Obj1_ MinRange (16) : Obj1_ MaxRange (16) + ABS_HAT3X Obj0_SignalRate_Spad(32) + ABS_HAT3Y Obj1_SignalRate_Spad(32) + ABS_WHEEL AmbientRate(32) + ABS_BRAKE EffectiveSpadRtnCount(16):RangeStatus_1(8): + Range_status_0(8) + ABS_TILT_X XtalkChange(8) :StreamCount(8) : + NumberofObjects(2) : RoiNumber(4) : + RoiStatus(2) + ABS_TILT_Y DMAX + ABS_TOOL_WIDTH XtalkValue + ABS_DISTANCE + ABS_THROTTLE + ABS_RUDDER + ABS_MISC + ABS_VOLUME + ************************************************************/ + + rc = VL53L1_GetCalibrationData(&data->stdev, &calibration_data); + if (rc) { + //This should not happen + vl53l1_errmsg("%d error:%d\n", __LINE__, rc); + return; } + + //ABS_HAT0X - Time in Sec(32) + + input_report_abs(input, ABS_HAT0X, tv.tv_sec); + vl53l1_dbgmsg("ABS_HAT0X : %ld, %zu\n", tv.tv_sec, sizeof(tv.tv_sec)); + //ABS_HAT0Y - Time in uSec(32) + //REVISIT : The following code may cause loss of data due to + //8 bytes to 32 bits conversion + input_report_abs(input, ABS_HAT0Y, tv.tv_usec); + vl53l1_dbgmsg("ABS_HAT0Y : %ld\n", tv.tv_usec); + + //ABS_WHEEL - AmbientRate(32) + input_report_abs(input, ABS_WHEEL, + meas_array[0]->AmbientRateRtnMegaCps); + vl53l1_dbgmsg("ABS_WHEEL : AmbRate = %d\n", + meas_array[0]->AmbientRateRtnMegaCps); + + //ABS_TILT_X XtalkChange(8) :StreamCount(8) : + //Number of Objects(2) : RoiNumber(4) : RoiStatus(2) + input_report_abs(input, ABS_TILT_X, + (mmeas->HasXtalkValueChanged << 16) + | (mmeas->StreamCount << 8) + | ((mmeas->NumberOfObjectsFound & 0x3) << 6) + | ((mmeas->RoiNumber & 0xF) << 2) + | (mmeas->RoiStatus & 0x3)); + vl53l1_dbgmsg("ABS_TILT_X :(%d):(%d):(%d):(%d):(%d)\n\n", + mmeas->HasXtalkValueChanged, + mmeas->StreamCount, + mmeas->NumberOfObjectsFound, + mmeas->RoiNumber, + mmeas->RoiStatus + ); + + + //ABS_TILT_Y DMAX + input_report_abs(input, ABS_TILT_Y, mmeas->DmaxMilliMeter); + vl53l1_dbgmsg("ABS_TILT_Y DMAX = %d\n", mmeas->DmaxMilliMeter); + + //ABS_TOOL_WIDTH + input_report_abs(input, ABS_TOOL_WIDTH, +calibration_data.customer.algo__crosstalk_compensation_plane_offset_kcps); + vl53l1_dbgmsg("ABS_TOOL_WIDTH Xtalk = %d\n", +calibration_data.customer.algo__crosstalk_compensation_plane_offset_kcps); + + + if (mmeas->NumberOfObjectsFound == 0) { + input_sync(input); + return; + } + + //ABS_HAT1X - Obj0_Distance(16) : Obj0_Sigma(16) + input_report_abs(input, ABS_HAT1X, meas_array[0]->RangeMilliMeter << 16 + | (meas_array[0]->SigmaMilliMeter/65536)); + vl53l1_dbgmsg("ABS_HAT1X : 0x%X(%d:%d)\n", + meas_array[0]->RangeMilliMeter << 16 + | (meas_array[0]->SigmaMilliMeter/65536), + meas_array[0]->RangeMilliMeter, + (meas_array[0]->SigmaMilliMeter/65536)); + + //ABS_HAT1Y - Obj0_MinRange(16) : Obj0_MaxRange(16) + input_report_abs(input, ABS_HAT1Y, + meas_array[0]->RangeMinMilliMeter << 16 + | meas_array[0]->RangeMaxMilliMeter); + + vl53l1_dbgmsg("ABS_HAT1Y : 0x%X(%d:%d)\n", + meas_array[0]->RangeMinMilliMeter << 16 + | meas_array[0]->RangeMaxMilliMeter, + meas_array[0]->RangeMinMilliMeter, + meas_array[0]->RangeMaxMilliMeter); + + if (mmeas->NumberOfObjectsFound > 1) { + //ABS_HAT2X - Obj1_Distance(16) : Obj1_Sigma(16) + input_report_abs(input, ABS_HAT2X, + meas_array[1]->RangeMilliMeter << 16 + | (meas_array[1]->SigmaMilliMeter/65536)); + vl53l1_dbgmsg("ABS_HAT2X : 0x%x(%d:%d)\n", + meas_array[1]->RangeMilliMeter << 16 + | (meas_array[1]->SigmaMilliMeter/65536), + meas_array[1]->RangeMilliMeter, + (meas_array[1]->SigmaMilliMeter/65536)); + + //ABS_HAT2Y - Obj1_ MinRange (16) : Obj1_ MaxRange (16) + input_report_abs(input, ABS_HAT2Y, + meas_array[1]->RangeMinMilliMeter << 16 + | meas_array[1]->RangeMaxMilliMeter); + + vl53l1_dbgmsg("ABS_HAT1Y : 0x%X(%d:%d)\n", + meas_array[1]->RangeMinMilliMeter << 16 + | meas_array[1]->RangeMaxMilliMeter, + meas_array[1]->RangeMinMilliMeter, + meas_array[1]->RangeMaxMilliMeter); + + } + + // ABS_HAT3X - Obj0_SignalRate_Spad(32) + input_report_abs(input, ABS_HAT3X, + meas_array[0]->SignalRateRtnMegaCps); + vl53l1_dbgmsg("ABS_HAT3X : SignalRateRtnMegaCps_0(%d)\n", + meas_array[0]->SignalRateRtnMegaCps); + if (mmeas->NumberOfObjectsFound > 1) { + //ABS_HAT3Y - Obj1_SignalRate_Spad(32) + input_report_abs(input, ABS_HAT3Y, + meas_array[1]->SignalRateRtnMegaCps); + vl53l1_dbgmsg("ABS_HAT3Y : SignalRateRtnMegaCps_1(%d)\n", + meas_array[1]->SignalRateRtnMegaCps); + } + + //ABS_BRAKE - EffectiveSpadRtnCount(16):RangeStatus_3(1): + //Range_status_2(0) + input_report_abs(input, ABS_BRAKE, + mmeas->EffectiveSpadRtnCount << 16 + | ((meas_array[1]->RangeStatus) << 8) + | meas_array[0]->RangeStatus); + + vl53l1_dbgmsg("ABS_BRAKE : (%d):(%d):(%d)\n", + mmeas->EffectiveSpadRtnCount, + meas_array[1]->RangeStatus, + meas_array[0]->RangeStatus); + + vl53l1_dbgmsg("ABS_BRAKE : 0x%X\n", + (mmeas->EffectiveSpadRtnCount & 0xFFFF) << 16 + | ((meas_array[1]->RangeStatus) << 8) + | meas_array[0]->RangeStatus); + + + input_sync(input); + + } static void stmvl53l1_input_push_data(struct stmvl53l1_data *data) @@ -3940,42 +3821,31 @@ static int stmvl53l1_input_setup(struct stmvl53l1_data *data) } /* setup all event */ set_bit(EV_ABS, idev->evbit); - /* range in cm*/ + input_set_abs_params(idev, ABS_DISTANCE, 0, 0xff, 0, 0); - /* tv_sec */ + input_set_abs_params(idev, ABS_HAT0X, 0, 0xffffffff, 0, 0); - /* tv_usec */ input_set_abs_params(idev, ABS_HAT0Y, 0, 0xffffffff, 0, 0); - /* range in_mm */ - input_set_abs_params(idev, ABS_HAT1X, 0, 765, 0, 0); - /* error code change maximum to 0xff for more flexibility */ - input_set_abs_params(idev, ABS_HAT1Y, 0, 0xff, 0, 0); - /* rtnRate */ + input_set_abs_params(idev, ABS_HAT1X, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_HAT1Y, 0, 0xffffffff, 0, 0); input_set_abs_params(idev, ABS_HAT2X, 0, 0xffffffff, 0, 0); - /* rtn_amb_rate */ input_set_abs_params(idev, ABS_HAT2Y, 0, 0xffffffff, 0, 0); - /* SigmaMilliMeter */ input_set_abs_params(idev, ABS_HAT3X, 0, 0xffffffff, 0, 0); - /* dmax */ input_set_abs_params(idev, ABS_HAT3Y, 0, 0xffffffff, 0, 0); - /* LimitCheckCurrent*/ input_set_abs_params(idev, ABS_WHEEL, 0, 0xffffffff, 0, 0); - /* EffectiveSpadRtnCount */ - input_set_abs_params(idev, ABS_MISC, 0, 0xffffffff, 0, 0); - /* roi number in 16 msb bits with object number in 16 lsb bits */ + + input_set_abs_params(idev, ABS_TILT_Y, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_BRAKE, 0, 0xffffffff, 0, 0); - /* RangeMaxMilliMeter in 16 msb bits with RangeMinMilliMeter in lsb */ input_set_abs_params(idev, ABS_TILT_X, 0, 0xffffffff, 0, 0); - /* ConfidenceLevel */ input_set_abs_params(idev, ABS_TOOL_WIDTH, 0, 0xffffffff, 0, 0); - /* flushCount */ - input_set_abs_params(idev, ABS_GAS, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_THROTTLE, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_RUDDER, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_MISC, 0, 0xffffffff, 0, 0); - /* those are still free to use - * input_set_abs_params(idev, ABS_RUDDER, 0, 0xffffffff, 0, 0); - * input_set_abs_params(idev, ABS_TILT_Y, 0, 0xffffffff, 0, 0); - */ + input_set_abs_params(idev, ABS_VOLUME, 0, 0xffffffff, 0, 0); + input_set_abs_params(idev, ABS_GAS, 0, 0xffffffff, 0, 0); idev->name = "STM VL53L1 proximity sensor"; rc = input_register_device(idev); @@ -4040,13 +3910,10 @@ int stmvl53l1_intr_handler(struct stmvl53l1_data *data) int stmvl53l1_setup(struct stmvl53l1_data *data) { int rc = 0; - VL53L1_CalibrationData_t cali_data; VL53L1_DeviceInfo_t dev_info; vl53l1_dbgmsg("Enter\n"); - data->hw_rev = 0; - /* acquire an id */ data->id = allocate_dev_id(); if (data->id < 0) { @@ -4072,7 +3939,11 @@ int stmvl53l1_setup(struct stmvl53l1_data *data) data->last_error = VL53L1_ERROR_NONE; data->is_device_remove = false; - /* vdd will be controlled in reset_release() */ + rc = stmvl53l1_module_func_tbl.power_up(data->client_object); + if (rc) { + vl53l1_errmsg("%d,error rc %d\n", __LINE__, rc); + goto exit_ipp_cleanup; + } rc = reset_release(data); if (rc) goto exit_ipp_cleanup; @@ -4120,8 +3991,6 @@ int stmvl53l1_setup(struct stmvl53l1_data *data) data->output_mode = STMVL53L1_CFG_DEFAULT_OUTPUT_MODE; data->offset_correction_mode = STMVL53L1_CFG_DEFAULT_OFFSET_CORRECTION_MODE; - data->cam_mode = 0; - data->sar_mode = 0; stmvl53l1_setup_auto_config(data); data->dmax_mode = STMVL53L1_CFG_DEFAULT_DMAX_MODE; data->smudge_correction_mode = @@ -4134,7 +4003,7 @@ int stmvl53l1_setup(struct stmvl53l1_data *data) rc = VL53L1_DataInit(&data->stdev); data->is_delay_allowed = false; if (rc) { - vl53l1_errmsg("VL53L1_data_init %d\n", rc); + vl53l1_errmsg("VL53L1_DataInit %d\n", rc); goto exit_unregister_dev_ps; } @@ -4160,63 +4029,12 @@ int stmvl53l1_setup(struct stmvl53l1_data *data) } /* set tuning from stmvl53l1_tunings.h */ - rc = setup_tunings(data); + rc = setup_tunings(data, dev_info.ProductType); if (rc) { vl53l1_errmsg("setup_tunings %d\n", rc); goto exit_unregister_dev_ps; } - data->hw_rev = dev_info.ProductRevisionMinor; - - memset(&cali_data, 0, sizeof(cali_data)); - rc = VL53L1_GetCalibrationData(&data->stdev, &cali_data); - if (rc) - vl53l1_errmsg("VL53L1_GetCalibrationData fail\n"); - else { - data->inner_offset = cali_data.customer.mm_config__inner_offset_mm; - data->outer_offset = cali_data.customer.mm_config__outer_offset_mm; - - /* update xtalk values */ - cali_data.customer.algo__crosstalk_compensation_plane_offset_kcps - = data->xtalk_offset; - cali_data.customer.algo__crosstalk_compensation_x_plane_gradient_kcps - = data->xtalk_x; - cali_data.customer.algo__crosstalk_compensation_y_plane_gradient_kcps - = data->xtalk_y; - - cali_data.xtalkhisto.xtalk_shape.VL53L1_PRM_00019 = 0 ; - cali_data.xtalkhisto.xtalk_shape.VL53L1_PRM_00020 = 24; - cali_data.xtalkhisto.xtalk_shape.VL53L1_PRM_00021 = 12; - cali_data.xtalkhisto.xtalk_shape.bin_data[0] = 353; - cali_data.xtalkhisto.xtalk_shape.bin_data[1] = 472; - cali_data.xtalkhisto.xtalk_shape.bin_data[2] = 472; - cali_data.xtalkhisto.xtalk_shape.bin_data[3] = 353; - cali_data.xtalkhisto.xtalk_shape.bin_data[4] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[5] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[6] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[7] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[8] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[9] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[10] = 0; - cali_data.xtalkhisto.xtalk_shape.bin_data[11] = 0; - cali_data.xtalkhisto.xtalk_shape.phasecal_result__reference_phase = 10240; - cali_data.xtalkhisto.xtalk_shape.phasecal_result__vcsel_start = 6; - cali_data.xtalkhisto.xtalk_shape.cal_config__vcsel_start = 9; - cali_data.xtalkhisto.xtalk_shape.vcsel_width = 40; - cali_data.xtalkhisto.xtalk_shape.VL53L1_PRM_00022 = 48332; - cali_data.xtalkhisto.xtalk_shape.zero_distance_phase = 4096; - cali_data.gain_cal.standard_ranging_gain_factor = 0x07D7; - cali_data.gain_cal.histogram_ranging_gain_factor = 0x07CC; - - rc = VL53L1_SetCalibrationData(&data->stdev, &cali_data); - if (rc) - vl53l1_errmsg("VL53L1_SetCalibrationData fail\n"); - else { - vl53l1_info("device crosstalk data updated: %u %d %d\n", - data->xtalk_offset, data->xtalk_x, data->xtalk_y); - } - } - /* if working in interrupt ask intr to enable and hook the handler */ data->poll_mode = 0; rc = stmvl53l1_module_func_tbl.start_intr(data->client_object, @@ -4265,96 +4083,6 @@ exit_ipp_cleanup: return rc; } -/* Attribute: name (RO) */ -static ssize_t name_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return scnprintf(buf, PAGE_SIZE, VL53L1_INPUT_DEVICE_NAME); -} - -static struct device_attribute laser_name_attributes = __ATTR_RO(name); - -#define LASERDEV_MINOR_BASE 256 -#define LASERDEV_MINOR_MAX 32 - -int stmvl53l1_sysfs_laser(struct stmvl53l1_data *data, bool create) -{ - int i, error = 0; - static struct class *laser_class; - static struct device *laser_class_dev; - static int minor; - - if (data == NULL) { - vl53l1_errmsg("stmvl53l1 dev data is null!\n"); - return -ENODEV; - } - - if (create) { - minor = input_get_new_minor(data->sysfs_base, 1, false); - if (minor < 0) - minor = input_get_new_minor(LASERDEV_MINOR_BASE, - LASERDEV_MINOR_MAX, true); - vl53l1_info("assigned minor %d\n", minor); - - laser_class = class_create(THIS_MODULE, "laser"); - if (IS_ERR(laser_class)) { - error = PTR_ERR(laser_class); - laser_class = NULL; - return error; - } - - laser_class_dev = device_create(laser_class, NULL, - MKDEV(INPUT_MAJOR, minor), - data, STMVL53L1_DRV_NAME); - if (IS_ERR(laser_class_dev)) { - error = PTR_ERR(laser_class_dev); - laser_class_dev = NULL; - return error; - } - - for (i = 0; stmvl53l1_attributes[i] != NULL; ++i) { - error = sysfs_create_file(&laser_class_dev->kobj, - stmvl53l1_attributes[i]); - if (error) - break; - } - - if (error) - goto device_destroy; - - error = device_create_file(laser_class_dev, - &laser_name_attributes); - if (error) - goto device_destroy; - } else { - if (!laser_class || !laser_class_dev) - return -ENODEV; - - device_remove_file(laser_class_dev, - &laser_name_attributes); - for (i = 0; stmvl53l1_attributes[i] != NULL; ++i) - sysfs_remove_file(&laser_class_dev->kobj, - stmvl53l1_attributes[i]); - - device_unregister(laser_class_dev); - class_unregister(laser_class); - } - - vl53l1_info("laser sysfs %s(0x%x) created\n", - STMVL53L1_DRV_NAME, data->sysfs_base); - return 0; - -device_destroy: - for (--i; i >= 0; --i) - sysfs_remove_file(&laser_class_dev->kobj, - stmvl53l1_attributes[i]); - device_destroy(laser_class, MKDEV(INPUT_MAJOR, minor)); - laser_class_dev = NULL; - class_unregister(laser_class); - vl53l1_errmsg("error creating laser class\n"); - - return -ENODEV; -} void stmvl53l1_cleanup(struct stmvl53l1_data *data) { @@ -4387,26 +4115,30 @@ void stmvl53l1_cleanup(struct stmvl53l1_data *data) /* be sure device is put under reset */ data->force_device_on_en = false; reset_hold(data); + stmvl53l1_module_func_tbl.power_down(data->client_object); vl53l1_dbgmsg("done\n"); deallocate_dev_id(data->id); data->is_device_remove = true; } -#ifdef CONFIG_COMPAT -static long stmvl53l1_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) +#ifdef CONFIG_PM_SLEEP +void stmvl53l1_pm_suspend_stop(struct stmvl53l1_data *data) { - int ret; - struct stmvl53l1_data *data = - container_of(file->private_data, - struct stmvl53l1_data, miscdev); - ret = stmvl53l1_ioctl_handler(data, cmd, arg, compat_ptr(arg)); - return ret; + int rc; + + vl53l1_dbgmsg("Enter\n"); + + rc = _ctrl_stop(data); + if (rc < 0) + vl53l1_errmsg("stop failed %d aborting anyway\n", rc); + + vl53l1_dbgmsg("done\n"); } #endif static long stmvl53l1_ioctl(struct file *file, - unsigned int cmd, unsigned long arg){ + unsigned int cmd, unsigned long arg) +{ long ret; struct stmvl53l1_data *data = container_of(file->private_data, diff --git a/drivers/input/misc/vl53L1/stmvl53l1_tunings.h b/drivers/input/misc/vl53L1/stmvl53l1_tunings.h index 06a3af1a4694..6a92a3b2c3c2 100644 --- a/drivers/input/misc/vl53L1/stmvl53l1_tunings.h +++ b/drivers/input/misc/vl53L1/stmvl53l1_tunings.h @@ -1,37 +1,37 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ /* -* THIS IS A GENERATED FILE -*/ + * THIS IS A GENERATED FILE + */ #ifndef STMVL53L1_TUNINGS_H #define STMVL53L1_TUNINGS_H diff --git a/drivers/input/misc/vl53L1/vl53l1_platform.h b/drivers/input/misc/vl53L1/vl53l1_platform.h index efb529071402..742e25aa66da 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef _VL53L1_PLATFORM_H_ @@ -269,25 +269,25 @@ VL53L1_Error VL53L1_WaitMs( /** -* @brief Get the frequency of the timer used for ranging results time stamps -* -* @param[out] ptimer_freq_hz : pointer for timer frequency -* + * @brief Get the frequency of the timer used for ranging results time stamps + * + * @param[out] ptimer_freq_hz : pointer for timer frequency + * * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error -*/ + */ VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz); /** -* @brief Get the timer value in units of timer_freq_hz (see -* VL53L1_get_timestamp_frequency()) -* -* @param[out] ptimer_count : pointer for timer count value -* + * @brief Get the timer value in units of timer_freq_hz (see + * VL53L1_get_timestamp_frequency()) + * + * @param[out] ptimer_count : pointer for timer count value + * * @return VL53L1_ERROR_NONE Success * @return "Other error code" See ::VL53L1_Error -*/ + */ VL53L1_Error VL53L1_GetTimerValue(int32_t *ptimer_count); diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_ipp.h b/drivers/input/misc/vl53L1/vl53l1_platform_ipp.h index 97144b30caf4..b187272fe7b3 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_ipp.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_ipp.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef _VL53L1_PLATFORM_IPP_H_ diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_ipp_imports.h b/drivers/input/misc/vl53L1/vl53l1_platform_ipp_imports.h index 187952d2bc15..b7700a919089 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_ipp_imports.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_ipp_imports.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef _VL53L1_PLATFORM_IPP_IMPORTS_H_ diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_log.h b/drivers/input/misc/vl53L1/vl53l1_platform_log.h index fb0e2de3aefb..357e0abb9773 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_log.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_log.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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_platform_log.h diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_user_config.h b/drivers/input/misc/vl53L1/vl53l1_platform_user_config.h index 09489237a845..396d25762a5d 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_user_config.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_user_config.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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_platform_user_config.h diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_user_data.h b/drivers/input/misc/vl53L1/vl53l1_platform_user_data.h index 9b5114f155f0..41da1dda1235 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_user_data.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_user_data.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef _VL53L1_PLATFORM_USER_DATA_H_ @@ -48,11 +48,12 @@ extern "C" #define VL53L1_Dev_t VL53L1_DevData_t #define VL53L1_DEV VL53L1_DevData_t * -#define PALDevDataGet(Dev, field) (Dev->field) -#define PALDevDataSet(Dev, field, data) ((Dev->field) = (data)) +#define VL53L1DevDataGet(Dev, field) (Dev->field) +#define VL53L1DevDataSet(Dev, field, data) ((Dev->field) = (data)) -#define VL53L1DevStructGetLLDriverHandle(Dev) (&PALDevDataGet(Dev, LLData)) -#define VL53L1DevStructGetLLResultsHandle(Dev) (&PALDevDataGet(Dev, llresults)) +#define VL53L1DevStructGetLLDriverHandle(Dev) (&VL53L1DevDataGet(Dev, LLData)) +#define VL53L1DevStructGetLLResultsHandle(Dev) (&VL53L1DevDataGet(Dev,\ + llresults)) #ifdef __cplusplus } diff --git a/drivers/input/misc/vl53L1/vl53l1_platform_user_defines.h b/drivers/input/misc/vl53L1/vl53l1_platform_user_defines.h index 9bab15910be2..731c48341756 100644 --- a/drivers/input/misc/vl53L1/vl53l1_platform_user_defines.h +++ b/drivers/input/misc/vl53L1/vl53l1_platform_user_defines.h @@ -1,33 +1,33 @@ -/* -* Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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. + ****************************************************************************/ #ifndef _VL53L1_PLATFORM_USER_DEFINES_H_ diff --git a/drivers/input/misc/vl53L1/vl53l1_types.h b/drivers/input/misc/vl53L1/vl53l1_types.h index 9dcd440a9628..3d78e2559204 100644 --- a/drivers/input/misc/vl53L1/vl53l1_types.h +++ b/drivers/input/misc/vl53L1/vl53l1_types.h @@ -1,33 +1,33 @@ -/******************************************************************************* -*Copyright (c) 2016, STMicroelectronics - All Rights Reserved -* -* 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. -*******************************************************************************/ +/************************************************************************** + * Copyright (c) 2016, STMicroelectronics - All Rights Reserved + + 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_types.h * @brief VL53L1 types definition