so this works now
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0c4589d3bc
commit
530f01f3dc
4 changed files with 39 additions and 33 deletions
|
@ -22,7 +22,7 @@ TARGET = rockboxui
|
||||||
CC = gcc
|
CC = gcc
|
||||||
RM = rm
|
RM = rm
|
||||||
|
|
||||||
CFLAGS = -g -O2
|
CFLAGS = -g
|
||||||
CPPFLAGS = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS
|
CPPFLAGS = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS
|
||||||
LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl
|
LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ distclean: clean
|
||||||
$(RM) config.cache
|
$(RM) config.cache
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CPPFLAGS) $(CCFLAGS) -c $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
||||||
|
|
||||||
$(DEPEND):
|
$(DEPEND):
|
||||||
$(CC) -MM $(CFLAGS) $(SRCS) > $(DEPEND)
|
$(CC) -MM $(CFLAGS) $(SRCS) > $(DEPEND)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "lcd-x11.h"
|
#include "lcd-x11.h"
|
||||||
|
|
||||||
extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT];
|
extern unsigned char display[LCD_HEIGHT/8][LCD_WIDTH];
|
||||||
|
|
||||||
void lcd_update (void)
|
void lcd_update (void)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,9 @@ void lcd_update (void)
|
||||||
if(display[y/8][x]&(1<<bit)) {
|
if(display[y/8][x]&(1<<bit)) {
|
||||||
points[p].x = x + MARGIN_X;
|
points[p].x = x + MARGIN_X;
|
||||||
points[p].y = y+bit + MARGIN_Y;
|
points[p].y = y+bit + MARGIN_Y;
|
||||||
|
#ifdef LCD_DEBUG
|
||||||
|
printf("Set pixel at %d,%d\n", x, y+bit);
|
||||||
|
#endif
|
||||||
p++; /* increase the point counter */
|
p++; /* increase the point counter */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,13 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#ifdef LCD_DEBUG
|
#ifdef LCD_DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define PRINT(x) printf x
|
||||||
|
#else
|
||||||
|
#define PRINT(x)
|
||||||
#endif
|
#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 */
|
||||||
|
|
||||||
|
@ -168,14 +173,11 @@ 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
|
PRINT(("lcd_position: set to %d, %d\n", x, y));
|
||||||
fprintf(stderr, "lcd_position: set to %d, %d\n", x, y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef LCD_DEBUG
|
|
||||||
else
|
else
|
||||||
fprintf(stderr, "lcd_position: not set\n");
|
PRINT(("lcd_position: not set\n"));
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +200,12 @@ void lcd_clear(void)
|
||||||
*/
|
*/
|
||||||
void lcd_char (int ch, char invert)
|
void lcd_char (int ch, char invert)
|
||||||
{
|
{
|
||||||
unsigned char (*dp)[DISP_X] = (void *) &display[lcd_y/8][lcd_x];
|
unsigned char yrow = lcd_y/8;
|
||||||
unsigned long shift, mask, col;
|
unsigned char (*dp)[LCD_WIDTH] = &display[yrow][lcd_x];
|
||||||
|
unsigned char shift, mask, col;
|
||||||
|
|
||||||
|
PRINT(("lcd_char: output %c (%02x) at %d, %d (yrow %d)\n",
|
||||||
|
ch, ch, lcd_x, lcd_y, yrow));
|
||||||
|
|
||||||
/* Limit to char generation table */
|
/* Limit to char generation table */
|
||||||
if (ch < ASCII_MIN || ch > ASCII_MAX)
|
if (ch < ASCII_MIN || ch > ASCII_MAX)
|
||||||
|
@ -214,9 +220,14 @@ 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 = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert;
|
unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert;
|
||||||
|
|
||||||
|
PRINT(("OR[0]: %02x on x %d y %d \n", data&0xff, col+lcd_x, yrow));
|
||||||
|
|
||||||
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) {
|
||||||
|
PRINT(("OR[1]: %02x on x %d y %d\n", (data>>8), col+lcd_x, yrow+1));
|
||||||
dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8);
|
dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Column after char */
|
/* Column after char */
|
||||||
|
@ -232,10 +243,8 @@ void lcd_string(const char *text, char invert)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
#ifdef LCD_DEBUG
|
PRINT(("lcd_string: output %s at %d, %d\n", text, lcd_x, lcd_y));
|
||||||
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) */
|
||||||
|
@ -248,16 +257,13 @@ void lcd_string(const char *text, char invert)
|
||||||
else {
|
else {
|
||||||
lcd_char (ch, invert);
|
lcd_char (ch, invert);
|
||||||
lcd_x += CHAR_X;
|
lcd_x += CHAR_X;
|
||||||
}
|
|
||||||
|
|
||||||
if (lcd_x > DISP_X-CHAR_X) {
|
if (lcd_x > DISP_X-CHAR_X) {
|
||||||
/* Wrap to next line */
|
/* Wrap to next line */
|
||||||
lcd_x = 0;
|
lcd_x = 0;
|
||||||
lcd_y += CHAR_Y;
|
lcd_y += CHAR_Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef LCD_DEBUG
|
PRINT(("lcd_string: position after write: %d, %d\n", lcd_x, lcd_y));
|
||||||
fprintf(stderr, "lcd_string: position after write: %d, %d\n",
|
|
||||||
lcd_x, lcd_y);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,16 +224,13 @@ screenhack (Display *the_dpy, Window the_window)
|
||||||
|
|
||||||
Logf("Rockbox will kill ya!");
|
Logf("Rockbox will kill ya!");
|
||||||
|
|
||||||
lcd_position(1, 1);
|
lcd_position(0, 6);
|
||||||
lcd_string( "R", 0);
|
lcd_string( "Rock the box", 0);
|
||||||
|
|
||||||
lcd_position(0, 16);
|
|
||||||
lcd_string( "R", 0);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
lcd_position(8, 24);
|
lcd_position(8, 24);
|
||||||
lcd_string( "2", 0);
|
lcd_string( "Roolz", 0);
|
||||||
#endif
|
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* deal with input here */
|
/* deal with input here */
|
||||||
|
|
Loading…
Reference in a new issue