This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new e540e2b92 lvgl: Add IPS parameters to ILI9341 driver
e540e2b92 is described below

commit e540e2b92b8c5891811e41208a2f8a5308ad36b4
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sun Sep 29 23:40:27 2024 +0200

    lvgl: Add IPS parameters to ILI9341 driver
    
    Some ILI9341 displays are IPS not TFT and
    they require different configuration.
    
    This adds syscfg value to use configuration
    suitable for IPS displays base on ILI9341
    controller.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c | 24 +++++++++++++++++++++++
 hw/drivers/display/lvgl/tft/ili9341/syscfg.yml    |  6 ++++++
 2 files changed, 30 insertions(+)

diff --git a/hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c 
b/hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c
index 09053df39..28bd75bc8 100644
--- a/hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c
+++ b/hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c
@@ -159,6 +159,7 @@ LCD_SEQUENCE(init_cmds)
         1, ILI9341_SWRESET,
         LCD_SEQUENCE_DELAY(5),
 #endif
+#if MYNEWT_VAL(ILI9341_IPS) == 0
         1, ILI9341_DISPOFF,
         4, ILI9341_PWCTRLB, 0x00, 0x83, 0x30,
         5, ILI9341_PWSEQCTRL, 0x64, 0x03, 0x12, 0x81,
@@ -177,6 +178,29 @@ LCD_SEQUENCE(init_cmds)
         2, ILI9341_GAMSET, 01,
         16, ILI9341_PGAMCTRL, 0x1f, 0x1a, 0x18, 0x0a, 0x0f, 0x06, 0x45, 0x87, 
0x32, 0x0a, 0x07, 0x02, 0x07, 0x05, 0x00,
         16, ILI9341_NGAMCTRL, 0x00, 0x25, 0x27, 0x05, 0x10, 0x09, 0x3a, 0x78, 
0x4d, 0x05, 0x18, 0x0d, 0x38, 0x3a, 0x1f,
+#elif MYNEWT_VAL(ILI9341_IPS) == 1
+        1, ILI9341_DISPOFF,
+        4, ILI9341_PWCTRLB, 0x00, 0xC1, 0x30,
+        5, ILI9341_PWSEQCTRL, 0x64, 0x03, 0x12, 0x81,
+        4, ILI9341_TIMECTRLA_INT, 0x85, 0x00, 0x78,
+        6, ILI9341_PWCTRLA, 0x39, 0x2c, 0x00, 0x34, 0x02,
+        2, ILI9341_PUMPRATIO, 0x20,
+        3, ILI9341_TIMECTRLB, 0x00, 0x00,
+        2, ILI9341_PWCTRL1, 0x13, /* VRH[5:0] */
+        2, ILI9341_PWCTRL2, 0x13, /* SAP[2:0];BT[3:0] */
+        3, ILI9341_VMCTRL1, 0x1C, 0x35,
+        2, ILI9341_VMCTRL2, 0xC8,
+        1, ILI9341_DINVON,
+        2, ILI9341_MADCTL, MADCTL_BGR | MADCTL_MX,
+        2, ILI9341_PIXSET, 0x55,
+        3, ILI9341_IFCTL, 0x01, 0x30,
+        3, ILI9341_FRMCTR1, 0x00, 0x1B,
+        /* positive gamma correction */
+        2, ILI9341_GAM3CTRL, 0x00,
+        2, ILI9341_GAMSET, 0x01,
+        16, ILI9341_PGAMCTRL, 0x0F, 0x35, 0x31, 0x0B, 0x0E, 0x06, 0x49, 0xA7, 
0x33, 0x07, 0x0F, 0x03, 0x0C, 0x0A, 0x00,
+        16, ILI9341_NGAMCTRL, 0x00, 0x0A, 0x0F, 0x04, 0x11, 0x08, 0x36, 0x58, 
0x4D, 0x07, 0x10, 0x0C, 0x32, 0x34, 0x0F,
+#endif
         5, ILI9341_CASET, 0x00, 0x00, 0x00, 0xEF,
         5, ILI9341_PASET, 0x00, 0x00, 0x01, 0x3F,
         1, ILI9341_TEON,
diff --git a/hw/drivers/display/lvgl/tft/ili9341/syscfg.yml 
b/hw/drivers/display/lvgl/tft/ili9341/syscfg.yml
index 9b18475be..716a531d5 100644
--- a/hw/drivers/display/lvgl/tft/ili9341/syscfg.yml
+++ b/hw/drivers/display/lvgl/tft/ili9341/syscfg.yml
@@ -17,6 +17,12 @@
 #
 
 syscfg.defs:
+    ILI9341_IPS:
+        description: >
+            Use configuration for IPS display.
+            IPS displays require different register values to show
+            correct colors.
+        value: 0
 
 syscfg.vals:
     LVGL_DISPLAY_HORIZONTAL_RESOLUTION: 240

Reply via email to