From 2a3157b8fcb6cf14c8a6b74f26a14a1ba297cabd Mon Sep 17 00:00:00 2001 From: C47D Date: Wed, 8 Sep 2021 23:02:47 -0500 Subject: [PATCH] ST7789: Move configuration to display_config.h --- display_config.h | 29 +++++++++++++++++++++++++++++ lvgl_tft/st7789.h | 16 ++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 display_config.h diff --git a/display_config.h b/display_config.h new file mode 100644 index 0000000..37e6387 --- /dev/null +++ b/display_config.h @@ -0,0 +1,29 @@ +#ifndef DISPLAY_CONFIG_H_ +#define DISPLAY_CONFIG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "sdkconfig.h" + +/* Configuration options for ST7789 display controllers */ +#if CONFIG_LV_DISP_USE_RST + #if CONFIG_LV_DISP_ST7789_SOFT_RESET + #define ST7789_SOFT_RST + #endif +#else + #define ST7789_SOFT_RST +#endif + +#if defined (CONFIG_LV_INVERT_COLORS) +#define ST7789_INVERT_COLORS 1U +#endif + +#define ST7789_INITIAL_ORIENTATION CONFIG_LV_DISPLAY_ORIENTATION + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* DISPLAY_CONFIG_H_ */ diff --git a/lvgl_tft/st7789.h b/lvgl_tft/st7789.h index e09f6a7..d48da96 100644 --- a/lvgl_tft/st7789.h +++ b/lvgl_tft/st7789.h @@ -17,19 +17,11 @@ extern "C" #else #include "lvgl/lvgl.h" #endif -#include "../lvgl_helpers.h" -#include "sdkconfig.h" - -#if CONFIG_LV_DISP_USE_RST - #if CONFIG_LV_DISP_ST7789_SOFT_RESET - #define ST7789_SOFT_RST - #endif -#else - #define ST7789_SOFT_RST -#endif - -#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS +/* For SPI transfers */ +#include "lvgl_helpers.h" +/* For ST7789 particular configurations */ +#include "display_config.h" /* ST7789 commands */ #define ST7789_NOP 0x00