st7735s add CONFIG_LV_TFT_DISPLAY_OFFSETS

This commit is contained in:
xuhailong11 2022-09-06 13:01:04 +08:00
parent 26fe6e7703
commit 9cb0e8f505
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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