The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2
Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.
Diff: src/vl53l1_api_core.c
- Revision:
- 18:0696efe39d08
- Parent:
- 7:1add29d51e72
--- a/src/vl53l1_api_core.c Wed Jun 23 12:57:26 2021 +0000 +++ b/src/vl53l1_api_core.c Wed Jul 21 17:06:38 2021 +0200 @@ -71,6 +71,8 @@ tB = pdev->per_vcsel_cal_data.long_b_offset_mm; break; default: + tA = pdev->per_vcsel_cal_data.long_a_offset_mm; + tB = pdev->per_vcsel_cal_data.long_b_offset_mm; status = VL53L1_ERROR_INVALID_PARAMS; *poffset = 0; break; @@ -610,9 +612,12 @@ VL53L1_additional_offset_cal_data_t *pCD = &(pdev->add_off_cal_data); VL53L1_decoded_nvm_fmt_range_data_t fmt_rrd; + uint8_t i, VL53L1_p_001, count; LOG_FUNCTION_START(""); + pdev->fmt_total_enabled_spads = 256; + if (status == VL53L1_ERROR_NONE) status = VL53L1_get_static_nvm_managed( Dev, @@ -630,10 +635,21 @@ &(pdev->nvm_copy_data)); - if (status == VL53L1_ERROR_NONE) + if (status == VL53L1_ERROR_NONE) { VL53L1_copy_rtn_good_spads_to_buffer( &(pdev->nvm_copy_data), &(pdev->rtn_good_spads[0])); + pdev->fmt_total_enabled_spads = 0; + for (i = 0; i < 32; i++) { + VL53L1_p_001 = pdev->rtn_good_spads[i]; + count = 0; + while(VL53L1_p_001) { + count += VL53L1_p_001&1; + VL53L1_p_001 = VL53L1_p_001>>1; + } + pdev->fmt_total_enabled_spads += count; + } + } } @@ -3676,7 +3692,7 @@ (VL53L1DevDataGet(Dev, CurrentParameters.PresetMode) == VL53L1_PRESETMODE_RANGING); - + presults->fmt_total_enabled_spads = pdev->fmt_total_enabled_spads; if ((pdev->sys_ctrl.system__mode_start & VL53L1_DEVICESCHEDULERMODE_HISTOGRAM) == VL53L1_DEVICESCHEDULERMODE_HISTOGRAM) { @@ -6258,6 +6274,10 @@ *ptuning_parm_value = pdev->tuning_parms.tp_uwr_lng_corr_z_5_rangeb; break; + case VL53L1_TUNINGPARM_MIN_SIGNAL_SECONDARY_TARGETS: + *ptuning_parm_value = + pdev->tuning_parms.tp_min_signal_secondary_targets; + break; default: *ptuning_parm_value = 0x7FFFFFFF; @@ -7058,7 +7078,10 @@ pdev->tuning_parms.tp_uwr_lng_corr_z_5_rangeb = (int16_t)tuning_parm_value; break; - + case VL53L1_TUNINGPARM_MIN_SIGNAL_SECONDARY_TARGETS: + pdev->tuning_parms.tp_min_signal_secondary_targets = + (uint32_t)tuning_parm_value; + break; default: status = VL53L1_ERROR_INVALID_PARAMS;