📄 lcd_l0_drv.c
字号:
OS_ENTER_CRITICAL();
LCD_P0_ClearRect(x0,y0,x1, y1);
OS_EXIT_CRITICAL();
}
/******************************************************************************
** 名字: 设置前景颜色值
** 接口: void LCD_L0_SetFillColor(LCD_COLOR color)
** 描述: 设置前景颜色
** 输入参数:
(color): 16bit颜色值
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_SetBGColor(int color)
{
//LCM_GAC_FillColor(color);
BKCOLOR_BAK = color;
}
/******************************************************************************
** 名字: 设置边框/线条颜色值
** 接口: void LCD_L0_SetLineColor(LCD_COLOR color)
** 描述: 设置边框/线条颜色
** 输入参数:
(color): 16bit颜色值
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_SetPenColor(int color)
{
PENCOLOR_BAK = color;
}
/******************************************************************************
** 名字: 写一个象素
** 接口: void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex)
** 描述:把指定象素设成当前颜色值
** 输入参数:
x: 象素值的X座标
y: 象素值的Y座标
colorIndex: 颜色的索引值
** 输出参数: void
** 使用说明:
********************************************************************************/
//
void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_SetPixelIndex(x,y,ColorIndex);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
/******************************************************************************
** 名字: 取指定象素的颜色索引值
** 接口: unsigned int LCD_L0_GetPixelIndex(int x, int y)
** 描述: 取指定象素的颜色索引值
** 输入参数:
(x,y) : 要求的象素的座标
** 输出参数:
** 使用说明:
********************************************************************************/
unsigned int LCD_L0_GetPixelIndex(int x, int y)
{
unsigned int result;
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
result = LCD_P0_GetPixelIndex(x,y);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
return result;
}
/******************************************************************************
** 名字: Xor 一个象素
** 接口: void LCD_L0_XorPixel(int x, int y)
** 描述: 把当前屏上的指定点的象素的值取 XOR
** 输入参数:
int x: 指定的 X 座标值
int y: 指定的 Y 座标值
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_XorPixel(int x, int y)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_XorPixel(x,y);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
/*
********************************************************************************
* Description : 把 frame buffer 中的内容更新到 LCD 上
*
* Arguments :
*
* Returns :
*
* Notes :
*
********************************************************************************
*/
void FB_UpdateScreen(void)
{
}
void LCD_L0_BuffDataTrans(U8 *pData, int cnt, char mode)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_BuffDataTrans(pData, cnt, mode);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
/*
********************************************************************************
* Description : 把一张没有剪切过的bmp图片数据送到显示屏上
*
* Arguments :
*
* Returns :
*
* Notes :
*
********************************************************************************
*/
void LCD_L0_DrawFullBMP16BPP(int x, int y, int xsize, int ysize, U8 const *pData)
{
LCD_RECT rectwin;
rectwin.x0 = x;
rectwin.y0 = y;
rectwin.x1 = x+xsize-1;
rectwin.y1 = y+ysize-1;
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_SetWindow(&rectwin);
LCD_P0_BuffDataTrans((U8 *)pData, xsize*ysize*2, NORTransMode_def);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
/*
********************************************************************************
* Description : 把 frame buffer 中的内容更新到 LCD 上
*
* Arguments :
*
* Returns :
*
* Notes :
*
********************************************************************************
*/
void LCD_L0_DrawBitLine16BPP(int x, int y, U16 const*p, int xsize)
{
LCD_RECT rectwin;
rectwin.x0 = x;
rectwin.y0 = y;
rectwin.x1 = x+xsize;
rectwin.y1 = y+1;
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_SetWindow(&rectwin);
LCD_P0_BuffDataTrans((U8 *)p, xsize*2, NORTransMode_def);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
/*
********************************************************************************
* Description : 设置窗口
*
* Arguments :
*
* Returns :
*
* Notes :
*
********************************************************************************
*/
//static void _SetWindow(LCD_RECT *win)
void LCD_L0_SetWindow(LCD_RECT *win)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_SetWindow(win);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
//关于字符的操作
static const GUI_FONT_PROP* __FindChar(const GUI_FONT_PROP* pProp, U16P c) {
for (; pProp; pProp=(GUI_FONT_PROP*) pProp->pNext) {
if ((c>=pProp->First) && (c<=pProp->Last))
break;
}
return pProp;
}
GUI_FONT* LCD_L0_SetFont(GUI_FONT* pNewFont)
{
GUI_FONT* i;
i = pFontName;
pFontName = pNewFont;
return i;
}
void LCD_L0_PutChar(U16P c)
{
U8 BytesPerLine;
LCD_RECT win;
const GUI_FONT_PROP* pProp;
const GUI_CHARINFO* pCharInfo;
int cnt;
pProp = __FindChar(pFontName->p.pProp, c);
if (pProp)
{
pCharInfo = pProp->paCharInfo+(c-pProp->First);
BytesPerLine = pCharInfo->BytesPerLine;
win.x0 = TextPosX;
win.y0 = TextPosY;
win.x1 = TextPosX+7;//pCharInfo->XSize-1;
win.y1 = TextPosY+7;//pFontName->YSize-1;
cnt = 64;//(win.y1-win.y0)*(win.x1-win.x0);
LCD_P0_SetWindow(&win);
LCD_P0_BitFill(pCharInfo->pData, cnt, PENCOLOR_BAK,BKCOLOR_BAK);
}
}
void LCD_L0_PutS(char *str, unsigned char len)
{
while((*str)&&len)
{
if ((TextPosX>LCD_XSIZE-8)
||(TextPosY>LCD_YSIZE-8) )
{
return;
}
LCD_L0_PutChar(*str);
TextPosX +=8;
str++;
len--;
}
return;
}
void LCD_L0_SetTextPos(unsigned int x,unsigned int y)
{
TextPosX = x;
TextPosY = y;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -