summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-01-07 20:34:11 +0000
committerDave Chapman <dave@dchapman.com>2008-01-07 20:34:11 +0000
commit945c8a221ade41c462a93f8452320a806e5645b3 (patch)
tree2a17823e286e6252e60c44c7f4753d5c18ef5172 /firmware/export
parent2a8f39820b49f116820356c2ca224f82f2106c21 (diff)
downloadrockbox-945c8a221ade41c462a93f8452320a806e5645b3.tar.gz
rockbox-945c8a221ade41c462a93f8452320a806e5645b3.zip
Add viewport capabilities to all the LCD drivers, and adapt scrolling code. This is the firmware/ part of FS#8385 - the changes to the WPS code still need more work and will be committed at a later date. NOTE: There are no user-visible changes with this commit - just the infrastructure.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16018 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/lcd-remote.h7
-rw-r--r--firmware/export/lcd.h28
-rw-r--r--firmware/export/scroll_engine.h14
3 files changed, 47 insertions, 2 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 3be23747ea..34c40e52c1 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -24,6 +24,7 @@
24#include "cpu.h" 24#include "cpu.h"
25#include "config.h" 25#include "config.h"
26#include "adc.h" 26#include "adc.h"
27#include "lcd.h"
27 28
28#ifdef HAVE_REMOTE_LCD 29#ifdef HAVE_REMOTE_LCD
29 30
@@ -109,7 +110,9 @@ extern void lcd_remote_init(void);
109extern int lcd_remote_default_contrast(void); 110extern int lcd_remote_default_contrast(void);
110extern void lcd_remote_set_contrast(int val); 111extern void lcd_remote_set_contrast(int val);
111 112
113extern void lcd_remote_set_viewport(struct viewport* vp);
112extern void lcd_remote_clear_display(void); 114extern void lcd_remote_clear_display(void);
115extern void lcd_remote_clear_viewport(void);
113extern void lcd_remote_puts(int x, int y, const unsigned char *str); 116extern void lcd_remote_puts(int x, int y, const unsigned char *str);
114extern void lcd_remote_puts_style(int x, int y, const unsigned char *str, 117extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
115 int style); 118 int style);
@@ -132,6 +135,8 @@ extern void lcd_remote_puts_scroll_style_offset(int x, int y,
132 135
133extern void lcd_remote_update(void); 136extern void lcd_remote_update(void);
134extern void lcd_remote_update_rect(int x, int y, int width, int height); 137extern void lcd_remote_update_rect(int x, int y, int width, int height);
138extern void lcd_remote_update_viewport(void);
139extern void lcd_remote_update_viewport_rect(int x, int y, int width, int height);
135 140
136extern void lcd_remote_set_invert_display(bool yesno); 141extern void lcd_remote_set_invert_display(bool yesno);
137extern void lcd_remote_set_flip(bool yesno); 142extern void lcd_remote_set_flip(bool yesno);
@@ -141,6 +146,8 @@ extern int lcd_remote_get_drawmode(void);
141extern void lcd_remote_setmargins(int xmargin, int ymargin); 146extern void lcd_remote_setmargins(int xmargin, int ymargin);
142extern int lcd_remote_getxmargin(void); 147extern int lcd_remote_getxmargin(void);
143extern int lcd_remote_getymargin(void); 148extern int lcd_remote_getymargin(void);
149extern int lcd_remote_getwidth(void);
150extern int lcd_remote_getheight(void);
144extern void lcd_remote_setfont(int font); 151extern void lcd_remote_setfont(int font);
145extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); 152extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
146 153
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 60d9efaf92..276dcdfedc 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -24,6 +24,28 @@
24#include "cpu.h" 24#include "cpu.h"
25#include "config.h" 25#include "config.h"
26 26
27struct viewport {
28 int x;
29 int y;
30 int width;
31 int height;
32#ifdef HAVE_LCD_BITMAP
33 int font;
34 int drawmode;
35#endif
36 int xmargin; /* During the transition only - to be removed */
37 int ymargin; /* During the transition only - to be removed */
38#if LCD_DEPTH > 1
39 unsigned fg_pattern;
40 unsigned bg_pattern;
41#ifdef HAVE_LCD_COLOR
42 unsigned lss_pattern;
43 unsigned lse_pattern;
44 unsigned lst_pattern;
45#endif
46#endif
47};
48
27#define STYLE_DEFAULT 0x00000000 49#define STYLE_DEFAULT 0x00000000
28#define STYLE_COLORED 0x10000000 50#define STYLE_COLORED 0x10000000
29#define STYLE_INVERT 0x20000000 51#define STYLE_INVERT 0x20000000
@@ -76,9 +98,14 @@ extern void lcd_set_contrast(int val);
76extern void lcd_setmargins(int xmargin, int ymargin); 98extern void lcd_setmargins(int xmargin, int ymargin);
77extern int lcd_getxmargin(void); 99extern int lcd_getxmargin(void);
78extern int lcd_getymargin(void); 100extern int lcd_getymargin(void);
101extern int lcd_getwidth(void);
102extern int lcd_getheight(void);
79extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); 103extern int lcd_getstringsize(const unsigned char *str, int *w, int *h);
80 104
105extern void lcd_set_viewport(struct viewport* vp);
81extern void lcd_update(void); 106extern void lcd_update(void);
107extern void lcd_update_viewport(void);
108extern void lcd_clear_viewport(void);
82extern void lcd_clear_display(void); 109extern void lcd_clear_display(void);
83extern void lcd_putsxy(int x, int y, const unsigned char *string); 110extern void lcd_putsxy(int x, int y, const unsigned char *string);
84extern void lcd_puts(int x, int y, const unsigned char *string); 111extern void lcd_puts(int x, int y, const unsigned char *string);
@@ -119,6 +146,7 @@ extern void lcd_blit(const fb_data* data, int x, int by, int width,
119 146
120/* update a fraction of the screen */ 147/* update a fraction of the screen */
121extern void lcd_update_rect(int x, int y, int width, int height); 148extern void lcd_update_rect(int x, int y, int width, int height);
149extern void lcd_update_viewport_rect(int x, int y, int width, int height);
122 150
123#ifdef HAVE_REMOTE_LCD 151#ifdef HAVE_REMOTE_LCD
124extern void lcd_remote_update(void); 152extern void lcd_remote_update(void);
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index 5e39990129..48d5c5cb8c 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -23,9 +23,17 @@
23#ifndef __SCROLL_ENGINE_H__ 23#ifndef __SCROLL_ENGINE_H__
24#define __SCROLL_ENGINE_H__ 24#define __SCROLL_ENGINE_H__
25 25
26#include <lcd.h>
27
26void scroll_init(void); 28void scroll_init(void);
29void lcd_scroll_stop(struct viewport* vp);
30void lcd_scroll_stop_line(struct viewport* vp, int y);
27void lcd_scroll_fn(void); 31void lcd_scroll_fn(void);
32#ifdef HAVE_REMOTE_LCD
28void lcd_remote_scroll_fn(void); 33void lcd_remote_scroll_fn(void);
34void lcd_remote_scroll_stop(struct viewport* vp);
35void lcd_remote_scroll_stop_line(struct viewport* vp, int y);
36#endif
29 37
30/* internal usage, but in multiple drivers */ 38/* internal usage, but in multiple drivers */
31#define SCROLL_SPACING 3 39#define SCROLL_SPACING 3
@@ -37,8 +45,10 @@ void lcd_remote_scroll_fn(void);
37 45
38struct scrollinfo 46struct scrollinfo
39{ 47{
48 struct viewport* vp;
40 char line[SCROLL_LINE_SIZE]; 49 char line[SCROLL_LINE_SIZE];
41 int len; /* length of line in chars */ 50 int len; /* length of line in chars */
51 int y; /* Position of the line on the screen (char co-ordinates) */
42 int offset; 52 int offset;
43 int startx; 53 int startx;
44#ifdef HAVE_LCD_BITMAP 54#ifdef HAVE_LCD_BITMAP
@@ -54,7 +64,7 @@ struct scroll_screen_info
54{ 64{
55 struct scrollinfo * const scroll; 65 struct scrollinfo * const scroll;
56 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */ 66 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
57 int lines; /* Bitpattern of which lines are scrolling */ 67 int lines; /* Number of currently scrolling lines */
58 long ticks; /* # of ticks between updates*/ 68 long ticks; /* # of ticks between updates*/
59 long delay; /* ticks delay before start */ 69 long delay; /* ticks delay before start */
60 int bidir_limit; /* percent */ 70 int bidir_limit; /* percent */
@@ -74,7 +84,7 @@ struct scroll_screen_info
74#ifdef HAVE_LCD_BITMAP 84#ifdef HAVE_LCD_BITMAP
75#define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32) 85#define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
76#else 86#else
77#define LCD_SCROLLABLE_LINES LCD_HEIGHT 87#define LCD_SCROLLABLE_LINES LCD_HEIGHT * 2
78#endif 88#endif
79 89
80extern struct scroll_screen_info lcd_scroll_info; 90extern struct scroll_screen_info lcd_scroll_info;