Skip to content

Commit

Permalink
Merge branch 'feat/lcd_component_version_update' into 'master'
Browse files Browse the repository at this point in the history
feat(lcd): LCD component version update

Closes AEG-1541

See merge request ae_group/esp-iot-solution!1062
  • Loading branch information
Lzw655 committed Aug 26, 2024
2 parents c09eabf + f31a552 commit 1f855ac
Show file tree
Hide file tree
Showing 81 changed files with 2,120 additions and 229 deletions.
1 change: 1 addition & 0 deletions .github/workflows/upload_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
components/display/lcd/esp_lcd_jd9165;
components/display/lcd/esp_lcd_jd9365;
components/display/lcd/esp_lcd_gc9b71;
components/display/lcd/esp_lcd_hx8399;
components/display/lcd/esp_lcd_panel_io_additions;
components/display/lcd/esp_lcd_nv3022b;
components/display/lcd/esp_lcd_sh8601;
Expand Down
10 changes: 10 additions & 0 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,16 @@ build_components_display_lcd_esp_lcd_gc9b71_test_apps:
variables:
EXAMPLE_DIR: components/display/lcd/esp_lcd_gc9b71/test_apps

build_components_display_lcd_esp_lcd_hx8399_test_apps:
extends:
- .build_examples_template
- .rules:build:components_display_lcd_esp_lcd_hx8399_test_apps
parallel:
matrix:
- IMAGE: espressif/idf:release-v5.3
variables:
EXAMPLE_DIR: components/display/lcd/esp_lcd_hx8399/test_apps

build_components_display_lcd_esp_lcd_panel_io_additions_test_apps:
extends:
- .build_examples_template
Expand Down
14 changes: 14 additions & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
.patterns-components_display_lcd_esp_lcd_gc9b71: &patterns-components_display_lcd_esp_lcd_gc9b71
- "components/display/lcd/esp_lcd_gc9b71/**/*"

.patterns-components_display_lcd_esp_lcd_hx8399: &patterns-components_display_lcd_esp_lcd_hx8399
- "components/display/lcd/esp_lcd_hx8399/**/*"

.patterns-components_display_lcd_esp_lcd_panel_io_additions: &patterns-components_display_lcd_esp_lcd_panel_io_additions
- "components/display/lcd/esp_lcd_panel_io_additions/**/*"

Expand Down Expand Up @@ -1534,6 +1537,17 @@
- <<: *if-dev-push
changes: *patterns-components_display_lcd_esp_lcd_gc9b71

.rules:build:components_display_lcd_esp_lcd_hx8399_test_apps:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-trigger-job
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-components_display_lcd_esp_lcd_hx8399

.rules:build:components_display_lcd_esp_lcd_panel_io_additions_test_apps:
rules:
- <<: *if-protected
Expand Down
4 changes: 4 additions & 0 deletions components/.build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ components/display/lcd/esp_lcd_gc9b71/test_apps:
enable:
- if: INCLUDE_DEFAULT == 1

components/display/lcd/esp_lcd_hx8399/test_apps:
enable:
- if: IDF_TARGET in ["esp32p4"]

components/display/lcd/esp_lcd_panel_io_additions/test_apps:
enable:
- if: IDF_TARGET in ["esp32s3"]
Expand Down
6 changes: 6 additions & 0 deletions components/display/lcd/esp_lcd_ek79007/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## v1.0.0 - 2024-08-12

### Enhancements:

* Component version maintenance, code improvement, and documentation enhancement

## v0.1.0 - 2024-05-07

### Enhancements:
Expand Down
2 changes: 2 additions & 0 deletions components/display/lcd/esp_lcd_ek79007/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Implementation of the EK79007 LCD controller with esp_lcd component.

**Note**: MIPI-DSI interface only supports ESP-IDF v5.3 and above versions.

For more information on LCD, please refer to the [LCD documentation](https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html).

## Add to project

Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
Expand Down
63 changes: 50 additions & 13 deletions components/display/lcd/esp_lcd_ek79007/esp_lcd_ek79007.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
#include "esp_log.h"
#include "esp_lcd_ek79007.h"

#define EK79007_PAD_CONTROL (0xB2)
#define EK79007_DSI_2_LANE (0x10)
#define EK79007_DSI_4_LANE (0x00)

#define EK79007_CMD_SHLR_BIT (1ULL << 0)
#define EK79007_CMD_UPDN_BIT (1ULL << 1)
#define EK79007_MDCTL_VALUE_DEFAULT (0x01)

typedef struct {
esp_lcd_panel_io_handle_t io;
int reset_gpio_num;
uint8_t madctl_val; // save current value of LCD_CMD_MADCTL register
const ek79007_lcd_init_cmd_t *init_cmds;
uint16_t init_cmds_size;
uint8_t lane_num;
struct {
unsigned int reset_level: 1;
} flags;
Expand All @@ -42,7 +49,6 @@ static esp_err_t panel_ek79007_init(esp_lcd_panel_t *panel);
static esp_err_t panel_ek79007_reset(esp_lcd_panel_t *panel);
static esp_err_t panel_ek79007_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool mirror_y);
static esp_err_t panel_ek79007_invert_color(esp_lcd_panel_t *panel, bool invert_color_data);
static esp_err_t panel_ek79007_disp_on_off(esp_lcd_panel_t *panel, bool on_off);

esp_err_t esp_lcd_new_panel_ek79007(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config,
esp_lcd_panel_handle_t *ret_panel)
Expand All @@ -69,8 +75,10 @@ esp_err_t esp_lcd_new_panel_ek79007(const esp_lcd_panel_io_handle_t io, const es
ek79007->io = io;
ek79007->init_cmds = vendor_config->init_cmds;
ek79007->init_cmds_size = vendor_config->init_cmds_size;
ek79007->lane_num = vendor_config->mipi_config.lane_num;
ek79007->reset_gpio_num = panel_dev_config->reset_gpio_num;
ek79007->flags.reset_level = panel_dev_config->flags.reset_active_high;
ek79007->madctl_val = EK79007_MDCTL_VALUE_DEFAULT;

// Create MIPI DPI panel
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_dpi(vendor_config->mipi_config.dsi_bus, vendor_config->mipi_config.dpi_config, ret_panel), err, TAG,
Expand All @@ -86,7 +94,6 @@ esp_err_t esp_lcd_new_panel_ek79007(const esp_lcd_panel_io_handle_t io, const es
(*ret_panel)->reset = panel_ek79007_reset;
(*ret_panel)->mirror = panel_ek79007_mirror;
(*ret_panel)->invert_color = panel_ek79007_invert_color;
(*ret_panel)->disp_on_off = panel_ek79007_disp_on_off;
(*ret_panel)->user_data = ek79007;
ESP_LOGD(TAG, "new ek79007 panel @%p", ek79007);

Expand All @@ -111,7 +118,6 @@ static const ek79007_lcd_init_cmd_t vendor_specific_init_default[] = {
{0x84, (uint8_t []){0xA8}, 1, 0},
{0x85, (uint8_t []){0xE3}, 1, 0},
{0x86, (uint8_t []){0x88}, 1, 0},
{0xB2, (uint8_t []){0x10}, 1, 0},
{0x11, (uint8_t []){0x00}, 0, 120},
};

Expand All @@ -120,6 +126,24 @@ static esp_err_t panel_ek79007_send_init_cmds(ek79007_panel_t *ek79007)
esp_lcd_panel_io_handle_t io = ek79007->io;
const ek79007_lcd_init_cmd_t *init_cmds = NULL;
uint16_t init_cmds_size = 0;
uint8_t lane_command = EK79007_DSI_2_LANE;
bool is_cmd_overwritten = false;

switch (ek79007->lane_num) {
case 0:
case 2:
lane_command = EK79007_DSI_2_LANE;
break;
case 4:
lane_command = EK79007_DSI_4_LANE;
break;
default:
ESP_LOGE(TAG, "Invalid lane number %d", ek79007->lane_num);
return ESP_ERR_INVALID_ARG;
}
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, EK79007_PAD_CONTROL, (uint8_t[]) {
lane_command,
}, 1), TAG, "send command failed");

// vendor specific initialization, it can be different between manufacturers
// should consult the LCD supplier for initialization sequence code
Expand All @@ -132,11 +156,30 @@ static esp_err_t panel_ek79007_send_init_cmds(ek79007_panel_t *ek79007)
}

for (int i = 0; i < init_cmds_size; i++) {
// Check if the command has been used or conflicts with the internal
if (init_cmds[i].data_bytes > 0) {
switch (init_cmds[i].cmd) {
case LCD_CMD_MADCTL:
is_cmd_overwritten = true;
ek79007->madctl_val = ((uint8_t *)init_cmds[i].data)[0];
break;
default:
is_cmd_overwritten = false;
break;
}

if (is_cmd_overwritten) {
is_cmd_overwritten = false;
ESP_LOGW(TAG, "The %02Xh command has been used and will be overwritten by external initialization sequence",
init_cmds[i].cmd);
}
}

// Send command
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, init_cmds[i].cmd, init_cmds[i].data, init_cmds[i].data_bytes),
TAG, "send command failed");
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, init_cmds[i].cmd, init_cmds[i].data, init_cmds[i].data_bytes), TAG, "send command failed");
vTaskDelay(pdMS_TO_TICKS(init_cmds[i].delay_ms));
}

ESP_LOGD(TAG, "send init commands success");

return ESP_OK;
Expand Down Expand Up @@ -190,7 +233,7 @@ static esp_err_t panel_ek79007_mirror(esp_lcd_panel_t *panel, bool mirror_x, boo
{
ek79007_panel_t *ek79007 = (ek79007_panel_t *)panel->user_data;
esp_lcd_panel_io_handle_t io = ek79007->io;
uint8_t madctl_val = 0x01;
uint8_t madctl_val = ek79007->madctl_val;

ESP_RETURN_ON_FALSE(io, ESP_ERR_INVALID_STATE, TAG, "invalid panel IO");

Expand All @@ -209,6 +252,7 @@ static esp_err_t panel_ek79007_mirror(esp_lcd_panel_t *panel, bool mirror_x, boo
ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t []) {
madctl_val
}, 1), TAG, "send command failed");
ek79007->madctl_val = madctl_val;

return ESP_OK;
}
Expand All @@ -230,10 +274,3 @@ static esp_err_t panel_ek79007_invert_color(esp_lcd_panel_t *panel, bool invert_

return ESP_OK;
}

static esp_err_t panel_ek79007_disp_on_off(esp_lcd_panel_t *panel, bool on_off)
{
ESP_LOGE(TAG, "display on/off is not supported");

return ESP_ERR_NOT_SUPPORTED;
}
4 changes: 2 additions & 2 deletions components/display/lcd/esp_lcd_ek79007/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "0.1.0"
version: "1.0.0"
targets:
- esp32p4
description: ESP LCD EK79007
description: ESP LCD EK79007(MIPI-DSI)
url: https://github.com/espressif/esp-iot-solution/tree/master/components/display/lcd/esp_lcd_ek79007
repository: https://github.com/espressif/esp-iot-solution.git
issues: https://github.com/espressif/esp-iot-solution/issues
Expand Down
16 changes: 1 addition & 15 deletions components/display/lcd/esp_lcd_ek79007/include/esp_lcd_ek79007.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,8 @@ typedef struct {
struct {
esp_lcd_dsi_bus_handle_t dsi_bus; /*!< MIPI-DSI bus configuration */
const esp_lcd_dpi_panel_config_t *dpi_config; /*!< MIPI-DPI panel configuration */
uint8_t lane_num; /*!< Number of MIPI-DSI lanes, defaults to 2 if set to 0 */
} mipi_config;
struct {
unsigned int use_mipi_interface: 1; /*<! Set to 1 if using MIPI interface, default is RGB interface */
unsigned int mirror_by_cmd: 1; /*<! The `mirror()` function will be implemented by LCD command if set to 1. This flag is only valid for the RGB interface.
* Otherwise, the function will be implemented by software.
*/

union {
unsigned int auto_del_panel_io: 1;
unsigned int enable_io_multiplex: 1;
}; /*<! Delete the panel IO instance automatically if set to 1. All `*_by_cmd` flags will be invalid.
* If the panel IO pins are sharing other pins of the RGB interface to save GPIOs,
* Please set it to 1 to release the panel IO and its pins (except CS signal).
* This flag is only valid for the RGB interface.
*/
} flags;
} ek79007_vendor_config_t;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define TEST_PIN_NUM_BK_LIGHT (22) // set to -1 if not used
#define TEST_LCD_BK_LIGHT_ON_LEVEL (1)
#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL
#define TEST_MIPI_DSI_LANE_NUM (2)
#define TEST_PIN_NUM_VER_FLIP (-1)
#define TEST_PIN_NUM_HOR_FLIP (-1)
#define TEST_LCD_ROTATE_LEVEL (1)
Expand Down Expand Up @@ -101,12 +102,10 @@ static void test_init_lcd(void)
ESP_LOGI(TAG, "Install LCD driver of ek79007");
esp_lcd_dpi_panel_config_t dpi_config = EK79007_1024_600_PANEL_60HZ_CONFIG(TEST_MIPI_DPI_PX_FORMAT);
ek79007_vendor_config_t vendor_config = {
.flags = {
.use_mipi_interface = 1,
},
.mipi_config = {
.dsi_bus = mipi_dsi_bus,
.dpi_config = &dpi_config,
.lane_num = TEST_MIPI_DSI_LANE_NUM,
},
};
const esp_lcd_panel_dev_config_t panel_config = {
Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions components/display/lcd/esp_lcd_gc9b71/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## v1.0.2 - 2024-08-12

### Enhancements:

* Component version maintenance, code improvement, and documentation enhancement

## v0.0.1 - 2023-08-22

### Enhancements:
Expand Down
2 changes: 2 additions & 0 deletions components/display/lcd/esp_lcd_gc9b71/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Implementation of the GC9B71 LCD controller with [esp_lcd](https://docs.espressi
| :------------: | :---------------------: | :------------: | :---------------------------------------------------------------------------: |
| GC9B71 | SPI/QSPI | esp_lcd_gc9b71 | [PDF](https://dl.espressif.com/AE/esp-iot-solution/GC9B71_DataSheet_V1.0.pdf) |

For more information on LCD, please refer to the [LCD documentation](https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html).

## Add to project

Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
Expand Down
4 changes: 2 additions & 2 deletions components/display/lcd/esp_lcd_gc9b71/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: "1.0.1"
description: ESP LCD GC9B71
version: "1.0.2"
description: ESP LCD GC9B71(SPI & QSPI)
url: https://github.com/espressif/esp-iot-solution/tree/master/components/display/lcd/esp_lcd_gc9b71
repository: https://github.com/espressif/esp-iot-solution.git
issues: https://github.com/espressif/esp-iot-solution/issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#define TEST_PIN_NUM_LCD_DATA3 (GPIO_NUM_14)
#define TEST_PIN_NUM_LCD_RST (GPIO_NUM_17)
#define TEST_PIN_NUM_LCD_DC (GPIO_NUM_8)
#define TEST_PIN_NUM_BK_LIGHT (GPIO_NUM_0) // set to -1 if not used
#define TEST_LCD_BK_LIGHT_ON_LEVEL (1)
#define TEST_LCD_BK_LIGHT_OFF_LEVEL !TEST_LCD_BK_LIGHT_ON_LEVEL

#define TEST_DELAY_TIME_MS (3000)

Expand Down Expand Up @@ -74,6 +77,16 @@ IRAM_ATTR static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle)

TEST_CASE("test gc9b71 to draw color bar with SPI interface", "[gc9b71][spi]")
{
#if TEST_PIN_NUM_BK_LIGHT >= 0
ESP_LOGI(TAG, "Turn on LCD backlight");
gpio_config_t bk_gpio_config = {
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = 1ULL << TEST_PIN_NUM_BK_LIGHT
};
TEST_ESP_OK(gpio_config(&bk_gpio_config));
TEST_ESP_OK(gpio_set_level(TEST_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL));
#endif

ESP_LOGI(TAG, "Initialize SPI bus");
const spi_bus_config_t buscfg = GC9B71_PANEL_BUS_SPI_CONFIG(TEST_PIN_NUM_LCD_PCLK,
TEST_PIN_NUM_LCD_DATA0,
Expand Down Expand Up @@ -104,10 +117,24 @@ TEST_CASE("test gc9b71 to draw color bar with SPI interface", "[gc9b71][spi]")
TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
TEST_ESP_OK(esp_lcd_panel_io_del(io_handle));
TEST_ESP_OK(spi_bus_free(TEST_LCD_HOST));

#if TEST_PIN_NUM_BK_LIGHT >= 0
TEST_ESP_OK(gpio_reset_pin(TEST_PIN_NUM_BK_LIGHT));
#endif
}

TEST_CASE("test gc9b71 to draw color bar with QSPI interface", "[gc9b71][qspi]")
{
#if TEST_PIN_NUM_BK_LIGHT >= 0
ESP_LOGI(TAG, "Turn on LCD backlight");
gpio_config_t bk_gpio_config = {
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = 1ULL << TEST_PIN_NUM_BK_LIGHT
};
TEST_ESP_OK(gpio_config(&bk_gpio_config));
TEST_ESP_OK(gpio_set_level(TEST_PIN_NUM_BK_LIGHT, TEST_LCD_BK_LIGHT_ON_LEVEL));
#endif

ESP_LOGI(TAG, "Initialize SPI bus");
const spi_bus_config_t buscfg = GC9B71_PANEL_BUS_QSPI_CONFIG(TEST_PIN_NUM_LCD_PCLK,
TEST_PIN_NUM_LCD_DATA0,
Expand Down Expand Up @@ -146,6 +173,10 @@ TEST_CASE("test gc9b71 to draw color bar with QSPI interface", "[gc9b71][qspi]")
TEST_ESP_OK(esp_lcd_panel_del(panel_handle));
TEST_ESP_OK(esp_lcd_panel_io_del(io_handle));
TEST_ESP_OK(spi_bus_free(TEST_LCD_HOST));

#if TEST_PIN_NUM_BK_LIGHT >= 0
TEST_ESP_OK(gpio_reset_pin(TEST_PIN_NUM_BK_LIGHT));
#endif
}

// Some resources are lazy allocated in the LCD driver, the threadhold is left for that case
Expand Down
7 changes: 7 additions & 0 deletions components/display/lcd/esp_lcd_hx8399/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ChangeLog

## v1.0.0 - 2024-06-14

### Enhancements:

* Implement the driver for the HX8399 MIPI-DSI LCD controller
Loading

0 comments on commit 1f855ac

Please sign in to comment.