The STSW-IMG005 software is an API containing all the calls you need to make - but it stops at the I2C call. You need to supply the platform layer between the I2C_read/write functions and your MCU. Refer to the platform.c file (which is where you put your functions).
Attached is a platform.c file I developed for an STM32 to give you the idea. Adapt it as you require.
As for what is in the main, try something like:
status=VL53L0X_StaticInit(&VL53L0XDevs[i]);
if( status ){
debug_printf("VL53L0X_StaticInit %d failed\n",i);
}
status = VL53L0X_PerformRefCalibration(&VL53L0XDevs[i], &VhvSettings, &PhaseCal);
if( status ){
debug_printf("VL53L0X_PerformRefCalibration failed\n");
}
status = VL53L0X_PerformRefSpadManagement(&VL53L0XDevs[i], &refSpadCount, &isApertureSpads);
if( status ){
debug_printf("VL53L0X_PerformRefSpadManagement failed\n");
}
status = VL53L0X_SetDeviceMode(&VL53L0XDevs[i], VL53L0X_DEVICEMODE_SINGLE_RANGING); // Setup in single ranging mode
if( status ){
debug_printf("VL53L0X_SetDeviceMode failed\n");
}
status = VL53L0X_SetLimitCheckEnable(&VL53L0XDevs[i], VL53L0X_CHECKENABLE_SIGMA_FINAL_RANGE, 1); // Enable Sigma limit
if( status ){
debug_printf("VL53L0X_SetLimitCheckEnable failed\n");
}
status = VL53L0X_SetLimitCheckEnable(&VL53L0XDevs[i], VL53L0X_CHECKENABLE_SIGNAL_RATE_FINAL_RANGE, 1); // Enable Signa limit
if( status ){
debug_printf("VL53L0X_SetLimitCheckEnable failed\n");
}
To set things up, then to run:
status = VL53L0X_PerformSingleRangingMeasurement(&VL53L0XDevs[SingleSensorNo],&RangingMeasurementData);
if( status ==0 ){
/* Push data logging to UART */
trace_printf("%d,%u,%d,%d,%d\n", VL53L0XDevs[SingleSensorNo].Id, TimeStamp_Get(), RangingMeasurementData.RangeStatus, RangingMeasurementData.RangeMilliMeter, RangingMeasurementData.SignalRateRtnMegaCps);
But there are lots of ways to configure and run - so do read the user's guide
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.