Include Github library for esp-idf framework

Hello,

I am a beginner and trying to work myself through the esp-idf framework with vscode and the platformio plugin. My problem begins when i try to add a github library to my project. More specifically the hd44780 component from esp-idf-lib/components/hd44780 at master · UncleRus/esp-idf-lib · GitHub. I am not quite sure how i am supossed to add this library to the platform.ini file.
So far i have tried:


and:

[env:esp32doit-devkit-v1]

platform = espressif32

board = esp32doit-devkit-v1

framework = espidf

lib_deps = 

    https://github.com/UncleRus/esp-idf-lib.git

lib_ldf_mode = chain+

monitor_baud = 115200

build_unflags = -Werror=all

Both with no success.
I have also tried adding the .h and .c file with all their dependencies in the include folder but this also throws errors. Can somebody guide me on how to add the library correctly, Also i must mention i havent found this library within the platformio search tool.

lib deps is designed to add a single library that is contained in one repository – the repo is expected to only have one library, not many. You cannot refer to this sublibrary with native PlatformIO tools / expressions. You will need to manually clone the referenced repo, create a components folder and then copy the hd44780 folder in there.

I have done as you suggested and there seems to be an improvement. Now i can compile further than the first time however new errors are shown. Specifically in one of the dependencies (i2cdev.c), one of the variables cannot be found (CONFIG_I2CDEV_TIMEOUT). I assume this is one of the variables that is defined using menuconfig following the conventional method without platformio.

in file included from C:/Users/User/.platformio/packages/framework-espidf/components/driver/include/driver/i2c.h:26,
                 from lib/i2cdev/i2cdev.h:38,
                 from lib/i2cdev/i2cdev.c:37:
lib/i2cdev/i2cdev.c: In function 'i2cdev_done':
lib/i2cdev/i2cdev.c:53:62: error: 'CONFIG_I2CDEV_TIMEOUT' undeclared (first use in this function); did you mean 'CONFIG_FATFS_TIMEOUT_MS'?
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                              ^~~~~~~~~~~~~~~~~~~~~
C:/Users/User/.platformio/packages/framework-espidf/components/freertos/include/freertos/semphr.h:314:115: note: in definition of macro 'xSemaphoreTake'
 #define xSemaphoreTake( xSemaphore, xBlockTime )  xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
                                                                                                                   ^~~~~~~~~~
lib/i2cdev/i2cdev.c:53:48: note: in expansion of macro 'pdMS_TO_TICKS'
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                ^~~~~~~~~~~~~
lib/i2cdev/i2cdev.c:100:13: note: in expansion of macro 'SEMAPHORE_TAKE'
             SEMAPHORE_TAKE(i);
             ^~~~~~~~~~~~~~
lib/i2cdev/i2cdev.c:53:62: note: each undeclared identifier is reported only once for each function it appears in
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                              ^~~~~~~~~~~~~~~~~~~~~
C:/Users/User/.platformio/packages/framework-espidf/components/freertos/include/freertos/semphr.h:314:115: note: in definition of macro 'xSemaphoreTake'
 #define xSemaphoreTake( xSemaphore, xBlockTime )  xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
                                                                                                                   ^~~~~~~~~~
lib/i2cdev/i2cdev.c:53:48: note: in expansion of macro 'pdMS_TO_TICKS'
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                ^~~~~~~~~~~~~
lib/i2cdev/i2cdev.c:100:13: note: in expansion of macro 'SEMAPHORE_TAKE'
             SEMAPHORE_TAKE(i);
             ^~~~~~~~~~~~~~
lib/i2cdev/i2cdev.c: In function 'i2c_dev_take_mutex':
lib/i2cdev/i2cdev.c:150:51: error: 'CONFIG_I2CDEV_TIMEOUT' undeclared (first use in this function); did you mean 'CONFIG_FATFS_TIMEOUT_MS'?
     if (!xSemaphoreTake(dev->mutex, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT)))
                                                   ^~~~~~~~~~~~~~~~~~~~~
C:/Users/User/.platformio/packages/framework-espidf/components/freertos/include/freertos/semphr.h:314:115: note: in definition of macro 'xSemaphoreTake'
 #define xSemaphoreTake( xSemaphore, xBlockTime )  xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
                                                                                                                   ^~~~~~~~~~
lib/i2cdev/i2cdev.c:150:37: note: in expansion of macro 'pdMS_TO_TICKS'
     if (!xSemaphoreTake(dev->mutex, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT)))
                                     ^~~~~~~~~~~~~
lib/i2cdev/i2cdev.c: In function 'i2c_dev_read':
lib/i2cdev/i2cdev.c:53:62: error: 'CONFIG_I2CDEV_TIMEOUT' undeclared (first use in this function); did you mean 'CONFIG_FATFS_TIMEOUT_MS'?
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                              ^~~~~~~~~~~~~~~~~~~~~
C:/Users/User/.platformio/packages/framework-espidf/components/freertos/include/freertos/semphr.h:314:115: note: in definition of macro 'xSemaphoreTake'
 #define xSemaphoreTake( xSemaphore, xBlockTime )  xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
                                                                                                                   ^~~~~~~~~~
lib/i2cdev/i2cdev.c:53:48: note: in expansion of macro 'pdMS_TO_TICKS'
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                ^~~~~~~~~~~~~
lib/i2cdev/i2cdev.c:240:5: note: in expansion of macro 'SEMAPHORE_TAKE'
     SEMAPHORE_TAKE(dev->port);
     ^~~~~~~~~~~~~~
lib/i2cdev/i2cdev.c: In function 'i2c_dev_write':
lib/i2cdev/i2cdev.c:53:62: error: 'CONFIG_I2CDEV_TIMEOUT' undeclared (first use in this function); did you mean 'CONFIG_FATFS_TIMEOUT_MS'?
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                              ^~~~~~~~~~~~~~~~~~~~~
C:/Users/User/.platformio/packages/framework-espidf/components/freertos/include/freertos/semphr.h:314:115: note: in definition of macro 'xSemaphoreTake'
 #define xSemaphoreTake( xSemaphore, xBlockTime )  xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
                                                                                                                   ^~~~~~~~~~
lib/i2cdev/i2cdev.c:53:48: note: in expansion of macro 'pdMS_TO_TICKS'
         if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
                                                ^~~~~~~~~~~~~
lib/i2cdev/i2cdev.c:272:5: note: in expansion of macro 'SEMAPHORE_TAKE'
     SEMAPHORE_TAKE(dev->port);
     ^~~~~~~~~~~~~~
*** [.pio\build\esp32doit-devkit-v1\lib524\i2cdev\i2cdev.o] Error 1

Do not put the i2cdev ESP-IDF component into lib/, but into components a well. Otherwise the Kconfig file of the component, which is the source of the macros that you are missing, will not be utilized.

It now compiles and works without errors, thank you very much for your guidance. I have one last question regarding the components directory. What is the best way to organize the libraries for each component in the components directory?