Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.md,*.rst}]
trim_trailing_whitespace = false

[{Makefile,*.mk,*.bat}]
indent_style = tab
indent_size = 2

[{*.cmake,CMakeLists.txt}]
indent_style = space
indent_size = 4
max_line_length = 120

[{*.sh,*.yml}]
indent_style = space
indent_size = 2
39 changes: 20 additions & 19 deletions lvgl_tft/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ menu "LVGL TFT Display controller"
bool
help
ST7789 display controller.

config LV_TFT_DISPLAY_CONTROLLER_GC9A01
bool
help
Expand Down Expand Up @@ -211,14 +211,14 @@ menu "LVGL TFT Display controller"

config LV_TFT_DISPLAY_X_OFFSET
depends on LV_TFT_DISPLAY_OFFSETS
int
int
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 0

config LV_TFT_DISPLAY_Y_OFFSET
depends on LV_TFT_DISPLAY_OFFSETS
int
int
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 0
Expand Down Expand Up @@ -284,7 +284,7 @@ menu "LVGL TFT Display controller"
config LV_TFT_DISPLAY_USER_CONTROLLER_GC9A01
bool "GC9A01"
select LV_TFT_DISPLAY_CONTROLLER_GC9A01
select LV_TFT_DISPLAY_PROTOCOL_SPI
select LV_TFT_DISPLAY_PROTOCOL_SPI
config LV_TFT_DISPLAY_USER_CONTROLLER_ST7735S
bool "ST7735S"
select LV_TFT_DISPLAY_CONTROLLER_ST7735S
Expand Down Expand Up @@ -441,7 +441,7 @@ menu "LVGL TFT Display controller"
config LV_FT81X_CONFIG_EVE_SUNFLOWER
bool "EVE_SUNFLOWER"
config LV_FT81X_CONFIG_EVE_CONNECTEVE
bool "EVE_CONNECTEVE"
bool "EVE_CONNECTEVE"
endchoice

choice
Expand Down Expand Up @@ -579,16 +579,17 @@ menu "LVGL TFT Display controller"
default 2

config LV_INVERT_DISPLAY
bool "IN DEPRECATION - Invert display."
default y if LV_PREDEFINED_DISPLAY_M5STACK
bool "IN DEPRECATION - Invert display." if LV_TFT_DISPLAY_CONTROLLER_RA8875
default n
help
If text is backwards on your display, try enabling this.

config LV_INVERT_COLORS
bool "Invert colors in display" if LV_TFT_DISPLAY_CONTROLLER_ILI9341 || LV_TFT_DISPLAY_CONTROLLER_ST7735S || LV_TFT_DISPLAY_CONTROLLER_ILI9481
bool "Invert colors in display" if LV_TFT_DISPLAY_CONTROLLER_ILI9341 || LV_TFT_DISPLAY_CONTROLLER_ST7735S || LV_TFT_DISPLAY_CONTROLLER_ILI9481 || LV_TFT_DISPLAY_CONTROLLER_ST7789 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 || LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_HX8357
default y if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICKC
help
If the colors look inverted on your display, try enabling this.
If it didn't help try LVGL configuration -> Swap the 2 bytes of RGB565 color.

config LV_M5STICKC_HANDLE_AXP192
bool "Handle Backlight and TFT power for M5StickC using AXP192." if LV_PREDEFINED_DISPLAY_M5STICKC || LV_TFT_DISPLAY_CONTROLLER_ST7735S
Expand Down Expand Up @@ -769,7 +770,7 @@ menu "LVGL TFT Display controller"
depends on LV_DISPLAY_USE_SPI_MISO
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 19 if LV_PREDEFINED_PINS_TKOALA
default 0

Expand All @@ -790,7 +791,7 @@ menu "LVGL TFT Display controller"
depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
range -1 39 if IDF_TARGET_ESP32
range -1 43 if IDF_TARGET_ESP32S2

default 22 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
default -1
help
Expand All @@ -801,7 +802,7 @@ menu "LVGL TFT Display controller"
depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
range -1 39 if IDF_TARGET_ESP32
range -1 43 if IDF_TARGET_ESP32S2

default 21 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
default -1
help
Expand All @@ -811,7 +812,7 @@ menu "LVGL TFT Display controller"
int "GPIO for CLK (SCK / Serial Clock)" if LV_TFT_DISPLAY_PROTOCOL_SPI
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 18 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 13 if LV_PREDEFINED_DISPLAY_M5STICKC
default 18 if LV_PREDEFINED_DISPLAY_ATAG
Expand All @@ -838,7 +839,7 @@ menu "LVGL TFT Display controller"
depends on LV_DISPLAY_USE_SPI_CS
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 5 if LV_PREDEFINED_PINS_38V1
default 14 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 5 if LV_PREDEFINED_DISPLAY_M5STICKC
Expand All @@ -865,7 +866,7 @@ menu "LVGL TFT Display controller"
int "GPIO for DC (Data / Command)" if LV_TFT_DISPLAY_PROTOCOL_SPI
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

depends on LV_DISPLAY_USE_DC
default 19 if LV_PREDEFINED_PINS_38V1
default 17 if LV_PREDEFINED_PINS_38V4
Expand All @@ -887,7 +888,7 @@ menu "LVGL TFT Display controller"
int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 18 if LV_PREDEFINED_PINS_38V1
default 25 if LV_PREDEFINED_PINS_38V4
default 33 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
Expand All @@ -908,7 +909,7 @@ menu "LVGL TFT Display controller"
int "GPIO for Busy" if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 35 if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
default 35

