lv_lcd_generic_mipi.h

Generic driver for controllers adhering to the MIPI DBI/DCS specification

Works with:

ST7735 ST7789 ST7796 ILI9341 ILI9488 (NOTE: in SPI mode ILI9488 only supports RGB666 mode, which is currently not supported)

any probably many more

Defines

LV_LCD_CMD_NOP
LV_LCD_CMD_SOFT_RESET
LV_LCD_CMD_GET_POWER_MODE
LV_LCD_CMD_GET_ADDRESS_MODE
LV_LCD_CMD_GET_PIXEL_FORMAT
LV_LCD_CMD_GET_DISPLAY_MODE
LV_LCD_CMD_GET_SIGNAL_MODE
LV_LCD_CMD_GET_DIAGNOSTIC_RESULT
LV_LCD_CMD_ENTER_SLEEP_MODE
LV_LCD_CMD_EXIT_SLEEP_MODE
LV_LCD_CMD_ENTER_PARTIAL_MODE
LV_LCD_CMD_ENTER_NORMAL_MODE
LV_LCD_CMD_EXIT_INVERT_MODE
LV_LCD_CMD_ENTER_INVERT_MODE
LV_LCD_CMD_SET_GAMMA_CURVE
LV_LCD_CMD_SET_DISPLAY_OFF
LV_LCD_CMD_SET_DISPLAY_ON
LV_LCD_CMD_SET_COLUMN_ADDRESS
LV_LCD_CMD_SET_PAGE_ADDRESS
LV_LCD_CMD_WRITE_MEMORY_START
LV_LCD_CMD_READ_MEMORY_START
LV_LCD_CMD_SET_PARTIAL_ROWS
LV_LCD_CMD_SET_PARTIAL_COLUMNS
LV_LCD_CMD_SET_SCROLL_AREA
LV_LCD_CMD_SET_TEAR_OFF
LV_LCD_CMD_SET_TEAR_ON
LV_LCD_CMD_SET_ADDRESS_MODE
LV_LCD_CMD_SET_SCROLL_START
LV_LCD_CMD_EXIT_IDLE_MODE
LV_LCD_CMD_ENTER_IDLE_MODE
LV_LCD_CMD_SET_PIXEL_FORMAT
LV_LCD_CMD_WRITE_MEMORY_CONTINUE
LV_LCD_CMD_READ_MEMORY_CONTINUE
LV_LCD_CMD_SET_TEAR_SCANLINE
LV_LCD_CMD_GET_SCANLINE
LV_LCD_CMD_READ_DDB_CONTINUE
LV_LCD_CMD_READ_DDB_START
LV_LCD_MASK_FLIP_VERTICAL
LV_LCD_MASK_FLIP_HORIZONTAL
LV_LCD_MASK_DATA_LATCH_DATA_ORDER
LV_LCD_MASK_RGB_ORDER
LV_LCD_MASK_LINE_ADDRESS_ORDER
LV_LCD_MASK_PAGE_COLUMN_ORDER
LV_LCD_MASK_COLUMN_ADDRESS_ORDER
LV_LCD_MASK_PAGE_ADDRESS_ORDER
LV_LCD_BIT_FLIP_VERTICAL__NOT_FLIPPED
LV_LCD_BIT_FLIP_VERTICAL__FLIPPED
LV_LCD_BIT_FLIP_HORIZONTAL__NOT_FLIPPED
LV_LCD_BIT_FLIP_HORIZONTAL__FLIPPED
LV_LCD_BIT_DATA_LATCH_DATA_ORDER__LTOR
LV_LCD_BIT_DATA_LATCH_DATA_ORDER__RTOL
LV_LCD_BIT_RGB_ORDER__RGB
LV_LCD_BIT_RGB_ORDER__BGR
LV_LCD_BIT_LINE_ADDRESS_ORDER__TTOB
LV_LCD_BIT_LINE_ADDRESS_ORDER__BTOT
LV_LCD_BIT_PAGE_COLUMN_ORDER__NORMAL
LV_LCD_BIT_PAGE_COLUMN_ORDER__REVERSE
LV_LCD_BIT_COLUMN_ADDRESS_ORDER__LTOR
LV_LCD_BIT_COLUMN_ADDRESS_ORDER__RTOL
LV_LCD_BIT_PAGE_ADDRESS_ORDER__TTOB
LV_LCD_BIT_PAGE_ADDRESS_ORDER__BTOT
LV_LCD_GAMMA_2_2
LV_LCD_GAMMA_1_8
LV_LCD_GAMMA_2_5
LV_LCD_GAMMA_1_0
LV_LCD_PIXEL_FORMAT_RGB565
LV_LCD_PIXEL_FORMAT_RGB666
LV_LCD_FLAG_NONE
LV_LCD_FLAG_MIRROR_X
LV_LCD_FLAG_MIRROR_Y
LV_LCD_FLAG_BGR
LV_LCD_FLAG_RGB666
LV_LCD_CMD_DELAY_MS
LV_LCD_CMD_EOF

