⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_tft6448.c

📁 uc/GUI移植TFT6448底层驱动。
💻 C
📖 第 1 页 / 共 2 页
字号:
   LCD_L0_SetPixelIndex(x+1, y, *(pTrans+(3&(pixels>>4))));
  if (!--xsize)
    return;
WriteTBit2:
  if (pixels&(3<<2))
    LCD_L0_SetPixelIndex(x+2, y, *(pTrans+(3&(pixels>>2))));
  if (!--xsize)
    return;
WriteTBit3:
  if (pixels&(3<<0))
    LCD_L0_SetPixelIndex(x+3, y, *(pTrans+(3&(pixels))));
  if (!--xsize)
    return;
  pixels = *(++p);
  x+=4;
  goto WriteTBit0;
}
#endif


/*********************************************************************
;;;
;;; 函 数 名:DrawBitLine4BPP
;;; 功    能:画4bit位图
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
#if (LCD_MAX_LOG_COLORS > 4)
static void  DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
  U8 pixels;
/*
// Jump to right entry point
*/
  pixels = *p;
  if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) {
    if ((Diff&1) ==0)
      goto WriteTBit0;
    goto WriteTBit1;
  } else {
    if ((Diff&1) ==0)
      goto WriteBit0;
    goto WriteBit1;
  }
/*
        Write without transparency
*/
WriteBit0:
  LCD_L0_SetPixelIndex(x+0, y, *(pTrans+(pixels>>4)));
  if (!--xsize)
    return;
WriteBit1:
  LCD_L0_SetPixelIndex(x+1, y, *(pTrans+(pixels&0xf)));
  if (!--xsize)
    return;
  x+=2;
  pixels = *(++p);
  goto WriteBit0;
/*
        Write with transparency
*/
WriteTBit0:
  if (pixels>>4)
    LCD_L0_SetPixelIndex(x+0, y, *(pTrans+(pixels>>4)));
  if (!--xsize)
    return;
WriteTBit1:
  if (pixels&0xf)
    LCD_L0_SetPixelIndex(x+1, y, *(pTrans+(pixels&0xf)));
  if (!--xsize)
    return;
  x+=2;
  pixels = *(++p);
  goto WriteTBit0;
}
#endif
	
