📄 lcddummy.c
字号:
}
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
/*********************************************************************
*
* Exported functions
*
**********************************************************************
*/
/*********************************************
*
* LCD_L0_SetPixelIndex
*
**********************************************
Purpose:
Sets the index of the given pixel. The upper layers of emWin
calling this routine make sure that the coordinates are in range, so
that no check on the parameters needs to be performed.
*/
#define IO_DELAY 0
#define DELAY(t)
//void DELAY(u8 t)
//{
// while(t--);
//}
void LCD_L0_SetPixelIndex(int x, int y, int PixelIndex)
{
/* Convert logical into physical coordinates (Dep. on LCDConf.h) */
#if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
int xPhys = LOG2PHYS_X(x, y);
int yPhys = LOG2PHYS_Y(x, y);
#else
#define xPhys x
#define yPhys y
#endif
/* Write into hardware ... Adapt to your system */
union
{
u16 nVal;
struct
{
u8 cValL;
u8 cValH;
}nValHL;
}nValY,nIndex;
nValY.nVal = yPhys;
nIndex.nVal = PixelIndex;
{
//TFT_WR_CMD(0, 0x02, xPhys);
//TFT_WR_CMD(1, 0x03, yPhys);
//TFT_WR_REG(0x0E);
//TFT_WR_DATA(PixelIndex);
TFT_CS_L();
TFT_RS_L();//写寄存器时位0
TFT_WR_L();
DataOut(0x02);
TFT_WR_H();
TFT_CS_H();
TFT_RS_L();
TFT_RS_H();
TFT_CS_L(); //读写数据时为1
TFT_WR_L();
DataOut((u8)xPhys);
TFT_WR_H();
TFT_CS_H();
TFT_RS_L();
//TFT_RS_L();
TFT_CS_L(); //写寄存器时位0
TFT_WR_L();
DataOut(0x03);
TFT_WR_H();
TFT_CS_H();
TFT_RS_L();
TFT_RS_H();
TFT_CS_L(); //读写数据时为1
TFT_WR_L();
DataOut(nValY.nValHL.cValH);//DataOut((u8)(yPhys>>8));
TFT_WR_H();
//TFT_CS_H();
//TFT_RS_L();
//TFT_RS_H();
//TFT_CS_L(); //读写数据时为1
TFT_WR_L();
DataOut(nValY.nValHL.cValL);//DataOut((u8)yPhys);
TFT_WR_H();
TFT_CS_H();
//TFT_RS_L();
TFT_RS_L();
TFT_CS_L(); //写寄存器时位0
TFT_WR_L();
DataOut(0x0E);
TFT_WR_H();
TFT_CS_H();
TFT_RS_L();
TFT_RS_H();
TFT_CS_L(); //读写数据时为1
TFT_WR_L();
DataOut(nIndex.nValHL.cValH);//DataOut((u8)(PixelIndex>>8));
TFT_WR_H();
//TFT_CS_H();
//TFT_RS_L();
//TFT_RS_H();
//TFT_CS_L(); //读写数据时为1
TFT_WR_L();
DataOut(nIndex.nValHL.cValL);//DataOut((u8)PixelIndex);
TFT_WR_H();
TFT_RS_L();
TFT_CS_H();
}
}
/*********************************************
*
* LCD_L0_GetPixelIndex
*
**********************************************
Purpose:
Returns the index of the given pixel. The upper layers of emWin
calling this routine make sure that the coordinates are in range, so
that no check on the parameters needs to be performed.
*/
unsigned int LCD_L0_GetPixelIndex(int x, int y)
{
LCD_PIXELINDEX PixelIndex;
/* Convert logical into physical coordinates (Dep. on LCDConf.h) */
#if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
int xPhys = LOG2PHYS_X(x, y);
int yPhys = LOG2PHYS_Y(x, y);
#else
#define xPhys x
#define yPhys y
#endif
/* Read from hardware ... Adapt to your system */
{
PixelIndex = 0;/* ... */
}
return PixelIndex;
}
/*********************************************
*
* LCD_L0_XorPixel
*
**********************************************
*/
void LCD_L0_XorPixel(int x, int y)
{
LCD_PIXELINDEX PixelIndex = LCD_L0_GetPixelIndex(x, y);
LCD_L0_SetPixelIndex(x, y, LCD_NUM_COLORS - PixelIndex - 1);
}
/*********************************************
*
* LCD_L0_DrawHLine
*
**********************************************
*/
void LCD_L0_DrawHLine(int x0, int y, int x1)
{
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR)
{
for (; x0 <= x1; x0++)
{
LCD_L0_XorPixel(x0, y);
}
}
else
{
for (; x0 <= x1; x0++)
{
LCD_L0_SetPixelIndex(x0, y, LCD_COLORINDEX);
}
}
}
/*********************************************
*
* LCD_L0_DrawVLine
*
**********************************************
*/
void LCD_L0_DrawVLine(int x, int y0, int y1)
{
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR)
{
for (; y0 <= y1; y0++)
{
LCD_L0_XorPixel(x, y0);
}
}
else
{
for (; y0 <= y1; y0++)
{
LCD_L0_SetPixelIndex(x, y0, LCD_COLORINDEX);
}
}
}
/*********************************************
*
* LCD_L0_FillRect
*
**********************************************
*/
void LCD_L0_FillRect(int x0, int y0, int x1, int y1)
{
for (; y0 <= y1; y0++)
{
LCD_L0_DrawHLine(x0, y0, x1);
}
}
/*********************************************
*
* LCD_L0_DrawBitmap
*
**********************************************
*/
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;
/* Use _DrawBitLineXBPP */
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
*
**********************************************
*/
void LCD_L0_SetOrg(int x, int y)
{
GUI_USE_PARA(x);
GUI_USE_PARA(y);
}
/*********************************************
*
* LCD_On / LCD_Off
*
**********************************************
*/
void LCD_On(void)
{
#ifdef LCD_ON
LCD_ON();
#endif
}
void LCD_Off(void)
{
#ifdef LCD_OFF
LCD_OFF();
#endif
}
/*********************************************
*
* LCD_L0_Init
*
**********************************************
Purpose:
Initialises the LCD-controller.
*/
int LCD_L0_Init(void)
{
LCD_INIT_CONTROLLER();
return 0;
}
/*********************************************
*
* LCD_L0_SetLUTEntry
*
**********************************************
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR Color)
{
GUI_USE_PARA(Pos);
GUI_USE_PARA(Color);
}
#else
void LCDDummy(void)
{
} /* avoid empty object files */
#endif /* (LCD_CONTROLLER undefined) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -