Przeglądaj źródła

add:luat_color_t 默认使用 uint16_t

Dozingfiretruck 4 lat temu
rodzic
commit
8d9ae41220
2 zmienionych plików z 4 dodań i 5 usunięć
  1. 0 3
      components/lcd/luat_lcd.c
  2. 4 2
      components/lcd/luat_lcd.h

+ 0 - 3
components/lcd/luat_lcd.c

@@ -177,7 +177,6 @@ int luat_lcd_set_color(luat_color_t back, luat_color_t fore){
 int luat_lcd_draw(luat_lcd_conf_t* conf, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, luat_color_t* color) {
     uint32_t size = (x2 - x1 + 1) * (y2 - y1 + 1) * 2;
     luat_lcd_set_address(conf, x1, y1, x2, y2);
-    luat_gpio_set(conf->pin_dc, Luat_GPIO_HIGH); // draw是data, 这一句应该不需要的
 	if (conf->port == LUAT_LCD_SPI_DEVICE){
 		luat_spi_device_send((luat_spi_device_t*)(conf->lcd_spi_device), (const char*)color, size);
 	}else{
@@ -219,8 +218,6 @@ int luat_lcd_draw_line(luat_lcd_conf_t* conf,uint16_t x1, uint16_t y1, uint16_t
     int incx, incy, row, col;
     if (x1 == x2 || y1 == y2) // 直线
     {
-        /* fast draw transverse line */
-        // luat_lcd_set_address(conf,x1, y1, x2, y2);
         size_t dots = (x2 - x1 + 1) * (y2 - y1 + 1);//点数量
         luat_color_t* line_buf = (luat_color_t*) luat_heap_malloc(dots * sizeof(luat_color_t));
         if (line_buf) {

+ 4 - 2
components/lcd/luat_lcd.h

@@ -25,7 +25,9 @@
 #define GRAY187          0XBDD7
 #define GRAY240          0XF79E
 
-#define LUAT_LCD_COLOR_DEPTH 32
+#ifndef LUAT_LCD_COLOR_DEPTH
+#define LUAT_LCD_COLOR_DEPTH 16
+#endif
 
 #if (LUAT_LCD_COLOR_DEPTH == 32)
 #define luat_color_t uint32_t
@@ -84,7 +86,7 @@ int luat_lcd_set_address(luat_lcd_conf_t* conf,uint16_t x1, uint16_t y1, uint16_
 int luat_lcd_set_color(luat_color_t back, luat_color_t fore);
 int luat_lcd_draw(luat_lcd_conf_t* conf, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, luat_color_t* color);
 int luat_lcd_draw_no_block(luat_lcd_conf_t* conf, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, luat_color_t* color, uint8_t last_flush);
-int luat_lcd_clear(luat_lcd_conf_t* conf,uint32_t color);
+int luat_lcd_clear(luat_lcd_conf_t* conf,luat_color_t color);
 int luat_lcd_draw_fill(luat_lcd_conf_t* conf,uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2,luat_color_t color);
 int luat_lcd_draw_point(luat_lcd_conf_t* conf, uint16_t x, uint16_t y, luat_color_t color);
 int luat_lcd_draw_line(luat_lcd_conf_t* conf,uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, luat_color_t color);