📄 apis.c
字号:
#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/mman.h>#include <sys/types.h>#include <linux/ppw.h>void LCD_Init(void){ StartApplication();}void LCD_Clear( char WorB ){ GraphicsContext gc; RectangleType r={0,0,192,64}; gc.color = (WorB=='B')? 1:0; PntFillRectangle(r,&gc);} void LCD6963_ClearScreen( void ) { LCD_Clear( 'W' ); }void LCD_SubScrClr(int y1,int x1,int y2,int x2){ GraphicsContext gc; RectangleType r={x1,y1,x2,y2}; gc.color = 0; PntFillRectangle(r,&gc);} //清空当前位置后面的行 (x,y) 2003-2-27 //Row 当前行号,Col 起始列号,SorD 单行或双行高('S'/'D') //'W'->白底黑字/'B'->黑底白字 void LCD_ClearOneLine(int Row,int Col,char SorD,char WorB) { char ss[8]; memset( ss,0,8 ); LCD_DisplayOneLine( Row,Col,ss,'D', (WorB=='B')? 1:0, 1 ); } //显示一字 (x,y,Hch,Lch) 2003-2-27 //返回 本字符显示所占用的列数 //Row 当前行号,Col 起始列号 //Hch 汉字高字节,Lch 汉字低字节,SorD 单行或双行高(SorD 当Hch<0x80时,SorD才有效('S'/'D')) //'W'->白底黑字/'B'->黑底白字 int LCD_DisplayOneChr(int Row,int Col,BYTE Hch,BYTE Lch,char SorD,char WorB) { BYTE chr_str[8]; int Half_flag; //=1 半角,=2 全角 Half_flag = 1; memset( chr_str,0,8 ); chr_str[0] = Hch; chr_str[1] = Lch; LCD_DisplayOneLine( Row,Col,chr_str,'D', (WorB=='B')? 1:0, 0 ); if( Hch >= 0x80 ) Half_flag = 2; return Half_flag * 8; }void LCD_DrawLine( int x1,int y1,int x2,int y2 ){ PntDrawLine(y1,x1,y2,x2,1);}//画 横线,点坐标void LCD_DrawH_Line( int x1,int y1,int y2,char WorB ){ PntDrawLine(y1,x1,y2,x1,1);}//画 竖线,点坐标void LCD_DrawV_Line( int x1,int y1,int x2,char WorB ){ PntDrawLine(y1,x1,y1,x2,1);}/******************************************************* * * import: * x,y: left-top corner * str: the string to display * wor_b: 1 -- black background white charactor, 0 -- white background black chactor * clr_flag: clear the right side in this line * *******************************************************///y range : 0,2,4,6,8 ?//x range : 0-191 ??//str 字符串//char SorD //char WorB //clr_flgvoid LCD_DisplayOneLine( int y,int x,unsigned char *str,char SorD,unsigned char wor_b,int clr_flag ){ GraphicsContext gc; RectangleType r; int w,h; y = (y>=8)? 52:((y & 1)? (y/2*13+10):(y / 2) * 13); //poly sun meng add //y = (y>=8)? 52:((y / 2) * 13); //poly sun meng add // get the font height for clear background purpose h = FntGetCurrentFontHeight(); w = FntGetStringWidth(str,0);; //printf("str:%s,w:%d\n",str,w); // clear the background if (wor_b=='B' || wor_b ) gc.color = 1; else gc.color = 0; //if (wor_b == 'W') gc.color = 0; //if ( wor_b ) gc.color = 1; else gc.color = 0; r.left = x;r.top = y; r.bottom = r.top + h - 2; //poly sun meng change : -2 if (clr_flag) r.right = 192; else r.right = r.left + w; PntFillRectangle(r,&gc); // display the string if (wor_b) gc.color = 0; else gc.color = 1; FntDrawString(x,y,str,&gc);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -