📄 lcd_l0_drv.c
字号:
/*
*******************************************************************************
* uc/gui
* This program demostrates how to build an AP
*
* (c) Copyright Actions Co,Ld.
*
*******************************************************************************
*/
#include "os_cpu.h"
#include "LCD.H"
#include "lcmoption.h"
#include "gui.h"
#include "LCD_LOG_DRV.H"
#include "LCD_PHY_DRV.H"
#include "lcdconf.h"
#include "intrz80.h"
void LCD_L0_SetBGColor(int color);
void LCD_L0_SetPenColor(int color);
unsigned char _fitRECT(LCD_RECT *win);
int BKCOLOR_BAK = 0x0;
int PENCOLOR_BAK = 0xffff;
unsigned int TextPosX = 0x0;
unsigned int TextPosY = 0x0;
GUI_FONT* pFontName;
int LCD_L0_Init(void)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_Init();
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
void LCD_L0_Standby(unsigned char bStandby)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_Standby(bStandby);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
void LCD_L0_On(void)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_On();
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
void LCD_L0_Off(void)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_Off();
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
void LCD_L0_SetContrast(char ContrastValue)
{
#ifdef __IAR_SYSTEMS_ICC
OS_ENTER_CRITICAL();
#endif
LCD_P0_SetContrast(ContrastValue);
#ifdef __IAR_SYSTEMS_ICC
OS_EXIT_CRITICAL();
#endif
}
unsigned char _fitRECT(LCD_RECT *win)
{
if ( (win->x0>LCD_XSIZE) || (win->y0>LCD_YSIZE)
|| (win->x1<win->x0)
|| (win->y1<win->y0) )
{
return 0; //不要显示
}
if (win->x1>LCD_XSIZE)
{
win->x1 = LCD_XSIZE;
}
if (win->y1>LCD_YSIZE)
{
win->y1 = LCD_YSIZE;
}
return 1;
}
#ifdef LCD_CONT_HX8310
void LCD_L0_DrawHLine(int x0, int y, int x1)
{
LCD_RECT win;
win.x0 = x0;
win.y0 = y;
win.x1 = x1;
win.y1 = y;
if(!_fitRECT(&win))
{
return;
}
OS_ENTER_CRITICAL();
LCD_P0_SetWindow(&win);
LCD_P0_FillArea(PENCOLOR_BAK,x1-x0+1);
OS_EXIT_CRITICAL();
}
#endif //LCD_CONT_HX8310
#ifdef LCD_CONT_SSD1332
void LCD_L0_DrawHLine(int x0, int y, int x1)
{
//用硬件驱动提供的画线函数
OS_ENTER_CRITICAL();
LCD_P0_DrawLine( x0, y, x1, y, PENCOLOR_BAK);
OS_EXIT_CRITICAL();
}
#endif //LCD_CONT_SSD1332
#ifdef LCD_CONT_HX8310
void LCD_L0_DrawVLine (int x, int y0, int y1)
{
LCD_RECT win;
win.x0 = x;
win.y0 = y0;
win.x1 = x;
win.y1 = y1;
if(!_fitRECT(&win))
{
return;
}
OS_ENTER_CRITICAL();
LCD_P0_SetWindow(&win);
LCD_P0_FillArea(PENCOLOR_BAK,y1-y0+1);
OS_EXIT_CRITICAL();
}
#endif //LCD_CONT_HX8310
#ifdef LCD_CONT_SSD1332
void LCD_L0_DrawVLine (int x, int y0, int y1)
{
//用硬件驱动提供的画线函数
OS_ENTER_CRITICAL();
LCD_P0_DrawLine(x, y0, x, y1, PENCOLOR_BAK);
OS_EXIT_CRITICAL();
}
#endif //LCD_CONT_SSD1332
/******************************************************************************
** 名字: 填充区域
** 接口: void LCD_L0_FillRect(int x0, int y0, int x1, int y1)
** 描述: 用当前画笔把指定的区域作填充
** 输入参数:
(x0,y0): 左上角座标
(x1,y1): 右下角座标
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_FillRect (int x0, int y0, int x1, int y1)
{
OS_ENTER_CRITICAL();
LCD_P0_DrawRect(x0, y0, x1, y1, BKCOLOR_BAK, BKCOLOR_BAK);
OS_EXIT_CRITICAL();
}
/******************************************************************************
** 名字: 填充区域
** 接口: void LCD_L0_DrawRect(int x0, int y0, int x1, int y1)
** 描述: 用当前画笔把指定的区域作填充
** 输入参数:
(x0,y0): 左上角座标
(x1,y1): 右下角座标
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_DrawRect(int x0, int y0, int x1, int y1)
{
char drawmod=0xf;//用四位分别表示矩形四条边是否要画,默认为都画,否则根据相应位画相应线,各位定义如下
// null | null | null | null | left | top | right | bottom
if ((x0>LCD_XSIZE)||(y0>LCD_YSIZE))
{
return;
}
if (y0<0)
{ //not draw top line
y0 = 0;
drawmod &= 0xfb;
}
if (x0<0)
{
//not draw left line
x0 = 0;
drawmod &= 0xf7;
}
if (x1>LCD_XSIZE-1)
{
//not draw right line
x1 = LCD_XSIZE-1;
drawmod &= 0xfd;
}
if (y1>LCD_YSIZE-1)
{
//not draw bottom line
y1 = LCD_YSIZE-1;
drawmod &= 0xfe;
}
//if((drawmod & 0xf) == 0xf)
//{
// OS_ENTER_CRITICAL();
// LCD_P0_DrawRect(x0, y0, x1, y1,PENCOLOR_BAK,0x0);
// OS_EXIT_CRITICAL();
//}
// else
{
if(drawmod & 0x1)
{
// draw bottom line
LCD_L0_DrawHLine(x0, y1, x1);
}
if(drawmod & 0x2)
{
//draw right line
LCD_L0_DrawVLine(x1, y0, y1);
}
if(drawmod & 0x4)
{
//draw top line
LCD_L0_DrawHLine(x0, y0, x1);
}
if(drawmod & 0x8)
{
// draw left line
LCD_L0_DrawVLine(x0, y0, y1);
}
}
}
/******************************************************************************
** 名字: 复制区域
** 接口: void LCD_L0_CopyRect(int x0, int y0, int x1, int y1,int newx, int newy)
** 描述: 复制由左上角坐标(x0,y0)和右下角坐标(x1,y1)所决定的矩形区域到由(newx,newy)
为新左上角坐标的位置上。
** 输入参数:
(x0,y0): 左上角座标
(x1,y1): 右下角座标
(newx,newy):新左上角坐标
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_CopyRect(int x0, int y0, int x1, int y1,int newx, int newy)
{
OS_ENTER_CRITICAL();
LCD_P0_CopyRect(x0, y0, x1, y1,newx, newy);
OS_EXIT_CRITICAL();
}
/******************************************************************************
** 名字: 清区域显示
** 接口: void LCD_L0_ClearRect(int x0, int y0, int x1, int y1)
** 描述: 将选中区域清屏
** 输入参数:
(x0,y0): 左上角座标
(x1,y1): 右下角座标
** 输出参数:
** 使用说明:
********************************************************************************/
void LCD_L0_ClearRect(int x0, int y0, int x1, int y1)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -