(2)输入设备,即用触摸屏作为输入设备复制代码
- /**
- * Flush a color buffer
- * @param x1 left coordinate of the rectangle
- * @param x2 right coordinate of the rectangle
- * @param y1 top coordinate of the rectangle
- * @param y2 bottom coordinate of the rectangle
- * @param color_p pointer to an array of colors
- */
- void tft_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p)
- {
- // LCD_Color_Fill(x1,y1,x2,y2,color_p);
- u16 height,width;
- u16 i,j;
- width=x2-x1+1; //得到填充的宽度
- height=y2-y1+1; //高度
- for(i=0;i<height;i++)
- {
- LCD_SetCursor(x1,y1+i); //设置光标位置
- LCD_WriteRAM_Prepare(); //开始写入GRAM
- for(j=0;j<width;j++)
- {
- LCD_TYPE->LCD_RAM=color_p->full;//写入数据
- color_p++;
- }
- }
- lv_flush_ready();
- }
- /**
- * Put a color map to a rectangular area
- * @param x1 left coordinate of the rectangle
- * @param x2 right coordinate of the rectangle
- * @param y1 top coordinate of the rectangle
- * @param y2 bottom coordinate of the rectangle
- * @param color_p pointer to an array of colors
- */
- void tft_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p)
- {
- u16 height,width;
- u16 i,j;
- width=x2-x1+1; //得到填充的宽度
- height=y2-y1+1; //高度
- for(i=0;i<height;i++)
- {
- LCD_SetCursor(x1,y1+i); //设置光标位置
- LCD_WriteRAM_Prepare(); //开始写入GRAM
- for(j=0;j<width;j++)
- {
- LCD_TYPE->LCD_RAM=color_p->full;//写入数据
- color_p++;
- }
- }
- }
- /**
- * Fill a rectangular area with a color
- * @param x1 left coordinate of the rectangle
- * @param x2 right coordinate of the rectangle
- * @param y1 top coordinate of the rectangle
- * @param y2 bottom coordinate of the rectangle
- * @param color fill color
- */
- void tft_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color)
- {
- LCD_Fill(x1,y1,x2,y2,color.full);
- }
欢迎光临 (http://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |