17#ifndef __VSF_DISP_MIPI_SPI_LCD_H__
18#define __VSF_DISP_MIPI_SPI_LCD_H__
24#if VSF_USE_UI == ENABLED && VSF_DISP_USE_MIPI_SPI_LCD == ENABLED
29#if defined(__VSF_DISP_MIPI_SPI_LCD_CLASS_IMPLEMENT)
30# define __VSF_CLASS_IMPLEMENT__
45#if VSF_HAL_USE_SPI != ENABLED
46# error "need VSF_HAL_USE_SPI"
49#ifndef VSF_DISP_MIPI_SPI_LCD_SUPPORT_HARDWARE_RESET
50# define VSF_DISP_MIPI_SPI_LCD_SUPPORT_HARDWARE_RESET ENABLED
53#ifndef VSF_DISP_MIPI_SPI_LCD_USING_VSF_GPIO
54# define VSF_DISP_MIPI_SPI_LCD_USING_VSF_GPIO ENABLED
57#define VSF_DISP_MIPI_SPI_LCD_SPI_8BITS_MODE 0
58#define VSF_DISP_MIPI_SPI_LCD_SPI_9BITS_MODE 1
60#ifndef VSF_DISP_MIPI_SPI_LCD_SPI_MODE
61# define VSF_DISP_MIPI_SPI_LCD_SPI_MODE VSF_DISP_MIPI_SPI_LCD_SPI_8BITS_MODE
64#if (VSF_DISP_MIPI_SPI_LCD_SPI_MODE != VSF_DISP_MIPI_SPI_LCD_SPI_8BITS_MODE)\
65 && (VSF_DISP_MIPI_SPI_LCD_SPI_MODE != VSF_DISP_MIPI_SPI_LCD_SPI_9BITS_MODE)
66# error "vsf_disp_mipi_spi_lcd: error spi mode"
69#if VSF_DISP_MIPI_SPI_LCD_SPI_MODE == VSF_DISP_MIPI_SPI_LCD_SPI_9BITS_MODE
70# error "TODO: support 9bit spi mode"
74#define MIPI_MODE_X_FLIP MIPI_DCS_COLUME_ADDRESS_RIGHT_TO_LEFT
75#define MIPI_MODE_Y_FLIP MIPI_DCS_PAGE_ADDRESS_BOTTOM_TO_TOP
76#define MIPI_MODE_RGB MIPI_DCS_DEVICE_REFRESH_RGB
77#define MIPI_MODE_BGR MIPI_DCS_DEVICE_REFRESH_BGR
80#define MIPI_PIXEL_FORMAT_BITLEN(__BITLEN) MIPI_DCS_PIXEL_FORMAT_DBI_BITS(__BITLEN)
82#define MIPI_SOFT_RESET MIPI_DCS_CMD_SOFT_RESET
84#define MIPI_ENTER_IDLE MIPI_DCS_CMD_HEX_CODE_ENTER_IDLE_MODE
86#define MIPI_EXIT_IDLE MIPI_DCS_CMD_HEX_CODE_EXIT_IDLE_MODE
88#define MIPI_ENTER_SLEEP MIPI_DCS_CMD_ENTER_SLEEP_MODE
90#define MIPI_EXIT_SLEEP MIPI_DCS_CMD_EXIT_SLEEP_MODE
92#define MIPI_ENTER_PARTIAL_MODE MIPI_DCS_CMD_ENTER_PARTIAL_MODE
94#define MIPI_EXIT_PARTIAL_MODE MIPI_DCS_CMD_ENTER_NORMAL_MODE
96#define MIPI_ENTER_INVERT_MODE MIPI_DCS_CMD_HEX_CODE_ENTER_INVERT_MODE
98#define MIPI_EXIT_INVERT_MODE MIPI_DCS_CMD_HEX_CODE_EXIT_INVERT_MODE
100#define MIPI_TEAR_PIN_ON MIPI_DCS_CMD_SET_TEAR_ON
102#define MIPI_TEAR_PIN_OFF MIPI_DCS_CMD_SET_TEAR_OFF
165#define VSF_DISP_MIPI_SPI_LCD_INITSEQ(__LCD_SEQ, __PIXEL_FORMAT, __MODE, ...) \
167 MIPI_DCS_CMD_SET_ADDRESS_MODE(__MODE), \
168 MIPI_DCS_CMD_SET_PIXEL_FORMAT(__PIXEL_FORMAT), \
169 MIPI_DCS_CMD_SET_DISPLAY_ON, \
172#define VSF_DISP_MIPI_SPI_LCD_S6D05A1_BASE \
173 VSF_DISP_MIPI_LCD_WRITE(0xF0, 2, 0x5A, 0x5A), \
174 VSF_DISP_MIPI_LCD_WRITE(0xF1, 2, 0x5A, 0x5A), \
175 VSF_DISP_MIPI_LCD_WRITE(0xF2, 19, 0x3B, 0x40, 0x03, 0x04, 0x02, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40, 0x08, 0x08, 0x08, 0x08), \
176 VSF_DISP_MIPI_LCD_WRITE(0xF4, 14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x03, 0x00, 0x70, 0x03), \
177 VSF_DISP_MIPI_LCD_WRITE(0xF5, 12, 0x00, 0x54, 0x73, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x53, 0x71), \
178 VSF_DISP_MIPI_LCD_WRITE(0xF6, 8, 0x04, 0x00, 0x08, 0x03, 0x01, 0x00, 0x01, 0x00), \
179 VSF_DISP_MIPI_LCD_WRITE(0xF7, 5, 0x48, 0x80, 0x10, 0x02, 0x00), \
180 VSF_DISP_MIPI_LCD_WRITE(0xF8, 2, 0x11, 0x00), \
181 VSF_DISP_MIPI_LCD_WRITE(0xF9, 1, 0x27), \
182 VSF_DISP_MIPI_LCD_WRITE(0xFA, 20, 0x0B, 0x0B, 0x0F, 0x26, 0x2A, 0x30, 0x33, 0x12, 0x1F, 0x25, 0x31, 0x30, 0x24, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x3F)
184#define VSF_DISP_MIPI_SPI_LCD_ILI9488_BASE \
185 VSF_DISP_MIPI_LCD_WRITE(0xE0, 15, 0x00, 0x07, 0x0f, 0x0D, 0x1B, 0x0A, 0x3c, 0x78, 0x4A, 0x07, 0x0E, 0x09, 0x1B, 0x1e, 0x0f), \
186 VSF_DISP_MIPI_LCD_WRITE(0xE1, 15, 0x00, 0x22, 0x24, 0x06, 0x12, 0x07, 0x36, 0x47, 0x47, 0x06, 0x0a, 0x07, 0x30, 0x37, 0x0f), \
187 VSF_DISP_MIPI_LCD_WRITE(0xC0, 2, 0x10, 0x10), \
188 VSF_DISP_MIPI_LCD_WRITE(0xC1, 1, 0x41), \
189 VSF_DISP_MIPI_LCD_WRITE(0xC5, 3, 0x00, 0x22, 0x80), \
190 VSF_DISP_MIPI_LCD_WRITE(0xB0, 1, 0x00), \
191 VSF_DISP_MIPI_LCD_WRITE(0xB1, 2, 0x60, 0x11), \
192 VSF_DISP_MIPI_LCD_WRITE(0xB4, 1, 0x02), \
193 VSF_DISP_MIPI_LCD_WRITE(0xB6, 2, 0x02, 0x02), \
194 VSF_DISP_MIPI_LCD_WRITE(0xB7, 1, 0x06), \
195 VSF_DISP_MIPI_LCD_WRITE(0xE9, 1, 0x00), \
196 VSF_DISP_MIPI_LCD_WRITE(0xF7, 4, 0xA9, 0x51, 0x2C, 0x82)
198#define VSF_DISP_MIPI_SPI_LCD_ILI9341_BASE \
199 VSF_DISP_MIPI_LCD_WRITE(0xCF, 3, 0x00, 0xC1, 0x30), \
200 VSF_DISP_MIPI_LCD_WRITE(0xED, 4, 0x64, 0x03, 0x12, 0x81), \
201 VSF_DISP_MIPI_LCD_WRITE(0xE8, 3, 0x85, 0x10, 0x7A), \
202 VSF_DISP_MIPI_LCD_WRITE(0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02), \
203 VSF_DISP_MIPI_LCD_WRITE(0xF7, 1, 0x20), \
204 VSF_DISP_MIPI_LCD_WRITE(0xEA, 2, 0x00, 0x00), \
205 VSF_DISP_MIPI_LCD_WRITE(0xC0, 1, 0x1B), \
206 VSF_DISP_MIPI_LCD_WRITE(0xC1, 1, 0x01), \
207 VSF_DISP_MIPI_LCD_WRITE(0xC5, 2, 0x30, 0x30), \
208 VSF_DISP_MIPI_LCD_WRITE(0xC7, 1, 0xB7), \
209 VSF_DISP_MIPI_LCD_WRITE(0xB1, 2, 0x01, 0x1B), \
210 VSF_DISP_MIPI_LCD_WRITE(0xB6, 2, 0x02, 0x82), \
211 VSF_DISP_MIPI_LCD_WRITE(0xB5, 4, 0x5F, 0x5F, 0x3F, 0x3F), \
212 VSF_DISP_MIPI_LCD_WRITE(0xF2, 1, 0x00), \
213 VSF_DISP_MIPI_LCD_WRITE(MIPI_DCS_CMD_HEX_CODE_SET_GAMMA_CURVE, 1, 0x01), \
214 VSF_DISP_MIPI_LCD_WRITE(0xE0, 15, 0x0F, 0x2A, 0x28, 0x08, 0x0E, 0x08, 0x54, 0xA9, 0x43, 0x0A, 0x0F, 0x00, 0x00, 0x00, 0x00), \
215 VSF_DISP_MIPI_LCD_WRITE(0xE1, 15, 0x00, 0x15, 0x17, 0x07, 0x11, 0x06, 0x2B, 0x56, 0x3C, 0x05, 0x10, 0x0F, 0x3F, 0x3F, 0x0F)
217#define VSF_DISP_MIPI_SPI_LCD_ST7789V_BASE \
218 VSF_DISP_MIPI_LCD_WRITE(0xB1, 3, 0x40, 0x7F, 0x14), \
219 VSF_DISP_MIPI_LCD_WRITE(0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33), \
220 VSF_DISP_MIPI_LCD_WRITE(0xB7, 1, 0x35), \
221 VSF_DISP_MIPI_LCD_WRITE(0xBB, 1, 0x20), \
222 VSF_DISP_MIPI_LCD_WRITE(0xC0, 1, 0x2C), \
223 VSF_DISP_MIPI_LCD_WRITE(0xC2, 1, 0x01), \
224 VSF_DISP_MIPI_LCD_WRITE(0xC3, 1, 0x0B), \
225 VSF_DISP_MIPI_LCD_WRITE(0xC4, 1, 0x20), \
226 VSF_DISP_MIPI_LCD_WRITE(0xC6, 1, 0x1F), \
227 VSF_DISP_MIPI_LCD_WRITE(0xD0, 2, 0xA4, 0xA1), \
228 VSF_DISP_MIPI_LCD_WRITE(0xE0, 14, 0xD0, 0x03, 0x09, 0x0E, 0x11, 0x3D, 0x47, 0x55, 0x53, 0x1A, 0x16, 0x14, 0x1F, 0x22), \
229 VSF_DISP_MIPI_LCD_WRITE(0xE1, 14, 0xD0, 0x02, 0x08, 0x0D, 0x12, 0x2C, 0x43, 0x55, 0x53, 0x1E, 0x1B, 0x19, 0x20, 0x22)
231#define VSF_DISP_ST7789V_SPI_INITSEQ(__MODE, __PIXEL_FORMAT, ...) \
232 VSF_DISP_MIPI_SPI_LCD_ST7789V_BASE, \
233 MIPI_DCS_CMD_SET_ADDRESS_MODE(__MODE), \
234 MIPI_DCS_CMD_SET_PIXEL_FORMAT(__PIXEL_FORMAT), \
235 MIPI_DCS_CMD_SET_DISPLAY_ON, \
238#define VSF_DISP_MIPI_SPI_LCD_ST7796S_BASE \
239 VSF_DISP_MIPI_LCD_WRITE(0xF0, 1, 0xC3), \
240 VSF_DISP_MIPI_LCD_WRITE(0xF0, 1, 0x96), \
241 VSF_DISP_MIPI_LCD_WRITE(0xE8, 8, 0x40, 0x82, 0x07, 0x18, 0x27, 0x0A, 0xB6, 0x33), \
242 VSF_DISP_MIPI_LCD_WRITE(0xC5, 1, 0x27), \
243 VSF_DISP_MIPI_LCD_WRITE(0xC2, 1, 0xA7), \
244 VSF_DISP_MIPI_LCD_WRITE(0xE0, 14, 0xF0, 0x01, 0x06, 0x0F, 0x12, 0x1D, 0x36, 0x54, 0x44, 0x0C, 0x18, 0x16, 0x13, 0x15), \
245 VSF_DISP_MIPI_LCD_WRITE(0xE1, 14, 0xF0, 0x01, 0x05, 0x0A, 0x0B, 0x07, 0x32, 0x44, 0x44, 0x0C, 0x18, 0x17, 0x13, 0x16), \
246 VSF_DISP_MIPI_LCD_WRITE(0xB5, 4, 0xFF, 0xFF, 0x00, 0x04), \
247 VSF_DISP_MIPI_LCD_WRITE(0xB1, 2, 0x00, 0x10), \
248 VSF_DISP_MIPI_LCD_WRITE(0xF0, 1, 0x3C), \
249 VSF_DISP_MIPI_LCD_WRITE(0xF0, 1, 0x69)
251#define VSF_DISP_MIPI_SPI_LCD_REFRESH_SEQ_LEN \
252 (1 + 1 + 4) + (1 + 1 + 4) + (1 + 1 + 4 + 4)
263#if VSF_DISP_MIPI_SPI_LCD_USING_VSF_GPIO == ENABLED
279#if VSF_DISP_MIPI_SPI_LCD_SUPPORT_HARDWARE_RESET == ENABLED
305#if VSF_DISP_MIPI_SPI_LCD_SPI_MODE == VSF_DISP_MIPI_SPI_LCD_SPI_8BITS_MODE
Definition vsf_disp.h:149
Definition vsf_disp_mipi_spi_lcd.h:256
Definition vsf_disp.h:173
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_disp.h:144
Definition vsf_template_gpio.h:491
Definition vsf_template_spi.h:541
void vsf_disp_mipi_spi_lcd_dcx_io_write(vk_disp_mipi_spi_lcd_t *disp_mipi_spi_lcd, bool state)
Definition vsf_disp_mipi_spi_lcd.c:127
void vsf_disp_mipi_spi_lcd_wait_te_line_ready(vk_disp_mipi_spi_lcd_t *disp_mipi_spi_lcd)
Definition vsf_disp_mipi_spi_lcd.c:106
#define VSF_DISP_MIPI_SPI_LCD_REFRESH_SEQ_LEN
Definition vsf_disp_mipi_spi_lcd.h:251
const vk_disp_drv_t vk_disp_drv_mipi_spi_lcd
Definition vsf_disp_mipi_spi_lcd.c:92
void(* vsf_eda_evthandler_t)(vsf_eda_t *eda, vsf_evt_t evt)
Definition vsf_eda.h:656
uint8_t state
Definition vsf_msg_tree.h:247