Merge pull request #96 from lvgl/feature/build-all-drivers

Build all display drivers
This commit is contained in:
Tomas Rezucha 2021-08-10 07:37:11 +02:00 committed by GitHub
commit 280bebf52e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 90 additions and 92 deletions

View file

@ -5,46 +5,25 @@ set(LVGL_INCLUDE_DIRS . lvgl_tft)
list(APPEND SOURCES "lvgl_tft/disp_driver.c")
list(APPEND SOURCES "lvgl_tft/esp_lcd_backlight.c")
# Include only the source file of the selected
# display controller.
if(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341)
# Build all display drivers
list(APPEND SOURCES "lvgl_tft/ili9341.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9481)
list(APPEND SOURCES "lvgl_tft/ili9481.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9486)
list(APPEND SOURCES "lvgl_tft/ili9486.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488)
list(APPEND SOURCES "lvgl_tft/ili9488.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789)
list(APPEND SOURCES "lvgl_tft/st7789.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S)
list(APPEND SOURCES "lvgl_tft/st7735s.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S)
list(APPEND SOURCES "lvgl_tft/st7796s.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_HX8357)
list(APPEND SOURCES "lvgl_tft/hx8357.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SH1107)
list(APPEND SOURCES "lvgl_tft/sh1107.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306)
list(APPEND SOURCES "lvgl_tft/ssd1306.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
list(APPEND SOURCES "lvgl_tft/EVE_commands.c")
list(APPEND SOURCES "lvgl_tft/FT81x.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820)
list(APPEND SOURCES "lvgl_tft/il3820.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A)
list(APPEND SOURCES "lvgl_tft/jd79653a.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D)
list(APPEND SOURCES "lvgl_tft/uc8151d.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875)
list(APPEND SOURCES "lvgl_tft/ra8875.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_GC9A01)
list(APPEND SOURCES "lvgl_tft/GC9A01.c")
elseif(CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C)
list(APPEND SOURCES "lvgl_tft/ili9163c.c")
else()
message(WARNING "LVGL ESP32 drivers: Display controller not defined.")
endif()
if(CONFIG_LV_TFT_DISPLAY_PROTOCOL_SPI)
list(APPEND SOURCES "lvgl_tft/disp_spi.c")

View file

@ -208,6 +208,8 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define EVE_SUNFLOWER
#elif defined(CONFIG_LV_FT81X_CONFIG_EVE_CONNECTEVE)
#define EVE_CONNECTEVE
#else
#define EVE_EVE2_35 // Define something if there is no Kconfig option selected
#endif
/* display timing parameters below */

View file

@ -220,7 +220,7 @@ static void GC9A01_send_color(void * data, uint16_t length)
static void GC9A01_set_orientation(uint8_t orientation)
{
// ESP_ASSERT(orientation < 4);
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
@ -229,14 +229,14 @@ static void GC9A01_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
uint8_t data[] = {0x68, 0x68, 0x08, 0x08}; ///
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
uint8_t data[] = {0x4C, 0x88, 0x28, 0xE8}; ///
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE)
uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8}; ///ggggg
const uint8_t data[] = {0x4C, 0x88, 0x28, 0xE8};
#else
const uint8_t data[] = {0x08, 0xC8, 0x68, 0xA8};
#endif
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]);
GC9A01_send_cmd(0x36);
GC9A01_send_data((void *) &data[orientation], 1);

View file

@ -180,7 +180,9 @@ void il3820_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
BIT_CLEAR(buf[byte_index], 7 - bit_index);
}
#else
#error "Unsupported orientation used"
(void)byte_index;
(void)bit_index;
assert(false); // Unsupported orientation configured. Crash if we get here, but allow compilation for CI
#endif
}

View file

@ -186,7 +186,7 @@ static void ili9341_send_color(void * data, uint16_t length)
static void ili9341_set_orientation(uint8_t orientation)
{
// ESP_ASSERT(orientation < 4);
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
@ -195,16 +195,16 @@ static void ili9341_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_M5CORE2)
uint8_t data[] = {0x08, 0x88, 0x28, 0xE8};
const uint8_t data[] = {0x08, 0x88, 0x28, 0xE8};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
uint8_t data[] = {0x6C, 0xEC, 0xCC, 0x4C};
#elif defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE)
uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
const uint8_t data[] = {0x6C, 0xEC, 0xCC, 0x4C};
#else
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#endif
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]);
ili9341_send_cmd(0x36);
ili9341_send_data((void *) &data[orientation], 1);

View file

@ -165,7 +165,7 @@ static void ili9486_send_color(void * data, uint16_t length)
static void ili9486_set_orientation(uint8_t orientation)
{
// ESP_ASSERT(orientation < 4);
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
@ -173,11 +173,9 @@ static void ili9486_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
#if defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE)
uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#endif
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]);
ili9486_send_cmd(0x36);
ili9486_send_data((void *) &data[orientation], 1);

View file

@ -194,7 +194,7 @@ static void ili9488_send_color(void * data, uint16_t length)
static void ili9488_set_orientation(uint8_t orientation)
{
// ESP_ASSERT(orientation < 4);
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"
@ -202,11 +202,9 @@ static void ili9488_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
#if defined (CONFIG_LV_PREDEFINED_DISPLAY_NONE)
uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#endif
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]);
ili9488_send_cmd(0x36);
ili9488_send_data((void *) &data[orientation], 1);

View file

@ -123,10 +123,9 @@ static const uint8_t lut_bb1[] = {
static const jd79653a_seq_t init_seq[] = {
#if defined (CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
{0x00, {0xd3, 0x0e}, 2}, // Panel settings
#elif defined(CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
{0x00, {0xdf, 0x0e}, 2}, // Panel settings
//#elif defined(CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
#else
#error "Unsupported orientation - only portrait modes are supported for now"
{0x00, {0xdf, 0x0e}, 2}, // Panel settings
#endif
{0x4d, {0x55}, 1}, // Undocumented secret from demo code
{0xaa, {0x0f}, 1}, // Undocumented secret from demo code
@ -249,7 +248,8 @@ static void jd79653a_partial_in()
#elif defined(CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
uint8_t pst_use_reg_lut[] = { 0xff, 0x0e };
#else
#error "Unsupported orientation - only portrait modes are supported for now"
assert(false); // Unsupported orientation configured. Crash if we get here, but allow compilation for CI
uint8_t pst_use_reg_lut[] = { 0,0 };
#endif
jd79653a_spi_send_cmd(0x00);
jd79653a_spi_send_data(pst_use_reg_lut, sizeof(pst_use_reg_lut));
@ -276,7 +276,8 @@ static void jd79653a_partial_out()
#elif defined(CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT)
uint8_t pst_use_otp_lut[] = { 0xdf, 0x0e };
#else
#error "Unsupported orientation - only portrait modes are supported for now"
assert(false); // Unsupported orientation configured. Crash if we get here, but allow compilation for CI
uint8_t pst_use_otp_lut[] = { 0,0 };
#endif
jd79653a_spi_send_cmd(0x00);
jd79653a_spi_send_data(pst_use_otp_lut, sizeof(pst_use_otp_lut));

View file

@ -16,7 +16,6 @@
/*********************
* DEFINES
*********************/
#define DEBUG false
#define TAG "RA8875"
#define DIV_ROUND_UP(n, d) (((n)+(d)-1)/(d))
@ -43,6 +42,24 @@
#define VDIR_MASK (1 << 2)
#define HDIR_MASK (1 << 3)
#ifndef CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875
// Use this settings if there is no Kconfig settings defined
#define DPCR_VAL (0x00)
#define PCSR_VAL (0x00)
#define HNDR_VAL (0x00)
#define HNDFTR_VAL (0x00)
#define HSTR_VAL (0x00)
#define HPW (0x00)
#define HPWR_VAL (0x00)
#define VNDR_VAL (0x00)
#define VSTR_VAL (0x00)
#define VPW (0x00)
#define VPWR_VAL (0x00)
#define CONFIG_LV_DISP_RA8875_PLLDIVM (0x00)
#define CONFIG_LV_DISP_RA8875_PLLDIVN (0x00)
#define CONFIG_LV_DISP_RA8875_PLLDIVK (0x00)
#else
#if ( CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED || CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED )
#if CONFIG_LV_INVERT_DISPLAY
#define DPCR_VAL (VDIR_MASK)
@ -92,6 +109,7 @@
#else
#define VPWR_VAL (VPW)
#endif
#endif // CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875
/**********************
* TYPEDEFS
@ -119,6 +137,9 @@ static void ra8875_send_buffer(uint8_t * data, size_t length, bool signal_flush)
void ra8875_init(void)
{
#ifndef CONFIG_LV_TFT_DISPLAY_CONTROLLER_RA8875
assert(false); // This driver is not properly configured
#endif
unsigned int i = 0;
struct {
@ -205,18 +226,14 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
size_t linelen = (area->x2 - area->x1 + 1);
uint8_t * buffer = (uint8_t*)color_map;
#if DEBUG
ESP_LOGI(TAG, "flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 );
#endif
ESP_LOGD(TAG, "flush: %d,%d at %d,%d", area->x1, area->x2, area->y1, area->y2 );
// Get lock
disp_spi_acquire();
// Set window if needed
if ((x1 != area->x1) || (x2 != area->x2)) {
#if DEBUG
ESP_LOGI(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2);
#endif
ESP_LOGD(TAG, "flush: set window (x1,x2): %d,%d -> %d,%d", x1, x2, area->x1, area->x2);
ra8875_set_window(area->x1, area->x2, 0, LV_VER_RES_MAX-1);
x1 = area->x1;
x2 = area->x2;
@ -224,9 +241,7 @@ void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
// Set cursor if needed
if ((x != area->x1) || (y != area->y1)) {
#if DEBUG
ESP_LOGI(TAG, "flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1);
#endif
ESP_LOGD(TAG, "flush: set cursor (x,y): %d,%d -> %d,%d", x, y, area->x1, area->y1);
ra8875_set_memory_write_cursor(area->x1, area->y1);
x = area->x1;
}

View file

@ -106,7 +106,7 @@ void ssd1306_init(void)
orientation_1 = 0xA0;
orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_NORMAL;
#else
#error "Unsupported orientation"
assert(false); // Invalid configuration of SSD1306 driver
#endif
uint8_t display_mode = 0;

View file

@ -41,10 +41,13 @@ static void st7735s_send_cmd(uint8_t cmd);
static void st7735s_send_data(void * data, uint16_t length);
static void st7735s_send_color(void * data, uint16_t length);
static void st7735s_set_orientation(uint8_t orientation);
#ifdef CONFIG_LV_M5STICKC_HANDLE_AXP192
static void axp192_write_byte(uint8_t addr, uint8_t data);
static void axp192_init();
static void axp192_sleep_in();
static void axp192_sleep_out();
#endif
/**********************
* STATIC VARIABLES

View file

@ -189,7 +189,7 @@ static void st7796s_send_color(void *data, uint16_t length)
static void st7796s_set_orientation(uint8_t orientation)
{
// ESP_ASSERT(orientation < 4);
assert(orientation < 4);
const char *orientation_str[] = {
"PORTRAIT", "PORTRAIT_INVERTED", "LANDSCAPE", "LANDSCAPE_INVERTED"};
@ -197,16 +197,16 @@ static void st7796s_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
#if defined CONFIG_LV_PREDEFINED_DISPLAY_M5STACK
uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
const uint8_t data[] = {0x68, 0x68, 0x08, 0x08};
#elif defined(CONFIG_LV_PREDEFINED_DISPLAY_WROVER4)
uint8_t data[] = {0x4C, 0x88, 0x28, 0xE8};
const uint8_t data[] = {0x4C, 0x88, 0x28, 0xE8};
#elif defined(CONFIG_LV_PREDEFINED_DISPLAY_WT32_SC01)
uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#elif defined(CONFIG_LV_PREDEFINED_DISPLAY_NONE)
uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#else
const uint8_t data[] = {0x48, 0x88, 0x28, 0xE8};
#endif
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
ESP_LOGD(TAG, "0x36 command value: 0x%02X", data[orientation]);
st7796s_send_cmd(0x36);
st7796s_send_data((void *)&data[orientation], 1);