Skip to content

Commit fd86eb4

Browse files
Merge pull request #661 from Big-mouth-c/add-HX8394-driver
add HX8394 driver
2 parents 8dce522 + 8ac2a35 commit fd86eb4

File tree

3 files changed

+73
-4
lines changed

3 files changed

+73
-4
lines changed

src/databus/Arduino_ESP32DSIPanel.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
Arduino_ESP32DSIPanel::Arduino_ESP32DSIPanel(
77
uint32_t hsync_pulse_width, uint32_t hsync_back_porch, uint32_t hsync_front_porch,
88
uint32_t vsync_pulse_width, uint32_t vsync_back_porch, uint32_t vsync_front_porch,
9-
uint32_t prefer_speed)
9+
uint32_t prefer_speed,uint32_t lane_bit_rate /*新增成员变量*/)
1010
: _hsync_pulse_width(hsync_pulse_width), _hsync_back_porch(hsync_back_porch), _hsync_front_porch(hsync_front_porch),
1111
_vsync_pulse_width(vsync_pulse_width), _vsync_back_porch(vsync_back_porch), _vsync_front_porch(vsync_front_porch),
12-
_prefer_speed(prefer_speed)
12+
_prefer_speed(prefer_speed),
13+
_lane_bit_rate(lane_bit_rate)/*新增成员变量*/
1314
{
1415
}
1516

@@ -39,7 +40,7 @@ bool Arduino_ESP32DSIPanel::begin(int16_t w, int16_t h, int32_t speed, const lcd
3940
.bus_id = 0,
4041
.num_data_lanes = 2,
4142
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT,
42-
.lane_bit_rate_mbps = 750,
43+
.lane_bit_rate_mbps = _lane_bit_rate, /*新增成员变量*/
4344
};
4445
esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL;
4546

src/databus/Arduino_ESP32DSIPanel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define EXAMPLE_MIPI_DSI_PHY_PWR_LDO_CHAN 3 // LDO_VO3 连接至 VDD_MIPI_DPHY
2424
#define EXAMPLE_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV 2500
25+
#define DEFAULT_MIPI_DSI_LANE_BIT_RATE_MBPS 750 // 新增宏定义
2526

2627
typedef struct
2728
{
@@ -37,7 +38,7 @@ class Arduino_ESP32DSIPanel
3738
Arduino_ESP32DSIPanel(
3839
uint32_t hsync_pulse_width, uint32_t hsync_back_porch, uint32_t hsync_front_porch,
3940
uint32_t vsync_pulse_width, uint32_t vsync_back_porch, uint32_t vsync_front_porch,
40-
uint32_t prefer_speed = GFX_NOT_DEFINED);
41+
uint32_t prefer_speed = GFX_NOT_DEFINED,uint32_t lane_bit_rate = DEFAULT_MIPI_DSI_LANE_BIT_RATE_MBPS /*新增成员变量*/);
4142

4243
bool begin(int16_t w, int16_t h, int32_t speed = GFX_NOT_DEFINED, const lcd_init_cmd_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED);
4344

@@ -52,6 +53,7 @@ class Arduino_ESP32DSIPanel
5253
uint32_t _vsync_back_porch;
5354
uint32_t _vsync_front_porch;
5455
uint32_t _prefer_speed;
56+
uint32_t _lane_bit_rate; // 新增成员变量
5557

5658
esp_lcd_panel_handle_t _panel_handle = NULL;
5759
};

src/display/Arduino_DSI_Display.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,72 @@
99

1010
#include <esp_cache.h>
1111

