How to Register Custom Assets

I would like to load and display files such as CSV files using custom code, but I couldn’t find a way to register them as assets in LVGL Pro.

If this is already supported, could you please let me know how to do it?

If it is not supported yet but is planned for a future release, could you let me know the expected timeline for this feature?

Hi @high-red ,

For custom code, you just need to add the file path inside : user_config.cmake

list(APPEND LV_EDITOR_PROJECT_SOURCES
    # ${CMAKE_CURRENT_LIST_DIR}/src/my_file.c
    ${CMAKE_CURRENT_LIST_DIR}/csv_parse.c}
)

I recommend you create a folder, such as assets or custom, and include your implementations there.

Hi @halyssonJr

Thanks for your reply.

What I’m looking for is slightly different.

I’ve already registered the CSV parser source code in user_config.cmake. What I would like to do is register the CSV data files as assets and preview them directly in the LVGL Pro editor.

I understand that it is possible to convert the CSV files into C arrays and register them that way, but I would like this conversion to be automated on the editor side.

It would also be even more convenient if I could use lv_fs from custom code to load the CSV files in the preview, so that I wouldn’t need to rebuild the project every time I modify a CSV file.

Hi @high-red ,

Given your requirements, I strongly recommend creating a widget and invoking it on the screen. This way, whenever the preview reloads, the file will be processed and converted into a C array.

Note: The custom_data folder must be created and placed at the same level as globals.xml and project.xml in your project.

Here is a simple example that might help you.

example.zip (32.0 KB)

Enjoy :slight_smile:

Editor: v2.02

Hi @halyssonJr ,

Thanks for the example!

I didn’t realize that custom_data is mapped to A: in the LVGL Pro Preview. (I couldn’t find this mentioned in the documentation.)

I was able to integrate it into my project and confirm that everything works as expected.

Hi @high-red ,

I am very happy to hear that.

The Editor team is updating the documentation.