From 9cb0e8f5050bea821955a1d6309a9c8ca5861ffb Mon Sep 17 00:00:00 2001 From: xuhailong11 Date: Tue, 6 Sep 2022 13:01:04 +0800 Subject: [PATCH] st7735s add CONFIG_LV_TFT_DISPLAY_OFFSETS --- lvgl_tft/Kconfig | 3 +++ lvgl_tft/st7735s.h | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lvgl_tft/Kconfig b/lvgl_tft/Kconfig index 4a74ad2..839821c 100644 --- a/lvgl_tft/Kconfig +++ b/lvgl_tft/Kconfig @@ -228,6 +228,7 @@ menu "LVGL TFT Display controller" int "X offset" default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) + default 26 if LV_TFT_DISPLAY_USER_CONTROLLER_ST7735S default 0 config LV_TFT_DISPLAY_Y_OFFSET @@ -235,6 +236,7 @@ menu "LVGL TFT Display controller" int "Y offset" default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED) default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED) + default 1 if LV_TFT_DISPLAY_USER_CONTROLLER_ST7735S default 0 @@ -303,6 +305,7 @@ menu "LVGL TFT Display controller" bool "ST7735S" select LV_TFT_DISPLAY_CONTROLLER_ST7735S select LV_TFT_DISPLAY_PROTOCOL_SPI + select LV_TFT_DISPLAY_OFFSETS config LV_TFT_DISPLAY_USER_CONTROLLER_HX8357 bool "HX8357" select LV_TFT_DISPLAY_CONTROLLER_HX8357 diff --git a/lvgl_tft/st7735s.h b/lvgl_tft/st7735s.h index 2d02ed0..7039ce6 100644 --- a/lvgl_tft/st7735s.h +++ b/lvgl_tft/st7735s.h @@ -37,8 +37,10 @@ extern "C" { // https://github.com/adafruit/Adafruit-ST7735-Library // #define ST7735_GREENTAB160x80 // For 160 x 80 display (BGR, inverted, 26 / 1 offset) -#define COLSTART 26 -#define ROWSTART 1 +#if (CONFIG_LV_TFT_DISPLAY_OFFSETS) +#define COLSTART CONFIG_LV_TFT_DISPLAY_X_OFFSET +#define ROWSTART CONFIG_LV_TFT_DISPLAY_Y_OFFSET +#endif // Delay between some initialisation commands #define TFT_INIT_DELAY 0x80