Comments (18)
We're still trying to make this work...
from lv_port_esp32.
Hi! Managed to get it working! Bellow are my changes...
In ILI9341.h change
DISP_BUF_SIZE (LV_HOR_RES_MAX * 20)
In ILI9341.h add
/*******************
* ILI 9488 REGS
*********************/
/* Level 1 Commands (from the display Datasheet) */
#define ILI9488_CMD_NOP 0x00
#define ILI9488_CMD_SOFTWARE_RESET 0x01
#define ILI9488_CMD_READ_DISP_ID 0x04
#define ILI9488_CMD_READ_ERROR_DSI 0x05
#define ILI9488_CMD_READ_DISP_STATUS 0x09
#define ILI9488_CMD_READ_DISP_POWER_MODE 0x0A
#define ILI9488_CMD_READ_DISP_MADCTRL 0x0B
#define ILI9488_CMD_READ_DISP_PIXEL_FORMAT 0x0C
#define ILI9488_CMD_READ_DISP_IMAGE_MODE 0x0D
#define ILI9488_CMD_READ_DISP_SIGNAL_MODE 0x0E
#define ILI9488_CMD_READ_DISP_SELF_DIAGNOSTIC 0x0F
#define ILI9488_CMD_ENTER_SLEEP_MODE 0x10
#define ILI9488_CMD_SLEEP_OUT 0x11
#define ILI9488_CMD_PARTIAL_MODE_ON 0x12
#define ILI9488_CMD_NORMAL_DISP_MODE_ON 0x13
#define ILI9488_CMD_DISP_INVERSION_OFF 0x20
#define ILI9488_CMD_DISP_INVERSION_ON 0x21
#define ILI9488_CMD_PIXEL_OFF 0x22
#define ILI9488_CMD_PIXEL_ON 0x23
#define ILI9488_CMD_DISPLAY_OFF 0x28
#define ILI9488_CMD_DISPLAY_ON 0x29
#define ILI9488_CMD_COLUMN_ADDRESS_SET 0x2A
#define ILI9488_CMD_PAGE_ADDRESS_SET 0x2B
#define ILI9488_CMD_MEMORY_WRITE 0x2C
#define ILI9488_CMD_MEMORY_READ 0x2E
#define ILI9488_CMD_PARTIAL_AREA 0x30
#define ILI9488_CMD_VERT_SCROLL_DEFINITION 0x33
#define ILI9488_CMD_TEARING_EFFECT_LINE_OFF 0x34
#define ILI9488_CMD_TEARING_EFFECT_LINE_ON 0x35
#define ILI9488_CMD_MEMORY_ACCESS_CONTROL 0x36
#define ILI9488_CMD_VERT_SCROLL_START_ADDRESS 0x37
#define ILI9488_CMD_IDLE_MODE_OFF 0x38
#define ILI9488_CMD_IDLE_MODE_ON 0x39
#define ILI9488_CMD_COLMOD_PIXEL_FORMAT_SET 0x3A
#define ILI9488_CMD_WRITE_MEMORY_CONTINUE 0x3C
#define ILI9488_CMD_READ_MEMORY_CONTINUE 0x3E
#define ILI9488_CMD_SET_TEAR_SCANLINE 0x44
#define ILI9488_CMD_GET_SCANLINE 0x45
#define ILI9488_CMD_WRITE_DISPLAY_BRIGHTNESS 0x51
#define ILI9488_CMD_READ_DISPLAY_BRIGHTNESS 0x52
#define ILI9488_CMD_WRITE_CTRL_DISPLAY 0x53
#define ILI9488_CMD_READ_CTRL_DISPLAY 0x54
#define ILI9488_CMD_WRITE_CONTENT_ADAPT_BRIGHTNESS 0x55
#define ILI9488_CMD_READ_CONTENT_ADAPT_BRIGHTNESS 0x56
#define ILI9488_CMD_WRITE_MIN_CAB_LEVEL 0x5E
#define ILI9488_CMD_READ_MIN_CAB_LEVEL 0x5F
#define ILI9488_CMD_READ_ABC_SELF_DIAG_RES 0x68
#define ILI9488_CMD_READ_ID1 0xDA
#define ILI9488_CMD_READ_ID2 0xDB
#define ILI9488_CMD_READ_ID3 0xDC
/* Level 2 Commands (from the display Datasheet) */
#define ILI9488_CMD_INTERFACE_MODE_CONTROL 0xB0
#define ILI9488_CMD_FRAME_RATE_CONTROL_NORMAL 0xB1
#define ILI9488_CMD_FRAME_RATE_CONTROL_IDLE_8COLOR 0xB2
#define ILI9488_CMD_FRAME_RATE_CONTROL_PARTIAL 0xB3
#define ILI9488_CMD_DISPLAY_INVERSION_CONTROL 0xB4
#define ILI9488_CMD_BLANKING_PORCH_CONTROL 0xB5
#define ILI9488_CMD_DISPLAY_FUNCTION_CONTROL 0xB6
#define ILI9488_CMD_ENTRY_MODE_SET 0xB7
#define ILI9488_CMD_BACKLIGHT_CONTROL_1 0xB9
#define ILI9488_CMD_BACKLIGHT_CONTROL_2 0xBA
#define ILI9488_CMD_HS_LANES_CONTROL 0xBE
#define ILI9488_CMD_POWER_CONTROL_1 0xC0
#define ILI9488_CMD_POWER_CONTROL_2 0xC1
#define ILI9488_CMD_POWER_CONTROL_NORMAL_3 0xC2
#define ILI9488_CMD_POWER_CONTROL_IDEL_4 0xC3
#define ILI9488_CMD_POWER_CONTROL_PARTIAL_5 0xC4
#define ILI9488_CMD_VCOM_CONTROL_1 0xC5
#define ILI9488_CMD_CABC_CONTROL_1 0xC6
#define ILI9488_CMD_CABC_CONTROL_2 0xC8
#define ILI9488_CMD_CABC_CONTROL_3 0xC9
#define ILI9488_CMD_CABC_CONTROL_4 0xCA
#define ILI9488_CMD_CABC_CONTROL_5 0xCB
#define ILI9488_CMD_CABC_CONTROL_6 0xCC
#define ILI9488_CMD_CABC_CONTROL_7 0xCD
#define ILI9488_CMD_CABC_CONTROL_8 0xCE
#define ILI9488_CMD_CABC_CONTROL_9 0xCF
#define ILI9488_CMD_NVMEM_WRITE 0xD0
#define ILI9488_CMD_NVMEM_PROTECTION_KEY 0xD1
#define ILI9488_CMD_NVMEM_STATUS_READ 0xD2
#define ILI9488_CMD_READ_ID4 0xD3
#define ILI9488_CMD_ADJUST_CONTROL_1 0xD7
#define ILI9488_CMD_READ_ID_VERSION 0xD8
#define ILI9488_CMD_POSITIVE_GAMMA_CORRECTION 0xE0
#define ILI9488_CMD_NEGATIVE_GAMMA_CORRECTION 0xE1
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_1 0xE2
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_2 0xE3
#define ILI9488_CMD_SET_IMAGE_FUNCTION 0xE9
#define ILI9488_CMD_ADJUST_CONTROL_2 0xF2
#define ILI9488_CMD_ADJUST_CONTROL_3 0xF7
#define ILI9488_CMD_ADJUST_CONTROL_4 0xF8
#define ILI9488_CMD_ADJUST_CONTROL_5 0xF9
#define ILI9488_CMD_SPI_READ_SETTINGS 0xFB
#define ILI9488_CMD_ADJUST_CONTROL_6 0xFC
#define ILI9488_CMD_ADJUST_CONTROL_7 0xFF
In ILI9341.c at the function ili9341_init
lcd_init_cmd_t ili_init_cmds[]={
{ILI9488_CMD_SLEEP_OUT, {0x00}, 0x80},
{ILI9488_CMD_POSITIVE_GAMMA_CORRECTION, {0x00, 0x03, 0x09, 0x08, 0x16, 0x0A, 0x3F, 0x78, 0x4C, 0x09, 0x0A, 0x08, 0x16, 0x1A, 0x0F}, 15},
{ILI9488_CMD_NEGATIVE_GAMMA_CORRECTION, {0x00, 0x16, 0x19, 0x03, 0x0F, 0x05, 0x32, 0x45, 0x46, 0x04, 0x0E, 0x0D, 0x35, 0x37, 0x0F}, 15},
{ILI9488_CMD_POWER_CONTROL_1, {0x17, 0x15}, 2}, /*Power control */
{ILI9488_CMD_POWER_CONTROL_2, {0x41}, 1}, /*Power control */
{ILI9488_CMD_VCOM_CONTROL_1, {0x00,0x12,0x80}, 3}, /*Pixel Format Set*/
{ILI9488_CMD_MEMORY_ACCESS_CONTROL, {(0x20 | 0x08)}, 1}, /*Memory Access Control*/ // control portrait mode 0x08 BGR
{ILI9488_CMD_COLMOD_PIXEL_FORMAT_SET, {0x66}, 1}, /*(0x66 RGB666/RGB888)*/
{ILI9488_CMD_INTERFACE_MODE_CONTROL, {0x00}, 1},
{ILI9488_CMD_FRAME_RATE_CONTROL_NORMAL, {0xA0}, 1},
{ILI9488_CMD_DISPLAY_INVERSION_CONTROL, {0x02}, 1},
{ILI9488_CMD_DISPLAY_FUNCTION_CONTROL, {0x02, 0x02}, 2},
{ILI9488_CMD_SET_IMAGE_FUNCTION, {0x00}, 1},
{ILI9488_CMD_WRITE_CTRL_DISPLAY, {0x28}, 1},
{ILI9488_CMD_WRITE_DISPLAY_BRIGHTNESS, {0x7F}, 1},
{ILI9488_CMD_ADJUST_CONTROL_3, {0xA9, 0x51, 0x2C, 0x02}, 4},
{ILI9488_CMD_DISPLAY_ON, {0}, 0x80}, /*Power control*/
{0, {0}, 0xff},
};
replace ili9341 flush funtion with this:
void ili9341_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
lv_color16_t* buffer_16bit = (lv_color16_t*) color_map;
uint8_t* mybuf = (uint8_t*) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA);
if (mybuf == NULL) {
printf("Memory not allocated.");
exit(0);
}
uint32_t LD = 0;
uint32_t j = 0;
for(uint32_t i = 0; i < size; i++) {
LD = buffer_16bit[i].full;
mybuf[j] = (uint8_t)((LD & 0xF800) >> 8);
j++;
mybuf[j] = (uint8_t)((LD & 0x07E0) >> 3);
j++;
mybuf[j] = (uint8_t)((LD & 0x001F) << 3);
j++;
}
uint8_t data[4];
/*Column addresses*/
ili9341_send_cmd(0x2A);
data[0] = (area->x1 >> 8) & 0xFF;
data[1] = area->x1 & 0xFF;
data[2] = (area->x2 >> 8) & 0xFF;
data[3] = area->x2 & 0xFF;
ili9341_send_data(data, 4);
/*Page addresses*/
ili9341_send_cmd(0x2B);
data[0] = (area->y1 >> 8) & 0xFF;
data[1] = area->y1 & 0xFF;
data[2] = (area->y2 >> 8) & 0xFF;
data[3] = area->y2 & 0xFF;
ili9341_send_data(data, 4);
/*Memory write*/
ili9341_send_cmd(0x2C);
ili9341_send_color((void*)mybuf, size * 3);
heap_caps_free(mybuf);
}
At disp_spi_init replace this:
spi_bus_config_t buscfg={
.miso_io_num=-1,
.mosi_io_num=DISP_SPI_MOSI,
.sclk_io_num=DISP_SPI_CLK,
.quadwp_io_num=-1,
.quadhd_io_num=-1,
.max_transfer_sz = DISP_BUF_SIZE * 3,
};
from lv_port_esp32.
It's not supported by default, but it'd be great if you could add it.
It can be a Kconfig option to choose between the drivers.
from lv_port_esp32.
Hi,
I don't have any ILI9488 at hand but I will check the datasheet for it, so if @rdelcorro have one it would be very helpful if you can help us with the validation.
In regards of choosing the LCD driver on the esp configuration it's possible, but I would like to ask @jeremyjh for suggestions on how to implement it, I would suggest to abstract the LCD driver, something like this:
diff --git a/main.c b/main.c index 6fc45cb..2d98823 100644 --- a/main.c +++ b/main.c
@@ -11,7 +11,7 @@
#include "disp_spi.h"
-#include "ili9341.h"
+#include "disp_driver.h"
#include "tp_spi.h"
#include "xpt2046.h"
@@ -23,7 +23,7 @@ void app_main()
lv_init();
disp_spi_init();
- ili9341_init();
+ disp_driver_init();
#if ENABLE_TOUCH_INPUT
tp_spi_init();
@@ -37,7 +37,7 @@ void app_main()
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
- disp_drv.flush_cb = ili9341_flush;
+ disp_drv.flush_cb = disp_driver_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
I have some free time this saturday, I can work on this then.
Regards
from lv_port_esp32.
Thanks @C47D, I can help with the validation.
from lv_port_esp32.
Is it possible to support the IL9488? As far as I understand, the differences are quite minimal. Thanks
Hi @rdelcorro, do you happen to know the differences between the ILI9341 and ILI9488 drivers? I'm still stuck trying to figure out how to setup the project configuration to be able to choose between diferent drivers.
Also, can you share a link where I can find more information of the display you're using? an ebay or aliexpress link is cool.
from lv_port_esp32.
@C47D this is the aliexpress link: https://www.aliexpress.com/item/33057812377.html?spm=a2g0s.12269583.0.0.54b636d3APjqbt
I was also able to use the screen with this code: https://gist.github.com/rdelcorro/beb7ebe929064797b926f3affcd9e0ac which uses this library: https://github.com/Bodmer/TFT_eSPI.
As far as I understand, the difference is:
- Initialization sequence (can be seen in the repo above)
- 16 bit color mode (my screen) but it supports up to 24
Thanks!
from lv_port_esp32.
@rdelcorro Thanks for the information, I'm still trying to figure out how to handle the driver abstraction and also learn how to use the Kconfig lang to extend the menuconfig interface. Please give me some more time to arrive to something that handle your display driver and maybe others in the future.
from lv_port_esp32.
@C47D I think I'd just define some constants for the driver such that ILI9341 = 1, ILI9488 = 2 and then use a menu choice group to select from the two options, similar to how the pre-defined displays work. In the driver code we could have multiple init functions defined and call the correct one based on this value.
My fork of the loboris TFT driver has a KConfig for exactly that purpose: https://github.com/jeremyjh/ESP32_TFT_library/blob/master/components/tft/Kconfig#L31
We use the config value to define a controller (defaults to ILI9341): https://github.com/jeremyjh/ESP32_TFT_library/blob/master/components/tft/tftspi.h#L210
Then we use that value to select the init commands:
https://github.com/jeremyjh/ESP32_TFT_library/blob/master/components/tft/tftspi.c#L908
from lv_port_esp32.
Thanks for the links @jeremyjh, it's much clearer now.
I see you share the SPI and control signals across the drivers:
https://github.com/jeremyjh/ESP32_TFT_library/blob/cf347104a635a876fe9614ff465d5b9dec10f255/components/tft/tftspi.h#L54-L64
After checking the ILI9488 datasheet and @rdelcorro ali link we can notice it in fact uses the same pins as the ILI9341 driver, so i think the first step is to modify below pin naming so it becomes more generic? Or should i add an .h and .c files for the ILI9488?
from lv_port_esp32.
This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from lv_port_esp32.
Hi! I'am trying to port this display (ILI9488) to littlevgl. Well I made the initialization sequence works fine.
But now the problem is this:
ILI9488 only support RGB666 (18bits) it's like RGB888 but with some bits unused...
Seems that it only support RGB8888 or RGB565?
How to add support for littlevgl RGB sapce conversion?
from lv_port_esp32.
from lv_port_esp32.
Hi Mat,
Great to see it working, I was working on the support on ILI9488 on this pull request, i will check your changes and incorporate what i was missing.
Thanks for the help :)
from lv_port_esp32.
Updated the pull request with your code @Mat-Alm, i hope we're near to make it work!
from lv_port_esp32.
@Mat-Alm could you test @C47D's version here?
from lv_port_esp32.
How to download/clone the full project with this changes?
from lv_port_esp32.
@Mat-Alm , you need to clone my repo and track the ili9488_support
branch, something like this:
$ git clone --recurse-submodules https://github.com/C47D/esp32_ili9341.git
$ cd esp32_ili9341
$ git checkout --track origin/ili9488_support
from lv_port_esp32.
Related Issues (20)
- esp32-s3 invalid dma channel HOT 1
- Portrait mode of demos doesn't display correctly
- The link to the forum when you write a PR/issue is incorrect HOT 1
- build with esp-idf-4.4.3 fails HOT 1
- failed to run idf.py menuconfig HOT 3
- updated LVGL+squareline studio+ ESP32 HOT 2
- Demo on older esp-wrover-kit board ( not v4.1) HOT 2
- Display not showing the correct windows while running this example HOT 2
- Sunton ESP32-8048S070 board HOT 8
- How can I add my own components to the project
- Unable to compile on esp-idf version 5.0 HOT 4
- undefined reference to `lv_obj_set_scroll_propagation'
- Cant turn off LV_USE_FLEX
- Horizontal scrolling HOT 4
- fatal error: Arduino_H7_Video.h: No such file or directory
- ESP32C3 - non-LVGL task (temp reading) causes TFT display to go blank and stay blank on second run of task HOT 1
- ssd1306 driver
- ssd1306
- how to use this port in arduino ide ?
- LVGL Lottie plays partially then crashes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lv_port_esp32.