Merge branch 'lvgl:master' into master

This commit is contained in:
Martin 2021-06-21 20:15:32 +02:00 committed by GitHub
commit 4004726e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 567 additions and 86 deletions

6
.gitignore vendored
View file

@ -50,3 +50,9 @@ modules.order
Module.symvers Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
# MacOS
.DS_Store
# ESP-IDF build dir
build

View file

@ -45,6 +45,8 @@ elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875)
list(APPEND SOURCES "lvgl_tft/ra8875.c") list(APPEND SOURCES "lvgl_tft/ra8875.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01) elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01)
list(APPEND SOURCES "lvgl_tft/GC9A01.c") list(APPEND SOURCES "lvgl_tft/GC9A01.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
list(APPEND SOURCES "lvgl_tft/ili9163c.c")
else() else()
message(WARNING "LVGL ESP32 drivers: Display controller not defined.") message(WARNING "LVGL ESP32 drivers: Display controller not defined.")
endif() endif()

View file

@ -17,6 +17,7 @@ swap of RGB565 color on the LVGL configuration menuconfig (it's not handled auto
| Display Controller | Type | Interface | Color depth (LV_COLOR_DEPTH) | Swap RGB565 color (LV_COLOR_16_SWAP) | | Display Controller | Type | Interface | Color depth (LV_COLOR_DEPTH) | Swap RGB565 color (LV_COLOR_16_SWAP) |
|---------------------------------------------|------------|------------------------|------------------------------|----------------------------------------| |---------------------------------------------|------------|------------------------|------------------------------|----------------------------------------|
| ILI9341 | TFT | SPI | 16: RGB565 | Yes | | ILI9341 | TFT | SPI | 16: RGB565 | Yes |
| ILI9163C | TFT | SPI | 16: RGB565 | Yes |
| ILI9486 | TFT | SPI | 16: RGB565 | Yes | | ILI9486 | TFT | SPI | 16: RGB565 | Yes |
| ILI9488 | TFT | SPI | 16: RGB565 | No | | ILI9488 | TFT | SPI | 16: RGB565 | No |
| HX8357B/HX8357D | TFT | SPI | 16: RGB565 | Yes | | HX8357B/HX8357D | TFT | SPI | 16: RGB565 | Yes |
@ -51,6 +52,7 @@ and sets the gpio numbers for the interface.
|---------------------------|-----------------------|-----------|-----------|-----------| |---------------------------|-----------------------|-----------|-----------|-----------|
| ESP Wrover Kit v4.1 | ILI9341 | SPI | 240 | 320 | | ESP Wrover Kit v4.1 | ILI9341 | SPI | 240 | 320 |
| M5Stack | ILI9341 | SPI | 240 | 320 | | M5Stack | ILI9341 | SPI | 240 | 320 |
| M5Core2 | ILI9341 | SPI | 240 | 320 |
| M5Stick | SH1107 | SPI | - | - | | M5Stick | SH1107 | SPI | - | - |
| M5StickC | ST7735S | SPI | 80 | 160 | | M5StickC | ST7735S | SPI | 80 | 160 |
| Adafruit 3.5 Featherwing | HX8357 | SPI | 480 | 320 | | Adafruit 3.5 Featherwing | HX8357 | SPI | 480 | 320 |

View file

@ -79,6 +79,8 @@ extern "C" {
#define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 5KB #define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 5KB
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D)
#define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 2888 bytes #define DISP_BUF_SIZE ((LV_VER_RES_MAX * LV_VER_RES_MAX) / 8) // 2888 bytes
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#else #else
#error "No display controller selected" #error "No display controller selected"
#endif #endif

View file

@ -130,7 +130,8 @@ extern "C" {
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107) || \ defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) || \ defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820) || \ defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A) defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A) || \
defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
#define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 2) #define SPI_BUS_MAX_TRANSFER_SZ (DISP_BUF_SIZE * 2)
@ -157,7 +158,9 @@ extern "C" {
#define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000) #define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341) #elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341)
#define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000) #define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000)
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X) #elif defined(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
#define SPI_TFT_CLOCK_SPEED_HZ (40 * 1000 * 1000)
#elif defined(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
#define SPI_TFT_CLOCK_SPEED_HZ (32*1000*1000) #define SPI_TFT_CLOCK_SPEED_HZ (32*1000*1000)
#else #else
#define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000) #define SPI_TFT_CLOCK_SPEED_HZ (40*1000*1000)

View file

@ -144,7 +144,7 @@ void DELAY_MS(uint16_t ms)
vTaskDelay(ms / portTICK_PERIOD_MS); vTaskDelay(ms / portTICK_PERIOD_MS);
} }
#if EVE_USE_PDN
void EVE_pdn_set(void) void EVE_pdn_set(void)
{ {
gpio_set_level(EVE_PDN, 0); /* Power-Down low */ gpio_set_level(EVE_PDN, 0); /* Power-Down low */
@ -155,7 +155,7 @@ void EVE_pdn_clear(void)
{ {
gpio_set_level(EVE_PDN, 1); /* Power-Down high */ gpio_set_level(EVE_PDN, 1); /* Power-Down high */
} }
#endif
void spi_acquire() void spi_acquire()
{ {
@ -841,11 +841,13 @@ uint8_t EVE_init(void)
uint8_t chipid = 0; uint8_t chipid = 0;
uint16_t timeout = 0; uint16_t timeout = 0;
#if EVE_USE_PDN
EVE_pdn_set(); EVE_pdn_set();
DELAY_MS(6); /* minimum time for power-down is 5ms */ DELAY_MS(6); /* minimum time for power-down is 5ms */
EVE_pdn_clear(); EVE_pdn_clear();
DELAY_MS(21); /* minimum time to allow from rising PD_N to first access is 20ms */ DELAY_MS(21); /* minimum time to allow from rising PD_N to first access is 20ms */
#endif
/* EVE_cmdWrite(EVE_CORERST,0); */ /* reset, only required for warm-start if PowerDown line is not used */ /* EVE_cmdWrite(EVE_CORERST,0); */ /* reset, only required for warm-start if PowerDown line is not used */

View file

@ -39,8 +39,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define BLOCK_TRANSFER_SIZE 3840 // block transfer size when write data to CMD buffer #define BLOCK_TRANSFER_SIZE 3840 // block transfer size when write data to CMD buffer
void DELAY_MS(uint16_t ms); void DELAY_MS(uint16_t ms);
#if EVE_USE_PDN
void EVE_pdn_set(void); void EVE_pdn_set(void);
void EVE_pdn_clear(void); void EVE_pdn_clear(void);
#endif
void spi_acquire(); void spi_acquire();
void spi_release(); void spi_release();
@ -64,7 +68,7 @@ void EVE_get_cmdoffset(void);
/* commands to operate on memory: */ /* commands to operate on memory: */
void EVE_cmd_memzero(uint32_t ptr, uint32_t num); void EVE_cmd_memzero(uint32_t ptr, uint32_t num);
void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num); void EVE_cmd_memset(uint32_t ptr, uint8_t value, uint32_t num);
void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data); void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data);
void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num); void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num);
#if FT81X_FULL #if FT81X_FULL

View file

@ -44,11 +44,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#include "FT81x.h" #include "FT81x.h"
#define EVE_CLK DISP_SPI_CLK // orange #define EVE_CLK DISP_SPI_CLK // orange
#define EVE_MISO DISP_SPI_MISO // yellow #define EVE_MISO DISP_SPI_MISO // yellow
#define EVE_MOSI DISP_SPI_MOSI // green #define EVE_MOSI DISP_SPI_MOSI // green
#define EVE_CS DISP_SPI_CS // blue #define EVE_CS DISP_SPI_CS // blue
#define EVE_PDN CONFIG_LV_DISP_PIN_RST // grey #define EVE_PDN CONFIG_LV_DISP_PIN_RST // grey
#define EVE_USE_PDN CONFIG_LV_DISP_USE_RST
#define SPI_TRANSER_SIZE (DISP_BUF_SIZE * (LV_COLOR_DEPTH / 8)) #define SPI_TRANSER_SIZE (DISP_BUF_SIZE * (LV_COLOR_DEPTH / 8))

