Skip to content

Commit d81c024

Browse files
authored
fix: add compatibility to ESP-IDF v6.0 and bump minor version (#21)
* fix: add compatibility to ESP-IDF v6.0 and bump minor version * fix: example version * fix: ifguard around TFT_COLOR_MODE * fix: make required conditional so it doesn't break previous ESP-IDF versions * docs: update changelog for v1.1.0
1 parent 6577e7a commit d81c024

File tree

8 files changed

+46
-6
lines changed

8 files changed

+46
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log for esp_lcd_ili9488
22

3+
## v1.1.0 – Add ESP-IDF v6.0 Compatibility
4+
5+
* Added conditional inclusion of `esp_driver_ledc` in the main component **REQUIRES** list for ESP-IDF >= v6.0.
6+
* Updated `esp_lcd_new_panel_ili9488` to handle the ESP-IDF v6.0 color-order API change (`color_space` -> `rgb_ele_order`).
37

48
## v1.0.11 - Updates to LVGL examples
59

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
cmake_minimum_required(VERSION 3.20)
88

9+
set(requires "driver freertos esp_lcd esp_timer")
10+
11+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
12+
list(APPEND requires "esp_driver_ledc")
13+
endif()
14+
915
idf_component_register(SRCS "esp_lcd_ili9488.c"
1016
INCLUDE_DIRS "include"
11-
REQUIRES "driver esp_lcd")
17+
REQUIRES ${requires})

esp_lcd_ili9488.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ esp_err_t esp_lcd_new_panel_ili9488(
367367
}
368368

369369
ili9488->memory_access_control = LCD_CMD_MX_BIT | LCD_CMD_BGR_BIT;
370+
371+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
370372
switch (panel_dev_config->color_space)
371373
{
372374
case ESP_LCD_COLOR_SPACE_RGB:
@@ -380,6 +382,21 @@ esp_err_t esp_lcd_new_panel_ili9488(
380382
ESP_GOTO_ON_FALSE(false, ESP_ERR_INVALID_ARG, err, TAG,
381383
"Unsupported color mode!");
382384
}
385+
#else
386+
switch (panel_dev_config->rgb_ele_order)
387+
{
388+
case LCD_RGB_ELEMENT_ORDER_RGB:
389+
ESP_LOGI(TAG, "Configuring for RGB color order");
390+
ili9488->memory_access_control &= ~LCD_CMD_BGR_BIT;
391+
break;
392+
case LCD_RGB_ELEMENT_ORDER_BGR:
393+
ESP_LOGI(TAG, "Configuring for BGR color order");
394+
break;
395+
default:
396+
ESP_GOTO_ON_FALSE(false, ESP_ERR_INVALID_ARG, err, TAG,
397+
"Unsupported color mode!");
398+
}
399+
#endif
383400

384401
ili9488->io = io;
385402
ili9488->reset_gpio_num = panel_dev_config->reset_gpio_num;
@@ -416,4 +433,4 @@ esp_err_t esp_lcd_new_panel_ili9488(
416433
free(ili9488);
417434
}
418435
return ret;
419-
}
436+
}

examples/lvgl/main/idf_component.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ dependencies:
22
idf: ">=4.4.2"
33
lvgl/lvgl: "<9.0.0"
44
esp_lcd_ili9488:
5-
version: "~1.0.0"
6-
override_path: "../../.."
5+
version: "~1.1.0"
6+
override_path: "../../.."

examples/lvgl/main/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ static const gpio_num_t TFT_BACKLIGHT = GPIO_NUM_18;
5656
#else
5757
#error Unsure which GPIO to use for SPI/TFT, please update code accordingly.
5858
#endif
59+
60+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
61+
static const lcd_rgb_element_order_t TFT_COLOR_MODE = LCD_RGB_ELEMENT_ORDER_BGR;
62+
#else
5963
static const lcd_rgb_element_order_t TFT_COLOR_MODE = COLOR_RGB_ELEMENT_ORDER_BGR;
64+
#endif
6065

6166
// Default to 25 lines of color data
6267
static const size_t LV_BUFFER_SIZE = DISPLAY_HORIZONTAL_PIXELS * 25;
@@ -216,7 +221,11 @@ void initialize_display()
216221
const esp_lcd_panel_dev_config_t lcd_config =
217222
{
218223
.reset_gpio_num = TFT_RESET,
224+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
219225
.color_space = TFT_COLOR_MODE,
226+
#else
227+
.rgb_ele_order = TFT_COLOR_MODE,
228+
#endif
220229
.bits_per_pixel = 18,
221230
.flags =
222231
{

examples/lvgl_for_i8080/main/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ dependencies:
22
idf: ">=4.4.2"
33
lvgl/lvgl: "~8.3.0"
44
esp_lcd_ili9488:
5-
version: "~1.0.0"
5+
version: "~1.1.0"
66
override_path: "../../.."

examples/lvgl_for_i8080/main/lvgl_example_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ void app_main(void)
154154
esp_lcd_panel_handle_t panel_handle = NULL;
155155
esp_lcd_panel_dev_config_t panel_config = {
156156
.reset_gpio_num = EXAMPLE_PIN_NUM_RST,
157+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
157158
.color_space = ESP_LCD_COLOR_SPACE_RGB,
159+
#else
160+
.rgb_ele_order = COLOR_SPACE_RGB,
161+
#endif
158162
.bits_per_pixel = 16,
159163
};
160164
ESP_ERROR_CHECK(esp_lcd_new_panel_ili9488(io_handle, &panel_config,EXAMPLE_LCD_H_RES * 20 * sizeof(lv_color_t), &panel_handle));

idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ dependencies:
22
idf: '>=4.4.2'
33
description: esp_lcd driver for ILI9488 displays
44
url: https://github.com/atanisoft/esp_lcd_ili9488
5-
version: 1.0.11
5+
version: 1.1.0

0 commit comments

Comments
 (0)