Index: umsboot/target/ipodnano2g/target.h |
— | — | @@ -47,6 +47,8 @@ |
48 | 48 | #define LCD_HEIGHT 132
|
49 | 49 | #define LCD_FORMAT rgb565
|
50 | 50 | #define LCD_BYTESPERPIXEL 2
|
| 51 | +#define FRAMEBUF_WIDTH 176
|
| 52 | +#define FRAMEBUF_HEIGHT 132
|
51 | 53 |
|
52 | 54 | #define HAVE_BACKLIGHT
|
53 | 55 |
|
Index: umsboot/lcd.h |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | #include "global.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -#define LCD_FRAMEBUFSIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BYTESPERPIXEL)
|
| 32 | +#define LCD_FRAMEBUFSIZE (FRAMEBUF_WIDTH * FRAMEBUF_HEIGHT * LCD_BYTESPERPIXEL)
|
33 | 33 |
|
34 | 34 |
|
35 | 35 | void lcd_init() INITCODE_ATTR;
|
Index: umsboot/lcdconsole.c |
— | — | @@ -30,20 +30,20 @@ |
31 | 31 | #define OFFSETX LCDCONSOLE_OFFSETX
|
32 | 32 | #define OFFSETY LCDCONSOLE_OFFSETY
|
33 | 33 | #define PIXELBYTES (LCD_BYTESPERPIXEL)
|
34 | | -#define LINEBYTES (LCD_WIDTH * PIXELBYTES)
|
| 34 | +#define LINEBYTES (FRAMEBUF_WIDTH * PIXELBYTES)
|
35 | 35 | #define COLBYTES (FONT_WIDTH * PIXELBYTES)
|
36 | 36 | #define ROWBYTES (FONT_HEIGHT * LINEBYTES)
|
37 | 37 | #define OFFSETBYTES (LINEBYTES * OFFSETY + PIXELBYTES * OFFSETX)
|
38 | 38 |
|
39 | 39 |
|
40 | | -static unsigned char framebuf[LCD_FRAMEBUFSIZE];
|
41 | | -static unsigned int current_row IBSS_ATTR;
|
42 | | -static unsigned int current_col IBSS_ATTR;
|
43 | | -static bool lcdconsole_needs_update IBSS_ATTR;
|
| 40 | +static unsigned char framebuf[LCD_FRAMEBUFSIZE] IBSS_ATTR;
|
| 41 | +static unsigned int current_row;
|
| 42 | +static unsigned int current_col;
|
| 43 | +static bool lcdconsole_needs_update;
|
44 | 44 |
|
45 | | -
|
46 | 45 | void lcdconsole_init()
|
47 | 46 | {
|
| 47 | + displaylcd(0, LCD_WIDTH - 1, 0, LCD_HEIGHT - 1, (void*)0xffffffff, 0);
|
48 | 48 | memset(framebuf, -1, sizeof(framebuf));
|
49 | 49 | current_row = 0;
|
50 | 50 | current_col = -1;
|
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | current_row = LCDCONSOLE_ROWS - 1;
|
82 | 82 | }
|
83 | 83 | renderchar(&framebuf[OFFSETBYTES + ROWBYTES * current_row + COLBYTES * current_col],
|
84 | | - fgcolor, bgcolor, string, LCD_WIDTH);
|
| 84 | + fgcolor, bgcolor, string, FRAMEBUF_WIDTH);
|
85 | 85 | }
|
86 | 86 |
|
87 | 87 | void lcdconsole_puts_noblit(const char* string, int fgcolor, int bgcolor)
|
— | — | @@ -103,7 +103,11 @@ |
104 | 104 | return;
|
105 | 105 | }
|
106 | 106 | leave_critical_section(mode);
|
107 | | - displaylcd(0, LCD_WIDTH - 1, 0, LCD_HEIGHT - 1, framebuf, 0);
|
| 107 | + displaylcd((LCD_WIDTH - FRAMEBUF_WIDTH) / 2,
|
| 108 | + (LCD_WIDTH - FRAMEBUF_WIDTH) / 2 + FRAMEBUF_WIDTH - 1,
|
| 109 | + (LCD_HEIGHT - FRAMEBUF_HEIGHT) / 2,
|
| 110 | + (LCD_HEIGHT - FRAMEBUF_HEIGHT) / 2 + FRAMEBUF_HEIGHT - 1,
|
| 111 | + framebuf, 0);
|
108 | 112 | }
|
109 | 113 |
|
110 | 114 | void lcdconsole_putc(char string, int fgcolor, int bgcolor)
|
— | — | @@ -128,7 +132,11 @@ |
129 | 133 | {
|
130 | 134 | if (lcdconsole_needs_update)
|
131 | 135 | {
|
132 | | - displaylcd(0, LCD_WIDTH - 1, 0, LCD_HEIGHT - 1, framebuf, 0);
|
| 136 | + displaylcd((LCD_WIDTH - FRAMEBUF_WIDTH) / 2,
|
| 137 | + (LCD_WIDTH - FRAMEBUF_WIDTH) / 2 + FRAMEBUF_WIDTH - 1,
|
| 138 | + (LCD_HEIGHT - FRAMEBUF_HEIGHT) / 2,
|
| 139 | + (LCD_HEIGHT - FRAMEBUF_HEIGHT) / 2 + FRAMEBUF_HEIGHT - 1,
|
| 140 | + framebuf, 0);
|
133 | 141 | lcdconsole_needs_update = false;
|
134 | 142 | }
|
135 | 143 | }
|
Index: umsboot/lcdconsole.h |
— | — | @@ -30,10 +30,10 @@ |
31 | 31 | #include "lcd.h"
|
32 | 32 |
|
33 | 33 |
|
34 | | -#define LCDCONSOLE_COLS (LCD_WIDTH / FONT_WIDTH)
|
35 | | -#define LCDCONSOLE_ROWS (LCD_HEIGHT / FONT_HEIGHT)
|
36 | | -#define LCDCONSOLE_OFFSETX ((LCD_WIDTH - LCDCONSOLE_COLS * FONT_WIDTH) / 2)
|
37 | | -#define LCDCONSOLE_OFFSETY ((LCD_HEIGHT - LCDCONSOLE_ROWS * FONT_HEIGHT) / 2)
|
| 34 | +#define LCDCONSOLE_COLS (FRAMEBUF_WIDTH / FONT_WIDTH)
|
| 35 | +#define LCDCONSOLE_ROWS (FRAMEBUF_HEIGHT / FONT_HEIGHT)
|
| 36 | +#define LCDCONSOLE_OFFSETX ((FRAMEBUF_WIDTH - LCDCONSOLE_COLS * FONT_WIDTH) / 2)
|
| 37 | +#define LCDCONSOLE_OFFSETY ((FRAMEBUF_HEIGHT - LCDCONSOLE_ROWS * FONT_HEIGHT) / 2)
|
38 | 38 |
|
39 | 39 |
|
40 | 40 | void lcdconsole_init();
|