View file

@ -250,7 +250,7 @@ void TFT_bitmap_display(void)
EVE_cmd_dl(TAG(0)); EVE_cmd_dl(TAG(0));
EVE_cmd_dl(DL_DISPLAY); /* instruct the graphics processor to show the list */ EVE_cmd_dl(DL_DISPLAY); /* instruct the graphics processor to show the list */
EVE_cmd_dl(CMD_SWAP); /* make this list active */ EVE_cmd_dl(CMD_SWAP); /* make this list active */
EVE_end_cmd_burst(); /* stop writing to the cmd-fifo */ EVE_end_cmd_burst(); /* stop writing to the cmd-fifo */
@ -262,12 +262,18 @@ void TFT_bitmap_display(void)
void FT81x_init(void) void FT81x_init(void)
{ {
#if EVE_USE_PDN
gpio_pad_select_gpio(EVE_PDN); gpio_pad_select_gpio(EVE_PDN);
#endif
gpio_set_level(EVE_CS, 1); gpio_set_level(EVE_CS, 1);
#if EVE_USE_PDN
gpio_set_direction(EVE_PDN, GPIO_MODE_OUTPUT); gpio_set_direction(EVE_PDN, GPIO_MODE_OUTPUT);
#endif
spi_acquire(); spi_acquire();
if(EVE_init()) if(EVE_init())
{ {
tft_active = 1; tft_active = 1;
@ -278,7 +284,7 @@ void FT81x_init(void)
EVE_cmd_memset(SCREEN_BITMAP_ADDR, BLACK, SCREEN_BUFFER_SIZE); // clear screen buffer EVE_cmd_memset(SCREEN_BITMAP_ADDR, BLACK, SCREEN_BUFFER_SIZE); // clear screen buffer
EVE_cmd_execute(); EVE_cmd_execute();
TFT_bitmap_display(); // set DL for fullscreen bitmap display TFT_bitmap_display(); // set DL for fullscreen bitmap display
} }
@ -320,4 +326,4 @@ void TFT_WriteBitmap(uint8_t* Bitmap, uint16_t X, uint16_t Y, uint16_t Width, ui
void FT81x_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map) void FT81x_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{ {
TFT_WriteBitmap((uint8_t*)color_map, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area)); TFT_WriteBitmap((uint8_t*)color_map, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area));
} }

View file

