📄 main.c
字号:
if((*s>=0xa1)&&(*(s+1)>=0xa1))/*如果是汉字内码*/
{
flag=putcharex(x,y+cnt,*(int16 *)s,CharColor,BackColor);/*显示一个字符*/
if(flag==-1)
{
disp_in_use=0;
return -1;/*有错误*/
}
if(flag==1)
{
if(y+cnt+1<24)
{
s+=2;
cnt++;
cnt2+=2;
}
else
if(x+1<7)
{
s+=2;
cnt=0;y=0;x++;
cnt2+=2;
}
else
{
disp_in_use=0;
return cnt2;/*显示到最后行列*/
}
}/*正常*/
}
else/*是ASIC码*/
{
if((*s>=32)&&(*s<=128))/*大于等于32并且小于等于asic表长度加32,为可显示的ASIC字符*/
{
flag=putcharex(x,y+cnt,*(int16 *)(asic+(*s-32)*2),CharColor,BackColor);/*显示一个字符*/
if(flag==-1)
{
disp_in_use=0;
return -1;/*有错误*/
}
if(flag==1)
{
if(y+cnt+1<24)
{
s+=1;
cnt++;
cnt2+=1;
}
else
if(x+1<7)
{
s+=1;
cnt=0;y=0;x++;
cnt2+=1;
}
else
{
disp_in_use=0;
return cnt2;/*显示到最后行列*/
}
}/*正常*/
}
else
{
s+=1;
cnt2+=1;
}
}
}
disp_in_use=0;
return 0;/*返回显示的字符数*/
}
/***************************************
扩展方式输出一串字符,用于按键显示
输入X,Y坐标
****************************************/
int8 sprint_key(uint16 x,uint16 y,char *s,uint16 CharColor,uint16 BackColor) //reentrant
{
int16 cnt=0;
int16 flag=0;
// if(disp_in_use)return -1;
disp_in_use=1;
while(*s!='\0')
{
flag=putcharex(x,y+cnt,*(int16 *)s,CharColor,BackColor);/*显示一个字符*/
if(flag==-1)
{
disp_in_use=0;
return -1;/*有错误*/
}
if(flag==1)
{
if(y+cnt+1<24)
{
s+=2;
cnt++;
}
else
if(x+1<8)
{
s+=2;
cnt=0;y=0;x++;
}
else
{
disp_in_use=0;
return 0;/*显示到最后行列*/
}
}/*正常*/
}
disp_in_use=0;
return 0;/*返回显示的字符数*/
}
/**************************************
设置文本方式显示
***************************************/
void set_text(void)
{
command(KANJI_FONT_DISPLAY_CONTROL);
}
/**************************************
设置主屏偏移位置,输入X,Y坐标,输出:成功1,失败0
***************************************/
int8 set_main_position(uint16 x,uint16 y)
{
if((x>0x3f)|(y>0x3f))return 0;
command(MAIN_SCREEN_VERTICAL_POSTION_CONTROL|y);
command(MAIN_SCREEN_HORIZONTAL_POSITION_CONTROL|x|SC);
return 1;
}
/****************************************
开显示
*****************************************/
int8 ondisplay(uint16 backcolor,uint16 alt)
{
if(backcolor>7)return 0;
if((alt!=0)&&(alt!=IE))return 0;
command(SCREEN_CONTROL1|NP|CM|DC|alt);
command(SCREEN_CONTROL2);
command(MAIN_SCREEN_LINE_CONTROL1);
command(MAIN_SCREEN_LINE_CONTROL2|VD);
command(COLOR_CONTROL|RB|CC|BC|UC|backcolor);
return 1;
}
/*uint8 ondisplay(uint16 backcolor,uint16 alt)
{
if(backcolor>7)return 0;
if((alt!=0)&&(alt!=IE))return 0;
command(SCREEN_CONTROL1|NP|CM|DC|alt);
command(SCREEN_CONTROL2|APC);
command(MAIN_SCREEN_LINE_CONTROL1);
command(MAIN_SCREEN_LINE_CONTROL2|VD);
command(COLOR_CONTROL|RB|CC|BC|UC|backcolor);
return 1;
}*/
/****************************************
显示门口图象
*****************************************/
int8 image_alt(uint16 alt)
{
// if(disp_in_use)return -1;
disp_in_use=1;
if((alt!=0)&&(alt!=IE))
{
disp_in_use=0;
return 0;
}
command(SCREEN_CONTROL1|NP|CM|DC|alt);
disp_in_use=0;
return 1;
}
/****************************************
改变背景色
*****************************************/
int8 color_background(uint16 backcolor)
{
// if(disp_in_use)return -1;
disp_in_use=1;
if(backcolor>7)
{
disp_in_use=0;
return 0;
}
command(COLOR_CONTROL|RB|CC|BC|UC|backcolor);
disp_in_use=0;
return 1;
}
/********************************************
设置子屏位置,输入X,Y坐标,输出:成功1,失败0
*********************************************/
uint8 set_sub_position(uint16 x,uint16 y)
{
if((x>0x1ff)|(y>0xff))return 0;
command(SUB_SCREEN_VERTICAL_POSITION_CONTROL|(y&0x007f)|((y<<1)&0x0100));
command(SUB_SCREEN_HORIZONTAL_POSITION_CONTROL|(x&0x007f)|((x<<1)&0x0300));
return 1;
}
/*uint8 set_sub_position(uint16 x,uint16 y)
{
if((x>0x1ff)|(y>0xff))return 0;
command(SUB_SCREEN_VERTICAL_POSITION_CONTROL|(y&0x007f)|((y<<1)&0x0100)|SGA);
command(SUB_SCREEN_HORIZONTAL_POSITION_CONTROL|(x&0x007f)|((x<<1)&0x0300));
return 1;
}*/
/*********************************************
设置子屏的行数,字符颜色,字符背景颜色
输出:成功1,失败0
**********************************************/
uint8 init_sub_screen(uint16 linenum,uint16 charcolor,uint16 backcolor)
{
if((linenum>7)|(charcolor>7)|(backcolor>7))return 0;
command(SUB_SCREEN_CONTROL|(linenum<<8)|0x0038|backcolor);
return 1;
}
/*uint8 init_sub_screen(uint16 linenum,uint16 charcolor,uint16 backcolor)
{
if((linenum>7)|(charcolor>7)|(backcolor>7))return 0;
command(SUB_SCREEN_CONTROL|(linenum<<8)|(charcolor<<3)|backcolor);
return 1;
}*/
/**************************************
子屏显示字符行定位,输入X坐标,输出:成功1,失败0
***************************************/
int8 sub_gotoxy(uint16 x,uint16 y)
{
uint16 com;
if((x>0x000f)|(y>0x001f))return 0;
_X=x;_Y=y;
com=VRAM_ADDR_SET|VSL;
com|=((_X<<6)&0x0300);
com|=((_X<<5)&0x0060);
com|=_Y<<1;
command(com);
return 1;
}
/****************************************
显示门口图象
*****************************************/
/*uint8 sub_location(uint16 x)
{
uint16 com;
if(x>0x000f)return 0;
com=VRAM_ADDR_SET|VSL;
com|=((x<<6)&0x0300);
com|=((x<<5)&0x0060);
command(com);
return 1;
}*/
/**************************************
在子屏X行显示1个汉字
输入:行X,列Y,汉字内码,字符颜色,字符背景颜色
***************************************/
int8 sub_display(char x,char y,uint16 gb,uint16 CharColor,uint16 BackColor)
{
if(!sub_gotoxy(x,y))return 0;
command(GbToAddress(gb).char_addr1|CharColor|BackColor|SUB_SCREEN_LINE_CONTROL1);
command(GbToAddress(gb).char_addr2|SUB_SCREEN_LINE_CONTROL2);
return 1;
}
/*uint8 sub_display(uint16 x,uint16 y,uint16 gb,uint16 CharColor,uint16 BackColor)
{
if(!sub_location(x))return 0;
command(GbToAddress(gb).char_addr1|CharColor|BackColor|SUB_SCREEN_LINE_CONTROL1);
command(GbToAddress(gb).char_addr2|SUB_SCREEN_LINE_CONTROL2);
return 1;
}*/
void disp1(void)
{
sprintex(0,5,"信息显示",C_WHITE,B_WHITE);
sprintex(2,0,"收件箱:3封",C_WHITE,B_WHITE);
// sprintex(4,0,"胖小 LOVE 丫头",C_WHITE,B_WHITE);
sprintex(7,5,"查看",C_WHITE,B_WHITE);
}
void disp2(void)
{
sprintex(0,5,"第一封",C_WHITE,B_WHITE);
sprintex(4,0,"胖小 LOVE 丫头",C_WHITE,B_WHITE);
sprintex(7,8,"下一封",C_WHITE,B_WHITE);
sprintex(7,0,"上一封",C_WHITE,B_WHITE);
}
void disp3(void)
{
sprintex(0,5,"第二封",C_WHITE,B_WHITE);
sprintex(4,0,"胖小还是 LOVE 丫头",C_WHITE,B_WHITE);
sprintex(7,8,"下一封",C_WHITE,B_WHITE);
sprintex(7,0,"上一封",C_WHITE,B_WHITE);
}
/***************************************/
int main (void)
{
// PINSEL2=0x00000014;
IO0DIR =0x00400000;
IO0CLR =0x00400000;
IO1DIR =0x00100000;
IO1CLR =0x00100000;
IO2DIR =0xf0000000;
IO2SET =0xf0000000;
MB90092_REST();/*复位90092*/
init_sub_screen(1,C_YELLOW,B_CYAN);
set_sub_position(511,255);
sub_display(0,0,*(int16 *)" ",C_YELLOW,B_CYAN);
sub_display(1,0,*(int16 *)" ",C_YELLOW,B_CYAN);
init_sub_screen(1,C_YELLOW,B_CYAN);
/*set_sub_position(511,255);
sub_display(0,0,*(int16 *)" ",C_YELLOW,B_CYAN);
sub_display(1,0,*(int16 *)" ",C_YELLOW,B_CYAN);
init_sub_screen(1,C_YELLOW,B_CYAN);
set_sub_position(511,255);
sub_display(0,0,*(int16 *)" ",C_YELLOW,B_CYAN);
sub_display(1,0,*(int16 *)" ",C_YELLOW,B_CYAN);*/
ondisplay(/*config_table.backcolor&*/B_BLUE&0x0007,0);/*开显示*/
set_main_position(0,27);/*设置主屏左上角位置(2,23)*/
set_text();/*设置显示为文本方式*/
cls();
//while(image_alt(0x0400)==-1){DelayNS(100);}/*开门口图象OSTimeDly(2);*/
// sprintex(5,0,"监视呼叫信息设置",C_WHITE,B_WHITE);
// sprintex(7,5,"HELLO",C_WHITE,B_WHITE);
// sprintex(3,0,"胖小 LOVE 丫头",C_WHITE,B_WHITE);
// sprintex(0,0,"欢迎使用智能住宅终端欢迎使用",C_WHITE,B_WHITE);
image_alt(0x0400);
disp1();
DelayNS(65000);
/* cls();
disp2();
DelayNS(65000);
cls();
disp3();*/
// MB90092_REST();/*复位90092*/
// init_sub_screen(1,C_WHITE,B_WHITE);
// set_sub_position(511,255);
// sub_display(0,0,*(int16 *)" ",C_WHITE,B_WHITE);
// sub_display(1,0,*(int16 *)" ",C_WHITE,B_WHITE);
// ondisplay(B_BLUE,0);/*开显示*/
// set_main_position(0,27);/*设置主屏左上角位置(2,23)*/
// set_text();/*设置显示为文本方式*/
// cls_windows(0,0,8,23);/*清屏幕*/
// DelayNS(60000);
// sprintex(3,6,"欢迎使用智能住宅终端",C_WHITE,B_WHITE);
// sprintex(4,6,"查看信息请按 确认键",C_WHITE,B_WHITE);
while(1)
{;
// sprintex(0,0,"欢迎使用智能住宅终端",C_WHITE,B_WHITE);
}
//while(sprintex(7,0," 控制 监视 呼叫 信息 设置 ",C_YELLOW,B_CYAN)==-1) //OSTimeDly(2);
//if(config_table.alarm.guard==0x42)
//{ DelayNS(100);
//while(sprintex(0,20,"系统设防",C_YELLOW,B_CYAN)==-1)
//OSTimeDly(2);
//DelayNS(100);
//}
/*else
if(config_table.alarm.guard==0x41)
{
while(sprintex(0,20,"系统撤防",C_YELLOW,B_CYAN)==-1)OSTimeDly(2);
}
else
{
flag=0x41;
modifyconfig(GUARD,&flag);
while(sprintex(0,20,"系统撤防",C_YELLOW,B_CYAN)==-1)OSTimeDly(2);
}*/
return (0);
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -