cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to make use of the VL53L0X API on stm32cubeide but I've encountered some issues coming from the file vl53l0x_i2c_win_serial_comms.c. Apparently INFINITE, WAIT_OBJECT_0 aren't declared and HANDLE is an unknown type name.

LShan.11
Associate

I thought HANDLE was part of the stm32 hal library so I tried including stm32h7xx_hal.h however it did not resolve the issue

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

I hate the way that code was delivered. The platform layer (VL53L0_platform.c) was written to communicate to a Windows PC. And nobody does that. Well, apparently one guy did. But nobody else.

Our instructions tell you to gut the VL53L0_platform.c file and rewrite it for your MCU.

But that's silly - you are using an STM32.

So here is what I think you should do.

Create a different project using a VL53L3CX. This L3 sensor is supported by the X-cube so it will be included.

When you create the code for this project there will be a VL53L3_platform.c

Then compare this VL53L3_platform.c to the VL53L0_platform.c function names.

It will give you a good head start. You might have to fix a few things, but the basic communication is there and it should be easy. (I know - famous last words.)

You can also try finding a VL53L0_platform.c on GitHub.

Good luck,

  • 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.

View solution in original post

1 REPLY 1
John E KVAM
ST Employee

I hate the way that code was delivered. The platform layer (VL53L0_platform.c) was written to communicate to a Windows PC. And nobody does that. Well, apparently one guy did. But nobody else.

Our instructions tell you to gut the VL53L0_platform.c file and rewrite it for your MCU.

But that's silly - you are using an STM32.

So here is what I think you should do.

Create a different project using a VL53L3CX. This L3 sensor is supported by the X-cube so it will be included.

When you create the code for this project there will be a VL53L3_platform.c

Then compare this VL53L3_platform.c to the VL53L0_platform.c function names.

It will give you a good head start. You might have to fix a few things, but the basic communication is there and it should be easy. (I know - famous last words.)

You can also try finding a VL53L0_platform.c on GitHub.

Good luck,

  • 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.