@ -124,18 +124,24 @@ void GC9A01_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(GC9A01_DC); gpio_pad_select_gpio(GC9A01_DC);
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT); gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
#if GC9A01_USE_RST
gpio_pad_select_gpio(GC9A01_RST); gpio_pad_select_gpio(GC9A01_RST);
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT); gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
#endif
#if GC9A01_ENABLE_BACKLIGHT_CONTROL #if GC9A01_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(GC9A01_BCKL); gpio_pad_select_gpio(GC9A01_BCKL);
gpio_set_direction(GC9A01_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(GC9A01_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if GC9A01_USE_RST
//Reset the display //Reset the display
gpio_set_level(GC9A01_RST, 0); gpio_set_level(GC9A01_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(GC9A01_RST, 1); gpio_set_level(GC9A01_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization."); ESP_LOGI(TAG, "Initialization.");
@ -167,7 +173,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
uint8_t data[4]; uint8_t data[4];
/*Column addresses*/ /*Column addresses*/
GC9A01_send_cmd(0x2A); //0x2A GC9A01_send_cmd(0x2A); //0x2A
data[0] = (area->x1 >> 8) & 0xFF; data[0] = (area->x1 >> 8) & 0xFF;
data[1] = area->x1 & 0xFF; data[1] = area->x1 & 0xFF;
data[2] = (area->x2 >> 8) & 0xFF; data[2] = (area->x2 >> 8) & 0xFF;
@ -175,7 +181,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
GC9A01_send_data(data, 4); GC9A01_send_data(data, 4);
/*Page addresses*/ /*Page addresses*/
GC9A01_send_cmd(0x2B); //0x2B GC9A01_send_cmd(0x2B); //0x2B
data[0] = (area->y1 >> 8) & 0xFF; data[0] = (area->y1 >> 8) & 0xFF;
data[1] = area->y1 & 0xFF; data[1] = area->y1 & 0xFF;
data[2] = (area->y2 >> 8) & 0xFF; data[2] = (area->y2 >> 8) & 0xFF;
@ -183,7 +189,7 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
GC9A01_send_data(data, 4); GC9A01_send_data(data, 4);
/*Memory write*/ /*Memory write*/
GC9A01_send_cmd(0x2C); //0x2C GC9A01_send_cmd(0x2C); //0x2C
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area); uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
@ -211,7 +217,7 @@ void GC9A01_sleep_in()
{ {
uint8_t data[] = {0x08}; uint8_t data[] = {0x08};
GC9A01_send_cmd(0x10); //0x10 Enter Sleep Mode GC9A01_send_cmd(0x10); //0x10 Enter Sleep Mode
GC9A01_send_data(&data, 1); GC9A01_send_data(&data, 1);
} }
void GC9A01_sleep_out() void GC9A01_sleep_out()

View file

@ -25,9 +25,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define GC9A01_DC CONFIG_LV_DISP_PIN_DC #define GC9A01_DC CONFIG_LV_DISP_PIN_DC
#define GC9A01_RST CONFIG_LV_DISP_PIN_RST #define GC9A01_RST CONFIG_LV_DISP_PIN_RST
#define GC9A01_BCKL CONFIG_LV_DISP_PIN_BCKL #define GC9A01_USE_RST CONFIG_LV_DISP_USE_RST
#define GC9A01_BCKL CONFIG_LV_DISP_PIN_BCKL
#define GC9A01_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define GC9A01_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -21,6 +21,10 @@ menu "LVGL TFT/Epaper Display controller"
bool "M5Stack" bool "M5Stack"
select LV_TFT_DISPLAY_CONTROLLER_ILI9341 select LV_TFT_DISPLAY_CONTROLLER_ILI9341
select LV_TFT_DISPLAY_PROTOCOL_SPI select LV_TFT_DISPLAY_PROTOCOL_SPI
config LV_PREDEFINED_DISPLAY_M5CORE2
bool "M5Core2"
select LV_TFT_DISPLAY_CONTROLLER_ILI9341
select LV_TFT_DISPLAY_PROTOCOL_SPI
config LV_PREDEFINED_DISPLAY_M5STICK config LV_PREDEFINED_DISPLAY_M5STICK
bool "M5Stick" bool "M5Stick"
select LV_TFT_DISPLAY_CONTROLLER_SH1107 select LV_TFT_DISPLAY_CONTROLLER_SH1107
@ -173,6 +177,11 @@ menu "LVGL TFT/Epaper Display controller"
help help
ST7796S display controller. ST7796S display controller.
config LV_TFT_DISPLAY_CONTROLLER_ILI9163C
bool
help
ILI9163C display controller.
# Display controller communication protocol # Display controller communication protocol
# #
# This symbols define the communication protocol used by the # This symbols define the communication protocol used by the
@ -349,6 +358,10 @@ menu "LVGL TFT/Epaper Display controller"
bool "RA8875" bool "RA8875"
select LV_TFT_DISPLAY_CONTROLLER_RA8875 select LV_TFT_DISPLAY_CONTROLLER_RA8875
select LV_TFT_DISPLAY_PROTOCOL_SPI select LV_TFT_DISPLAY_PROTOCOL_SPI
config LV_TFT_DISPLAY_USER_CONTROLLER_ILI9163C
bool "ILI9163C"
select LV_TFT_DISPLAY_CONTROLLER_ILI9163C
select LV_TFT_DISPLAY_PROTOCOL_SPI
endchoice endchoice
config CUSTOM_DISPLAY_BUFFER_SIZE config CUSTOM_DISPLAY_BUFFER_SIZE
@ -608,7 +621,7 @@ menu "LVGL TFT/Epaper Display controller"
If text is backwards on your display, try enabling this. If text is backwards on your display, try enabling this.
config LV_INVERT_COLORS 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 || LV_TFT_DISPLAY_CONTROLLER_ST7789 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 || LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_HX8357 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 || LV_TFT_DISPLAY_CONTROLLER_GC9A01 || LV_TFT_DISPLAY_CONTROLLER_ILI9163C
default y if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICKC default y if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICKC
help help
If the colors look inverted on your display, try enabling this. If the colors look inverted on your display, try enabling this.
@ -766,11 +779,11 @@ menu "LVGL TFT/Epaper Display controller"
config LV_DISP_ST7789_SOFT_RESET config LV_DISP_ST7789_SOFT_RESET
bool "Soft reset - use software reset instead of reset pin" bool "Soft reset - use software reset instead of reset pin"
depends on LV_TFT_DISPLAY_CONTROLLER_ST7789 depends on LV_TFT_DISPLAY_CONTROLLER_ST7789
default n default n
help help
Use software reset and ignores configured reset pin (some hardware does not use a reset pin). Use software reset and ignores configured reset pin (some hardware does not use a reset pin).
endmenu endmenu
# menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y # menu will be visible only when LV_PREDEFINED_DISPLAY_NONE is y
@ -785,6 +798,7 @@ menu "LVGL TFT/Epaper Display controller"
default 23 if LV_PREDEFINED_DISPLAY_WROVER4 default 23 if LV_PREDEFINED_DISPLAY_WROVER4
default 23 if LV_PREDEFINED_DISPLAY_ATAG default 23 if LV_PREDEFINED_DISPLAY_ATAG
default 23 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK default 23 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 23 if LV_PREDEFINED_DISPLAY_M5CORE2
default 15 if LV_PREDEFINED_DISPLAY_M5STICKC default 15 if LV_PREDEFINED_DISPLAY_M5STICKC
default 18 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING default 18 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
default 23 if LV_PREDEFINED_PINS_TKOALA default 23 if LV_PREDEFINED_PINS_TKOALA
@ -799,6 +813,7 @@ menu "LVGL TFT/Epaper Display controller"
config LV_DISPLAY_USE_SPI_MISO config LV_DISPLAY_USE_SPI_MISO
bool "GPIO for MISO (Master In Slave Out)" if LV_TFT_DISPLAY_PROTOCOL_SPI bool "GPIO for MISO (Master In Slave Out)" if LV_TFT_DISPLAY_PROTOCOL_SPI
default y if LV_PREDEFINED_PINS_TKOALA default y if LV_PREDEFINED_PINS_TKOALA
default y if LV_PREDEFINED_DISPLAY_M5CORE2
help help
Enable the MISO signal to control the display. You can disable Enable the MISO signal to control the display. You can disable
it when the display does not need MISO signal to be controlled. it when the display does not need MISO signal to be controlled.
@ -810,6 +825,7 @@ menu "LVGL TFT/Epaper Display controller"
range 0 43 if IDF_TARGET_ESP32S2 range 0 43 if IDF_TARGET_ESP32S2
default 19 if LV_PREDEFINED_PINS_TKOALA default 19 if LV_PREDEFINED_PINS_TKOALA
default 38 if LV_PREDEFINED_DISPLAY_M5CORE2
default 0 default 0
help help
@ -852,6 +868,7 @@ menu "LVGL TFT/Epaper Display controller"
range 0 43 if IDF_TARGET_ESP32S2 range 0 43 if IDF_TARGET_ESP32S2
default 18 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK default 18 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 18 if LV_PREDEFINED_DISPLAY_M5CORE2
default 13 if LV_PREDEFINED_DISPLAY_M5STICKC default 13 if LV_PREDEFINED_DISPLAY_M5STICKC
default 18 if LV_PREDEFINED_DISPLAY_ATAG default 18 if LV_PREDEFINED_DISPLAY_ATAG
default 19 if LV_PREDEFINED_DISPLAY_WROVER4 default 19 if LV_PREDEFINED_DISPLAY_WROVER4
@ -880,6 +897,7 @@ menu "LVGL TFT/Epaper Display controller"
default 5 if LV_PREDEFINED_PINS_38V1 default 5 if LV_PREDEFINED_PINS_38V1
default 14 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK default 14 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 5 if LV_PREDEFINED_DISPLAY_M5CORE2
default 5 if LV_PREDEFINED_DISPLAY_M5STICKC default 5 if LV_PREDEFINED_DISPLAY_M5STICKC
default 22 if LV_PREDEFINED_DISPLAY_WROVER4 default 22 if LV_PREDEFINED_DISPLAY_WROVER4
default 15 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING default 15 if LV_PREDEFINED_DISPLAY_ADA_FEATHERWING
@ -909,6 +927,7 @@ menu "LVGL TFT/Epaper Display controller"
default 19 if LV_PREDEFINED_PINS_38V1 default 19 if LV_PREDEFINED_PINS_38V1
default 17 if LV_PREDEFINED_PINS_38V4 default 17 if LV_PREDEFINED_PINS_38V4
default 27 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK default 27 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 15 if LV_PREDEFINED_DISPLAY_M5CORE2
default 23 if LV_PREDEFINED_DISPLAY_M5STICKC default 23 if LV_PREDEFINED_DISPLAY_M5STICKC
default 21 if LV_PREDEFINED_DISPLAY_WROVER4 default 21 if LV_PREDEFINED_DISPLAY_WROVER4
default 21 if LV_PREDEFINED_DISPLAY_WT32_SC01 default 21 if LV_PREDEFINED_DISPLAY_WT32_SC01
@ -922,8 +941,22 @@ menu "LVGL TFT/Epaper Display controller"
help help
Configure the display DC pin here. Configure the display DC pin here.
config LV_DISP_USE_RST
bool "Use a GPIO for resetting the display" if LV_TFT_DISPLAY_PROTOCOL_SPI
default n if LV_PREDEFINED_DISPLAY_M5CORE2
default y
help
Enable display reset control. Set this if the reset pin of the
display is connected to the host. If this is not set, then it is
the user's responsibility to ensure that the display is reset
before initialisation.
You may want to disable this option because the reset pin is not
connected, or is connected to an external component such as the
power management IC.
config LV_DISP_PIN_RST config LV_DISP_PIN_RST
int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET
depends on LV_DISP_USE_RST
range 0 39 if IDF_TARGET_ESP32 range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2 range 0 43 if IDF_TARGET_ESP32S2
@ -959,6 +992,7 @@ menu "LVGL TFT/Epaper Display controller"
( LV_PREDEFINED_DISPLAY_NONE && ! ( LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 ) ) \ ( LV_PREDEFINED_DISPLAY_NONE && ! ( LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 ) ) \
|| LV_PREDEFINED_DISPLAY_RPI_MPI3501 || LV_PREDEFINED_DISPLAY_RPI_MPI3501
default y if LV_PREDEFINED_DISPLAY_M5STACK default y if LV_PREDEFINED_DISPLAY_M5STACK
default n if LV_PREDEFINED_DISPLAY_M5CORE2
default y if LV_PREDEFINED_DISPLAY_WROVER4 default y if LV_PREDEFINED_DISPLAY_WROVER4
default y if LV_PREDEFINED_DISPLAY_ERTFT0356 default y if LV_PREDEFINED_DISPLAY_ERTFT0356
default y if LV_PREDEFINED_DISPLAY_TTGO default y if LV_PREDEFINED_DISPLAY_TTGO

View file

@ -26,7 +26,7 @@ void disp_driver_init(void)
st7735s_init(); st7735s_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357
hx8357_init(); hx8357_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486
ili9486_init(); ili9486_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107 #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107
sh1107_init(); sh1107_init();
@ -44,6 +44,8 @@ void disp_driver_init(void)
jd79653a_init(); jd79653a_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
uc8151d_init(); uc8151d_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
ili9163c_init();
#endif #endif
} }
@ -85,6 +87,8 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t *
jd79653a_lv_fb_flush(drv, area, color_map); jd79653a_lv_fb_flush(drv, area, color_map);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
uc8151d_lv_fb_flush(drv, area, color_map); uc8151d_lv_fb_flush(drv, area, color_map);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
ili9163c_flush(drv, area, color_map);
#endif #endif
} }
@ -105,7 +109,7 @@ void disp_driver_rounder(lv_disp_drv_t * disp_drv, lv_area_t * area)
} }
void disp_driver_set_px(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, void disp_driver_set_px(lv_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)
{ {
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306 #if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
ssd1306_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa); ssd1306_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);

View file

@ -54,6 +54,8 @@ extern "C" {
#include "jd79653a.h" #include "jd79653a.h"
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
#include "uc8151d.h" #include "uc8151d.h"
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
#include "ili9163c.h"
#endif #endif
/********************* /*********************

View file

@ -162,19 +162,24 @@ void hx8357_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(HX8357_DC); gpio_pad_select_gpio(HX8357_DC);
gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT); gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT);
#if HX8357_USE_RST
gpio_pad_select_gpio(HX8357_RST); gpio_pad_select_gpio(HX8357_RST);
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT); gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
#endif
#if HX8357_ENABLE_BACKLIGHT_CONTROL #if HX8357_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(HX8357_BCKL); gpio_pad_select_gpio(HX8357_BCKL);
gpio_set_direction(HX8357_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(HX8357_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if HX8357_USE_RST
//Reset the display //Reset the display
gpio_set_level(HX8357_RST, 0); gpio_set_level(HX8357_RST, 0);
vTaskDelay(10 / portTICK_RATE_MS); vTaskDelay(10 / portTICK_RATE_MS);
gpio_set_level(HX8357_RST, 1); gpio_set_level(HX8357_RST, 1);
vTaskDelay(120 / portTICK_RATE_MS); vTaskDelay(120 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization."); ESP_LOGI(TAG, "Initialization.");

View file

@ -35,9 +35,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define HX8357_DC CONFIG_LV_DISP_PIN_DC #define HX8357_DC CONFIG_LV_DISP_PIN_DC
#define HX8357_RST CONFIG_LV_DISP_PIN_RST #define HX8357_RST CONFIG_LV_DISP_PIN_RST
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL #define HX8357_USE_RST CONFIG_LV_DISP_USE_RST
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL
#define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS #define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS

View file

@ -73,9 +73,9 @@ static uint8_t il3820_lut_initial[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
static uint8_t il3820_lut_default[] = { static uint8_t il3820_lut_default[] = {
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x10, 0x18, 0x18, 0x08, 0x18, 0x18,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
@ -113,7 +113,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m
uint8_t *buffer = (uint8_t*) color_map; uint8_t *buffer = (uint8_t*) color_map;
uint16_t x_addr_counter = 0; uint16_t x_addr_counter = 0;
uint16_t y_addr_counter = 0; uint16_t y_addr_counter = 0;
/* Configure entry mode */ /* Configure entry mode */
il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1); il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1);
@ -131,7 +131,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m
il3820_set_cursor(x_addr_counter, y_addr_counter); il3820_set_cursor(x_addr_counter, y_addr_counter);
il3820_send_cmd(IL3820_CMD_WRITE_RAM); il3820_send_cmd(IL3820_CMD_WRITE_RAM);
/* Write the pixel data to graphic RAM, linelen bytes at the time. */ /* Write the pixel data to graphic RAM, linelen bytes at the time. */
for(size_t row = 0; row <= (EPD_PANEL_HEIGHT - 1); row++){ for(size_t row = 0; row <= (EPD_PANEL_HEIGHT - 1); row++){
il3820_send_data(buffer, linelen); il3820_send_data(buffer, linelen);
@ -139,7 +139,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m
} }
il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1); il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1);
il3820_update_display(); il3820_update_display();
/* IMPORTANT!!! /* IMPORTANT!!!
@ -152,7 +152,7 @@ void il3820_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_m
* BIT_SET(byte_index, bit_index) clears the bit_index pixel at byte_index of * BIT_SET(byte_index, bit_index) clears the bit_index pixel at byte_index of
* the display buffer. * the display buffer.
* BIT_CLEAR(byte_index, bit_index) sets the bit_index pixel at the byte_index * BIT_CLEAR(byte_index, bit_index) sets the bit_index pixel at the byte_index
* of the display buffer. */ * of the display buffer. */
void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf, void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, 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)
@ -198,20 +198,26 @@ void il3820_init(void)
/* Initialize non-SPI GPIOs */ /* Initialize non-SPI GPIOs */
gpio_pad_select_gpio(IL3820_DC_PIN); gpio_pad_select_gpio(IL3820_DC_PIN);
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT); gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
#if IL3820_USE_RST
gpio_pad_select_gpio(IL3820_RST_PIN); gpio_pad_select_gpio(IL3820_RST_PIN);
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT); gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
#endif
gpio_pad_select_gpio(IL3820_BUSY_PIN); gpio_pad_select_gpio(IL3820_BUSY_PIN);
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT); gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
#if IL3820_USE_RST
/* Harware reset */ /* Harware reset */
gpio_set_level( IL3820_RST_PIN, 0); gpio_set_level( IL3820_RST_PIN, 0);
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS); vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
gpio_set_level( IL3820_RST_PIN, 1); gpio_set_level( IL3820_RST_PIN, 1);
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS); vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
#endif
/* Software reset */ /* Software reset */
il3820_write_cmd(IL3820_CMD_SW_RESET, NULL, 0); il3820_write_cmd(IL3820_CMD_SW_RESET, NULL, 0);
/* Busy wait for the BUSY signal to go low */ /* Busy wait for the BUSY signal to go low */
il3820_waitbusy(IL3820_WAIT); il3820_waitbusy(IL3820_WAIT);
@ -239,10 +245,10 @@ void il3820_init(void)
// allow partial updates now // allow partial updates now
il3820_partial = true; il3820_partial = true;
/* Update LUT */ /* Update LUT */
il3820_write_cmd(IL3820_CMD_UPDATE_LUT, il3820_lut_default, sizeof(il3820_lut_default)); il3820_write_cmd(IL3820_CMD_UPDATE_LUT, il3820_lut_default, sizeof(il3820_lut_default));
/* Clear control memory and update */ /* Clear control memory and update */
il3820_clear_cntlr_mem(IL3820_CMD_WRITE_RAM, true); il3820_clear_cntlr_mem(IL3820_CMD_WRITE_RAM, true);
} }
@ -251,10 +257,10 @@ void il3820_init(void)
void il3820_sleep_in(void) void il3820_sleep_in(void)
{ {
uint8_t data[] = {0x01}; uint8_t data[] = {0x01};
/* Wait for the BUSY signal to go low */ /* Wait for the BUSY signal to go low */
il3820_waitbusy(IL3820_WAIT); il3820_waitbusy(IL3820_WAIT);
il3820_write_cmd(IL3820_CMD_SLEEP_MODE, data, 1); il3820_write_cmd(IL3820_CMD_SLEEP_MODE, data, 1);
} }
@ -264,15 +270,15 @@ static void il3820_waitbusy(int wait_ms)
int i = 0; int i = 0;
vTaskDelay(10 / portTICK_RATE_MS); // 10ms delay vTaskDelay(10 / portTICK_RATE_MS); // 10ms delay
for(i = 0; i < (wait_ms * 10); i++) { for(i = 0; i < (wait_ms * 10); i++) {
if(gpio_get_level(IL3820_BUSY_PIN) != IL3820_BUSY_LEVEL) { if(gpio_get_level(IL3820_BUSY_PIN) != IL3820_BUSY_LEVEL) {
return; return;
} }
vTaskDelay(10 / portTICK_RATE_MS); vTaskDelay(10 / portTICK_RATE_MS);
} }
ESP_LOGE( TAG, "busy exceeded %dms", i*10 ); ESP_LOGE( TAG, "busy exceeded %dms", i*10 );
} }
@ -288,10 +294,10 @@ static inline void il3820_data_mode(void)
gpio_set_level(IL3820_DC_PIN, 1); gpio_set_level(IL3820_DC_PIN, 1);
} }
static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len) static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len)
{ {
disp_wait_for_pending_transactions(); disp_wait_for_pending_transactions();
il3820_command_mode(); il3820_command_mode();
disp_spi_send_data(&cmd, 1); disp_spi_send_data(&cmd, 1);
@ -302,10 +308,10 @@ static inline void il3820_write_cmd(uint8_t cmd, uint8_t *data, size_t len)
} }
/* Send cmd to the display */ /* Send cmd to the display */
static inline void il3820_send_cmd(uint8_t cmd) static inline void il3820_send_cmd(uint8_t cmd)
{ {
disp_wait_for_pending_transactions(); disp_wait_for_pending_transactions();
il3820_command_mode(); il3820_command_mode();
disp_spi_send_data(&cmd, 1); disp_spi_send_data(&cmd, 1);
} }
@ -314,14 +320,14 @@ static inline void il3820_send_cmd(uint8_t cmd)
static void il3820_send_data(uint8_t *data, uint16_t length) static void il3820_send_data(uint8_t *data, uint16_t length)
{ {
disp_wait_for_pending_transactions(); disp_wait_for_pending_transactions();
il3820_data_mode(); il3820_data_mode();
disp_spi_send_colors(data, length); disp_spi_send_colors(data, length);
} }
/* Specify the start/end positions of the window address in the X and Y /* Specify the start/end positions of the window address in the X and Y
* directions by an address unit. * directions by an address unit.
* *
* @param sx: X Start position. * @param sx: X Start position.
* @param ex: X End position. * @param ex: X End position.
* @param ys: Y Start position. * @param ys: Y Start position.
@ -330,7 +336,7 @@ static void il3820_send_data(uint8_t *data, uint16_t length)
static inline void il3820_set_window( uint16_t sx, uint16_t ex, uint16_t ys, uint16_t ye) static inline void il3820_set_window( uint16_t sx, uint16_t ex, uint16_t ys, uint16_t ye)
{ {
uint8_t tmp[4] = {0}; uint8_t tmp[4] = {0};
tmp[0] = sx / 8; tmp[0] = sx / 8;
tmp[1] = ex / 8; tmp[1] = ex / 8;
@ -378,7 +384,7 @@ static void il3820_update_display(void)
} else { } else {
tmp = (IL3820_CTRL2_ENABLE_CLK | IL3820_CTRL2_ENABLE_ANALOG | IL3820_CTRL2_TO_PATTERN); tmp = (IL3820_CTRL2_ENABLE_CLK | IL3820_CTRL2_ENABLE_ANALOG | IL3820_CTRL2_TO_PATTERN);
} }
il3820_write_cmd(IL3820_CMD_UPDATE_CTRL2, &tmp, 1); il3820_write_cmd(IL3820_CMD_UPDATE_CTRL2, &tmp, 1);
il3820_write_cmd(IL3820_CMD_MASTER_ACTIVATION, NULL, 0); il3820_write_cmd(IL3820_CMD_MASTER_ACTIVATION, NULL, 0);
@ -394,10 +400,10 @@ static void il3820_clear_cntlr_mem(uint8_t ram_cmd, bool update)
/* Arrays used by SPI must be word alligned */ /* Arrays used by SPI must be word alligned */
WORD_ALIGNED_ATTR uint8_t clear_page[IL3820_COLUMNS]; WORD_ALIGNED_ATTR uint8_t clear_page[IL3820_COLUMNS];
memset(clear_page, 0xff, sizeof clear_page); memset(clear_page, 0xff, sizeof clear_page);
/* Configure entry mode */ /* Configure entry mode */
il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1); il3820_write_cmd(IL3820_CMD_ENTRY_MODE, &il3820_scan_mode, 1);
/* Configure the window */ /* Configure the window */
il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1); il3820_set_window(0, EPD_PANEL_WIDTH - 1, 0, EPD_PANEL_HEIGHT - 1);

