ARCS SDK
LISTENAI Software Development Kit
Loading...
Searching...
No Matches
mipi_dcs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025, LISTENAI
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#pragma once
8
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/* ========================================================================
22 * MIPI DCS 标准命令定义
23 * ======================================================================== */
24
25/* --- System Commands --- */
26#define MIPI_DCS_NOP 0x00 /* No Operation */
27#define MIPI_DCS_SOFT_RESET 0x01 /* Software Reset */
28#define MIPI_DCS_GET_DISPLAY_ID 0x04 /* Get Display ID */
29#define MIPI_DCS_GET_ERROR_COUNT 0x05 /* Get Error Count on DSI */
30#define MIPI_DCS_GET_RED_CHANNEL 0x06 /* Get Red Channel */
31#define MIPI_DCS_GET_GREEN_CHANNEL 0x07 /* Get Green Channel */
32#define MIPI_DCS_GET_BLUE_CHANNEL 0x08 /* Get Blue Channel */
33#define MIPI_DCS_GET_DISPLAY_STATUS 0x09 /* Get Display Status */
34#define MIPI_DCS_GET_POWER_MODE 0x0A /* Get Power Mode */
35#define MIPI_DCS_GET_ADDRESS_MODE 0x0B /* Get Address Mode */
36#define MIPI_DCS_GET_PIXEL_FORMAT 0x0C /* Get Pixel Format */
37#define MIPI_DCS_GET_DISPLAY_MODE 0x0D /* Get Display Mode */
38#define MIPI_DCS_GET_SIGNAL_MODE 0x0E /* Get Signal Mode */
39#define MIPI_DCS_GET_DIAGNOSTIC_RESULT 0x0F /* Get Diagnostic Result */
40
41/* --- Display Control Commands --- */
42#define MIPI_DCS_ENTER_SLEEP_MODE 0x10 /* Enter Sleep Mode */
43#define MIPI_DCS_EXIT_SLEEP_MODE 0x11 /* Sleep Out */
44#define MIPI_DCS_ENTER_PARTIAL_MODE 0x12 /* Partial Mode On */
45#define MIPI_DCS_ENTER_NORMAL_MODE 0x13 /* Normal Display Mode On */
46#define MIPI_DCS_EXIT_INVERT_MODE 0x20 /* Display Inversion Off */
47#define MIPI_DCS_ENTER_INVERT_MODE 0x21 /* Display Inversion On */
48#define MIPI_DCS_SET_GAMMA_CURVE 0x26 /* Gamma Set */
49#define MIPI_DCS_SET_DISPLAY_OFF 0x28 /* Display Off */
50#define MIPI_DCS_SET_DISPLAY_ON 0x29 /* Display On */
51
52/* --- Memory Access Commands --- */
53#define MIPI_DCS_SET_COLUMN_ADDRESS 0x2A /* Column Address Set */
54#define MIPI_DCS_SET_PAGE_ADDRESS 0x2B /* Page Address Set (Row) */
55#define MIPI_DCS_WRITE_MEMORY_START 0x2C /* Memory Write */
56#define MIPI_DCS_WRITE_LUT 0x2D /* Color Set (LUT) */
57#define MIPI_DCS_READ_MEMORY_START 0x2E /* Memory Read */
58
59#define MIPI_DCS_SET_PARTIAL_ROWS 0x30 /* Partial Area */
60#define MIPI_DCS_SET_PARTIAL_COLUMNS 0x31 /* Partial Columns */
61#define MIPI_DCS_SET_SCROLL_AREA 0x33 /* Vertical Scrolling Definition */
62#define MIPI_DCS_SET_TEAR_OFF 0x34 /* Tearing Effect Line OFF */
63#define MIPI_DCS_SET_TEAR_ON 0x35 /* Tearing Effect Line ON */
64#define MIPI_DCS_SET_ADDRESS_MODE 0x36 /* Memory Access Control (MADCTL) */
65#define MIPI_DCS_SET_SCROLL_START 0x37 /* Vertical Scrolling Start Address */
66#define MIPI_DCS_EXIT_IDLE_MODE 0x38 /* Idle Mode Off */
67#define MIPI_DCS_ENTER_IDLE_MODE 0x39 /* Idle Mode On */
68#define MIPI_DCS_SET_PIXEL_FORMAT 0x3A /* Interface Pixel Format */
69
70#define MIPI_DCS_WRITE_MEMORY_CONTINUE 0x3C /* Memory Write Continue */
71#define MIPI_DCS_READ_MEMORY_CONTINUE 0x3E /* Memory Read Continue */
72
73#define MIPI_DCS_SET_TEAR_SCANLINE 0x44 /* Set Tear Scanline */
74#define MIPI_DCS_GET_SCANLINE 0x45 /* Get Scanline */
75
76/* --- Brightness Control --- */
77#define MIPI_DCS_WRITE_DISPLAY_BRIGHTNESS 0x51 /* Write Display Brightness */
78#define MIPI_DCS_READ_DISPLAY_BRIGHTNESS 0x52 /* Read Display Brightness */
79#define MIPI_DCS_WRITE_CTRL_DISPLAY 0x53 /* Write CTRL Display */
80#define MIPI_DCS_READ_CTRL_DISPLAY 0x54 /* Read CTRL Display */
81#define MIPI_DCS_WRITE_CABC 0x55 /* Write Content Adaptive Brightness Control */
82#define MIPI_DCS_READ_CABC 0x56 /* Read Content Adaptive Brightness Control */
83#define MIPI_DCS_WRITE_CABC_MIN 0x5E /* Write CABC Minimum Brightness */
84#define MIPI_DCS_READ_CABC_MIN 0x5F /* Read CABC Minimum Brightness */
85
86/* --- Misc Commands --- */
87#define MIPI_DCS_READ_DDB_START 0xA1 /* Read DDB Start */
88#define MIPI_DCS_READ_DDB_CONTINUE 0xA8 /* Read DDB Continue */
89
90/* ========================================================================
91 * 常用命令别名(为了兼容性和可读性)
92 * ======================================================================== */
93
94/* Sleep Control */
95#define LCD_CMD_SLEEP_IN MIPI_DCS_ENTER_SLEEP_MODE
96#define LCD_CMD_SLEEP_OUT MIPI_DCS_EXIT_SLEEP_MODE
97
98/* Display Control */
99#define LCD_CMD_DISPLAY_OFF MIPI_DCS_SET_DISPLAY_OFF
100#define LCD_CMD_DISPLAY_ON MIPI_DCS_SET_DISPLAY_ON
101#define LCD_CMD_INVERT_OFF MIPI_DCS_EXIT_INVERT_MODE
102#define LCD_CMD_INVERT_ON MIPI_DCS_ENTER_INVERT_MODE
103#define LCD_CMD_NORMAL_MODE MIPI_DCS_ENTER_NORMAL_MODE
104#define LCD_CMD_PARTIAL_MODE MIPI_DCS_ENTER_PARTIAL_MODE
105#define LCD_CMD_IDLE_OFF MIPI_DCS_EXIT_IDLE_MODE
106#define LCD_CMD_IDLE_ON MIPI_DCS_ENTER_IDLE_MODE
107
108/* Memory Access */
109#define LCD_CMD_CASET MIPI_DCS_SET_COLUMN_ADDRESS
110#define LCD_CMD_RASET MIPI_DCS_SET_PAGE_ADDRESS
111#define LCD_CMD_RAMWR MIPI_DCS_WRITE_MEMORY_START
112#define LCD_CMD_RAMRD MIPI_DCS_READ_MEMORY_START
113#define LCD_CMD_MADCTL MIPI_DCS_SET_ADDRESS_MODE
114#define LCD_CMD_COLMOD MIPI_DCS_SET_PIXEL_FORMAT
115
116/* Tearing Effect */
117#define LCD_CMD_TE_OFF MIPI_DCS_SET_TEAR_OFF
118#define LCD_CMD_TE_ON MIPI_DCS_SET_TEAR_ON
119
120/* Brightness */
121#define LCD_CMD_WRITE_BRIGHTNESS MIPI_DCS_WRITE_DISPLAY_BRIGHTNESS
122#define LCD_CMD_READ_BRIGHTNESS MIPI_DCS_READ_DISPLAY_BRIGHTNESS
123
124#define LCD_OPCODE_WRITE_CMD (0x02ULL)
125#define LCD_OPCODE_WRITE_IMG (0x32ULL)
126
127/* ========================================================================
128 * MADCTL (0x36) 位定义 - Memory Access Control
129 * ======================================================================== */
130
131#define MADCTL_MY 0x80 /* Row Address Order */
132#define MADCTL_MX 0x40 /* Column Address Order */
133#define MADCTL_MV 0x20 /* Row/Column Exchange */
134#define MADCTL_ML 0x10 /* Vertical Refresh Order */
135#define MADCTL_BGR 0x08 /* BGR Order (vs RGB) */
136#define MADCTL_MH 0x04 /* Horizontal Refresh Order */
137
138/* ========================================================================
139 * COLMOD (0x3A) 像素格式定义
140 * ======================================================================== */
141
142#define COLMOD_RGB_12BIT 0x03 /* 12-bit/pixel */
143#define COLMOD_RGB_16BIT 0x05 /* 16-bit/pixel (RGB565) */
144#define COLMOD_RGB_18BIT 0x06 /* 18-bit/pixel (RGB666) */
145#define COLMOD_RGB_24BIT 0x07 /* 24-bit/pixel (RGB888) */
146
147#ifdef __cplusplus
148}
149#endif