Skip to content

Commit

Permalink
lvgl: Add IPS parameters to ILI9341 driver
Browse files Browse the repository at this point in the history
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 <jerzy@apache.org>
  • Loading branch information
kasjer committed Oct 2, 2024
1 parent f4a8906 commit ac06e77
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hw/drivers/display/lvgl/tft/ili9341/src/ili9341.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions hw/drivers/display/lvgl/tft/ili9341/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac06e77

Please sign in to comment.