How to use custom LVGL lv_conf.h with Adafruit LittlevGL Glue Library on PlatformIO

If you use PlatformIO with the Adafruit LittlevGL Glue Library as we did in our LVGL examples such as Adafruit ST7735R display minimal LVGL example for PlatformIOlv_conf.h comes with the Adafruit LittlevGL Glue Library, hence any changes to lv_conf.h would not be permanent as they would be overwritten when the library inside the .pio folder is re-installed.

The original config fileis located at

.pio/libdeps/esp32dev/Adafruit LittlevGL Glue Library/lv_conf.h

(esp32dev is the environment name in your platformio.ini and hence might be different in your configuration)

How to create a custom lv_conf.h

Luckily, PlatformIO configures the project’s include directory to have precedence over other folders, including the library dependencies located in .pio.

In other words, you simply have to create a file called lv_conf.h in your project’s include directory and PlatformIO will handle the rest for you.

Typically, just copy the content from the original lv_conf.h to get started and then make your modifications.

**Furthermore, to suppress some internal errors,**you need to add the following #defines/compiler flags to your platformio.ini:

build_flags = -DLV_CONF_INCLUDE_SIMPLE -DLV_CONF_SUPPRESS_DEFINE_CHECK