/*********************************************************************
;;;
;;; 函 数 名:DrawBitLine8BPP
;;; 功    能:画256色的位图
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
#if (LCD_MAX_LOG_COLORS > 16)
static void  DrawBitLine8BPP(int x, int y, U8 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
  LCD_PIXELINDEX Pixel;
  switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
    case 0:
      if (pTrans) {
        for (; xsize > 0; xsize--, x++, p++) {
          Pixel = *p;
          LCD_L0_SetPixelIndex(x, y, *(pTrans + Pixel));
        }
      } else {
        for (; xsize > 0; xsize--, x++, p++) {
          LCD_L0_SetPixelIndex(x, y, *p);
        }
      }
      break;
    case LCD_DRAWMODE_TRANS:
      if (pTrans) {
        for (; xsize > 0; xsize--, x++, p++) {
          Pixel = *p;
          if (Pixel) {
            LCD_L0_SetPixelIndex(x, y, *(pTrans + Pixel));
          }
        }
      } else {
        for (; xsize > 0; xsize--, x++, p++) {
          Pixel = *p;
          if (Pixel) {
            LCD_L0_SetPixelIndex(x, y, Pixel);
          }
        }
      }
      break;
  }
}
#endif
	
/*********************************************************************
;;;
;;; 函 数 名:DrawBitLine16BPP
;;; 功    能:画62256色的位图
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
#if (LCD_BITSPERPIXEL > 8)
static void  DrawBitLine16BPP(int x, int y, U16 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
  LCD_PIXELINDEX pixel;
  if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
    if (pTrans) {
      for (; xsize > 0; xsize--, x++, p++) {
        pixel = *p;
        LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
      }
    } else {
      for (;xsize > 0; xsize--, x++, p++) {
        LCD_L0_SetPixelIndex(x, y, *p);
      }
    }
  } else {
    if (pTrans) {
      for (; xsize > 0; xsize--, x++, p++) {
        pixel = *p;
        if (pixel) {
          LCD_L0_SetPixelIndex(x, y, *(pTrans + pixel));
        }
      }
    } else {
      for (; xsize > 0; xsize--, x++, p++) {
        pixel = *p;
        if (pixel) {
          LCD_L0_SetPixelIndex(x, y, pixel);
        }
      }
    }
  }
}
#endif
	 	   	   	  	   
/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_DrawBitmap
;;; 功    能:绘图函数
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
void LCD_L0_DrawBitmap  (int x0, int y0, int xsize, int ysize,
						int BitsPerPixel, int BytesPerLine,
						const U8 * pData, int Diff,
						const LCD_PIXELINDEX* pTrans)
{
	int i;
	for (i=0; i<ysize; i++)
	 {
	 	switch (BitsPerPixel)
	 		{
	 		   case 1:	 		   
     				  DrawBitLine1BPP(x0, i + y0, pData, Diff, xsize, pTrans);
				      break;
				      
			 #if (LCD_MAX_LOG_COLORS > 2)
      		   case 2:
       				  DrawBitLine2BPP(x0, i+y0, pData, Diff, xsize, pTrans);
			          break;
		     #endif
		     
	         #if (LCD_MAX_LOG_COLORS > 4)
			   case 4:
			          DrawBitLine4BPP(x0, i+y0, pData, Diff, xsize, pTrans);
			          break;
		     #endif				      
				      
  		     #if (LCD_MAX_LOG_COLORS > 16)
   			   case 8:
      				  DrawBitLine8BPP(x0, i + y0, pData, xsize, pTrans);
    				  break;
 			 #endif	 		
 			 
	 		 #if (LCD_BITSPERPIXEL > 8)
     		   case 16:
      		   		  DrawBitLine16BPP(x0, i + y0, (const U16 *)pData, xsize, pTrans);
     		   		  break;
   			 #endif
	 		}
	    pData += BytesPerLine;
	 }
}
  
/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_SetOrg
;;; 功    能:设置原点参考点
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
int OrgX, OrgY;
void LCD_L0_SetOrg(int x, int y)
{
	OrgX = x;
	OrgY = y;
}

/*********************************************************************
;;;
;;; 函 数 名:LCD_Off/LCD_On/LCD_Init_Controler
;;; 功    能:开关LCD,初始化LCD
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
void LCD_Off  (void)
{
}
/*******************************************************/
void LCD_On  (void)
{
}		 
/*******************************************************/
void LCD_Init_Controler()
{
}    			

/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_GetPixelIndex
;;; 功    能:获得指定象素点的颜色值 
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计:Zhanghua             日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
unsigned int LCD_L0_GetPixelIndex(int x, int y)
{
	return GetPixelIndex(x,y);
}

/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_SetLUTEntry
;;; 功    能:设置设色板
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计::Zhanghua           日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color)
{
}

/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_ReInit
;;; 功    能:复位控制器 
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计::Zhanghua           日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
void LCD_L0_ReInit(void)
{
	LCD_Init_Controler();
}

/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_Init
;;; 功    能:复位控制器 
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计::Zhanghua           日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
int LCD_L0_Init(void)
{

	GUI_DEBUG_LOG("\nLCD_Init()");
	LCD_L0_ReInit();
	LCD_Off();


	return 0;
}

/*********************************************************************
;;;
;;; 函 数 名:LCD_L0_ReInit
;;; 功    能:复位控制器 
;;; 说    明:
;;; 入口参数:
;;; 出口参数:
;;; 设    计::Zhanghua           日    期:2006-02-27
;;; 修    改:                     日    期: 
**********************************************************************/
int LCD_L0_CheckInit(void)
{
	return 0;
}			

//#else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -