📄 print_method.c
字号:
#define LCD_LCCR0 (*(volatile unsigned long *)(0x44000000))
#define LCD_FDADR0 (*(volatile unsigned long *)(0x44000200))
#define LCD_FSADR0 (*(volatile unsigned long *)(0xa0300004))
#define LCD_LCSR (*(volatile unsigned long *)(0x44000038))
extern char hzk16[];
void screen_clean(int color)
{
long int i,fill_color ;
i = 0x96000/4;
fill_color = 0x111100*color;
for(;i>0;i--)
(*(volatile unsigned long int *)(0xa0500000 + i*4)) = fill_color;
}
void disable_lcd(void)
{
LCD_LCCR0 = LCD_LCCR0 | 0x0400;
}
void enable_lcd(void)
{
;LCD_FDADR0 = 0xa0300000;
;LCD_FSADR0 = 0xa0500000;
;LCD_LCSR = 0;
LCD_LCCR0 = 0x003008f8;
LCD_LCCR0 = LCD_LCCR0 | 0x01;
}
void lcd_put_pixel(int x,int y, int c)
{
long int base_addr;
base_addr = 0xa0500000;
if(x<1280 && y<480)
(*((unsigned int *)(base_addr+y*1280+x*2))) = c;
}
void memcpy(char *q1,char *q2,int n)
{
int i;
for(i=0;i<n;i++)
*(q1+i)=*(q2+i);
}
void print_hzk16(int x,int y,char *s,int colour)
{
char buffer[32];
int i,j,k;
unsigned char qh,wh;
unsigned long location;
while(*s)
{
qh=*s-0xa0;
wh=*(s+1)-0xa0;
location=(94*(qh-1)+(wh-1))*32L;
memcpy(buffer, &hzk16[location], 32);
for(i=0;i<16;i++)
{
for(j=0;j<2;j++)
{
for(k=0;k<8;k++)
{ if(((buffer[i*2+j]>>(7-k)) & 0x1) != 0)
lcd_put_pixel(x+8*j+k,y+i,colour);
}
}
}
s+=2;
x+=32;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -