📄 lcd12864.c
字号:
unsigned char i,j,k,lcdpart,lcdcur,mode;
unsigned char hanzi[3];
i=0;
j=0;
k=0;
lcdpart=0;
lcdcur=0;
if((lie>16)||(hang>4))
return 0;
i=lie;
while(*str)
{
mode=0;
if(disMod&(1<<k))
mode=1;
if(i<8)
{
if(lcdcur!=0)
{
lcdcur=0;
}
}
else
{
if(lcdcur!=1)
{
lcdcur=1;
j=8;
}
}
c=*str;
if(*str<=0x80)
{
gbchar_disp8(hang*2,(i-j)*8,c,lcdcur,mode);
i++;
if(i>15)
{
i=0;
j=0;
hang++;
if(hang>3)
hang=0;
}
k++;
str++;
}
else
{
hanzi[0]=*str;
hanzi[1]=*(str+1);
if(hanzi[1]==0)
{
gbchar_disp8(hang*2,56,' ',lcdcur,mode);
return 0;
}
gbhz_disp16(hang*2, i*8,hanzi,mode);
//
str++;
str++;
i++;
i++;
k++;
if(i>15)
{
i=0;
j=0;
hang++;
if(hang>3)
hang=0;
}
}
}
return 0;
}
void Display_Time_Flag(uint8 pos)
{
unsigned char j=0,i=0;
for(j=0;j<2;j++)
{
Set_Lcd_Page(6+j,pos);
for(i=0;i<4;i++)
{
LCD_Data_Write(Time_Flag_16_4[4*j+i]);
}
}
}
void Display_Sys_Info(uint8 type)
{
unsigned int i=0;
unsigned char oribuf[8];
for(i=0;i<8;i++)
{
oribuf[i]= Char_8_8[type*8+i];
}
Set_Lcd_Page(7,120);
for(i=0;i<8;i++)
{
LCD_Data_Write(oribuf[i]);
}
}
void Display_Lock(void)
{
unsigned int i=0;
Set_Lcd_Page(6,120);
for(i=0;i<8;i++)
{
LCD_Data_Write(Lock_8_8[i]);
}
}
void Display_Point(uint8 hang,uint8 enable/*允许*/)
{
unsigned char j=0,i=0;
unsigned char oribuf[32];
for(i=0;i<32;i++)
{
if(enable==1)
oribuf[i]= Pic_Point[i];
else
oribuf[i]= Disanable[i];
}
for(j=0;j<2;j++)
{
Set_Lcd_Page(hang*2+j,100);
for(i=0;i<16;i++)
{
LCD_Data_Write(oribuf[16*j+i]);
}
}
}
//显示箭头,0为上,1为下
void Display_Arow(uint8 mode)
{
unsigned char j=0,i=0;
unsigned char oribuf[16];
unsigned char hang;
// OS_ENTER_CRITICAL();
hang=0;
if(mode==1)
hang=3;
for(i=0;i<16;i++)
{
if(mode==0)
{
oribuf[i]= Pic_Arrow_Up[i];
}
else
{
oribuf[i]= Pic_Arrow_Down[i];
}
}
for(j=0;j<2;j++)
{
Set_Lcd_Page(hang*2+j,120);
for(i=0;i<8;i++)
{
LCD_Data_Write(oribuf[8*j+i]);
}
}
}
void Display_Chek(uint8 hang,uint8 Check_Radio,uint8 slect)
{
unsigned int j=0,i=0;
unsigned char oribuf[32];
if(Check_Radio==1)//显示Check
{
if (slect) //选中
{
memcpy(oribuf,Check_Select,32);
}
else
{
memcpy(oribuf,Check_Un_Select,32);
}
}
else //显示单选
{
if (slect) //选中
{
memcpy(oribuf,Radio_Select,32);
}
else
{
memcpy(oribuf,Radio_Un_Select,32);
}
}
for(j=0;j<2;j++)
{
Set_Lcd_Page(hang*2+j,1);
for(i=0;i<16;i++)
{
LCD_Data_Write(oribuf[16*j+i]);
}
}
}
void Display_Personal_Masg(void)
{
static char Disbuf[17];
static uint16 msg_len=0;
static uint16 data_pointer=0;
static uint16 time_count=0;
uint8 i;
uint8 pos=0;
if(display_finish==1)
{
Info_Process_Time=600;
for(i=0;i<16;i++)
Disbuf[i]=' ';
Disbuf[16]=0;
msg_len=strlen(MsgBuf);
if(msg_len<=16)
{
pos=(16-msg_len)/2;
strcpy(&Disbuf[pos],MsgBuf);
if(msg_len!=16)//修改16个字符时,显示错误
Disbuf[pos+msg_len]=' ';
Dis_GbStr(0,0,Disbuf,0);
display_finish=0;
//Get_Key=DIS_FINISH;
//OSMboxPost(KeyReviceMbox, (void *)&Get_Key);
}
else
{
display_finish=2;
data_pointer=0;
time_count=20;
for(i=0;i<16;i++)
Disbuf[i]=' ';//显示开始16个空格
Disbuf[16]=0;
}
}
if(display_finish==2)
{
Info_Process_Time=600;
time_count++;
if(time_count>=15)
{//显示下一个字符,右移
if(Disbuf[0]>0x80 )//|| MsgBuf[data_pointer]>0x80)
{//移出为汉字,2个字符
for(i=0;i<=13;i++)
Disbuf[i]=Disbuf[i+2];
//移出两个字符,补上两个
if(data_pointer==msg_len)
Disbuf[14]=' ';
else
Disbuf[14]=MsgBuf[data_pointer++];
if(data_pointer==msg_len)
Disbuf[15]=' ';
else
Disbuf[15]=MsgBuf[data_pointer++];
}
else
{//移出移入都为一个
for(i=0;i<=14;i++)
Disbuf[i]=Disbuf[i+1];
if(data_pointer==msg_len)
Disbuf[15]=' ';
else
Disbuf[15]=MsgBuf[data_pointer++];
}
if(0==strcmp(Disbuf," "))
{//显示全部移出
display_finish=0;
Get_Key=DIS_FINISH;
OSMboxPost(KeyReviceMbox, (void *)&Get_Key);
}
time_count=0;
Dis_GbStr(0,0,Disbuf,0);
}
}
}
void Display_Personal_Info(uint32 card_no)
{
uint16 i,j;
uint8 *Key,temp_key,err;
uint32 msg_type;
int cmpflag1,cmpflag2;
j=0;
while(j<18)
{
ReadMessage(j);
if(MsgBuf[0]!=0xff)
{
sprintf(msg_start_time,"%02d%02d%02d%02d%02d",(uint8)MsgBuf[5],(uint8)MsgBuf[6],(uint8)MsgBuf[7],(uint8)MsgBuf[8],(uint8)MsgBuf[9]);
sprintf(msg_end_time, "%02d%02d%02d%02d%02d",(uint8)MsgBuf[10],(uint8)MsgBuf[11],(uint8)MsgBuf[12],(uint8)MsgBuf[13],(uint8)MsgBuf[14]);
sprintf(current_time, "%02x%02x%02x%02x%02x",sysClock.year,sysClock.month,sysClock.day,
sysClock.hour,sysClock.min);
cmpflag1=strcmp(msg_start_time,current_time);
cmpflag2=strcmp(current_time,msg_end_time);
memcpy((uint8 *)&msg_type,(uint8 *)&MsgBuf[1],4);
if(cmpflag1<0 && cmpflag2<0 )
{
if(msg_type==card_no)
{
for(i=0;i<strlen(&MsgBuf[15]);i++)
MsgBuf[i]=MsgBuf[i+15];
MsgBuf[i]=0;
break;
}
}
}
j++;
}
if(j<18)
{
Key_Forbid_Flag=1;
Info_Process_Flag=0;
DISPLAY_AGAIN:
display_finish=1;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
{
Dis_GbStr(1,0,"Msg. A key stop",0xf);
Dis_GbStr(1,0,"Msg. A key stop",0xf);
}
else
{
Dis_GbStr(1,0,"讯息 任意键终止",3);
Dis_GbStr(1,0,"讯息 任意键终止",3);
}
if(strlen(MsgBuf)>16)
Key = OSMboxPend(KeyReviceMbox, 0, &err);
else
Key = OSMboxPend(KeyReviceMbox, 5000, &err);
if(Key!=0)
{
temp_key=*Key;
if(temp_key==DIS_FINISH)
{//显示完毕
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
{
Dis_GbStr(1,0,"Over # replay",0xf);
Dis_GbStr(1,0,"Over # replay",0xf);
}
else
{
Dis_GbStr(1,0,"完成 按#键重复",3);
Dis_GbStr(1,0,"完成 按#键重复",3);
}
Key = OSMboxPend(KeyReviceMbox, 5000, &err);
if(Key!=0)
{
temp_key=*Key;
if(temp_key==NUM_ENTER)
goto DISPLAY_AGAIN;
}
}
}
//清除接收缓冲区0806
wg_input_data.wg_flag=0;
wg_input_data.wg_read=wg_input_data.wg_write=0;
display_finish=0;
Key_Forbid_Flag=0;
Info_Process_Time=0;
}
}
//注意:用for循环的时候,函数的变量不能太多
void Display_TileMsg(uint8 mode)
{
static char Disbuf[17];
static uint16 msg_len=0;
static uint16 data_pointer=0;
static uint16 time_count=0;
uint8 new_msg_no;
uint16 i,j;
int cmpflag1,cmpflag2;
uint32 msg_type;
uint8 pos=0;
if(mode==0)
{
ReadTitle();
if(MsgBuf[0]==0xff || MsgBuf[0]==0)
{
msg_len=0;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
Dis_GbStr(0,0," AIDC. \"AIDC\" ",0);
else
Dis_GbStr(0,0," 艾迪希 \"AIDC\" ",0);
}
else
{
for(i=0;i<16;i++)
Disbuf[i]=' ';
Disbuf[16]=0;
msg_len=strlen(MsgBuf);
if(msg_len<=16)
{
pos=(16-msg_len)/2;
strcpy(&Disbuf[pos],MsgBuf);
if(msg_len!=16)
Disbuf[pos+msg_len]=' ';
Dis_GbStr(0,0,Disbuf,0);
}
else
{
data_pointer=0;
time_count=20;
for(i=0;i<16;i++)
Disbuf[i]=' ';//显示开始16个空格
Disbuf[16]=0;
}
}
}
else
{
j=0;
while(j<18)
{
//APP_TRACE_DEBUG(("read message\r\n"));
ReadMessage(j);
if(MsgBuf[0]!=0xff)
{
sprintf(msg_start_time,"%02d%02d%02d%02d%02d",(uint8)MsgBuf[5],(uint8)MsgBuf[6],(uint8)MsgBuf[7],(uint8)MsgBuf[8],(uint8)MsgBuf[9]);
sprintf(msg_end_time, "%02d%02d%02d%02d%02d",(uint8)MsgBuf[10],(uint8)MsgBuf[11],(uint8)MsgBuf[12],(uint8)MsgBuf[13],(uint8)MsgBuf[14]);
sprintf(current_time, "%02x%02x%02x%02x%02x",sysClock.year,sysClock.month,sysClock.day,
sysClock.hour,sysClock.min);
cmpflag1=strcmp(msg_start_time,current_time);
cmpflag2=strcmp(current_time,msg_end_time);
memcpy((uint8 *)&msg_type,(uint8 *)&MsgBuf[1],4);
if(cmpflag1<0 && cmpflag2<0 )
{
if(msg_type==0xffffffff)
{
new_msg_no=j;
for(i=0;i<strlen(&MsgBuf[15]);i++)
MsgBuf[i]=MsgBuf[i+15];
MsgBuf[i]=0;
if(strcmp(Old_MsgBuf,MsgBuf))
{
old_msg_no=19;
strcpy(Old_MsgBuf,MsgBuf);
}
break;
}
}
}
j++;
}
if(j==18)
{
new_msg_no=18;
ReadTitle();
if((MsgBuf[0]==0xff || MsgBuf[0]==0) && (old_msg_no!=new_msg_no))
{
msg_len=0;
old_msg_no=new_msg_no;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
Dis_GbStr(0,0," AIDC. \"AIDC\" ",0);
else
Dis_GbStr(0,0," 艾迪希 \"AIDC\" ",0);
}
}
if(old_msg_no!=new_msg_no)
{
old_msg_no=new_msg_no;
for(i=0;i<16;i++)
Disbuf[i]=' ';
Disbuf[16]=0;
msg_len=strlen(MsgBuf);
if(msg_len<=16)
{
pos=(16-msg_len)/2;
strcpy(&Disbuf[pos],MsgBuf);
if(msg_len!=16)
Disbuf[pos+msg_len]=' ';
Dis_GbStr(0,0,Disbuf,0);
}
else
{
data_pointer=0;
time_count=20;
for(i=0;i<16;i++)
Disbuf[i]=' ';//显示开始16个空格
Disbuf[16]=0;
}
}
if(msg_len>16)
{
time_count++;
if(time_count>=15)
{//显示下一个字符,右移
if(Disbuf[0]>0x80 )//|| MsgBuf[data_pointer]>0x80)
{//移出为汉字,2个字符
for(i=0;i<=13;i++)
Disbuf[i]=Disbuf[i+2];
//移出两个字符,补上两个
if(data_pointer==msg_len)
Disbuf[14]=' ';
else
Disbuf[14]=MsgBuf[data_pointer++];
if(data_pointer==msg_len)
Disbuf[15]=' ';
else
Disbuf[15]=MsgBuf[data_pointer++];
}
else
{//移出移入都为一个
for(i=0;i<=14;i++)
Disbuf[i]=Disbuf[i+1];
if(data_pointer==msg_len)
Disbuf[15]=' ';
else
Disbuf[15]=MsgBuf[data_pointer++];
}
if(0==strcmp(Disbuf," "))
{//显示全部移出
data_pointer=0;
}
time_count=0;
Dis_GbStr(0,0,Disbuf,0);
}
}
}
}
//显示模式。为0全部显示,1显示小时
//2显示分钟,3显示: 4清除:
void Dis_Sys_Time(uint8 Dis_Mode)
{
char TimeBuf[32];
uint8 Pos;
static uint8 clock_status=0;
static uint8 old_clock_status=0;
if(old_clock_status!=clock_status)
{
old_clock_status=clock_status;
if(clock_status==0)
{
Dis_Mode=0;
}
}
if(TimeCheck())
{
clock_status=1;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
{
Dis_GbStr(1,0," Clock ",0);
Dis_GbStr(2,0," Error ",0);
}
else
{
Dis_GbStr(1,0," 时钟 ",0);
Dis_GbStr(2,0," 错误 ",0);
}
return ;
}
else
clock_status=0;
//显示小时
if(Dis_Mode==0 || Dis_Mode==1)
{
Pos=(sysClock.hour>>4);
gbhz_disp32(2,0,Pos);
Pos=(sysClock.hour&0x0f);
gbhz_disp32(2,24,Pos);
}
//显示分
if(Dis_Mode==0 || Dis_Mode==2)
{
Pos=(sysClock.min>>4);
gbhz_disp32(2,64,Pos);
Pos=(sysClock.min&0x0f);
gbhz_disp32(2,96,10);
gbhz_disp32(2,88,Pos);
}
//显示:
if(Dis_Mode==0 || Dis_Mode==3)
{
gbhz_disp32_12(2,48,1);
}
//清除:
if(Dis_Mode==4)
{
gbhz_disp32_12(2,48,0);
}
if(Dis_Mode==0 || Dis_Mode==5)
{
sprintf( TimeBuf,"%04x",0x2000+sysClock.year);
Dis_GbStr(3,0,TimeBuf,0);
Display_Time_Flag(32);
sprintf( TimeBuf,"%02x",sysClock.month);
gbchar_disp8(6,36,TimeBuf[0],0,0);
gbchar_disp8(6,44,TimeBuf[1],0,0);
Display_Time_Flag(52);
sprintf( TimeBuf,"%02x",sysClock.day);
gbchar_disp8(6,56,TimeBuf[0],0,0);
if(sysClock.week==0x01)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," MON " );
else
strcat(TimeBuf,"星期一" );
}
if(sysClock.week==0x02)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," TUE " );
else
strcat(TimeBuf,"星期二" );
}
if(sysClock.week==0x03)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," WED " );
else
strcat(TimeBuf,"星期三" );
}
if(sysClock.week==0x04)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," THU " );
else
strcat(TimeBuf,"星期四" );
}
if(sysClock.week==0x05)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," FRI " );
else
strcat(TimeBuf,"星期五" );
}
if(sysClock.week==0x06)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," SAT " );
else
strcat(TimeBuf,"星期六" );
}
if(sysClock.week==0x07)
{
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
strcat(TimeBuf," SUN " );
else
strcat(TimeBuf,"星期日" );
}
Dis_GbStr(3,8,&TimeBuf[1],0);
//显示菜单是否加密
if(System_Para.Menu_Pwd[0]!=0)
Display_Lock();
//显示终端控制状态
if(System_Para.Mode_Type==MODE_TYPE_TWO_DOOR)
Display_Sys_Info(0);
else
Display_Sys_Info(1);
Capacity_Caculate();
}
}
void Display_System_Informaition(void)
{
char dis_buf[17];
fp32 fpercent;
uint32 upercent;
sprintf(dis_buf,"%03d.%03d.%03d.%03d ",System_Para.IP_Addr[0],System_Para.IP_Addr[1],System_Para.IP_Addr[2],System_Para.IP_Addr[3]);
Dis_GbStr(0,0,dis_buf,0);
Dis_GbStr(1,0,Device_SN,0);
Record_Num=Get_Record_Count();
fpercent=Record_Num/MAX_RECORD_COUNT;
fpercent=fpercent*100;
upercent=(uint32)fpercent;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
sprintf(dis_buf,"Rec.%06d %02d",Record_Num,upercent);
else
sprintf(dis_buf,"记录%06d 占%02d",Record_Num,upercent);
strcat(dis_buf,"%");
Dis_GbStr(2,0,dis_buf,0);
fpercent=Enroll_Card_Num/MAX_ENROLL_CARD;
fpercent=fpercent*100;
upercent=(uint32)fpercent;
if(System_Para.Language_Select ==LANGUAGE_ENGLISH)
sprintf(dis_buf,"Card%06d %02d",Enroll_Card_Num,upercent);
else
sprintf(dis_buf,"卡片%06d 占%02d",Enroll_Card_Num,upercent);
strcat(dis_buf,"%");
Dis_GbStr(3,0,dis_buf,0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -