summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-07-28 07:17:00 +0000
committerJens Arnold <amiconn@rockbox.org>2006-07-28 07:17:00 +0000
commitcb36fec3922cb1317bdb06a6497370f188694d4e (patch)
tree5dfe6aa35f8e55485e18de4c5bdac0ed54e8d80c /firmware/export
parent2d4cfa8738abc42603de8f90e715433bb4345dd7 (diff)
downloadrockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.zip
rockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.tar.gz
rockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.tar.bz2
rockbox-cb36fec3922cb1317bdb06a6497370f188694d4e.tar.xz
LCD drivers: * Slight speedup for 2bit greyscale drivers. Use the same scrolltext drawing anywhere. * Cleanup, fixes and definitions in preparation for X5 remote.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10346 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-h300.h2
-rw-r--r--firmware/export/lcd-remote.h109
-rw-r--r--firmware/export/lcd.h2
5 files changed, 96 insertions, 21 deletions
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 4461cc2..6d204c3 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -31,6 +31,8 @@
#define LCD_REMOTE_HEIGHT 64
#define LCD_REMOTE_DEPTH 1
+#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
+
#define CONFIG_KEYPAD IRIVER_H100_PAD
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index f2cd8c2..5635a92 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -27,6 +27,8 @@
#define LCD_REMOTE_HEIGHT 64
#define LCD_REMOTE_DEPTH 1
+#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
+
#define CONFIG_KEYPAD IRIVER_H100_PAD
#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 30cca21..e98b60c 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -29,6 +29,8 @@
#define LCD_REMOTE_HEIGHT 64
#define LCD_REMOTE_DEPTH 1
+#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
+
#define CONFIG_KEYPAD IRIVER_H300_PAD
#define CONFIG_REMOTE_KEYPAD H300_REMOTE
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index c27a0d4..031fcdf 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -27,9 +27,6 @@
#ifdef HAVE_REMOTE_LCD
-#define STYLE_DEFAULT 0
-#define STYLE_INVERT 1
-
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
#define REMOTETYPE_H100_LCD 1
#define REMOTETYPE_H300_LCD 2
@@ -37,35 +34,82 @@
extern int remote_type(void);
#endif
+#define STYLE_DEFAULT 0
+#define STYLE_INVERT 1
+
+#if LCD_REMOTE_DEPTH <= 8
+#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
+ || (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
+typedef unsigned short fb_remote_data;
+#else
+typedef unsigned char fb_remote_data;
+#endif
+#elif LCD_DEPTH <= 16
+typedef unsigned short fb_remote_data;
+#else
+typedef unsigned long fb_remote_data;
+#endif
+
+#ifndef LCD_REMOTE_FBWIDTH
+#define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
+#endif
+
+/* Low-level drawing function types */
+typedef void lcd_remote_pixelfunc_type(int x, int y);
+typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
+ unsigned bits);
+
+#if LCD_REMOTE_DEPTH > 1 /* greyscale */
+#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
+#define LCD_REMOTE_BRIGHTNESS(y) (((y) * LCD_REMOTE_MAX_LEVEL + 127) / 255)
+
+#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
+#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
+#define LCD_REMOTE_LIGHTGRAY LCD_REMOTE_BRIGHTNESS(170)
+#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
+#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
+#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
+
+#endif
+
+/* Memory copy of display bitmap */
+#if LCD_REMOTE_DEPTH == 1
+extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
+#elif LCD_REMOTE_DEPTH == 2
+#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
+extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
+#endif
+#endif
+
extern void lcd_remote_init(void);
extern int lcd_remote_default_contrast(void);
extern void lcd_remote_set_contrast(int val);
extern void lcd_remote_emireduce(bool state);
extern void lcd_remote_clear_display(void);
-extern void lcd_remote_puts(int x, int y, const unsigned char *string);
-extern void lcd_remote_puts_style(int x, int y, const unsigned char *string,
+extern void lcd_remote_puts(int x, int y, const unsigned char *str);
+extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
int style);
-extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset);
-extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset);
+extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
+ int offset);
+extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
+ int style, int offset);
extern void lcd_remote_putc(int x, int y, unsigned short ch);
extern void lcd_remote_stop_scroll(void);
extern void lcd_remote_scroll_speed(int speed);
extern void lcd_remote_scroll_delay(int ms);
-extern void lcd_remote_puts_scroll(int x, int y, const unsigned char* string);
-extern void lcd_remote_puts_scroll_style(int x, int y,const unsigned char* string,
- int style);
-extern void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string,
- int offset);
-extern void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string,
+extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
+extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
+ int style);
+extern void lcd_remote_puts_scroll_offset(int x, int y,
+ const unsigned char *str, int offset);
+extern void lcd_remote_puts_scroll_style_offset(int x, int y,
+ const unsigned char *string,
int style, int offset);
extern void lcd_remote_update(void);
extern void lcd_remote_update_rect(int x, int y, int width, int height);
-/* Memory copy of display bitmap */
-extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
-
extern void lcd_remote_set_invert_display(bool yesno);
extern void lcd_remote_set_flip(bool yesno);
extern void lcd_remote_roll(int pixels);
@@ -78,25 +122,50 @@ extern int lcd_remote_getymargin(void);
extern void lcd_remote_setfont(int font);
extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
+/* low level drawing function pointer arrays */
+extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
+extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
+
extern void lcd_remote_drawpixel(int x, int y);
extern void lcd_remote_drawline(int x1, int y1, int x2, int y2);
extern void lcd_remote_hline(int x1, int x2, int y);
extern void lcd_remote_vline(int x, int y1, int y2);
extern void lcd_remote_drawrect(int x, int y, int width, int height);
extern void lcd_remote_fillrect(int x, int y, int width, int height);
-extern void lcd_remote_bitmap_part(const unsigned char *src, int src_x,
+extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
int src_y, int stride, int x, int y,
int width, int height);
-extern void lcd_remote_bitmap(const unsigned char *src, int x, int y,
+extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
int width, int height);
-extern void lcd_remote_putsxy(int x, int y, const unsigned char *string);
+extern void lcd_remote_putsxy(int x, int y, const unsigned char *str);
extern void lcd_remote_invertscroll(int x, int y);
extern void lcd_remote_bidir_scroll(int threshold);
extern void lcd_remote_scroll_step(int pixels);
+#if LCD_REMOTE_DEPTH > 1
+extern void lcd_remote_set_foreground(unsigned foreground);
+extern unsigned lcd_remote_get_foreground(void);
+extern void lcd_remote_set_background(unsigned background);
+extern unsigned lcd_remote_get_background(void);
+extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
+ unsigned background);
+
+extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
+ int src_y, int stride, int x, int y,
+ int width, int height);
+extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
+ int width, int height);
+extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
+ int src_x, int src_y,
+ int stride, int x, int y,
+ int width, int height);
+extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
+ int y, int width, int height);
+#else /* LCD_REMOTE_DEPTH == 1 */
#define lcd_remote_mono_bitmap lcd_remote_bitmap
#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
+#endif /* LCD_REMOTE_DEPTH */
#endif
-#endif
+#endif /* __LCD_REMOTE_H__ */
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 89bf353..38561a7 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -138,7 +138,7 @@ extern void lcd_jump_scroll_delay(int ms);
/* Low-level drawing function types */
typedef void lcd_pixelfunc_type(int x, int y);
-typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits);
+typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
#if LCD_DEPTH >= 8
typedef void lcd_fastpixelfunc_type(fb_data *address);
#endif