View file

@ -28,6 +28,7 @@ extern "C"
#define IL3820_DC_PIN CONFIG_LV_DISP_PIN_DC #define IL3820_DC_PIN CONFIG_LV_DISP_PIN_DC
#define IL3820_RST_PIN CONFIG_LV_DISP_PIN_RST #define IL3820_RST_PIN CONFIG_LV_DISP_PIN_RST
#define IL3820_USE_RST CONFIG_LV_DISP_USE_RST
#define IL3820_BUSY_PIN CONFIG_LV_DISP_PIN_BUSY #define IL3820_BUSY_PIN CONFIG_LV_DISP_PIN_BUSY
#define IL3820_BUSY_LEVEL 1 #define IL3820_BUSY_LEVEL 1

270
lvgl_tft/ili9163c.c Normal file
View file

@ -0,0 +1,270 @@
/**
* @file ILI9163C.c
*
*/
/*********************
* INCLUDES
*********************/
#include "ili9163c.h"
#include "disp_spi.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "assert.h"
/*********************
* DEFINES
*********************/
#define TAG "ILI9163C"
// ILI9163C specific commands used in init
#define ILI9163C_NOP 0x00
#define ILI9163C_SWRESET 0x01
#define ILI9163C_RDDID 0x04
#define ILI9163C_RDDST 0x09
#define ILI9163C_SLPIN 0x10
#define ILI9163C_SLPOUT 0x11
#define ILI9163C_PTLON 0x12
#define ILI9163C_NORON 0x13
#define ILI9163C_INVOFF 0x20
#define ILI9163C_INVON 0x21
#define ILI9163C_CMD_GAMST 0x26
#define ILI9163C_DISPOFF 0x28
#define ILI9163C_DISPON 0x29
#define ILI9163C_CASET 0x2A
#define ILI9163C_RASET 0x2B
#define ILI9163C_RAMWR 0x2C
#define ILI9163C_COLORSET 0x2D
#define ILI9163C_RAMRD 0x2E
#define ILI9163C_PTLAR 0x30
#define ILI9163C_VSCRDEF 0x33
#define ILI9163C_COLMOD 0x3A
#define ILI9163C_MADCTL 0x36
#define ILI9163C_VSCRSADD 0x37
#define ILI9163C_FRMCTR1 0xB1
#define ILI9163C_FRMCTR2 0xB2
#define ILI9163C_FRMCTR3 0xB3
#define ILI9163C_INVCTR 0xB4
#define ILI9163C_DISSET5 0xB6
#define ILI9163C_SDDC 0xB7
#define ILI9163C_PWCTR1 0xC0
#define ILI9163C_PWCTR2 0xC1
#define ILI9163C_PWCTR3 0xC2
#define ILI9163C_PWCTR4 0xC3
#define ILI9163C_PWCTR5 0xC4
#define ILI9163C_VMCTR1 0xC5
#define ILI9163C_VMCOFFS 0xC7
#define ILI9163C_GAMCTL 0xF2
#define ILI9163C_GMCTRP1 0xE0
#define ILI9163C_GMCTRN1 0xE1
#define ST77XX_MADCTL_MY 0x80
#define ST77XX_MADCTL_MX 0x40
#define ST77XX_MADCTL_MV 0x20 #define
#define ST77XX_MADCTL_ML 0x10
#define ST77XX_MADCTL_RGB 0x00
#define ST77XX_MADCTL_BGR 0x08
/**********************
* TYPEDEFS
**********************/
/*The LCD needs a bunch of command/argument values to be initialized. They are stored in this struct. */
typedef struct
{
uint8_t cmd;
uint8_t data[16];
uint8_t databytes; //No of data in data; bit 7 = delay after set; 0xFF = end of cmds.
} lcd_init_cmd_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void ili9163c_set_orientation(uint8_t orientation);
static void ili9163c_send_cmd(uint8_t cmd);
static void ili9163c_send_data(void *data, uint16_t length);
static void ili9163c_send_color(void *data, uint16_t length);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void ili9163c_init(void)
{
ESP_LOGD(TAG, "Init");
lcd_init_cmd_t ili_init_cmds[] = {
{ILI9163C_SWRESET, {0}, 0x80}, // Software reset, 0 args, w/delay 120ms
{ILI9163C_SLPOUT, {0}, 0x80}, // Out of sleep mode, 0 args, w/delay 5ms
{ILI9163C_CMD_GAMST, {0x04}, 1}, // Gamma Curve
{ILI9163C_FRMCTR1, {0x0C, 0x14}, 2}, // Frame rate ctrl - normal mode
{ILI9163C_INVCTR, {0x07}, 1}, // Display inversion ctrl, 1 arg, no delay:No inversion
{ILI9163C_PWCTR1, {0x0C, 0x05}, 2}, // Power control, 2 args, no delay
{ILI9163C_PWCTR2, {0x02}, 1}, // Power control, 1 arg
{ILI9163C_PWCTR3, {0x02}, 1}, // Power control, 1 arg
{ILI9163C_VMCTR1, {0x20, 0x55}, 2}, // Power control, 1 arg, no delay:
{ILI9163C_VMCOFFS, {0x40}, 1}, // VCOM Offset
#if ILI9163C_INVERT_COLORS == 1
{ILI9163C_INVON, {0}, 0}, // set inverted mode
#else
{ILI9163C_INVOFF, {0}, 0}, // set non-inverted mode
#endif
{ILI9163C_COLMOD, {0x5}, 1}, // set color mode, 1 arg, no delay: 16-bit color
{ILI9163C_SDDC, {0}, 1}, // set source driver direction control
{ILI9163C_GAMCTL, {0x01}, 1}, // set source driver direction control
{ILI9163C_GMCTRP1, {0x36, 0x29, 0x12, 0x22, 0x1C, 0x15, 0x42, 0xB7, 0x2F, 0x13, 0x12, 0x0A, 0x11, 0x0B, 0x06}, 16}, // 16 args, no delay:
{ILI9163C_GMCTRN1, {0x09, 0x16, 0x2D, 0x0D, 0x13, 0x15, 0x40, 0x48, 0x53, 0x0C, 0x1D, 0x25, 0x2E, 0x34, 0x39}, 16}, // 16 args, no delay:
{ILI9163C_NORON, {0}, 0x80}, // Normal display on, no args, w/delay 10 ms delay
{ILI9163C_DISPON, {0}, 0x80}, // Main screen turn on, no args w/delay 100 ms delay
{0, {0}, 0xff}
};
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9163C_DC);
gpio_set_direction(ILI9163C_DC, GPIO_MODE_OUTPUT);
gpio_pad_select_gpio(ILI9163C_RST);
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
#if ILI9163C_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9163C_BCKL);
gpio_set_direction(ILI9163C_BCKL, GPIO_MODE_OUTPUT);
#endif
//Reset the display
gpio_set_level(ILI9163C_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9163C_RST, 1);
vTaskDelay(150 / portTICK_RATE_MS);
//Send all the commands
uint16_t cmd = 0;
while (ili_init_cmds[cmd].databytes != 0xff)
{
ili9163c_send_cmd(ili_init_cmds[cmd].cmd);
ili9163c_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes & 0x1F);
if (ili_init_cmds[cmd].databytes & 0x80)
{
vTaskDelay(150 / portTICK_RATE_MS);
}
cmd++;
}
ili9163c_enable_backlight(true);
ili9163c_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
}
void ili9163c_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
{
uint8_t data[4];
/*Column addresses*/
ili9163c_send_cmd(ILI9163C_CASET);
data[0] = (area->x1 >> 8) & 0xFF;
data[1] = area->x1 & 0xFF;
data[2] = (area->x2 >> 8) & 0xFF;
data[3] = area->x2 & 0xFF;
ili9163c_send_data(data, 4);
/*Page addresses*/
ili9163c_send_cmd(ILI9163C_RASET);
data[0] = (area->y1 >> 8) & 0xFF;
data[1] = area->y1 & 0xFF;
data[2] = (area->y2 >> 8) & 0xFF;
data[3] = area->y2 & 0xFF;
ili9163c_send_data(data, 4);
/*Memory write*/
ili9163c_send_cmd(ILI9163C_RAMWR);
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
ili9163c_send_color((void *)color_map, size * 2);
}
void ili9163c_enable_backlight(bool backlight)
{
#if ILI9163C_ENABLE_BACKLIGHT_CONTROL
ESP_LOGD(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
uint32_t tmp = 0;
#if (ILI9163C_BCKL_ACTIVE_LVL == 1)
tmp = backlight ? 1 : 0;
#else
tmp = backlight ? 0 : 1;
#endif
gpio_set_level(ILI9163C_BCKL, tmp);
#endif
}
void ili9163c_sleep_in()
{
uint8_t data[] = {0x08};
ili9163c_send_cmd(ILI9163C_SLPIN);
ili9163c_send_data(&data, 1);
}
void ili9163c_sleep_out()
{
uint8_t data[] = {0x08};
ili9163c_send_cmd(ILI9163C_SLPOUT);
ili9163c_send_data(&data, 1);
}
/**********************
* STATIC FUNCTIONS
**********************/
static void ili9163c_send_cmd(uint8_t cmd)
{
disp_wait_for_pending_transactions();
gpio_set_level(ILI9163C_DC, 0); /*Command mode*/
disp_spi_send_data(&cmd, 1);
}
static void ili9163c_send_data(void *data, uint16_t length)
{
disp_wait_for_pending_transactions();
gpio_set_level(ILI9163C_DC, 1); /*Data mode*/
disp_spi_send_data(data, length);
}
static void ili9163c_send_color(void *data, uint16_t length)
{
disp_wait_for_pending_transactions();
gpio_set_level(ILI9163C_DC, 1); /*Data mode*/
disp_spi_send_colors(data, length);
}
static void ili9163c_set_orientation(uint8_t orientation)
{
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"};
ESP_LOGD(TAG, "Display orientation: %s", orientation_str[orientation]);
uint8_t data[] = {0x48, 0x88, 0xA8, 0x68};
ili9163c_send_cmd(ILI9163C_MADCTL);
ili9163c_send_data((void *)&data[orientation], 1);
}

65
lvgl_tft/ili9163c.h Normal file
View file

@ -0,0 +1,65 @@
/**
* @file lv_templ.h
*
*/
#ifndef ILI9163C_H
#define ILI9163C_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#include "../lvgl_helpers.h"
/*********************
* DEFINES
*********************/
#define ILI9163C_DC CONFIG_LV_DISP_PIN_DC
#define ILI9163C_RST CONFIG_LV_DISP_PIN_RST
#define ILI9163C_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9163C_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
#define ILI9163C_BCKL_ACTIVE_LVL 1
#else
#define ILI9163C_BCKL_ACTIVE_LVL 0
#endif
#define ILI9163C_INVERT_COLORS CONFIG_LV_INVERT_COLORS
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void ili9163c_init(void);
void ili9163c_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
void ili9163c_enable_backlight(bool backlight);
void ili9163c_sleep_in(void);
void ili9163c_sleep_out(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*ILI9163C_H*/

View file

@ -93,18 +93,23 @@ void ili9341_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9341_DC); gpio_pad_select_gpio(ILI9341_DC);
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
#if ILI9341_USE_RST
gpio_pad_select_gpio(ILI9341_RST); gpio_pad_select_gpio(ILI9341_RST);
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9341_ENABLE_BACKLIGHT_CONTROL #if ILI9341_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9341_BCKL); gpio_pad_select_gpio(ILI9341_BCKL);
gpio_set_direction(ILI9341_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9341_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if ILI9341_USE_RST
//Reset the display //Reset the display
gpio_set_level(ILI9341_RST, 0); gpio_set_level(ILI9341_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9341_RST, 1); gpio_set_level(ILI9341_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization."); ESP_LOGI(TAG, "Initialization.");
@ -228,6 +233,8 @@ static void ili9341_set_orientation(uint8_t orientation)
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK #if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_M5CORE2)
uint8_t data[] = {0x08, 0x88, 0x28, 0xE8};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4) #elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
uint8_t data[] = {0x6C, 0xEC, 0xCC, 0x4C}; uint8_t data[] = {0x6C, 0xEC, 0xCC, 0x4C};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE) #elif defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE)

View file

@ -25,9 +25,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define ILI9341_DC CONFIG_LV_DISP_PIN_DC #define ILI9341_DC CONFIG_LV_DISP_PIN_DC
#define ILI9341_RST CONFIG_LV_DISP_PIN_RST #define ILI9341_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9341_BCKL CONFIG_LV_DISP_PIN_BCKL #define ILI9341_RST CONFIG_LV_DISP_PIN_RST
#define ILI9341_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9341_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ILI9341_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -76,19 +76,24 @@ void ili9481_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9481_DC); gpio_pad_select_gpio(ILI9481_DC);
gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT);
#if ILI9481_USE_RST
gpio_pad_select_gpio(ILI9481_RST); gpio_pad_select_gpio(ILI9481_RST);
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9481_ENABLE_BACKLIGHT_CONTROL #if ILI9481_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9481_BCKL); gpio_pad_select_gpio(ILI9481_BCKL);
gpio_set_direction(ILI9481_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9481_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if ILI9481_USE_RST
//Reset the display //Reset the display
gpio_set_level(ILI9481_RST, 0); gpio_set_level(ILI9481_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9481_RST, 1); gpio_set_level(ILI9481_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9481 initialization."); ESP_LOGI(TAG, "ILI9481 initialization.");

View file

@ -25,9 +25,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define ILI9481_DC CONFIG_LV_DISP_PIN_DC #define ILI9481_DC CONFIG_LV_DISP_PIN_DC
#define ILI9481_RST CONFIG_LV_DISP_PIN_RST #define ILI9481_RST CONFIG_LV_DISP_PIN_RST
#define ILI9481_BCKL CONFIG_LV_DISP_PIN_BCKL #define ILI9481_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9481_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9481_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ILI9481_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS #define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS

View file

@ -60,8 +60,8 @@ void ili9486_init(void)
{0xE0, {0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00}, 15}, {0xE0, {0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00}, 15},
{0XE1, {0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00}, 15}, {0XE1, {0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00}, 15},
{0x20, {0}, 0}, /* display inversion OFF */ {0x20, {0}, 0}, /* display inversion OFF */
{0x36, {0x48}, 1}, {0x36, {0x48}, 1},
{0x29, {0}, 0x80}, /* display on */ {0x29, {0}, 0x80}, /* display on */
{0x00, {0}, 0xff}, {0x00, {0}, 0xff},
}; };
@ -78,19 +78,24 @@ void ili9486_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9486_DC); gpio_pad_select_gpio(ILI9486_DC);
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
#if ILI9486_USE_RST
gpio_pad_select_gpio(ILI9486_RST); gpio_pad_select_gpio(ILI9486_RST);
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9486_ENABLE_BACKLIGHT_CONTROL #if ILI9486_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9486_BCKL); gpio_pad_select_gpio(ILI9486_BCKL);
gpio_set_direction(ILI9486_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9486_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if ILI9486_USE_RST
//Reset the display //Reset the display
gpio_set_level(ILI9486_RST, 0); gpio_set_level(ILI9486_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9486_RST, 1); gpio_set_level(ILI9486_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9486 Initialization."); ESP_LOGI(TAG, "ILI9486 Initialization.");
@ -135,7 +140,7 @@ void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
ili9486_send_cmd(0x2C); ili9486_send_cmd(0x2C);
size = lv_area_get_width(area) * lv_area_get_height(area); size = lv_area_get_width(area) * lv_area_get_height(area);
ili9486_send_color((void*) color_map, size * 2); ili9486_send_color((void*) color_map, size * 2);
} }

