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

.```generic {filename=“original_lv_conf_path.txt”} .pio/libdeps/esp32dev/Adafruit LittlevGL Glue Library/lv_conf.h

example.txt

(`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.

![](/images/2023/09/PlatformIO-Custom-lv_conf.h.png)

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 `#define`s/compiler flags to your `platformio.ini`:

```ini {filename="platformio_build_flags.ini"}
build_flags = -DLV_CONF_INCLUDE_SIMPLE -DLV_CONF_SUPPRESS_DEFINE_CHECK

Check out similar posts by category: LVGL, PlatformIO