Go to the documentation of this file.
18#ifndef __VSF_DISP_MIPI_LCD_DISPLAY_COMMAND_SET_H__
19#define __VSF_DISP_MIPI_LCD_DISPLAY_COMMAND_SET_H__
23#if VSF_USE_UI == ENABLED && VSF_DISP_USE_MIPI_SPI_LCD == ENABLED
31#define VSF_DISP_MIPI_LCD_WRITE(__CMD, __PARAM_LEN, ...) \
32 (__CMD), (__PARAM_LEN), ##__VA_ARGS__
41#define MIPI_DCS_CMD_HEX_CODE_NOP 0x00
42#define MIPI_DCS_CMD_NOP \
43 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_NOP, 0)
46#define MIPI_DCS_CMD_HEX_CODE_SOFT_RESET 0x01
47#define MIPI_DCS_CMD_SOFT_RESET \
48 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SOFT_RESET, 0)
66#define MIPI_DCS_CMD_HEX_CODE_ENTER_SLEEP_MODE 0x10
67#define MIPI_DCS_CMD_ENTER_SLEEP_MODE \
68 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_ENTER_SLEEP_MODE, 0)
71#define MIPI_DCS_CMD_HEX_CODE_EXIT_SLEEP_MODE 0x11
72#define MIPI_DCS_CMD_EXIT_SLEEP_MODE \
73 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_EXIT_SLEEP_MODE, 0)
76#define MIPI_DCS_CMD_HEX_CODE_ENTER_PARTIAL_MODE 0x12
77#define MIPI_DCS_CMD_ENTER_PARTIAL_MODE \
78 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_ENTER_PARTIAL_MODE, 0)
81#define MIPI_DCS_CMD_HEX_CODE_ENTER_NORMAL_MODE 0x13
82#define MIPI_DCS_CMD_ENTER_NORMAL_MODE \
83 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_ENTER_NORMAL_MODE, 0)
90#define MIPI_DCS_CMD_HEX_CODE_EXIT_INVERT_MODE 0x20
91#define MIPI_DCS_CMD_EXIT_INVERT_MODE \
92 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_EXIT_INVERT_MODE, 0)
95#define MIPI_DCS_CMD_HEX_CODE_ENTER_INVERT_MODE 0x21
96#define MIPI_DCS_CMD_ENTER_INVERT_MODE \
97 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_ENTER_INVERT_MODE, 0)
100#define MIPI_DCS_CMD_HEX_CODE_SET_GAMMA_CURVE 0x26
101#define MIPI_DCS_CMD_GAMMA_CURVE_GC0 0x01
102#define MIPI_DCS_CMD_GAMMA_CURVE_GC1 0x02
103#define MIPI_DCS_CMD_GAMMA_CURVE_GC2 0x04
104#define MIPI_DCS_CMD_GAMMA_CURVE_GC3 0x08
105#define MIPI_DCS_CMD_SET_GAMMA_CURVE(__GC_MASK) \
106 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_GAMMA_CURVE, 0, __GC_MASK)
109#define MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_OFF 0x28
110#define MIPI_DCS_CMD_SET_DISPLAY_OFF \
111 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_OFF, 0)
114#define MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_ON 0x29
115#define MIPI_DCS_CMD_SET_DISPLAY_ON \
116 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_ON, 0)
119#define MIPI_DCS_CMD_HEX_CODE_SET_COLUMN_ADDRESS 0x2A
121#define MIPI_DCS_CMD_SET_COLUMN_ADDRESS(__SC, __EC) \
122 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_COLUMN_ADDRESS, 4,\
123 ((uint16_t)__SC >> 8), (__SC & 0xFF), \
124 ((uint16_t)__EC >> 8), (__EC & 0xFF))
127#define MIPI_DCS_CMD_HEX_CODE_SET_PAGE_ADDRESS 0x2B
129#define MIPI_DCS_CMD_SET_PAGE_ADDRESS(__SP, __EP) \
130 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_PAGE_ADDRESS, 4, \
131 ((uint16_t)__SP >> 8), (__SP & 0xFF), \
132 ((uint16_t)__EP >> 8), (__EP & 0xFF))
136#define MIPI_DCS_CMD_HEX_CODE_WRITE_MEMORY_START 0x2C
137#define MIPI_DCS_CMD_WRITE_MEMORY_START(__NUM, ...) \
138 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_WRITE_MEMORY_START, __NUM, ##__VA_ARGS__)
141#define MIPI_DCS_CMD_HEX_CODE_WRITE_LUT 0x2D
142#define MIPI_DCS_CMD_WRITE_LUT(__NUM, ...) \
143 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_WRITE_LUT, __NUM, ##__VA_ARGS__)
149#define MIPI_DCS_CMD_HEX_CODE_SET_PARTIAL_ROWS 0x30
151#define MIPI_DCS_CMD_SET_PARTIAL_ROWS(__SR, __ER) \
152 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_PARTIAL_ROWS, 4, \
153 ((uint16_t)__SR >> 8), (__SR & 0xFF), \
154 ((uint16_t)__ER >> 8), (__ER & 0xFF))
156#define MIPI_DCS_CMD_HEX_CODE_SET_PARTIAL_COLUMNS 0x31
158#define MIPI_DCS_CMD_SET_PARTIAL_COLUMNS(__SC, __EC) \
159 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_PARTIAL_COLUMNS, 4, \
160 ((uint16_t)__SC >> 8), (__SC & 0xFF), \
161 ((uint16_t)__EC >> 8), (__EC & 0xFF))
164#define MIPI_DCS_CMD_HEX_CODE_SET_SCROLL_AREA 0x33
166#define MIPI_DCS_CMD_SET_SCROLL_AREA(__TFA, __VERTICAL_SCROLLING_AREA, __BFA) \
167 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_SCROLL_AREA, 6, \
168 ((uint16_t)__TFA >> 8), (__TFA & 0xFF), \
169 ((uint16_t)__VSA >> 8), (__VSA & 0xFF), \
170 ((uint16_t)__BFA >> 8), (__BFA & 0xFF))
173#define MIPI_DCS_CMD_HEX_CODE_SET_TEAR_OFF 0x34
174#define MIPI_DCS_CMD_SET_TEAR_OFF \
175 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_TEAR_OFF, 0)
178#define MIPI_DCS_CMD_HEX_CODE_SET_TEAR_ON 0x35
179#define MIPI_DCS_CMD_SET_TEAR_ON \
180 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_TEAR_ON, 0)
182#define MIPI_DCS_CMD_HEX_CODE_SET_ADDRESS_MODE 0x36
185#define MIPI_DCS_PAGE_ADDRESS_TOP_TO_BOTTOM (0 << 7)
186#define MIPI_DCS_PAGE_ADDRESS_BOTTOM_TO_TOP (1 << 7)
188#define MIPI_DCS_COLUME_ADDRESS_LEFT_TO_RIGHT (0 << 6)
189#define MIPI_DCS_COLUME_ADDRESS_RIGHT_TO_LEFT (1 << 6)
193#define MIPI_DCS_PAGE_COLUMN_NORMAL_ORDER (0 << 5)
194#define MIPI_DCS_PAGE_COLUMN_REVERSE_ORDER (1 << 5)
197#define MIPI_DCS_DEVICE_REFRESH_TOP_TO_BOTTOM (0 << 4)
198#define MIPI_DCS_DEVICE_REFRESH_BOTTOM_TO_TOP (1 << 4)
200#define MIPI_DCS_DEVICE_REFRESH_RGB (0 << 3)
201#define MIPI_DCS_DEVICE_REFRESH_BGR (1 << 3)
203#define MIPI_DCS_LCD_REFRESH_LEFT_TO_RIGHT (0 << 2)
204#define MIPI_DCS_LCD_REFRESH_RIGHT_TO_LEFT (1 << 2)
206#define MIPI_DCS_FLIP_HORIZONTAL_NORMAL (0 << 1)
207#define MIPI_DCS_FLIP_HORIZONTAL_FLIPPED (1 << 1)
209#define MIPI_DCS_FLIP_VERTICAL_NORMAL (0 << 0)
210#define MIPI_DCS_FLIP_VERTICAL_FLIPPED (1 << 0)
212#define MIPI_DCS_CMD_SET_ADDRESS_MODE(__MODE_MASK) \
213 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_ADDRESS_MODE, 1, __MODE_MASK)
216#define MIPI_DCS_CMD_HEX_CODE_SET_SCROLL_START 0x37
217#define MIPI_DCS_CMD_SET_SCROLL_START(__VSP) \
218 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_SCROLL_START, 2, \
219 ((uint16_t)__VSP >> 8), (__VSP & 0xFF))
222#define MIPI_DCS_CMD_HEX_CODE_EXIT_IDLE_MODE 0x38
223#define MIPI_DCS_CMD_EXIT_IDLE_MODE \
224 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_EXIT_IDLE_MODE, 0)
227#define MIPI_DCS_CMD_HEX_CODE_ENTER_IDLE_MODE 0x39
228#define MIPI_DCS_CMD_ENTER_IDLE_MODE \
229 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_ENTER_IDLE_MODE, 0)
233#define MIPI_DCS_CMD_HEX_CODE_SET_PIXEL_FORMAT 0x3A
234#define MIPI_DCS_PIXEL_FORMAT_BITS_3 0x01
235#define MIPI_DCS_PIXEL_FORMAT_BITS_8 0x02
236#define MIPI_DCS_PIXEL_FORMAT_BITS_12 0x03
237#define MIPI_DCS_PIXEL_FORMAT_BITS_16 0x05
238#define MIPI_DCS_PIXEL_FORMAT_BITS_18 0x06
239#define MIPI_DCS_PIXEL_FORMAT_BITS_24 0x07
241#define MIPI_DCS_PIXEL_FORMAT_BITS(__BITS) MIPI_DCS_PIXEL_FORMAT_BITS_ ## __BITS
244#define MIPI_DCS_PIXEL_FORMAT_DBI_BITS(__BITS) MIPI_DCS_PIXEL_FORMAT_BITS(__BITS)
247#define MIPI_DCS_PIXEL_FORMAT_DPI_BITS(__BITS) (MIPI_DCS_PIXEL_FORMAT_BITS(__BITS) << 4)
248#define MIPI_DCS_CMD_SET_PIXEL_FORMAT(__PF) \
249 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_PIXEL_FORMAT, 1, __PF)
252#define MIPI_DCS_CMD_HEX_CODE_WRITE_MEMORY_CONTINUE 0x3C
253#define MIPI_DCS_CMD_WRITE_MEMORY_CONTINUE(__LEN, ...) \
254 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_WRITE_MEMORY_CONTINUE, __LEN, ##__VA_ARGS__)
257#define MIPI_DCS_CMD_HEX_CODE_SET_3D_CONTROL 0x3D
259#define MIPI_DCS_3D_CONTROL_LEFT_EYE_FIRST (0 << 5)
260#define MIPI_DCS_3D_CONTROL_RIGHT_EYE_FIRST (1 << 5)
264#define MIPI_DCS_3D_CONTROL_3DVSYNC_NO (0 << 4)
265#define MIPI_DCS_3D_CONTROL_3DVSYNC_SYNC (1 << 4)
270#define MIPI_DCS_3D_CONTROL_3DFMT_LINE (0 << 2)
271#define MIPI_DCS_3D_CONTROL_3DFMT_FRAME (1 << 2)
272#define MIPI_DCS_3D_CONTROL_3DFMT_PIXEL (2 << 2)
277#define MIPI_DCS_3D_CONTROL_3DMODE_OFF (0 << 0)
278#define MIPI_DCS_3D_CONTROL_3DMODE_ON_PO (1 << 0)
279#define MIPI_DCS_3D_CONTROL_3DMODE_ON_LO (2 << 0)
280#define MIPI_DCS_CMD_SET_3D_CONTROL(__V) \
281 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_3D_CONTROL, 2, __V, 0)
288#define MIPI_DCS_CMD_HEX_CODE_SET_VSYNC_TIMING 0x40
290#define MIPI_DCS_VSYNC_TIMING_NO_RESET (0 << 7)
291#define MIPI_DCS_VSYNC_TIMING_RESET (1 << 7)
293#define MIPI_DCS_VSYNC_TIMING_LD_LATER (0 << 7)
294#define MIPI_DCS_VSYNC_TIMING_LD_EARLIER (1 << 7)
296#define MIPI_DCS_VSYNC_TIMING_LD_LINES(__L) (__L << 1)
298#define MIPI_DCS_VSYNC_TIMING_NEXT_FRAME (0 << 0)
299#define MIPI_DCS_VSYNC_TIMING_FRAME_AFTER_NEXT_FRAME (1 << 0)
300#define MIPI_DCS_CMD_SET_VSYNC_TIMING(__V) \
301 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_VSYNC_TIMING, 1)
306#define MIPI_DCS_CMD_HEX_CODE_SET_TEAR_SCANLINE 0x44
307#define MIPI_DCS_CMD_SET_TEAR_SCANLINE(__N) \
308 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_TEAR_SCANLINE, 2, \
309 ((uint16_t)__N >> 8), (__N & 0xFF)
315#define MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_BRIGHTNESS 0x51
316#define MIPI_DCS_CMD_SET_DISPLAY_BRIGHTNESS(__B) \
317 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_DISPLAY_BRIGHTNESS, 1, __B)
323#define MIPI_DCS_CMD_HEX_CODE_WRITE_CONTROL_DISPLAY 0x53
324#define MIPI_DCS_CMD_WRITE_CONTROL_DISPLAY(__DISP) \
325 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_WRITE_CONTROL_DISPLAY, 1, __DISP)
331#define MIPI_DCS_CMD_HEX_CODE_WRITE_POWER_SAVE 0x55
332#define MIPI_DCS_CMD_WRITE_POWER_SAVE(__V) \
333 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_WRITE_POWER_SAVE, 1, __V)
339#define MIPI_DCS_CMD_HEX_CODE_SET_CABC_MIN_BRIGHTNESS 0x5E
340#define MIPI_DCS_CMD_SET_CABC_MIN_BRIGHTNESS(__B) \
341 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_CABC_MIN_BRIGHTNESS, 1, __B)