View file

@ -25,9 +25,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define ILI9486_DC CONFIG_LV_DISP_PIN_DC #define ILI9486_DC CONFIG_LV_DISP_PIN_DC
#define ILI9486_RST CONFIG_LV_DISP_PIN_RST #define ILI9486_RST CONFIG_LV_DISP_PIN_RST
#define ILI9486_BCKL CONFIG_LV_DISP_PIN_BCKL #define ILI9486_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9486_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9486_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ILI9486_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -50,7 +50,7 @@ static void ili9488_send_color(void * data, uint16_t length);
/********************** /**********************
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
// From github.com/jeremyjh/ESP32_TFT_library // From github.com/jeremyjh/ESP32_TFT_library
// From github.com/mvturnho/ILI9488-lvgl-ESP32-WROVER-B // From github.com/mvturnho/ILI9488-lvgl-ESP32-WROVER-B
void ili9488_init(void) void ili9488_init(void)
{ {
@ -78,26 +78,31 @@ void ili9488_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9488_DC); gpio_pad_select_gpio(ILI9488_DC);
gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT);
#if ILI9488_USE_RST
gpio_pad_select_gpio(ILI9488_RST); gpio_pad_select_gpio(ILI9488_RST);
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9488_ENABLE_BACKLIGHT_CONTROL #if ILI9488_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9488_BCKL); gpio_pad_select_gpio(ILI9488_BCKL);
gpio_set_direction(ILI9488_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(ILI9488_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if ILI9488_USE_RST
//Reset the display //Reset the display
gpio_set_level(ILI9488_RST, 0); gpio_set_level(ILI9488_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9488_RST, 1); gpio_set_level(ILI9488_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ILI9488 initialization."); ESP_LOGI(TAG, "ILI9488 initialization.");
// Exit sleep // Exit sleep
ili9488_send_cmd(0x01); /* Software reset */ ili9488_send_cmd(0x01); /* Software reset */
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
//Send all the commands //Send all the commands
uint16_t cmd = 0; uint16_t cmd = 0;
while (ili_init_cmds[cmd].databytes!=0xff) { while (ili_init_cmds[cmd].databytes!=0xff) {
@ -146,7 +151,7 @@ void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
(uint8_t) (area->x2 >> 8) & 0xFF, (uint8_t) (area->x2 >> 8) & 0xFF,
(uint8_t) (area->x2) & 0xFF, (uint8_t) (area->x2) & 0xFF,
}; };
/* Page addresses */ /* Page addresses */
uint8_t yb[] = { uint8_t yb[] = {
(uint8_t) (area->y1 >> 8) & 0xFF, (uint8_t) (area->y1 >> 8) & 0xFF,

View file

@ -25,9 +25,10 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define ILI9488_DC CONFIG_LV_DISP_PIN_DC #define ILI9488_DC CONFIG_LV_DISP_PIN_DC
#define ILI9488_RST CONFIG_LV_DISP_PIN_RST #define ILI9488_RST CONFIG_LV_DISP_PIN_RST
#define ILI9488_BCKL CONFIG_LV_DISP_PIN_BCKL #define ILI9488_USE_RST CONFIG_LV_DISP_USE_RST
#define ILI9488_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ILI9488_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ILI9488_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL

View file

@ -159,18 +159,24 @@ void ra8875_init(void)
#endif #endif
// Initialize non-SPI GPIOs // Initialize non-SPI GPIOs
#if RA8875_USE_RST
gpio_pad_select_gpio(RA8875_RST); gpio_pad_select_gpio(RA8875_RST);
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT); gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
#endif
#ifdef CONFIG_LV_DISP_PIN_BCKL #ifdef CONFIG_LV_DISP_PIN_BCKL
gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_BCKL); gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_BCKL);
gpio_set_direction(CONFIG_LV_DISP_PIN_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(CONFIG_LV_DISP_PIN_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if RA8875_USE_RST
// Reset the RA8875 // Reset the RA8875
gpio_set_level(RA8875_RST, 0); gpio_set_level(RA8875_RST, 0);
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS)); vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
gpio_set_level(RA8875_RST, 1); gpio_set_level(RA8875_RST, 1);
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS)); vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
#endif
// Initalize RA8875 clocks (SPI must be decelerated before initializing clocks) // Initalize RA8875 clocks (SPI must be decelerated before initializing clocks)
disp_spi_change_device_speed(SPI_CLOCK_SPEED_SLOW_HZ); disp_spi_change_device_speed(SPI_CLOCK_SPEED_SLOW_HZ);

