lcdgui.c
来自「完整的原创单片机控制彩色液晶源代码(keil工程) 320x240液晶模块底层」· C语言 代码 · 共 64 行
C
64 行
#include "LCD.h"
#include "LCDGUI.h"
//====================================================================================
void FillBox(unsigned int xb,unsigned int yb,unsigned int xe,unsigned int ye,unsigned int FillColor)
{
unsigned int i,j;
for (j=yb;j<=ye;j++)
{
SetRamAddr(xb,j);
SendCom(0x22);
for (i=xb;i<=xe;i++)
SendDat(FillColor);
}
}
//====================================================================================
void DrawPixel(unsigned int x,unsigned int y,unsigned int Color)
{
SetRamAddr(x,y);
SendCom(0x22);
SendDat(Color);
}
//====================================================================================
void DispSmallPic(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const unsigned char *str)
{
unsigned int i,j,temp,p=0;
for(j=0;j<h;j++)
{
SetRamAddr(x,y+j);
SendCom(0x22);
for(i=0;i<w;i++)
{
temp=str[p++]; //低位在前
temp|=str[p++] << 8;
SendDat(temp);
}
}
}
//====================================================================================
void DispBitPic(unsigned int x, unsigned int y, unsigned int w, unsigned int h,
const unsigned char *str,unsigned int BackColor,unsigned int FrontColor)
{
unsigned int i,j,k,p=0;
char temp;
for(j=0;j<h;j++)
{
SetRamAddr(x,y+j);
SendCom(0x22);
for(i=0;i<(w/8);i++)
{
temp = str[p++];
for (k=0;k<8;k++)
if (temp & (0x80 >> k))
SendDat(FrontColor);
else
SendDat(BackColor);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?