- 打卡等级:以坛为家II
- 打卡总天数:474
- 最近打卡:2026-05-14 08:50:14
金牌会员
- 积分
- 1924
|
发表于 2026-4-16 16:46:35
|
显示全部楼层
//******************************************************************
//函数名: LCD_SetWindows
//功能: 设置显示窗口
//输入参数:(xStar,yStar):窗口左上角起始坐标
// (xEnd,yEnd):窗口右下角结束坐标
//返回值: 无
//修改记录:无
//******************************************************************
void LCD_SetWindows(u16 xStar, u16 yStar,u16 xEnd,u16 yEnd)
{
u8 param[4];
u32 i;
u32 sum;
u32 width,height;
sum = (xEnd - xStar)*(yEnd - yStar);
sum <<= 1;
for(i=0;i<sizeof(lcd_buffer)/sizeof(lcd_buffer[0]);i++){
lcd_buffer = RED>>0;//颜色不对,尝试调试此处
}
width = (xEnd - xStar) + xStar -1 + EXAMPLE_LCD_X_GAP;
height = (yEnd - yStar) + yStar -1 + EXAMPLE_LCD_Y_GAP;
xStar += EXAMPLE_LCD_X_GAP;
yStar += EXAMPLE_LCD_Y_GAP;
param[0] = xStar >> 8;
param[1] = xStar & 0xff;
param[2] = width >> 8;
param[3] = width & 0xff;
lcd_tx_param(LCD_CMD_CASET, param, 4);
param[0] = yStar >> 8;
param[1] = yStar & 0xff;
param[2] = height >> 8;
param[3] = height & 0xff;
lcd_tx_param(LCD_CMD_RASET, param, 4);
// lcd_tx_color_start(LCD_CMD_RAMWR);
// while(sum)
// {
// if(sum <= sizeof(lcd_buffer)){
// lcd_tx_color((u8*)lcd_buffer, (u8)sum);
// sum = 0;
// }else{
// lcd_tx_color((u8*)lcd_buffer, sizeof(lcd_buffer));
// sum -= sizeof(lcd_buffer);
// }
// }
// lcd_tx_color_end();
}
//******************************************************************
//函数名: LCD_ShowChar
//功能: 显示单个英文字符
//输入参数:(x,y):字符显示位置起始坐标
// fc:前置画笔颜色
// bc:背景颜色
// num:数值(0-94)
// size:字体大小
//返回值: 无
//修改记录:无
//******************************************************************
void LCD_ShowChar(u16 x,u16 y,u16 fc, u16 bc, u8 num,u8 size,u8 mode)
{
u8 temp;
u8 pos,t;
u16 colortemp=POINT_COLOR;
num=num-' ';//得到偏移后的值
LCD_SetWindows(x,y,x+size/2-1,y+size-1);//设置单个文字显示窗口
// if(!mode) //非叠加方式
// {
// for(pos=0;pos<size;pos++)
// {
// if(size==12)temp=asc2_1206[num].dat[pos];//调用1206字体
// else temp=asc2_1608[num].dat[pos]; //调用1608字体
// for(t=0;t<size/2;t++)
// {
//// if(temp&0x01)LCD_WR_DATA_16Bit(fc);
//// else LCD_WR_DATA_16Bit(bc);
// temp>>=1;
//
// }
// }
// }else//叠加方式
// {
for(pos=0;pos<size;pos++)
{
if(size==12)temp=asc2_1206[num].dat[pos];//调用1206字体
else temp=asc2_1608[num].dat[pos]; //调用1608字体
for(t=0;t<size/2;t++)
{
POINT_COLOR=fc;
if(temp&0x01)GUI_DrawPoint(x+t,y+pos);//画一个点
temp>>=1;
}
}
// }
POINT_COLOR=colortemp;
LCD_SetWindows(0,0,lcddev.width-1,lcddev.height-1);//恢复窗口为全屏
}
/***************************************************/目前显示异常 |
|