View file

@ -24,7 +24,8 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define RA8875_RST CONFIG_LV_DISP_PIN_RST #define RA8875_RST CONFIG_LV_DISP_PIN_RST
#define RA8875_USE_RST CONFIG_LV_DISP_USE_RST
// System & Configuration Registers // System & Configuration Registers
#define RA8875_REG_PWRR (0x01) // Power and Display Control Register (PWRR) #define RA8875_REG_PWRR (0x01) // Power and Display Control Register (PWRR)

View file

@ -94,6 +94,8 @@ void sh1107_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(SH1107_DC); gpio_pad_select_gpio(SH1107_DC);
gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT); gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT);
#if SH1107_USE_RST
gpio_pad_select_gpio(SH1107_RST); gpio_pad_select_gpio(SH1107_RST);
gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT); gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT);
@ -102,6 +104,7 @@ void sh1107_init(void)
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(SH1107_RST, 1); gpio_set_level(SH1107_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
//Send all the commands //Send all the commands
uint16_t cmd = 0; uint16_t cmd = 0;

View file

@ -25,8 +25,9 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define SH1107_DC CONFIG_LV_DISP_PIN_DC #define SH1107_DC CONFIG_LV_DISP_PIN_DC
#define SH1107_RST CONFIG_LV_DISP_PIN_RST #define SH1107_RST CONFIG_LV_DISP_PIN_RST
#define SH1107_USE_RST CONFIG_LV_DISP_USE_RST
/********************** /**********************
* TYPEDEFS * TYPEDEFS

View file

@ -99,6 +99,8 @@ void st7735s_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7735S_DC); gpio_pad_select_gpio(ST7735S_DC);
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
#if ST7735S_USE_RST
gpio_pad_select_gpio(ST7735S_RST); gpio_pad_select_gpio(ST7735S_RST);
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
@ -107,6 +109,7 @@ void st7735s_init(void)
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7735S_RST, 1); gpio_set_level(ST7735S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "ST7735S initialization."); ESP_LOGI(TAG, "ST7735S initialization.");

View file

@ -25,8 +25,9 @@ extern "C" {
*********************/ *********************/
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#define ST7735S_DC CONFIG_LV_DISP_PIN_DC #define ST7735S_DC CONFIG_LV_DISP_PIN_DC
#define ST7735S_RST CONFIG_LV_DISP_PIN_RST #define ST7735S_RST CONFIG_LV_DISP_PIN_RST
#define ST7735S_USE_RST CONFIG_LV_DISP_USE_RST
#define AXP192_SDA CONFIG_LV_AXP192_PIN_SDA #define AXP192_SDA CONFIG_LV_AXP192_PIN_SDA
#define AXP192_SCL CONFIG_LV_AXP192_PIN_SCL #define AXP192_SCL CONFIG_LV_AXP192_PIN_SCL

View file

@ -35,8 +35,6 @@ typedef struct {
**********************/ **********************/
static void st7789_set_orientation(uint8_t orientation); static void st7789_set_orientation(uint8_t orientation);
static void st7789_send_cmd(uint8_t cmd);
static void st7789_send_data(void *data, uint16_t length);
static void st7789_send_color(void *data, uint16_t length); static void st7789_send_color(void *data, uint16_t length);
/********************** /**********************
@ -91,7 +89,7 @@ void st7789_init(void)
gpio_pad_select_gpio(ST7789_DC); gpio_pad_select_gpio(ST7789_DC);
gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT);
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET) #if !defined(ST7789_SOFT_RST)
gpio_pad_select_gpio(ST7789_RST); gpio_pad_select_gpio(ST7789_RST);
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
#endif #endif
@ -102,7 +100,7 @@ void st7789_init(void)
#endif #endif
//Reset the display //Reset the display
#if !defined(CONFIG_LV_DISP_ST7789_SOFT_RESET) #if !defined(ST7789_SOFT_RST)
gpio_set_level(ST7789_RST, 0); gpio_set_level(ST7789_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7789_RST, 1); gpio_set_level(ST7789_RST, 1);
@ -201,14 +199,14 @@ void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void st7789_send_cmd(uint8_t cmd) void st7789_send_cmd(uint8_t cmd)
{ {
disp_wait_for_pending_transactions(); disp_wait_for_pending_transactions();
gpio_set_level(ST7789_DC, 0); gpio_set_level(ST7789_DC, 0);
disp_spi_send_data(&cmd, 1); disp_spi_send_data(&cmd, 1);
} }
static void st7789_send_data(void * data, uint16_t length) void st7789_send_data(void * data, uint16_t length)
{ {
disp_wait_for_pending_transactions(); disp_wait_for_pending_transactions();
gpio_set_level(ST7789_DC, 1); gpio_set_level(ST7789_DC, 1);

View file

@ -25,6 +25,15 @@ extern "C"
#define ST7789_RST CONFIG_LV_DISP_PIN_RST #define ST7789_RST CONFIG_LV_DISP_PIN_RST
#define ST7789_BCKL CONFIG_LV_DISP_PIN_BCKL #define ST7789_BCKL CONFIG_LV_DISP_PIN_BCKL
#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_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ST7789_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS #define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS
@ -114,6 +123,9 @@ void st7789_init(void);
void st7789_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map); void st7789_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
void st7789_enable_backlight(bool backlight); void st7789_enable_backlight(bool backlight);
void st7789_send_cmd(uint8_t cmd);
void st7789_send_data(void *data, uint16_t length);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View file

@ -94,18 +94,24 @@ void st7796s_init(void)
//Initialize non-SPI GPIOs //Initialize non-SPI GPIOs
gpio_pad_select_gpio(ST7796S_DC); gpio_pad_select_gpio(ST7796S_DC);
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT); gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
#if ST7796S_USE_RST
gpio_pad_select_gpio(ST7796S_RST); gpio_pad_select_gpio(ST7796S_RST);
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT); gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
#endif
#if ST7796S_ENABLE_BACKLIGHT_CONTROL #if ST7796S_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ST7796S_BCKL); gpio_pad_select_gpio(ST7796S_BCKL);
gpio_set_direction(ST7796S_BCKL, GPIO_MODE_OUTPUT); gpio_set_direction(ST7796S_BCKL, GPIO_MODE_OUTPUT);
#endif #endif
#if ST7796S_USE_RST
//Reset the display //Reset the display
gpio_set_level(ST7796S_RST, 0); gpio_set_level(ST7796S_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ST7796S_RST, 1); gpio_set_level(ST7796S_RST, 1);
vTaskDelay(100 / portTICK_RATE_MS); vTaskDelay(100 / portTICK_RATE_MS);
#endif
ESP_LOGI(TAG, "Initialization."); ESP_LOGI(TAG, "Initialization.");

View file

@ -26,9 +26,10 @@ extern "C"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define ST7796S_DC CONFIG_LV_DISP_PIN_DC #define ST7796S_DC CONFIG_LV_DISP_PIN_DC
#define ST7796S_RST CONFIG_LV_DISP_PIN_RST #define ST7796S_RST CONFIG_LV_DISP_PIN_RST
#define ST7796S_BCKL CONFIG_LV_DISP_PIN_BCKL #define ST7796S_USE_RST CONFIG_LV_DISP_USE_RST
#define ST7796S_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ST7796S_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #define ST7796S_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS #define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS