1+ /*
2+ * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #include "soc/soc_caps.h"
8+
9+ #if SOC_MIPI_DSI_SUPPORTED
10+ #include "esp_check.h"
11+ #include "esp_log.h"
12+ #include "esp_lcd_panel_commands.h"
13+ #include "esp_lcd_panel_interface.h"
14+ #include "esp_lcd_panel_io.h"
15+ #include "esp_lcd_mipi_dsi.h"
16+ #include "esp_lcd_panel_vendor.h"
17+ #include "freertos/FreeRTOS.h"
18+ #include "freertos/task.h"
19+ #include "driver/gpio.h"
20+ #include "esp_lcd_st7123.h"
21+
22+ #define ST7123_PAD_CONTROL (0xB7)
23+ #define ST7123_DSI_2_LANE (0x03)
24+ #define ST7123_DSI_3_4_LANE (0x02)
25+
26+ #define ST7123_CMD_GS_BIT (1 << 0)
27+ #define ST7123_CMD_SS_BIT (1 << 1)
28+
29+ typedef struct {
30+ esp_lcd_panel_io_handle_t io ;
31+ int reset_gpio_num ;
32+ uint8_t madctl_val ; // save current value of LCD_CMD_MADCTL register
33+ uint8_t colmod_val ; // save surrent value of LCD_CMD_COLMOD register
34+ const st7123_lcd_init_cmd_t * init_cmds ;
35+ uint16_t init_cmds_size ;
36+ uint8_t lane_num ;
37+ struct {
38+ unsigned int reset_level : 1 ;
39+ } flags ;
40+ // To save the original functions of MIPI DPI panel
41+ esp_err_t (* del )(esp_lcd_panel_t * panel );
42+ esp_err_t (* init )(esp_lcd_panel_t * panel );
43+ } st7123_panel_t ;
44+
45+ static const char * TAG = "st7123" ;
46+
47+ static esp_err_t panel_st7123_del (esp_lcd_panel_t * panel );
48+ static esp_err_t panel_st7123_init (esp_lcd_panel_t * panel );
49+ static esp_err_t panel_st7123_reset (esp_lcd_panel_t * panel );
50+ static esp_err_t panel_st7123_invert_color (esp_lcd_panel_t * panel , bool invert_color_data );
51+ static esp_err_t panel_st7123_mirror (esp_lcd_panel_t * panel , bool mirror_x , bool mirror_y );
52+ static esp_err_t panel_st7123_disp_on_off (esp_lcd_panel_t * panel , bool on_off );
53+ static esp_err_t panel_st7123_sleep (esp_lcd_panel_t * panel , bool sleep );
54+
55+ esp_err_t esp_lcd_new_panel_st7123 (const esp_lcd_panel_io_handle_t io , const esp_lcd_panel_dev_config_t * panel_dev_config ,
56+ esp_lcd_panel_handle_t * ret_panel )
57+ {
58+ ESP_RETURN_ON_FALSE (io && panel_dev_config && ret_panel , ESP_ERR_INVALID_ARG , TAG , "invalid arguments" );
59+ st7123_vendor_config_t * vendor_config = (st7123_vendor_config_t * )panel_dev_config -> vendor_config ;
60+ ESP_RETURN_ON_FALSE (vendor_config && vendor_config -> mipi_config .dpi_config && vendor_config -> mipi_config .dsi_bus , ESP_ERR_INVALID_ARG , TAG ,
61+ "invalid vendor config" );
62+
63+ esp_err_t ret = ESP_OK ;
64+ st7123_panel_t * st7123 = (st7123_panel_t * )calloc (1 , sizeof (st7123_panel_t ));
65+ ESP_RETURN_ON_FALSE (st7123 , ESP_ERR_NO_MEM , TAG , "no mem for st7123 panel" );
66+
67+ if (panel_dev_config -> reset_gpio_num >= 0 ) {
68+ gpio_config_t io_conf = {
69+ .mode = GPIO_MODE_OUTPUT ,
70+ .pin_bit_mask = 1ULL << panel_dev_config -> reset_gpio_num ,
71+ };
72+ ESP_GOTO_ON_ERROR (gpio_config (& io_conf ), err , TAG , "configure GPIO for RST line failed" );
73+ }
74+
75+ switch (panel_dev_config -> rgb_ele_order ) {
76+ case LCD_RGB_ELEMENT_ORDER_RGB :
77+ st7123 -> madctl_val = 0 ;
78+ break ;
79+ case LCD_RGB_ELEMENT_ORDER_BGR :
80+ st7123 -> madctl_val |= LCD_CMD_BGR_BIT ;
81+ break ;
82+ default :
83+ ESP_GOTO_ON_FALSE (false, ESP_ERR_NOT_SUPPORTED , err , TAG , "unsupported color space" );
84+ break ;
85+ }
86+
87+ switch (panel_dev_config -> bits_per_pixel ) {
88+ case 16 : // RGB565
89+ st7123 -> colmod_val = 0x55 ;
90+ break ;
91+ case 18 : // RGB666
92+ st7123 -> colmod_val = 0x66 ;
93+ break ;
94+ case 24 : // RGB888
95+ st7123 -> colmod_val = 0x77 ;
96+ break ;
97+ default :
98+ ESP_GOTO_ON_FALSE (false, ESP_ERR_NOT_SUPPORTED , err , TAG , "unsupported pixel width" );
99+ break ;
100+ }
101+
102+ st7123 -> io = io ;
103+ st7123 -> init_cmds = vendor_config -> init_cmds ;
104+ st7123 -> init_cmds_size = vendor_config -> init_cmds_size ;
105+ st7123 -> lane_num = vendor_config -> mipi_config .lane_num ;
106+ st7123 -> reset_gpio_num = panel_dev_config -> reset_gpio_num ;
107+ st7123 -> flags .reset_level = panel_dev_config -> flags .reset_active_high ;
108+
109+ // Create MIPI DPI panel
110+ ESP_GOTO_ON_ERROR (esp_lcd_new_panel_dpi (vendor_config -> mipi_config .dsi_bus , vendor_config -> mipi_config .dpi_config , ret_panel ), err , TAG ,
111+ "create MIPI DPI panel failed" );
112+ ESP_LOGD (TAG , "new MIPI DPI panel @%p" , * ret_panel );
113+
114+ // Save the original functions of MIPI DPI panel
115+ st7123 -> del = (* ret_panel )-> del ;
116+ st7123 -> init = (* ret_panel )-> init ;
117+ // Overwrite the functions of MIPI DPI panel
118+ (* ret_panel )-> del = panel_st7123_del ;
119+ (* ret_panel )-> init = panel_st7123_init ;
120+ (* ret_panel )-> reset = panel_st7123_reset ;
121+ (* ret_panel )-> mirror = panel_st7123_mirror ;
122+ (* ret_panel )-> invert_color = panel_st7123_invert_color ;
123+ (* ret_panel )-> disp_on_off = panel_st7123_disp_on_off ;
124+ (* ret_panel )-> disp_sleep = panel_st7123_sleep ;
125+ (* ret_panel )-> user_data = st7123 ;
126+ ESP_LOGD (TAG , "new st7123 panel @%p" , st7123 );
127+
128+ return ESP_OK ;
129+
130+ err :
131+ if (st7123 ) {
132+ if (panel_dev_config -> reset_gpio_num >= 0 ) {
133+ gpio_reset_pin (panel_dev_config -> reset_gpio_num );
134+ }
135+ free (st7123 );
136+ }
137+ return ret ;
138+ }
139+
140+ static const st7123_lcd_init_cmd_t vendor_specific_init_default [] = {
141+ // {cmd, { data }, data_size, delay_ms}
142+ // TODO:
143+ {0x60 , (uint8_t []){0x71 ,0x23 ,0xa2 }, 3 , 0 },
144+ {0x60 , (uint8_t []){0x71 ,0x23 ,0xa3 }, 3 , 0 },
145+ {0x60 , (uint8_t []){0x71 ,0x23 ,0xa4 }, 3 , 0 },
146+ {0xA4 , (uint8_t []){0x31 }, 1 , 0 },
147+ {0xD7 , (uint8_t []){0x10 ,0x0A ,0x10 ,0x2A ,0x80 ,0x80 }, 6 , 0 },
148+ {0x90 , (uint8_t []){0x71 ,0x23 ,0x5A ,0x20 ,0x24 ,0x09 ,0x09 }, 7 , 0 },
149+ {0xA3 , (uint8_t []){0x80 ,0x01 ,0x88 ,0x30 ,0x05 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x46 ,0x00 ,0x00 ,0x1E ,0x5C ,0x1E ,0x80 ,0x00 ,0x4F ,0x05 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x46 ,0x00 ,0x00 ,0x1E ,0x5C ,0x1E ,0x80 ,0x00 ,0x6F ,0x58 ,0x00 ,0x00 ,0x00 ,0xFF }, 40 , 0 },
150+ {0xA6 , (uint8_t []){0x03 ,0x00 ,0x24 ,0x55 ,0x36 ,0x00 ,0x39 ,0x00 ,0x6E ,0x6E ,0x91 ,0xFF ,0x00 ,0x24 ,0x55 ,0x38 ,0x00 ,0x37 ,0x00 ,0x6E ,0x6E ,0x91 ,0xFF ,0x00 ,0x24 ,0x11 ,0x00 ,0x00 ,0x00 ,0x00 ,0x6E ,0x6E ,0x91 ,0xFF ,0x00 ,0xEC ,0x11 ,0x00 ,0x03 ,0x00 ,0x03 ,0x6E ,0x6E ,0xFF ,0xFF ,0x00 ,0x08 ,0x80 ,0x08 ,0x80 ,0x06 ,0x00 ,0x00 ,0x00 ,0x00 }, 55 , 0 },
151+ {0xA7 , (uint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x10 ,0x1F ,0x36 ,0x00 ,0x5D ,0x04 ,0x9D ,0x05 ,0x10 ,0xF2 ,0x06 ,0x60 ,0x03 ,0x11 ,0xAD ,0x00 ,0xEF ,0x01 ,0x22 ,0x2E ,0x0E ,0x74 ,0x08 ,0x32 ,0xDC ,0x09 ,0x33 ,0x0F ,0xF3 ,0x77 ,0x0D ,0xB0 ,0xDC ,0x03 ,0xFF }, 37 , 0 },
166+ {0x36 , (uint8_t []){0x03 }, 1 , 0 },
167+ {0x11 , (uint8_t []){0x00 }, 1 , 100 },
168+ {0x29 , (uint8_t []){0x00 }, 1 , 0 },
169+ {0x35 , (uint8_t []){0x00 }, 1 , 100 },
170+ //============ Gamma END===========
171+ };
172+
173+ static esp_err_t panel_st7123_del (esp_lcd_panel_t * panel )
174+ {
175+ st7123_panel_t * st7123 = (st7123_panel_t * )panel -> user_data ;
176+
177+ if (st7123 -> reset_gpio_num >= 0 ) {
178+ gpio_reset_pin (st7123 -> reset_gpio_num );
179+ }
180+ // Delete MIPI DPI panel
181+ st7123 -> del (panel );
182+ ESP_LOGD (TAG , "del st7123 panel @%p" , st7123 );
183+ free (st7123 );
184+
185+ return ESP_OK ;
186+ }
187+
188+ static esp_err_t panel_st7123_init (esp_lcd_panel_t * panel )
189+ {
190+ st7123_panel_t * st7123 = (st7123_panel_t * )panel -> user_data ;
191+ esp_lcd_panel_io_handle_t io = st7123 -> io ;
192+ const st7123_lcd_init_cmd_t * init_cmds = NULL ;
193+ uint16_t init_cmds_size = 0 ;
194+
195+ // switch (st7123->lane_num) {
196+ // case 0:
197+ // case 2:
198+ // lane_command = ST7123_DSI_2_LANE;
199+ // break;
200+ // case 3:
201+ // case 4:
202+ // lane_command = ST7123_DSI_3_4_LANE;
203+ // break;
204+ // default:
205+ // ESP_LOGE(TAG, "Invalid lane number %d", st7123->lane_num);
206+ // return ESP_ERR_INVALID_ARG;
207+ // }
208+
209+ uint8_t ID [3 ];
210+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_rx_param (io , 0x04 , ID , 3 ), TAG , "read ID failed" );
211+ ESP_LOGI (TAG , "LCD ID: %02X %02X %02X" , ID [0 ], ID [1 ], ID [2 ]);
212+
213+ // // For modifying MIPI-DSI lane settings
214+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, ST7123_PAD_CONTROL, (uint8_t[]) {
215+ // lane_command,
216+ // }, 1), TAG, "send command failed");
217+
218+ // // back to CMD_Page 0
219+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, ST7123_CMD_CNDBKxSEL, (uint8_t[]) {
220+ // ST7123_CMD_BKxSEL_BYTE0, ST7123_CMD_BKxSEL_BYTE1, ST7123_CMD_BKxSEL_BYTE2_PAGE0
221+ // }, 3), TAG, "send command failed");
222+ // // exit sleep mode
223+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_SLPOUT, NULL, 0), TAG,
224+ // "io tx param failed");
225+ // vTaskDelay(pdMS_TO_TICKS(120));
226+
227+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t[]) {
228+ // st7123->madctl_val,
229+ // }, 1), TAG, "send command failed");
230+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_COLMOD, (uint8_t[]) {
231+ // st7123->colmod_val,
232+ // }, 1), TAG, "send command failed");
233+
234+ // vendor specific initialization, it can be different between manufacturers
235+ // should consult the LCD supplier for initialization sequence code
236+ if (st7123 -> init_cmds ) {
237+ init_cmds = st7123 -> init_cmds ;
238+ init_cmds_size = st7123 -> init_cmds_size ;
239+ } else {
240+ init_cmds = vendor_specific_init_default ;
241+ init_cmds_size = sizeof (vendor_specific_init_default ) / sizeof (st7123_lcd_init_cmd_t );
242+ }
243+
244+ for (int i = 0 ; i < init_cmds_size ; i ++ ) {
245+ // Check if the command has been used or conflicts with the internal
246+ // if (is_command0_enable && init_cmds[i].data_bytes > 0) {
247+ // switch (init_cmds[i].cmd) {
248+ // case LCD_CMD_MADCTL:
249+ // is_cmd_overwritten = true;
250+ // st7123->madctl_val = ((uint8_t *)init_cmds[i].data)[0];
251+ // break;
252+ // case LCD_CMD_COLMOD:
253+ // is_cmd_overwritten = true;
254+ // st7123->colmod_val = ((uint8_t *)init_cmds[i].data)[0];
255+ // break;
256+ // default:
257+ // is_cmd_overwritten = false;
258+ // break;
259+ // }
260+
261+ // if (is_cmd_overwritten) {
262+ // is_cmd_overwritten = false;
263+ // ESP_LOGW(TAG, "The %02Xh command has been used and will be overwritten by external initialization sequence",
264+ // init_cmds[i].cmd);
265+ // }
266+ // }
267+
268+ // Send command
269+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , init_cmds [i ].cmd , init_cmds [i ].data , init_cmds [i ].data_bytes ), TAG , "send command failed" );
270+ vTaskDelay (pdMS_TO_TICKS (init_cmds [i ].delay_ms ));
271+
272+ // if ((init_cmds[i].cmd == ST7123_CMD_CNDBKxSEL) && (((uint8_t *)init_cmds[i].data)[2] == ST7123_CMD_BKxSEL_BYTE2_PAGE0)) {
273+ // is_command0_enable = true;
274+ // } else if ((init_cmds[i].cmd == ST7123_CMD_CNDBKxSEL) && (((uint8_t *)init_cmds[i].data)[2] != ST7123_CMD_BKxSEL_BYTE2_PAGE0)) {
275+ // is_command0_enable = false;
276+ // }
277+ }
278+ ESP_LOGD (TAG , "send init commands success" );
279+
280+ ESP_RETURN_ON_ERROR (st7123 -> init (panel ), TAG , "init MIPI DPI panel failed" );
281+
282+ return ESP_OK ;
283+ }
284+
285+ static esp_err_t panel_st7123_reset (esp_lcd_panel_t * panel )
286+ {
287+ st7123_panel_t * st7123 = (st7123_panel_t * )panel -> user_data ;
288+ esp_lcd_panel_io_handle_t io = st7123 -> io ;
289+
290+ // Perform hardware reset
291+ if (st7123 -> reset_gpio_num >= 0 ) {
292+ gpio_set_level (st7123 -> reset_gpio_num , st7123 -> flags .reset_level );
293+ vTaskDelay (pdMS_TO_TICKS (50 ));
294+ gpio_set_level (st7123 -> reset_gpio_num , !st7123 -> flags .reset_level );
295+ vTaskDelay (pdMS_TO_TICKS (50 ));
296+ } else if (io ) { // Perform software reset
297+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_SWRESET, NULL, 0), TAG, "send command failed");
298+ vTaskDelay (pdMS_TO_TICKS (20 ));
299+ }
300+
301+ return ESP_OK ;
302+ }
303+
304+ static esp_err_t panel_st7123_invert_color (esp_lcd_panel_t * panel , bool invert_color_data )
305+ {
306+ // st7123_panel_t *st7123 = (st7123_panel_t *)panel->user_data;
307+ // esp_lcd_panel_io_handle_t io = st7123->io;
308+ // uint8_t command = 0;
309+
310+ // ESP_RETURN_ON_FALSE(io, ESP_ERR_INVALID_STATE, TAG, "invalid panel IO");
311+
312+ // if (invert_color_data) {
313+ // command = LCD_CMD_INVON;
314+ // } else {
315+ // command = LCD_CMD_INVOFF;
316+ // }
317+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, command, NULL, 0), TAG, "send command failed");
318+
319+ return ESP_OK ;
320+ }
321+
322+ static esp_err_t panel_st7123_mirror (esp_lcd_panel_t * panel , bool mirror_x , bool mirror_y )
323+ {
324+ // st7123_panel_t *st7123 = (st7123_panel_t *)panel->user_data;
325+ // esp_lcd_panel_io_handle_t io = st7123->io;
326+ // uint8_t madctl_val = st7123->madctl_val;
327+
328+ // ESP_RETURN_ON_FALSE(io, ESP_ERR_INVALID_STATE, TAG, "invalid panel IO");
329+
330+ // // Control mirror through LCD command
331+ // if (mirror_x) {
332+ // madctl_val |= ST7123_CMD_GS_BIT;
333+ // } else {
334+ // madctl_val &= ~ST7123_CMD_GS_BIT;
335+ // }
336+ // if (mirror_y) {
337+ // madctl_val |= ST7123_CMD_SS_BIT;
338+ // } else {
339+ // madctl_val &= ~ST7123_CMD_SS_BIT;
340+ // }
341+
342+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, LCD_CMD_MADCTL, (uint8_t []) {
343+ // madctl_val
344+ // }, 1), TAG, "send command failed");
345+ // st7123->madctl_val = madctl_val;
346+
347+ return ESP_OK ;
348+ }
349+
350+ static esp_err_t panel_st7123_disp_on_off (esp_lcd_panel_t * panel , bool on_off )
351+ {
352+ // st7123_panel_t *st7123 = (st7123_panel_t *)panel->user_data;
353+ // esp_lcd_panel_io_handle_t io = st7123->io;
354+ // int command = 0;
355+
356+ // if (on_off) {
357+ // command = LCD_CMD_DISPON;
358+ // } else {
359+ // command = LCD_CMD_DISPOFF;
360+ // }
361+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, command, NULL, 0), TAG, "send command failed");
362+ return ESP_OK ;
363+ }
364+
365+ static esp_err_t panel_st7123_sleep (esp_lcd_panel_t * panel , bool sleep )
366+ {
367+ // st7123_panel_t *st7123 = (st7123_panel_t *)panel->user_data;
368+ // esp_lcd_panel_io_handle_t io = st7123->io;
369+ // int command = 0;
370+
371+ // if (sleep) {
372+ // command = LCD_CMD_SLPIN;
373+ // } else {
374+ // command = LCD_CMD_SLPOUT;
375+ // }
376+ // ESP_RETURN_ON_ERROR(esp_lcd_panel_io_tx_param(io, command, NULL, 0), TAG, "send command failed");
377+ // vTaskDelay(pdMS_TO_TICKS(100));
378+
379+ return ESP_OK ;
380+ }
381+ #endif // SOC_MIPI_DSI_SUPPORTED
382+
0 commit comments