12+
/* HX83xx User Define command set 用户自定义命令集 */
13+
#define UD_SETADDRESSMODE 0x36 /* Set address mode */
14+
#define UD_SETSEQUENCE 0xB0 /* Set sequence */
15+
#define UD_SETPOWER 0xB1 /* Set power */
16+
#define UD_SETDISP 0xB2 /* Set display related register */
17+
#define UD_SETCYC 0xB4 /* Set display waveform cycles */
18+
#define UD_SETVCOM 0xB6 /* Set VCOM voltage */
19+
#define UD_SETTE 0xB7 /* Set internal TE function */
20+
#define UD_SETSENSOR 0xB8 /* Set temperature sensor */
21+
#define UD_SETEXTC 0xB9 /* Set extension command */
22+
#define UD_SETMIPI 0xBA /* Set MIPI control */
23+
#define UD_SETOTP 0xBB /* Set OTP */
24+
#define UD_SETREGBANK 0xBD /* Set register bank */
25+
#define UD_SETDGCLUT 0xC1 /* Set DGC LUT */
26+
#define UD_SETID 0xC3 /* Set ID */
27+
#define UD_SETDDB 0xC4 /* Set DDB */
28+
#define UD_SETCABC 0xC9 /* Set CABC control */
29+
#define UD_SETCABCGAIN 0xCA
30+
#define UD_SETPANEL 0xCC
31+
#define UD_SETOFFSET 0xD2
32+
#define UD_SETGIP0 0xD3 /* Set GIP Option0 */
33+
#define UD_SETGIP1 0xD5 /* Set GIP Option1 */
34+
#define UD_SETGIP2 0xD6 /* Set GIP Option2 */
35+
#define UD_SETGIP3 0xD8 /* Set GIP Option2 */
36+
#define UD_SETGPO 0xD9
37+
#define UD_SETSCALING 0xDD
38+
#define UD_SETIDLE 0xDF
39+
#define UD_SETGAMMA 0xE0 /* Set gamma curve related setting */
40+
#define UD_SETCHEMODE_DYN 0xE4
41+
#define UD_SETCHE 0xE5
42+
#define UD_SETCESEL 0xE6 /* Enable color enhance */
43+
#define UD_SET_SP_CMD 0xE9
44+
#define UD_SETREADINDEX 0xFE /* Set SPI Read Index */
45+
#define UD_GETSPIREAD 0xFF /* SPI Read Command Data */
46+
47+
48+
static const lcd_init_cmd_t hx8394_init_operations[] = {
49+
// {cmd, { data }, data_size, delay_ms}
50+
/* 720 * 1280 */
51+
{UD_SETADDRESSMODE, (uint8_t []){0x01}, 1,0},
52+
{UD_SETEXTC, (uint8_t []){0xFF, 0x83, 0x94}, 3,0},
53+
{UD_SETMIPI, (uint8_t []){0x61, 0x03, 0x68, 0x6B, 0xB2, 0xC0}, 6,0}, //0x61
54+
{UD_SETPOWER, (uint8_t []){0x48, 0x12, 0x72, 0x09, 0x32, 0x54, 0x71, 0x71, 0x57, 0x47}, 10,0},
55+
{UD_SETDISP, (uint8_t []){0x00, 0x80, 0x64, 0x0C, 0x0D, 0x2F}, 6,0},
56+
{UD_SETCYC, (uint8_t []){0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0C, 0x86, 0x75, 0x00, 0x3F, 0x73, 0x74, 0x73, 0x74, 0x73, 0x74, 0x01, 0x0C, 0x86}, 21,0},
57+
{UD_SETGIP0, (uint8_t []){0x00, 0x00, 0x07, 0x07, 0x40, 0x07, 0x0C, 0x00, 0x08, 0x10, 0x08, 0x00, 0x08, 0x54, 0x15, 0x0A, 0x05, 0x0A, 0x02, 0x15, 0x06, 0x05, 0x06, 0x47, 0x44, 0x0A, 0x0A, 0x4B, 0x10, 0x07, 0x07, 0x0C, 0x40}, 33,0},
58+
{UD_SETGIP1, (uint8_t []){0x1C, 0x1C, 0x1D, 0x1D, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x24, 0x25, 0x18, 0x18, 0x26, 0x27, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x20, 0x21, 0x18, 0x18, 0x18, 0x18}, 44,0},
59+
{UD_SETGIP2, (uint8_t []){0x1C, 0x1C, 0x1D, 0x1D, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0B, 0x0A, 0x09, 0x08, 0x21, 0x20, 0x18, 0x18, 0x27, 0x26, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x25, 0x24, 0x18, 0x18, 0x18, 0x18}, 44,0},
60+
{UD_SETVCOM, (uint8_t []){0x6E, 0x6E}, 2,0}, //caiji
61+
{UD_SETGAMMA, (uint8_t []){0x00, 0x0A, 0x15, 0x1B, 0x1E, 0x21, 0x24, 0x22, 0x47, 0x56, 0x65, 0x66, 0x6E, 0x82, 0x88, 0x8B, 0x9A, 0x9D, 0x98, 0xA8, 0xB9, 0x5D, 0x5C, 0x61, 0x66, 0x6A, 0x6F, 0x7F, 0x7F, 0x00, 0x0A, 0x15, 0x1B, 0x1E, 0x21, 0x24, 0x22, 0x47, 0x56, 0x65, 0x65, 0x6E, 0x81, 0x87, 0x8B, 0x98, 0x9D, 0x99, 0xA8, 0xBA, 0x5D, 0x5D, 0x62, 0x67, 0x6B, 0x72, 0x7F, 0x7F}, 58,0},
62+
{0xC0, (uint8_t []){0x1F, 0x31}, 2,0},
63+
{UD_SETPANEL, (uint8_t []){0x03}, 1,0},
64+
{0xD4, (uint8_t []){0x02}, 1,0},
65+
{UD_SETREGBANK, (uint8_t []){0x02}, 1,0},
66+
{UD_SETGIP3, (uint8_t []){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 12,0},
67+
{UD_SETREGBANK, (uint8_t []){0x00}, 1,0},
68+
{UD_SETREGBANK, (uint8_t []){0x01}, 1,0},
69+
{UD_SETPOWER, (uint8_t []){0x00}, 1,0},
70+
{UD_SETREGBANK, (uint8_t []){0x00}, 1,0},
71+
{0xBF, (uint8_t []){0x40, 0x81, 0x50, 0x00, 0x1A, 0xFC, 0x01}, 7,0},
72+
{0xC6, (uint8_t []){0xED}, 1,0},
73+
{0x11, (uint8_t[]){0x00}, 0, 120},
74+
{0x29, (uint8_t[]){0x00}, 0, 0},
75+
};
76+
77+
1278
static const lcd_init_cmd_t jd9165_init_operations[] = {
1379
// {cmd, { data }, data_size, delay_ms}
1480
//{0x11, (uint8_t []){0x00}, 1, 120},

0 commit comments

Comments
 (0)