Expand Down Expand Up @@ -946,7 +947,7 @@ menu "LVGL TFT Display controller"
depends on LV_ENABLE_BACKLIGHT_CONTROL
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 23 if LV_PREDEFINED_PINS_38V1
default 26 if LV_PREDEFINED_PINS_38V4
default 32 if LV_PREDEFINED_DISPLAY_M5STACK
Expand All @@ -966,7 +967,7 @@ menu "LVGL TFT Display controller"
int "GPIO for I2C SDA" if LV_TFT_DISPLAY_PROTOCOL_I2C
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 5 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
default 5

Expand All @@ -977,7 +978,7 @@ menu "LVGL TFT Display controller"
int "GPIO for I2C SCL" if LV_TFT_DISPLAY_PROTOCOL_I2C
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2

default 4 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
default 4

Expand Down
20 changes: 11 additions & 9 deletions lvgl_tft/hx8357.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Adafruit 3.5" TFT 320x480 + Touchscreen Breakout
* http://www.adafruit.com/products/2050
*
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* https://www.adafruit.com/product/3651
*
*/
Expand Down Expand Up @@ -177,7 +177,7 @@ void hx8357_init(void)
vTaskDelay(120 / portTICK_RATE_MS);

ESP_LOGI(TAG, "Initialization.");

//Send all the commands
const uint8_t *addr = (displayType == HX8357B) ? initb : initd;
uint8_t cmd, x, numArgs;
Expand All @@ -199,9 +199,11 @@ void hx8357_init(void)
}

hx8357_set_rotation(1);

#if HX8357_INVERT_DISPLAY
hx8357_send_cmd(HX8357_INVON);;

#if HX8357_INVERT_COLORS
hx8357_send_cmd(HX8357_INVON);
#else
hx8357_send_cmd(HX8357_INVOFF);
#endif

hx8357_enable_backlight(true);
Expand All @@ -211,15 +213,15 @@ void hx8357_init(void)
void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);

/* Column addresses */
uint8_t xb[] = {
(uint8_t) (area->x1 >> 8) & 0xFF,
(uint8_t) (area->x1) & 0xFF,
(uint8_t) (area->x2 >> 8) & 0xFF,
(uint8_t) (area->x2) & 0xFF,
};

/* Page addresses */
uint8_t yb[] = {
(uint8_t) (area->y1 >> 8) & 0xFF,
Expand Down Expand Up @@ -261,7 +263,7 @@ void hx8357_enable_backlight(bool backlight)
void hx8357_set_rotation(uint8_t r)
{
r = r & 3; // can't be higher than 3

switch(r) {
case 0:
r = MADCTL_MX | MADCTL_MY | MADCTL_RGB;
Expand All @@ -276,7 +278,7 @@ void hx8357_set_rotation(uint8_t r)
r = MADCTL_MX | MADCTL_MV | MADCTL_RGB;
break;
}

hx8357_send_cmd(HX8357_MADCTL);
hx8357_send_data(&r, 1);
}
Expand Down
6 changes: 2 additions & 4 deletions lvgl_tft/hx8357.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Adafruit 3.5" TFT 320x480 + Touchscreen Breakout
* http://www.adafruit.com/products/2050
*
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* https://www.adafruit.com/product/3651
*
*/
Expand Down Expand Up @@ -40,16 +40,14 @@ extern "C" {
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL

#define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS

#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
#define HX8357_BCKL_ACTIVE_LVL 1
#else
#define HX8357_BCKL_ACTIVE_LVL 0
#endif

// if text/images are backwards, try setting this to 1
#define HX8357_INVERT_DISPLAY CONFIG_LV_INVERT_DISPLAY


/*******************
* HX8357B/D REGS
Expand Down
22 changes: 11 additions & 11 deletions lvgl_tft/sh1107.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void sh1107_init(void)
{0x81, {0}, 0}, // Set display contrast
{0x2F, {0}, 0}, // ...value
{0x20, {0}, 0}, // Set memory mode
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xC8, {0}, 0}, // flipped vertical
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
{0xC7, {0}, 0}, // flipped vertical
Expand All @@ -82,11 +82,11 @@ void sh1107_init(void)
{0xDA, {0}, 0}, // Set com pins
{0x12, {0}, 0}, // ...value
{0xA4, {0}, 0}, // output ram to display
#if defined CONFIG_LV_INVERT_DISPLAY
#if defined CONFIG_LV_INVERT_COLORS
{0xA7, {0}, 0}, // inverted display
#else
{0xA6, {0}, 0}, // Non-inverted display
#endif
#endif
{0xAF, {0}, 0}, // Turn display on
{0, {0}, 0xff},
};
Expand Down Expand Up @@ -116,14 +116,14 @@ void sh1107_init(void)
}

void sh1107_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa)
lv_color_t color, lv_opa_t opa)
{
/* buf_w will be ignored, the configured CONFIG_LV_DISPLAY_HEIGHT and _WIDTH,
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
uint16_t byte_index = 0;
uint8_t bit_index = 0;

#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
byte_index = y + (( x>>3 ) * LV_VER_RES_MAX);
bit_index = x & 0x7;
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
Expand All @@ -146,10 +146,10 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
uint32_t size = 0;
void *ptr;

#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
row1 = area->x1>>3;
row2 = area->x2>>3;
#else
#else
row1 = area->y1>>3;
row2 = area->y2>>3;
#endif
Expand All @@ -158,9 +158,9 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
sh1107_send_cmd(0x00 | columnLow); // Set Lower Column Start Address for Page Addressing Mode
sh1107_send_cmd(0xB0 | i); // Set Page Start Address for Page Addressing Mode
size = area->y2 - area->y1 + 1;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
ptr = color_map + i * LV_VER_RES_MAX;
#else
#else
ptr = color_map + i * LV_HOR_RES_MAX;
#endif
if(i != row2){
Expand Down
Loading