How to address this header file ?

Hi,

I copied source code for the esp32_3248s035C display. I removed the non-arduino files and kept the C/C++ files.

I want to address the header files in my custom folder:

I tried this addressing but it didn't work:

Is there a solution for this problem or I have to copy the source code into my arduino code ?

In which parent directory is the referenced file?

Start by turning off the ridiculous Windows option that hides file extensions. It will not solve your problem but it certainly makes it easier to understand which files you are dealing with

1 Like

In the arduino/libraries folder.

What about the relative paths: "./" or "../" or "../../"

Maybe replace those relative links with hard coded links (file >> properties >> location >> /home/arduino/etc/etc)

Here's another issue:

The lv_msg.h is inside lvgl library as I want to access LV_EVENT_MSG_RECEIVED which is defined in this file.

So I used this path:
#include "lvgl/src/extra/others/msg/lv_msg.h"

I assumed that the arduino system requires the name of the library first, then I should stage into the nested folder but I don't know why it isn't working as exptected.

Since you have already included lvgl.h, try the relative path <extra/others/msg/lv_msg.h>

1 Like

I would ask what relative location is that file located, but I already asked that, twice, so I won't ask.

2 Likes

You're using IDE 1.x, which I am not familiar with. But generally, there are two directories with libraries:

  • the installed Boards and their built-in libraries
  • add-on libraries, populated by the Library Manager

Both of these contain dozens and dozens of directories that can be individually enumerated as search roots during compile time. There is no exhaustive search through those two trees, or considering library names. For example, if you use the Library Manager to install lvgl, then libraries/lvgl/src is added as one of many include directories to search.

When you #include <lvgl.h> that file is found -- the one in src. (Note there is also one in lvgl. The one in src is mainly

#include "../lvgl.h"
#include "lv_conf_internal.h"

so it includes lvgl/lvgl.h) Given this, you should use.

#include "extra/others/msg/lv_msg.h"

as already suggested. (I don't have a src/extra directory in my v9.1.0 copy of the library, though.) Remember, this is a search through dozens of include directories, and the first match wins. So if the name is not sufficiently unique, you could get something else.

For your original problem: if you want to just put files on your disk without creating/using an actual Library, here's something to try (works in 2.x, don't have 1.x)

  1. Create a directory to act as the root of your extra tree. It cannot be in either of those two directories above, or in the sketchbook. So perhaps as a sibling of the sketchbook
    > mkdir C:\Users\username\Documents\LibTree
    
  2. Put the files in there, so you have for example LibTree\esp32_capacative_display
  3. Create a file in your sketch named build_opt.h -- extra build options -- with
    -IC:/Users/username/Documents/LibTree
    
    Note that the slashes are forward. If you use backslash, the entire thing has to be quoted and the backslashes doubled/escaped.
  4. Reference the files relative to LibTree, as you had in post #1
1 Like

Yes, this is still not completely clear to me now.

What you mean here is that the Arduino IDE basically search for header files in scr folders ? then read the ones in the parent folder ?

Does this mean that because of sequential order that the lvgl.h which is in the sub-folder was called, then I can reference the surround files within that sub-folder directly without calling the later files with their relative path ?

Yep, this one worked but still the arduino ide can't reference the functions and variables in those header files. I'm still getting the errors that the function/variable isn't declared where I'm referencing its header files !

Tried to do the same with this file, but obviously I don't know how the arduino referencing works.

I tried both:
#include "cmsis-pack/lv_conf_cmsis.h"

assuming that arduino read what is inside scr, so env_support should be like scr but it didn't work.

then I tried this:

#include "env_support/cmsis-pack/lv_conf_cmsis.h"

and the same problem.

I think I eventually will copy the lvgl required files and put them in arduino-like libraries system.

Would help if we could actually see the file structure for your library files, but on my installation the file would be located at "../env_support/cmsis-pack/lv_conf_cmsis.h" because env_support is located one directory above the lvgl.h file. The file path starts in the directory where the lvlg.h file is located.

2 Likes

Yep, that worked perfectly.

Still one error:

Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"

In file included from E:\projects_electronics_programming\tft\esp32_3248s035\tft_espi_using_cyd_klipper\ui_utils.cpp:7:

e:\programs_files\arduino\libraries\lvgl\env_support\cmsis-pack\lv_conf_cmsis.h:13:10: fatal error: RTE_Components.h: No such file or directory

 #include "RTE_Components.h"

          ^~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

OK, I got you, you mean you need to know my actual arduino project.

Here's .zip file:

tft_espi_using_cyd_klipper.zip (27.6 KB)

The story, is that I have this esp32_3248s035c board, and I tried to run a simple tft_espi example but didn't work. I checked the pin layout in the tft_espi config file ensuring it's the same as what is on the schematic. And still not working.

Then I found this wonderful work done by this project on platformio:
https://github.com/suchmememanyskill/CYD-Klipper

When I installed the code, the board worked. So I thought of using his source files to check what is wrong with my tft_espi/lvgl source code setup.

So I put all the .h/.cpp files in my arduino project folder and trying to compile the code.

According to the Library specification

The header file lvgl/src/lvgl.h specifically says to include ../lvgl.h, which of course is lvgl/lvgl.h There's no magic or automatic behavior going here. Once the preprocessor finds the file in src, it does what it is told. It is not reading "the ones in the parent" -- just that one.

1 Like

OK guys I found a working example in:

C:\Programs Files\Arduino\libraries\GFX_Library_for_Arduino-1.4.7\examples\PDQgraphicstest

Uncomment the model you have an enjoy :slight_smile:

I'm workig with another library and applied the technique you told me and it worked.

When I include the master header file, I can include the other libraries in the sub-folders.

With this:

#include <Arduino_GFX_Library.h>
#include "../src/databus/Arduino_ESP32RGBPanel.h"
#include "../src/display/Arduino_RGB_Display.h"

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.