esp-idf adding custom component library

DominicS
Posts: 2
Joined: Tue Jan 03, 2023 1:55 pm

esp-idf adding custom component library

Postby DominicS » Sun Dec 24, 2023 8:41 pm

Hello, I am trying to add custom DHT-11 library to already existing esp-idf project. I am working on VScode. I created folder named 'components', inside created another 'dht_11', then added dht11.c and CmakeLists.txt files and included dht11.h inside include folder of this component. I tried including .h file inside main, but compiler cant find it, tried building project and got huge amount of errors, but I think main one is that dht11.h file is not found. I edited Cmake file like documentation of build system showed:

Code: Select all

idf_component_register(SRCS "dht11.c"
                     INCLUDE_DIRS "include"
                     REQUIRES mbedtls)
Maybe someone can help with this? What are the steps of adding or creating custom driver library? As I understood, it should be added to component folder, but it seems that my project doesn't recognize this component folder.

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: esp-idf adding custom component library

Postby MicroController » Mon Dec 25, 2023 7:35 pm

created another 'dht_11'
...
but it seems that my project doesn't recognize this component folder.
Don't forget to also add dht_11 to the REQUIRES of your main project :)

Who is online

Users browsing this forum: Google [Bot] and 115 guests