Skip to main content
ritzeng
Associate II
March 24, 2021
Question

VL53L1 2.0 Library

  • March 24, 2021
  • 3 replies
  • 1009 views

Unused code detected:

VL53L1_Error VL53L1::VL53L1_RdByte(VL53L1_DEV Dev, uint16_t index, uint8_t *data)

{

int status;

status = VL53L1_I2CRead(Dev->I2cDevAddr, index, data, 1);

//FR bug :: I2CRead exits always with 0! why the following check? Unused.

if (status) {

return -1;

}

return 0;

}

This topic has been closed for replies.

3 replies

John E KVAM
ST Employee
March 26, 2021

The I2CRead function has to be implemented for the customer's MCU. It's maybe that some implementations have a non-zero status from the call.

Some might not, but we cannot count on that.

  • john
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.
ritzeng
ritzengAuthor
Associate II
March 26, 2021

Hello John,

which of the lIbrary functions is like this that we, customers, have to adapt.

I did not mention this (Wire, I2C Bus etc.). Maybe it was written somehow.

I got a Interrupt based version running, but with a very difficult timing of VL53L1_ClearInterruptAndStartMeasurement()

and

L53L1_GetMultiRangingData()

It seems not to be a real Shakehand because of the timing.

But I'll write this in an extra message these days. This sensor is very difficult to get it run. I've had never this before.

Best regards

Frank

ritzeng
ritzengAuthor
Associate II
April 2, 2021

I solved the problem. The provided examples software for Arduino Environment's never worked. I will publish my example and the working solution at my GitHub the next days. It's running on ESP 8266 and ESP32 and STM platforms.