Page 1 of 1

Add VL53L0X Api to ESP-IDF project

Posted: Tue Sep 29, 2020 10:27 am
by Hack-Mike
Hi,

unfortunately I'm stuck again with CMake and external sources.
I'm not able to find the right way to add ST VL53L0X Api to my project to use it.

If some one help me I'll appreciate.

Re: Add VL53L0X Api to ESP-IDF project

Posted: Tue Sep 29, 2020 1:37 pm
by ESP_Sprite
Sorry, I left my crystal ball home today, so I'm unable to diagnose your problem from just 'I'm stuck again'. Can you post where you are stuck, what the output of the compile process is, what you have tried, perhaps even a link to your code? That will help immensely in us being able to tell you what to do.

Re: Add VL53L0X Api to ESP-IDF project

Posted: Tue Sep 29, 2020 2:15 pm
by Hack-Mike
I want to add the VL53L0X Api to my project
Schermata 2020-09-29 alle 16.03.22.png
Schermata 2020-09-29 alle 16.03.22.png (78.15 KiB) Viewed 4353 times
, I created a CMake.txt like this:

Code: Select all

set(COMPONENT_SRCS 
  "core/src/vl53l0x_api.c"
  "core/src/vl53l0x_api_calibration.c"
  "core/src/vl53l0x_api_core.c"
  "core/src/vl53l0x_api_ranging.c"
  "core/src/vl53l0x_api_strings.c"
  "platform/src/vl53l0x_platform.c"
  "platform/src/vl53l0x_platform_log.c"
)

set(COMPONENT_ADD_INCLUDEDIRS "." "core/inc" "platform/inc")

register_component()
then in main/CMake.txt I call

Code: Select all

add_subdirectory(...mylib/vl53l0x_Api VL53L0X)
but when I reload CMake project I receive this error:

"add_library cannot create target "__idf_main" because another target with
the same name already exists. The existing target is a static library
created in source directory"

Re: Add VL53L0X Api to ESP-IDF project

Posted: Sat May 22, 2021 10:53 am
by Reibers
I think you need to write the platform specific parts under vl53l0x_platform.h like the documentation says to use the api for esp32.
You already did that?!