Просмотр исходного кода

update:interface_mode与配置表绑定

Dozingfiretruck 2 лет назад
Родитель
Сommit
30aa4d12df

+ 3 - 3
components/lcd/luat_lcd.c

@@ -77,7 +77,7 @@ int lcd_write_cmd_data(luat_lcd_conf_t* conf,const uint8_t cmd, const uint8_t *d
         return conf->opts->write_cmd_data(conf,cmd,data,data_len);
     }
     size_t len;
-    if (conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
+    if (conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
         luat_gpio_set(conf->pin_dc, Luat_GPIO_LOW);
 #ifdef LUAT_LCD_CMD_DELAY_US
     if (conf->dc_delay_us){
@@ -89,7 +89,7 @@ int lcd_write_cmd_data(luat_lcd_conf_t* conf,const uint8_t cmd, const uint8_t *d
     }else{
         len = luat_spi_send(conf->port, (const char*)&cmd, 1);
     }
-    if (conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
+    if (conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
         luat_gpio_set(conf->pin_dc, Luat_GPIO_HIGH);
     if (len != 1){
         LLOGI("lcd_write_cmd error. %d", len);
@@ -138,7 +138,7 @@ int luat_lcd_init(luat_lcd_conf_t* conf) {
 
     if (conf->pin_pwr != 255)
         luat_gpio_mode(conf->pin_pwr, Luat_GPIO_OUTPUT, Luat_GPIO_DEFAULT, Luat_GPIO_LOW); // POWER
-    if (conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
+    if (conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I || conf->opts->interface_mode==LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_II)
         luat_gpio_mode(conf->pin_dc, Luat_GPIO_OUTPUT, Luat_GPIO_DEFAULT, Luat_GPIO_HIGH); // DC
     luat_gpio_mode(conf->pin_rst, Luat_GPIO_OUTPUT, Luat_GPIO_DEFAULT, Luat_GPIO_LOW); // RST
 

+ 1 - 1
components/lcd/luat_lcd.h

@@ -68,12 +68,12 @@ typedef struct luat_lcd_conf {
     int16_t flush_y_max;
     uint8_t is_init_done;
 
-    uint8_t interface_mode;	// LUAT_LCD_IM_XXX
     uint8_t lcd_cs_pin;		//注意不用的时候写0xff
 } luat_lcd_conf_t;
 
 typedef struct luat_lcd_opts {
     const char* name;
+    uint8_t interface_mode;	// LUAT_LCD_IM_XXX
     uint8_t direction0;
     uint8_t direction90;
     uint8_t direction180;

+ 1 - 0
components/lcd/luat_lcd_gc9106l.c

@@ -23,6 +23,7 @@ const luat_lcd_opts_t lcd_opts_gc9106l = {
     .name = "gc9106l",
     .init_cmds_len = sizeof(gc9106l_init_cmds)/sizeof(gc9106l_init_cmds[0]),
     .init_cmds = gc9106l_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0xC8,
     .direction90 = 0x08,
     .direction180 = 0x68,

+ 1 - 0
components/lcd/luat_lcd_gc9306x.c

@@ -41,6 +41,7 @@ const luat_lcd_opts_t lcd_opts_gc9306x = {
     .name = "gc9306x",
     .init_cmds_len = sizeof(gc9306x_init_cmds)/sizeof(gc9306x_init_cmds[0]),
     .init_cmds = gc9306x_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x48,
     .direction90 = 0xE8,
     .direction180 = 0x28,

+ 1 - 0
components/lcd/luat_lcd_gc9a01.c

@@ -59,6 +59,7 @@ const luat_lcd_opts_t lcd_opts_gc9a01 = {
     .name = "gc9a01",
     .init_cmds_len = sizeof(gc9a01_init_cmds)/sizeof(gc9a01_init_cmds[0]),
     .init_cmds = gc9a01_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x08,
     .direction90 = 0xC8,
     .direction180 = 0x68,

+ 1 - 0
components/lcd/luat_lcd_ili9341.c

@@ -33,6 +33,7 @@ const luat_lcd_opts_t lcd_opts_ili9341 = {
     .name = "ili9341",
     .init_cmds_len = sizeof(ili9341_init_cmds)/sizeof(ili9341_init_cmds[0]),
     .init_cmds = ili9341_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x08,
     .direction90 = 0xC8,
     .direction180 = 0x78,

+ 1 - 0
components/lcd/luat_lcd_ili9486.c

@@ -25,6 +25,7 @@ const luat_lcd_opts_t lcd_opts_ili9486 = {
     .name = "ili9486",
     .init_cmds_len = sizeof(ili9486_init_cmds)/sizeof(ili9486_init_cmds[0]),
     .init_cmds = ili9486_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x48,
     .direction90 = 0x88,
     .direction180 = 0x28,

+ 1 - 0
components/lcd/luat_lcd_st7735.c

@@ -29,6 +29,7 @@ const luat_lcd_opts_t lcd_opts_st7735 = {
     .name = "st7735",
     .init_cmds_len = sizeof(st7735_init_cmds)/sizeof(st7735_init_cmds[0]),
     .init_cmds = st7735_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0xC0,
     .direction90 = 0x70,
     .direction180 = 0x00,

+ 1 - 0
components/lcd/luat_lcd_st7735s.c

@@ -25,6 +25,7 @@ const luat_lcd_opts_t lcd_opts_st7735s = {
     .name = "st7735s",
     .init_cmds_len = sizeof(st7735s_init_cmds)/sizeof(st7735s_init_cmds[0]),
     .init_cmds = st7735s_init_cmds,
+	.interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x08,
     .direction90 = 0xC8,
     .direction180 = 0x78,

+ 1 - 0
components/lcd/luat_lcd_st7735v.c

@@ -24,6 +24,7 @@ const luat_lcd_opts_t lcd_opts_st7735v = {
     .name = "st7735v",
     .init_cmds_len = sizeof(st7735v_init_cmds)/sizeof(st7735v_init_cmds[0]),
     .init_cmds = st7735v_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0xC8,
     .direction90 = 0x78,
     .direction180 = 0x08,

+ 1 - 0
components/lcd/luat_lcd_st7789.c

@@ -37,6 +37,7 @@ const luat_lcd_opts_t lcd_opts_st7789 = {
     .name = "st7789",
     .init_cmds_len = sizeof(st7789_init_cmds)/sizeof(st7789_init_cmds[0]),
     .init_cmds = st7789_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x00,
     .direction90 = 0xC0,
     .direction180 = 0x70,

+ 1 - 0
components/lcd/luat_lcd_st7796.c

@@ -26,6 +26,7 @@ const luat_lcd_opts_t lcd_opts_st7796 = {
     .name = "st7796",
     .init_cmds_len = sizeof(st7796_init_cmds)/sizeof(st7796_init_cmds[0]),
     .init_cmds = st7796_init_cmds,
+    .interface_mode = LUAT_LCD_IM_4_WIRE_8_BIT_INTERFACE_I,
     .direction0 = 0x48,
     .direction90 = 0x88,
     .direction180 = 0x28,