From: Stefan E. <se...@us...> - 2002-05-27 09:59:37
|
Update of /cvsroot/blob/blob/src/diag In directory usw-pr-cvs1:/tmp/cvs-serv9560 Modified Files: lcd.c Log Message: - lcd_fill(), lcd_set_pixel() by Urs Kaufmann Index: lcd.c =================================================================== RCS file: /cvsroot/blob/blob/src/diag/lcd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- lcd.c 11 Feb 2002 16:53:16 -0000 1.6 +++ lcd.c 27 May 2002 09:59:33 -0000 1.7 @@ -1,11 +1,11 @@ /********************************************************************** * lcd.c * - * AUTOR: SELETZ - * * Generic lcd framework * - * Copyright (C) 2001 Stefan Eletzhofer <ste...@ww...> + * Copyright (C) 2001,2002 Stefan Eletzhofer + * <ste...@ww...> + * Copyright (C) 2002 Urs Kaufmann <u_k...@bl...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,10 @@ SerialOutputHex( val ); \ serial_write( '\n' ); +#ifdef MINIPRINT +# define LCD_GRADIENT +#endif + /********************************************************************** * program globals */ @@ -133,15 +137,20 @@ int WEAK_SYM lcd_palette_setup( void ) { - int n; + unsigned int n; +#ifdef LCD_GRADIENT + for ( n = 0 ; n < 256 ; n++ ) { + lcd_palette_set(n, 0x1000+(n<<4) ); + } +#else for ( n = 0 ; n < 128 ; n++ ) { lcd_palette_set(n, 0x1FFF ); } for ( n = 128 ; n < 256 ; n++ ) { lcd_palette_set(n, 0x1000 ); } - +#endif return 0; } @@ -155,6 +164,52 @@ return 0; } +int WEAK_SYM lcd_fill (int color) +{ + int i = 0; + + if (color>0xFF)return -EINVAL; + + color += (color<<8) + (color<<16) + (color<<24); + for(; i<(LCD_COLS*LCD_ROWS/4);i++) + lcd_vram[i] = color; + + return 0; +} + +int WEAK_SYM lcd_set_pixel (unsigned int x, unsigned int y, unsigned int color) +{ + +#ifdef LCD_REVERSE + x = LCD_COLS - 1 - x; + y = LCD_ROWS - 1 - y; +#endif + + if ((color>0xFF)||(y>=LCD_ROWS)||(x>=LCD_COLS)) return -EINVAL; + + switch(x%4) + { + case 0: + lcd_vram[(x>>2)+y*(LCD_COLS>>2)] = + (lcd_vram[(x>>2)+((y*LCD_COLS)>>2)]&0xFFFFFF00)|color; + break; + case 1: + lcd_vram[(x>>2)+y*(LCD_COLS>>2)] = + (lcd_vram[(x>>2)+((y*LCD_COLS)>>2)]&0xFFFF00FF)|(color<<8); + break; + case 2: + lcd_vram[(x>>2)+y*(LCD_COLS>>2)] = + (lcd_vram[(x>>2)+((y*LCD_COLS)>>2)]&0xFF00FFFF)|(color<<16); + break; + case 3: + lcd_vram[(x>>2)+y*(LCD_COLS>>2)] = + (lcd_vram[(x>>2)+((y*LCD_COLS)>>2)]&0x00FFFFFF)|(color<<24); + break; + } + + return 0; +} + /********************************************************************** * Statische Funktionen */ @@ -214,7 +269,14 @@ if ( ret != 0 ) return ret; SerialOutputString( "done\n" ); - +#ifdef LCD_GRADIENT + /* Gradient (bastel-code weil fixe aufloesung) */ + SerialOutputString( "LCD: Gradient test pattern ..." ); + lcd_fill(0x00); + for ( y=0; y<240; y++ ) + for ( x=0; x<320; x++ ) + lcd_set_pixel(x,y,(x/20)+((y/15)*16)); +#else /* vertical lines */ SerialOutputString( "LCD: vertical lines test pattern ..." ); for ( y=0; y<LCD_ROWS; y++ ) { @@ -226,7 +288,7 @@ } } } - +#endif SerialOutputString( "done\n" ); SerialOutputString( "LCD: press any key to proceed\n" ); |