Typedefs

typedef uint32_t lv_lcd_flag_t

Configuration flags for lv_lcd_xxx_create()

typedef void (*lv_lcd_send_cmd_cb_t)(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size)

Prototype of a platform-dependent callback to transfer commands and data to the LCD controller.

Param disp:

display object

Param cmd:

command buffer (can handle 16 bit commands as well)

Param cmd_size:

number of bytes of the command

Param param:

parameter buffer

Param param_size:

number of bytes of the parameters

typedef void (*lv_lcd_send_color_cb_t)(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size)

Prototype of a platform-dependent callback to transfer pixel data to the LCD controller.

Param disp:

display object

Param cmd:

command buffer (can handle 16 bit commands as well)

Param cmd_size:

number of bytes of the command

Param param:

parameter buffer

Param param_size:

number of bytes of the parameters

Functions

lv_display_t *lv_lcd_generic_mipi_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, lv_lcd_send_cmd_cb_t send_cmd_cb, lv_lcd_send_color_cb_t send_color_cb)

Create a MIPI DCS compatible LCD display

Parameters:
  • hor_res – horizontal resolution

  • ver_res – vertical resolution

  • flags – default configuration settings (mirror, RGB ordering, etc.)

  • send_cmd – platform-dependent function to send a command to the LCD controller (usually uses polling transfer)

  • send_color – platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback)

Returns:

pointer to the created display

void lv_lcd_generic_mipi_set_gap(lv_display_t *disp, uint16_t x, uint16_t y)

Set gap, i.e., the offset of the (0,0) pixel in the VRAM

Parameters:
  • disp – display object

  • x – x offset

  • y – y offset

void lv_lcd_generic_mipi_set_invert(lv_display_t *disp, bool invert)

Set color inversion

Parameters:
  • disp – display object

  • invert – false: normal, true: invert

void lv_lcd_generic_mipi_set_address_mode(lv_display_t *disp, bool mirror_x, bool mirror_y, bool swap_xy, bool bgr)

Set address mode

Parameters:
  • disp – display object

  • mirror_x – horizontal mirror (false: normal, true: mirrored)

  • mirror_y – vertical mirror (false: normal, true: mirrored)

  • swap_xy – swap axes (false: normal, true: swap)

  • bgr – RGB/BGR order (false: RGB, true: BGR)

void lv_lcd_generic_mipi_set_gamma_curve(lv_display_t *disp, uint8_t gamma)

Set gamma curve

Parameters:
  • disp – display object

  • gamma – gamma curve

void lv_lcd_generic_mipi_send_cmd_list(lv_display_t *disp, const uint8_t *cmd_list)

Send list of commands.

Parameters:
  • disp – display object

  • cmd_list – controller and panel-specific commands

struct lv_lcd_generic_mipi_driver_t
#include <lv_lcd_generic_mipi.h>

Generic MIPI compatible LCD driver

Public Members

lv_display_t *disp
lv_lcd_send_cmd_cb_t send_cmd
lv_lcd_send_color_cb_t send_color
uint16_t x_gap
uint16_t y_gap
uint8_t madctl_reg
uint8_t colmod_reg
bool mirror_x
bool mirror_y
bool swap_xy