From 215c70d9dc8cb009cfdb906c76e36da903fa2b8a Mon Sep 17 00:00:00 2001 From: hans boot Date: Mon, 1 Jul 2019 08:27:23 +0200 Subject: [PATCH] original files from STSW-IMG007 VL53L1X API 2.3.3, run through dos2unix to ease merge --- vl53l1_api.c | 138 ++++++++++++++++++++++----------- vl53l1_api.h | 21 ++++- vl53l1_api_calibration.c | 0 vl53l1_api_calibration.h | 0 vl53l1_api_core.c | 0 vl53l1_api_core.h | 0 vl53l1_api_debug.c | 0 vl53l1_api_debug.h | 0 vl53l1_api_preset_modes.c | 0 vl53l1_api_preset_modes.h | 0 vl53l1_api_strings.c | 0 vl53l1_api_strings.h | 0 vl53l1_core.c | 0 vl53l1_core.h | 0 vl53l1_core_support.c | 0 vl53l1_core_support.h | 0 vl53l1_def.h | 26 +++---- vl53l1_error_codes.h | 0 vl53l1_error_exceptions.h | 0 vl53l1_error_strings.c | 0 vl53l1_error_strings.h | 0 vl53l1_ll_def.h | 0 vl53l1_ll_device.h | 0 vl53l1_nvm_map.h | 0 vl53l1_platform.c | 0 vl53l1_platform.h | 0 vl53l1_platform_log.h | 0 vl53l1_platform_user_config.h | 0 vl53l1_platform_user_data.h | 0 vl53l1_platform_user_defines.h | 0 vl53l1_preset_setup.h | 5 +- vl53l1_register_funcs.c | 0 vl53l1_register_funcs.h | 0 vl53l1_register_map.h | 0 vl53l1_register_settings.h | 0 vl53l1_register_structs.h | 0 vl53l1_silicon_core.c | 0 vl53l1_silicon_core.h | 0 vl53l1_tuning_parm_defaults.h | 0 vl53l1_types.h | 0 vl53l1_wait.c | 0 vl53l1_wait.h | 0 42 files changed, 131 insertions(+), 59 deletions(-) mode change 100644 => 100755 vl53l1_api.c mode change 100644 => 100755 vl53l1_api.h mode change 100644 => 100755 vl53l1_api_calibration.c mode change 100644 => 100755 vl53l1_api_calibration.h mode change 100644 => 100755 vl53l1_api_core.c mode change 100644 => 100755 vl53l1_api_core.h mode change 100644 => 100755 vl53l1_api_debug.c mode change 100644 => 100755 vl53l1_api_debug.h mode change 100644 => 100755 vl53l1_api_preset_modes.c mode change 100644 => 100755 vl53l1_api_preset_modes.h mode change 100644 => 100755 vl53l1_api_strings.c mode change 100644 => 100755 vl53l1_api_strings.h mode change 100644 => 100755 vl53l1_core.c mode change 100644 => 100755 vl53l1_core.h mode change 100644 => 100755 vl53l1_core_support.c mode change 100644 => 100755 vl53l1_core_support.h mode change 100644 => 100755 vl53l1_def.h mode change 100644 => 100755 vl53l1_error_codes.h mode change 100644 => 100755 vl53l1_error_exceptions.h mode change 100644 => 100755 vl53l1_error_strings.c mode change 100644 => 100755 vl53l1_error_strings.h mode change 100644 => 100755 vl53l1_ll_def.h mode change 100644 => 100755 vl53l1_ll_device.h mode change 100644 => 100755 vl53l1_nvm_map.h mode change 100644 => 100755 vl53l1_platform.c mode change 100644 => 100755 vl53l1_platform.h mode change 100644 => 100755 vl53l1_platform_log.h mode change 100644 => 100755 vl53l1_platform_user_config.h mode change 100644 => 100755 vl53l1_platform_user_data.h mode change 100644 => 100755 vl53l1_platform_user_defines.h mode change 100644 => 100755 vl53l1_preset_setup.h mode change 100644 => 100755 vl53l1_register_funcs.c mode change 100644 => 100755 vl53l1_register_funcs.h mode change 100644 => 100755 vl53l1_register_map.h mode change 100644 => 100755 vl53l1_register_settings.h mode change 100644 => 100755 vl53l1_register_structs.h mode change 100644 => 100755 vl53l1_silicon_core.c mode change 100644 => 100755 vl53l1_silicon_core.h mode change 100644 => 100755 vl53l1_tuning_parm_defaults.h mode change 100644 => 100755 vl53l1_types.h mode change 100644 => 100755 vl53l1_wait.c mode change 100644 => 100755 vl53l1_wait.h diff --git a/vl53l1_api.c b/vl53l1_api.c old mode 100644 new mode 100755 index 1957b39..062ff06 --- a/vl53l1_api.c +++ b/vl53l1_api.c @@ -133,9 +133,11 @@ static int32_t BDTable[VL53L1_TUNING_MAX_TUNABLE_KEY] = { TUNING_SINGLE_TARGET_XTALK_SAMPLE_NUMBER, TUNING_MIN_AMBIENT_DMAX_VALID, TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER, - TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM + TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM, + TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT }; + #define VL53L1_NVM_POWER_UP_DELAY_US 50 #define VL53L1_NVM_READ_TRIGGER_DELAY_US 5 @@ -389,8 +391,8 @@ 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; @@ -452,10 +454,10 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) if (total_count > 0) { /* FixPoint1616_t / uint16_t = FixPoint1616_t */ 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; /* Round Mean Spads to Whole Number. * Typically the calculated mean SPAD count is a whole number @@ -511,7 +513,7 @@ static VL53L1_Error SingleTargetXTalkCalibration(VL53L1_DEV Dev) 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; @@ -1314,11 +1316,16 @@ VL53L1_Error VL53L1_SetInterMeasurementPeriodMilliSeconds(VL53L1_DEV Dev, uint32_t InterMeasurementPeriodMilliSeconds) { VL53L1_Error Status = VL53L1_ERROR_NONE; + uint32_t adjustedIMP; LOG_FUNCTION_START(""); + /* Fix for Ticket 468205 actual measurement period shorter than set */ + adjustedIMP = InterMeasurementPeriodMilliSeconds; + adjustedIMP += (adjustedIMP * 64) / 1000; + /* End of fix for Ticket 468205 */ Status = VL53L1_set_inter_measurement_period_ms(Dev, - InterMeasurementPeriodMilliSeconds); + adjustedIMP); LOG_FUNCTION_END(Status); return Status; @@ -1328,11 +1335,15 @@ 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); + /* Fix for Ticket 468205 actual measurement period shorter than set */ + adjustedIMP -= (adjustedIMP * 64) / 1000; + *pInterMeasurementPeriodMilliSeconds = adjustedIMP; + /* End of fix for Ticket 468205 */ LOG_FUNCTION_END(Status); return Status; @@ -1720,9 +1731,12 @@ 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(""); @@ -1746,6 +1760,22 @@ VL53L1_Error VL53L1_StartMeasurement(VL53L1_DEV Dev) DeviceMeasurementMode = VL53L1DevDataGet(Dev, LLData.measurement_mode); + /* Check timing configuration between timing budget and + * inter measurement period */ + if ((Status == VL53L1_ERROR_NONE) && + (DeviceMeasurementMode == VL53L1_DEVICEMEASUREMENTMODE_TIMED)) { + lStatus = VL53L1_GetMeasurementTimingBudgetMicroSeconds(Dev, + &MTBus); + /* convert timing budget in ms */ + MTBus /= 1000; + lStatus = VL53L1_GetInterMeasurementPeriodMilliSeconds(Dev, + &IMPms); + /* trick to get rid of compiler "set but not used" warning */ + 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( Dev, @@ -2178,7 +2208,6 @@ VL53L1_Error VL53L1_SetTuningParameter(VL53L1_DEV Dev, VL53L1_Error Status = VL53L1_ERROR_NONE; LOG_FUNCTION_START(""); - if (TuningParameterId >= 32768) Status = VL53L1_set_tuning_parm(Dev, TuningParameterId, @@ -2431,12 +2460,14 @@ VL53L1_Error VL53L1_PerformOffsetSimpleCalibration(VL53L1_DEV Dev, 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; LOG_FUNCTION_START(""); @@ -2446,48 +2477,67 @@ VL53L1_Error VL53L1_PerformOffsetSimpleCalibration(VL53L1_DEV Dev, pdev->customer.mm_config__inner_offset_mm = 0; pdev->customer.mm_config__outer_offset_mm = 0; - Max = BDTable[VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER]; - - 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); + /* Very first ranging completion interrupt must be ignored */ + 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); + /* offset calibration main loop */ + 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++; } + if (Status == VL53L1_ERROR_NONE) { + Status = VL53L1_ClearInterruptAndStartMeasurement( + Dev); + } + offset_meas++; } - if (Status == VL53L1_ERROR_NONE) { - Status = VL53L1_ClearInterruptAndStartMeasurement( - Dev); + total_count += inloopcount; + + /* no enough valid values found */ + if (inloopcount < UnderMax) { + Status = VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL; } - offset_meas++; - } - VL53L1_StopMeasurement(Dev); + VL53L1_StopMeasurement(Dev); - /* no valid values found */ - if (total_count == 0) { - Status = VL53L1_ERROR_OFFSET_CAL_NO_SAMPLE_FAIL; - } + Repeat--; + } /* check overflow (unlikely if target is near to the device) */ if ((sum_ranging < 0) || (sum_ranging > ((int32_t) total_count * 0xffff))) { 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; @@ -2730,11 +2780,11 @@ VL53L1_Error VL53L1_SetThresholdConfig(VL53L1_DEV Dev, * Apply invert distance gain to thresholds */ g = pdev->gain_cal.standard_ranging_gain_factor; /* gain is ufix 5.11, convert to 16.16 */ - 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); /* +32768 to round the results*/ high1616 = (high1616 + 32768) / gain; low1616 = (low1616 + 32768) / gain; diff --git a/vl53l1_api.h b/vl53l1_api.h old mode 100644 new mode 100755 index 3476fd0..44db02d --- a/vl53l1_api.h +++ b/vl53l1_api.h @@ -72,6 +72,18 @@ extern "C" { #endif +#if !defined(VL53L1DevDataGet) +#warning "Usage of PALDevDataGet is deprecated define VL53L1DevDataGet instead\ + in your vl53l1_platform_user_data.h file" +#define VL53L1DevDataGet(Dev, field) (Dev->Data.field) +#endif + +#if !defined(VL53L1DevDataSet) +#warning "Usage of PALDevDataSet is deprecated define VL53L1DevDataSet instead\ + in your vl53l1_platform_user_data.h file" +#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 * @{ @@ -403,6 +415,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 */ @@ -761,8 +776,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); diff --git a/vl53l1_api_calibration.c b/vl53l1_api_calibration.c old mode 100644 new mode 100755 diff --git a/vl53l1_api_calibration.h b/vl53l1_api_calibration.h old mode 100644 new mode 100755 diff --git a/vl53l1_api_core.c b/vl53l1_api_core.c old mode 100644 new mode 100755 diff --git a/vl53l1_api_core.h b/vl53l1_api_core.h old mode 100644 new mode 100755 diff --git a/vl53l1_api_debug.c b/vl53l1_api_debug.c old mode 100644 new mode 100755 diff --git a/vl53l1_api_debug.h b/vl53l1_api_debug.h old mode 100644 new mode 100755 diff --git a/vl53l1_api_preset_modes.c b/vl53l1_api_preset_modes.c old mode 100644 new mode 100755 diff --git a/vl53l1_api_preset_modes.h b/vl53l1_api_preset_modes.h old mode 100644 new mode 100755 diff --git a/vl53l1_api_strings.c b/vl53l1_api_strings.c old mode 100644 new mode 100755 diff --git a/vl53l1_api_strings.h b/vl53l1_api_strings.h old mode 100644 new mode 100755 diff --git a/vl53l1_core.c b/vl53l1_core.c old mode 100644 new mode 100755 diff --git a/vl53l1_core.h b/vl53l1_core.h old mode 100644 new mode 100755 diff --git a/vl53l1_core_support.c b/vl53l1_core_support.c old mode 100644 new mode 100755 diff --git a/vl53l1_core_support.h b/vl53l1_core_support.h old mode 100644 new mode 100755 diff --git a/vl53l1_def.h b/vl53l1_def.h old mode 100644 new mode 100755 index 5d68555..8f2b6a9 --- a/vl53l1_def.h +++ b/vl53l1_def.h @@ -88,9 +88,9 @@ extern "C" { /** VL53L1 IMPLEMENTATION minor version */ #define VL53L1_IMPLEMENTATION_VER_MINOR 3 /** VL53L1 IMPLEMENTATION sub version */ -#define VL53L1_IMPLEMENTATION_VER_SUB 1 +#define VL53L1_IMPLEMENTATION_VER_SUB 3 /** VL53L1 IMPLEMENTATION sub version */ -#define VL53L1_IMPLEMENTATION_VER_REVISION 1842 +#define VL53L1_IMPLEMENTATION_VER_REVISION 1885 /**************************************** * PRIVATE define do not edit @@ -588,57 +588,57 @@ typedef struct { #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) diff --git a/vl53l1_error_codes.h b/vl53l1_error_codes.h old mode 100644 new mode 100755 diff --git a/vl53l1_error_exceptions.h b/vl53l1_error_exceptions.h old mode 100644 new mode 100755 diff --git a/vl53l1_error_strings.c b/vl53l1_error_strings.c old mode 100644 new mode 100755 diff --git a/vl53l1_error_strings.h b/vl53l1_error_strings.h old mode 100644 new mode 100755 diff --git a/vl53l1_ll_def.h b/vl53l1_ll_def.h old mode 100644 new mode 100755 diff --git a/vl53l1_ll_device.h b/vl53l1_ll_device.h old mode 100644 new mode 100755 diff --git a/vl53l1_nvm_map.h b/vl53l1_nvm_map.h old mode 100644 new mode 100755 diff --git a/vl53l1_platform.c b/vl53l1_platform.c old mode 100644 new mode 100755 diff --git a/vl53l1_platform.h b/vl53l1_platform.h old mode 100644 new mode 100755 diff --git a/vl53l1_platform_log.h b/vl53l1_platform_log.h old mode 100644 new mode 100755 diff --git a/vl53l1_platform_user_config.h b/vl53l1_platform_user_config.h old mode 100644 new mode 100755 diff --git a/vl53l1_platform_user_data.h b/vl53l1_platform_user_data.h old mode 100644 new mode 100755 diff --git a/vl53l1_platform_user_defines.h b/vl53l1_platform_user_defines.h old mode 100644 new mode 100755 diff --git a/vl53l1_preset_setup.h b/vl53l1_preset_setup.h old mode 100644 new mode 100755 index 241a881..26f58e2 --- a/vl53l1_preset_setup.h +++ b/vl53l1_preset_setup.h @@ -78,12 +78,13 @@ enum VL53L1_Tuning_t { VL53L1_TUNING_MIN_AMBIENT_DMAX_VALID, VL53L1_TUNING_MAX_SIMPLE_OFFSET_CALIBRATION_SAMPLE_NUMBER, VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM, + VL53L1_TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT, VL53L1_TUNING_MAX_TUNABLE_KEY }; /* default values for the tuning settings parameters */ -#define TUNING_VERSION 0x0003 +#define TUNING_VERSION 0x0004 #define TUNING_PROXY_MIN -30 /* min distance in mm */ #define TUNING_SINGLE_TARGET_XTALK_TARGET_DISTANCE_MM 600 @@ -96,6 +97,8 @@ enum VL53L1_Tuning_t { /* Maximum loops to perform simple offset calibration */ #define TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM 600 /* Target distance in mm for target Xtalk from Bins method*/ +#define TUNING_SIMPLE_OFFSET_CALIBRATION_REPEAT 1 +/* Number of loops done during the simple offset calibration*/ /* the following table should actually be defined as static and shall be part * of the VL53L1_StaticInit() function code diff --git a/vl53l1_register_funcs.c b/vl53l1_register_funcs.c old mode 100644 new mode 100755 diff --git a/vl53l1_register_funcs.h b/vl53l1_register_funcs.h old mode 100644 new mode 100755 diff --git a/vl53l1_register_map.h b/vl53l1_register_map.h old mode 100644 new mode 100755 diff --git a/vl53l1_register_settings.h b/vl53l1_register_settings.h old mode 100644 new mode 100755 diff --git a/vl53l1_register_structs.h b/vl53l1_register_structs.h old mode 100644 new mode 100755 diff --git a/vl53l1_silicon_core.c b/vl53l1_silicon_core.c old mode 100644 new mode 100755 diff --git a/vl53l1_silicon_core.h b/vl53l1_silicon_core.h old mode 100644 new mode 100755 diff --git a/vl53l1_tuning_parm_defaults.h b/vl53l1_tuning_parm_defaults.h old mode 100644 new mode 100755 diff --git a/vl53l1_types.h b/vl53l1_types.h old mode 100644 new mode 100755 diff --git a/vl53l1_wait.c b/vl53l1_wait.c old mode 100644 new mode 100755 diff --git a/vl53l1_wait.h b/vl53l1_wait.h old mode 100644 new mode 100755