git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-03-26 14:27:03 +00:00
parent e446977579
commit a1fd255d04
6 changed files with 71 additions and 10 deletions

View file

@ -37,6 +37,7 @@
*/ */
#include "lcd.h" #include "lcd.h"
#include "lcd-x11.h"
extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT];
@ -53,8 +54,8 @@ void lcd_update (void)
/* one or more bits/pixels are set */ /* one or more bits/pixels are set */
for(bit=0; bit<8; bit++) { for(bit=0; bit<8; bit++) {
if(display[y/8][x]&(1<<bit)) { if(display[y/8][x]&(1<<bit)) {
points[p].x = x; points[p].x = x + MARGIN_X;
points[p].y = y+bit; points[p].y = y+bit + MARGIN_Y;
p++; /* increase the point counter */ p++; /* increase the point counter */
} }
} }
@ -63,4 +64,5 @@ void lcd_update (void)
} }
} }
drawdots(&points[0], p); drawdots(&points[0], p);
fprintf(stderr, "lcd_update: Draws %d pixels\n", p);
} }

22
uisimulator/lcd-x11.h Normal file
View file

@ -0,0 +1,22 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#define MARGIN_X 3
#define MARGIN_Y 3

View file

@ -22,6 +22,9 @@
*/ */
#include "lcd.h" #include "lcd.h"
#ifdef LCD_DEBUG
#include <stdio.h>
#endif
#define DISP_X LCD_WIDTH /* Display width in pixels */ #define DISP_X LCD_WIDTH /* Display width in pixels */
#define DISP_Y LCD_HEIGHT /* Display height in pixels */ #define DISP_Y LCD_HEIGHT /* Display height in pixels */
@ -40,7 +43,7 @@
#define ASCII_MIN 0x20 /* First char in table */ #define ASCII_MIN 0x20 /* First char in table */
#define ASCII_MAX 0x7f /* Last char in table */ #define ASCII_MAX 0x7f /* Last char in table */
static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = static const unsigned char lcd_font_data[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] =
{ {
0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */
0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00,
@ -154,8 +157,8 @@ static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] =
*/ */
unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; unsigned char display[LCD_HEIGHT/8][LCD_WIDTH];
static unsigned char lcd_y; /* Current pixel row */ static int lcd_y; /* Current pixel row */
static unsigned char lcd_x; /* Current pixel column */ static int lcd_x; /* Current pixel column */
/* /*
* Set current x,y position * Set current x,y position
@ -165,7 +168,15 @@ void lcd_position(int x, int y)
if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) {
lcd_x = x; lcd_x = x;
lcd_y = y; lcd_y = y;
#ifdef LCD_DEBUG
fprintf(stderr, "lcd_position: set to %d, %d\n", x, y);
#endif
} }
#ifdef LCD_DEBUG
else
fprintf(stderr, "lcd_position: not set\n");
#endif
} }
/* /*
@ -202,7 +213,7 @@ void lcd_char (int ch, char invert)
/* Write each char column */ /* Write each char column */
for (col = 0; col < CHAR_X-1; col++) { for (col = 0; col < CHAR_X-1; col++) {
unsigned long data = (char_gen[ch-ASCII_MIN][col] << shift) ^ invert; unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert;
dp[0][col] = (dp[0][col] & mask) | data; dp[0][col] = (dp[0][col] & mask) | data;
if (lcd_y < DISP_Y-8) if (lcd_y < DISP_Y-8)
dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8);
@ -221,6 +232,10 @@ void lcd_string(const char *text, char invert)
{ {
int ch; int ch;
#ifdef LCD_DEBUG
fprintf(stderr, "lcd_string: output %s at %d, %d\n",
text, lcd_x, lcd_y);
#endif
while ((ch = *text++) != '\0') { while ((ch = *text++) != '\0') {
if (lcd_y > DISP_Y-CHAR_Y) { if (lcd_y > DISP_Y-CHAR_Y) {
/* Scroll (8 pixels) */ /* Scroll (8 pixels) */

View file

@ -24,3 +24,5 @@
#define LCD_WIDTH 112 /* Display width in pixels */ #define LCD_WIDTH 112 /* Display width in pixels */
#define LCD_HEIGHT 64 /* Display height in pixels */ #define LCD_HEIGHT 64 /* Display height in pixels */
#define LCD_DEBUG 1

View file

@ -83,7 +83,7 @@ static XrmOptionDescRec default_options [] = {
static char *default_defaults[] = { static char *default_defaults[] = {
".root: false", ".root: false",
"*geometry: 100x200", /* this should be .geometry, but nooooo... */ "*geometry: 200x100", /* this should be .geometry, but nooooo... */
"*mono: false", "*mono: false",
"*installColormap: false", "*installColormap: false",
"*visualID: default", "*visualID: default",

View file

@ -33,6 +33,9 @@
#include "version.h" #include "version.h"
#include "lcd.h"
#include "lcd-x11.h"
#define MAX(x,y) ((x)>(y)?(x):(y)) #define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y))
@ -78,7 +81,7 @@ void Logf(char *fmt, ...)
t = localtime(&now); t = localtime(&now);
log = fopen(LOGFILE, "a"); log = fopen(LOGFILE, "a");
if(log) { if(log) {
fprintf(log, "%02d.%02d.%02d ", fprintf(log, "%02d:%02d:%02d ",
t->tm_hour, t->tm_min, t->tm_sec); t->tm_hour, t->tm_min, t->tm_sec);
vfprintf(log, fmt, args); vfprintf(log, fmt, args);
fprintf(log, "\n"); fprintf(log, "\n");
@ -86,7 +89,7 @@ void Logf(char *fmt, ...)
fclose(log); fclose(log);
} }
fprintf(stderr, "%02d.%02d.%02d ", fprintf(stderr, "%02d:%02d:%02d ",
t->tm_hour, t->tm_min, t->tm_sec); t->tm_hour, t->tm_min, t->tm_sec);
vfprintf(stderr, fmt, args); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -221,7 +224,14 @@ screenhack (Display *the_dpy, Window the_window)
Logf("Rockbox will kill ya!"); Logf("Rockbox will kill ya!");
lcd_string( PROGNAME, 0); lcd_position(1, 1);
lcd_string( "RockBoxx", 0);
lcd_position(8, 16);
lcd_string( "R", 0);
lcd_position(8, 24);
lcd_string( "2", 0);
while (1) { while (1) {
/* deal with input here */ /* deal with input here */
@ -237,6 +247,16 @@ void screen_redraw()
lcd_update(); lcd_update();
#define X1 0
#define Y1 0
#define X2 (LCD_WIDTH + MARGIN_X*2)
#define Y2 (LCD_HEIGHT + MARGIN_Y*2)
drawline(1, X1, Y1, X2, Y1);
drawline(1, X2, Y1, X2, Y2);
drawline(1, X1, Y2, X2, Y2);
drawline(1, X1, Y1, X1, Y2);
#if 0 #if 0
/* does nothing "real" yet */ /* does nothing "real" yet */
/* drawtext(1, 20, 20, PROGNAME);*/ /* drawtext(1, 20, 20, PROGNAME);*/