Skip to content

Commit de81425

Browse files
committed
Minor cleanup on PR #7
* Move portrait/landscape setting to esp_lcd_new_panel_ili9488. * Fix esp_lcd_panel_io_spi_config_t init in example for IDF v5.
1 parent 5b6f1c0 commit de81425

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.md

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

3+
## v1.0.8 - Adds support for portrait / landscape orientation.
4+
5+
Thanks to a contribution from @jacobvc it is possible to configure the
6+
display as portrait (default) or landscape.
7+
38
## v1.0.5 - Add 16-bit support for parallel IO interface support
49

510
Parallel IO mode (Intel 8080 interface) should use 16-bit color mode instead

esp_lcd_ili9488.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct
4040
uint8_t color_mode;
4141
size_t buffer_size;
4242
uint8_t *color_buffer;
43-
bool landscape;
43+
uint8_t screen_orientation;
4444
} ili9488_panel_t;
4545

4646
enum ili9488_constants
@@ -120,7 +120,6 @@ static esp_err_t panel_ili9488_init(esp_lcd_panel_t *panel)
120120
{
121121
ili9488_panel_t *ili9488 = __containerof(panel, ili9488_panel_t, base);
122122
esp_lcd_panel_io_handle_t io = ili9488->io;
123-
124123
lcd_init_cmd_t ili9488_init[] =
125124
{
126125
{ ILI9488_POSITIVE_GAMMA_CTL,
@@ -146,6 +145,7 @@ static esp_err_t panel_ili9488_init(esp_lcd_panel_t *panel)
146145
{ ILI9488_FUNCTION_CTL, { 0x02, 0x02, 0x3B }, 3},
147146
{ ILI9488_ENTRY_MODE_CTL, { 0xC6 }, 1 },
148147
{ ILI9488_ADJUST_CTL_THREE, { 0xA9, 0x51, 0x2C, 0x02 }, 4 },
148+
{ ILI9488_SET_ADDRESS_MODE, { ili9488->screen_orientation }, 1 },
149149
{ LCD_CMD_NOP, { 0 }, ILI9488_INIT_DONE_FLAG },
150150
};
151151

@@ -160,9 +160,6 @@ static esp_err_t panel_ili9488_init(esp_lcd_panel_t *panel)
160160
ili9488_init[cmd].data_bytes & ILI9488_INIT_LENGTH_MASK);
161161
cmd++;
162162
}
163-
// Set address mode orientation
164-
uint8_t cmdOrientation = ili9488->landscape ? ILI9488_ORIENTATION_LANDSCAPE : ILI9488_ORIENTATION_PORTRAIT;
165-
esp_lcd_panel_io_tx_param(io, ILI9488_SET_ADDRESS_MODE, &cmdOrientation, 1);
166163

167164
// Take the display out of sleep mode.
168165
esp_lcd_panel_io_tx_param(io, LCD_CMD_SLPOUT, NULL, 0);
@@ -351,8 +348,12 @@ esp_err_t esp_lcd_new_panel_ili9488(
351348
ESP_GOTO_ON_ERROR(gpio_config(&cfg), err, TAG,
352349
"configure GPIO for RESET line failed");
353350
}
354-
ili9488->landscape = landscape;
355351

352+
ili9488->screen_orientation = ILI9488_ORIENTATION_PORTRAIT;
353+
if (landscape)
354+
{
355+
ili9488->screen_orientation = ILI9488_ORIENTATION_LANDSCAPE;
356+
}
356357

357358
if (panel_dev_config->bits_per_pixel == 16)
358359
{

examples/lvgl/main/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,18 @@ void initialize_display()
171171
.lcd_param_bits = DISPLAY_PARAMETER_BITS,
172172
.flags =
173173
{
174+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
174175
.dc_as_cmd_phase = 0,
175176
.dc_low_on_data = 0,
176177
.octal_mode = 0,
177178
.lsb_first = 0
179+
#else
180+
.dc_low_on_data = 0,
181+
.octal_mode = 0,
182+
.sio_mode = 0,
183+
.lsb_first = 0,
184+
.cs_high_active = 0
185+
#endif
178186
}
179187
};
180188

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.7
5+
version: 1.0.8

0 commit comments

Comments
 (0)