print_method.c

来自「对pxa255内置lcd控制器编程来实现字符及图像的显示」· C语言 代码 · 共 58 行

C
58
字号
#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))


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,unsigned char c)
{
       long int base_addr;
       base_addr = 0xa0500000; 
    if(x<1280 && y<480)
  		(*((unsigned char *)(base_addr+y*1280+x))) = c;
}





void print_pic(char *pic)
{
 int x,y;
     for(y=0;y<480;y++)
   		for(x=0;x<1280;x++)
    		lcd_put_pixel(x,y,*(pic+y*1280+x));
}    		
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?