Add VL53L0X Api to ESP-IDF project

Hack-Mike
Posts: 8
Joined: Wed Jul 15, 2020 1:42 pm

Add VL53L0X Api to ESP-IDF project

Postby Hack-Mike » Tue Sep 29, 2020 10:27 am

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.

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Add VL53L0X Api to ESP-IDF project

Postby ESP_Sprite » Tue Sep 29, 2020 1:37 pm

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.

Hack-Mike
Posts: 8
Joined: Wed Jul 15, 2020 1:42 pm

Re: Add VL53L0X Api to ESP-IDF project

Postby Hack-Mike » Tue Sep 29, 2020 2:15 pm

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 4376 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"

Reibers
Posts: 6
Joined: Sat May 22, 2021 10:49 am

Re: Add VL53L0X Api to ESP-IDF project

Postby Reibers » Sat May 22, 2021 10:53 am

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?!

Who is online

Users browsing this forum: No registered users and 158 guests