summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2005-05-21 13:22:39 +0000
committerJonas Häggqvist <rasher@rasher.dk>2005-05-21 13:22:39 +0000
commit2ab3fae3eefc634a4936029ff079632b9b90ee79 (patch)
tree5aa4fbe1f4e17b91c8a5cb999a452affcce63f5d /apps
parente86ee9a33fe62f7c5ac4579c339382221d8fc2cd (diff)
downloadrockbox-2ab3fae3eefc634a4936029ff079632b9b90ee79.tar.gz
rockbox-2ab3fae3eefc634a4936029ff079632b9b90ee79.zip
Remote support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6499 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/SOURCES1
-rw-r--r--apps/plugins/flipit.c97
-rw-r--r--apps/plugins/logo.c7
-rw-r--r--apps/plugins/snow.c20
-rw-r--r--apps/plugins/viewers.config2
5 files changed, 100 insertions, 27 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 76be771fb3..7098c6584f 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -82,4 +82,5 @@ splitedit.c
82 82
83#ifdef HAVE_REMOTE_LCD 83#ifdef HAVE_REMOTE_LCD
84remotelcd.c 84remotelcd.c
85remotetest.c
85#endif 86#endif
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index bcd705c16c..8a493044cf 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -37,11 +37,11 @@
37 37
38#elif CONFIG_KEYPAD == IRIVER_H100_PAD 38#elif CONFIG_KEYPAD == IRIVER_H100_PAD
39#define FLIPIT_QUIT BUTTON_OFF 39#define FLIPIT_QUIT BUTTON_OFF
40#define FLIPIT_SHUFFLE BUTTON_SELECT 40#define FLIPIT_SHUFFLE BUTTON_MODE
41#define FLIPIT_SOLVE BUTTON_ON 41#define FLIPIT_SOLVE BUTTON_ON
42#define FLIPIT_STEP_BY_STEP BUTTON_REC 42#define FLIPIT_STEP_BY_STEP BUTTON_REC
43#define FLIPIT_TOGGLE_PRE BUTTON_MODE 43#define FLIPIT_TOGGLE_PRE BUTTON_SELECT
44#define FLIPIT_TOGGLE (BUTTON_MODE | BUTTON_REL) 44#define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL)
45 45
46#endif 46#endif
47 47
@@ -51,6 +51,43 @@ static int toggle[20];
51static int cursor_pos, moves; 51static int cursor_pos, moves;
52static char s[5]; 52static char s[5];
53static char *ptr; 53static char *ptr;
54
55#if LCD_WIDTH == 160
56#define SPOT_SIZE 20
57#define SPOT_SPACE 4
58#define MARGIN_TOP 16
59#define MARGIN_LEFT 5
60static unsigned char spot_pic[2][60] = {
61 { 0xe0, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
62 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xe0,
63 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
64 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
65 0x00, 0x01, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
66 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x01, 0x00, },
67 { 0xe0, 0x18, 0x0c, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
68 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x06, 0x0c, 0x18, 0xe0,
69 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f,
71 0x00, 0x01, 0x03, 0x06, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08,
72 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x03, 0x01, 0x00, }
73};
74
75#define CURSOR_SIZE 22
76static unsigned char cursor_pic[66] = {
77 0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
78 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
79 0x01, 0xaa, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0xaa, 0x15, 0x20, 0x00, 0x20, 0x00, 0x20,
82 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
83 0x00, 0x20, 0x00, 0x20, 0x00, 0x2a,
84};
85
86#else
87#define SPOT_SIZE 14
88#define SPOT_SPACE 2
89#define MARGIN_TOP 0
90#define MARGIN_LEFT 0
54static unsigned char spot_pic[2][28] = { 91static unsigned char spot_pic[2][28] = {
55 { 0xe0, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 92 { 0xe0, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff,
56 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xe0, 93 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xe0,
@@ -61,41 +98,47 @@ static unsigned char spot_pic[2][28] = {
61 0x01, 0x06, 0x08, 0x10, 0x10, 0x20, 0x20, 98 0x01, 0x06, 0x08, 0x10, 0x10, 0x20, 0x20,
62 0x20, 0x20, 0x10, 0x10, 0x08, 0x06, 0x01 } 99 0x20, 0x20, 0x10, 0x10, 0x08, 0x06, 0x01 }
63}; 100};
101
102#define CURSOR_SIZE 16
64static unsigned char cursor_pic[32] = { 103static unsigned char cursor_pic[32] = {
65 0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 104 0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
66 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xaa, 105 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xaa,
67 0x55, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 106 0x55, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
68 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xaa }; 107 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xaa };
69 108#endif
70 109
71/* draw a spot at the coordinates (x,y), range of p is 0-19 */ 110/* draw a spot at the coordinates (x,y), range of p is 0-19 */
72static void draw_spot(int p) { 111static void draw_spot(int p) {
73 ptr = spot_pic[spots[p]]; 112 ptr = spot_pic[spots[p]];
113 int x,y;
114 x = (p%5)*(SPOT_SIZE + SPOT_SPACE)+1 + MARGIN_LEFT;
115 y = (p/5)*(SPOT_SIZE + SPOT_SPACE)+1 + MARGIN_TOP;
116 rb->lcd_bitmap (ptr, x, y, SPOT_SIZE, SPOT_SIZE, true);
117/*
74 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8, true); 118 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8, true);
75 ptr += 14; 119 ptr += 14;
76 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6, true); 120 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6, true);
121*/
77} 122}
78 123
79/* draw the cursor at the current cursor position */ 124/* draw the cursor at the current cursor position */
80static void draw_cursor(void) { 125static void draw_cursor(void) {
81 int i,j; 126 int i,j;
82 i = (cursor_pos%5)*16; 127 i = (cursor_pos%5)*CURSOR_SIZE + (SPOT_SPACE/2)*(cursor_pos%5) + MARGIN_LEFT;
83 j = (cursor_pos/5)*16; 128 j = (cursor_pos/5)*CURSOR_SIZE + (SPOT_SPACE/2)*(cursor_pos/5) + MARGIN_TOP;
84 ptr = cursor_pic; 129 ptr = cursor_pic;
85 rb->lcd_bitmap (ptr, i, j, 16, 8, false); 130 rb->lcd_bitmap (ptr, i, j, CURSOR_SIZE, CURSOR_SIZE, false);
86 ptr += 16;
87 rb->lcd_bitmap (ptr, i, j+8, 16, 8, false);
88} 131}
89 132
90/* clear the cursor where it is */ 133/* clear the cursor where it is */
91static void clear_cursor(void) { 134static void clear_cursor(void) {
92 int i,j; 135 int i,j;
93 i = (cursor_pos%5)*16; 136 i = (cursor_pos%5)*CURSOR_SIZE + (SPOT_SPACE/2)*(cursor_pos%5) + MARGIN_LEFT;
94 j = (cursor_pos/5)*16; 137 j = (cursor_pos/5)*CURSOR_SIZE + (SPOT_SPACE/2)*(cursor_pos/5) + MARGIN_TOP;
95 rb->lcd_clearline(i, j, i+15, j); 138 rb->lcd_clearline(i, j, i+CURSOR_SIZE-1, j);
96 rb->lcd_clearline(i, j+15, i+15, j+15); 139 rb->lcd_clearline(i, j+CURSOR_SIZE-1, i+CURSOR_SIZE-1, j+CURSOR_SIZE-1);
97 rb->lcd_clearline(i, j, i, j+15); 140 rb->lcd_clearline(i, j, i, j+CURSOR_SIZE-1);
98 rb->lcd_clearline(i+15, j, i+15, j+15); 141 rb->lcd_clearline(i+CURSOR_SIZE-1, j, i+CURSOR_SIZE-1, j+CURSOR_SIZE-1);
99} 142}
100 143
101/* check if the puzzle is finished */ 144/* check if the puzzle is finished */
@@ -131,7 +174,7 @@ static void flipit_toggle(void) {
131 } 174 }
132 moves++; 175 moves++;
133 rb->snprintf(s, sizeof(s), "%d", moves); 176 rb->snprintf(s, sizeof(s), "%d", moves);
134 rb->lcd_putsxy(85, 20, s); 177 rb->lcd_putsxy(LCD_WIDTH - 27, 20, s);
135 if (flipit_finished()) 178 if (flipit_finished())
136 clear_cursor(); 179 clear_cursor();
137} 180}
@@ -151,8 +194,8 @@ static void flipit_init(void) {
151 int i; 194 int i;
152 rb->lcd_clear_display(); 195 rb->lcd_clear_display();
153 moves = 0; 196 moves = 0;
154 rb->lcd_drawrect(80, 0, 32, 64); 197 rb->lcd_drawrect(LCD_WIDTH - 32, 0, 32, LCD_HEIGHT);
155 rb->lcd_putsxy(81, 10, "Flips"); 198 rb->lcd_putsxy(LCD_WIDTH - 31, 10, "Flips");
156 for (i=0; i<20; i++) { 199 for (i=0; i<20; i++) {
157 spots[i]=1; 200 spots[i]=1;
158 toggle[i]=1; 201 toggle[i]=1;
@@ -167,11 +210,11 @@ static void flipit_init(void) {
167 cursor_pos = 0; 210 cursor_pos = 0;
168 draw_cursor(); 211 draw_cursor();
169 moves = 0; 212 moves = 0;
170 rb->lcd_clearrect(80, 0, 32, 64); 213 rb->lcd_clearrect(LCD_WIDTH - 32, 0, 32, LCD_HEIGHT);
171 rb->lcd_drawrect(80, 0, 32, 64); 214 rb->lcd_drawrect(LCD_WIDTH - 32, 0, 32, LCD_HEIGHT);
172 rb->lcd_putsxy(81, 10, "Flips"); 215 rb->lcd_putsxy(LCD_WIDTH - 31, 10, "Flips");
173 rb->snprintf(s, sizeof(s), "%d", moves); 216 rb->snprintf(s, sizeof(s), "%d", moves);
174 rb->lcd_putsxy(85, 20, s); 217 rb->lcd_putsxy(LCD_WIDTH - 27, 20, s);
175 rb->lcd_update(); 218 rb->lcd_update();
176} 219}
177 220
@@ -298,13 +341,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
298 rb->lcd_putsxy(2, 28, "[M-LEFT] shuffle"); 341 rb->lcd_putsxy(2, 28, "[M-LEFT] shuffle");
299 rb->lcd_putsxy(2, 38, "[M-UP] solution"); 342 rb->lcd_putsxy(2, 38, "[M-UP] solution");
300 rb->lcd_putsxy(2, 48, "[M-RIGHT] step by step"); 343 rb->lcd_putsxy(2, 48, "[M-RIGHT] step by step");
344#elif CONFIG_KEYPAD == IRIVER_H100_PAD
345 rb->lcd_putsxy(2, 8, "[STOP] to stop");
346 rb->lcd_putsxy(2, 18, "[SELECT] toggle");
347 rb->lcd_putsxy(2, 28, "[MODE] shuffle");
348 rb->lcd_putsxy(2, 38, "[PLAY] solution");
349 rb->lcd_putsxy(2, 48, "[REC] step by step");
301#endif 350#endif
302 rb->lcd_update(); 351 rb->lcd_update();
303 rb->sleep(HZ*3); 352 rb->sleep(HZ*3);
304 353
305 rb->lcd_clear_display(); 354 rb->lcd_clear_display();
306 rb->lcd_drawrect(80, 0, 32, 64); 355 rb->lcd_drawrect(LCD_WIDTH - 32, 0, 32, LCD_HEIGHT);
307 rb->lcd_putsxy(81, 10, "Flips"); 356 rb->lcd_putsxy(LCD_WIDTH - 31, 10, "Flips");
308 for (i=0; i<20; i++) { 357 for (i=0; i<20; i++) {
309 spots[i]=1; 358 spots[i]=1;
310 draw_spot(i); 359 draw_spot(i);
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index 9cace8943c..acfea234cb 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -25,8 +25,8 @@
25#define RAND_SCALE 5 25#define RAND_SCALE 5
26 26
27#if defined(IRIVER_H100) && !defined(SIMULATOR) 27#if defined(IRIVER_H100) && !defined(SIMULATOR)
28#define REMOTE_WIDTH 134 28#define REMOTE_WIDTH LCD_REMOTE_WIDTH
29#define REMOTE_HEIGHT 65 29#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
30#define REMOTE_LOGO_WIDTH 91 30#define REMOTE_LOGO_WIDTH 91
31#define REMOTE_LOGO_HEIGHT 32 31#define REMOTE_LOGO_HEIGHT 32
32#define REMOTE_LOGO rockbox91x32 32#define REMOTE_LOGO rockbox91x32
@@ -191,6 +191,7 @@ const unsigned char rockbox16x7[] = {
191 191
192 192
193enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { 193enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
194 static char debug[30];
194 int button; 195 int button;
195 int timer = 10; 196 int timer = 10;
196 int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2); 197 int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2);
@@ -226,6 +227,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
226 (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH), 227 (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH),
227 (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT), 228 (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT),
228 REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT, false); 229 REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT, false);
230 rb->snprintf(debug, sizeof(debug), "X: %d Y: %d - RX: %d RY: %d", x, y, (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH), (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT));
231 rb->lcd_putsxy(5, DISPLAY_HEIGHT - 10, debug);
229#endif 232#endif
230#else 233#else
231 pgfx_clear_display(); 234 pgfx_clear_display();
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 09c416d655..0fc01eef6e 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -87,6 +87,13 @@ static void snow_move(void)
87#else 87#else
88 pgfx_clearpixel(particles[i][0],particles[i][1]); 88 pgfx_clearpixel(particles[i][0],particles[i][1]);
89#endif 89#endif
90#ifdef HAVE_REMOTE_LCD
91 if (particles[i][0] <= LCD_REMOTE_WIDTH
92 && particles[i][1] <= LCD_REMOTE_HEIGHT) {
93 rb->remote_clearrect(particles[i][0],particles[i][1],
94 FLAKE_WIDTH,FLAKE_WIDTH);
95 }
96#endif
90 switch ((rb->rand()%7)) { 97 switch ((rb->rand()%7)) {
91 case 0: 98 case 0:
92 particles[i][0]++; 99 particles[i][0]++;
@@ -110,6 +117,13 @@ static void snow_move(void)
110#else 117#else
111 pgfx_drawpixel(particles[i][0],particles[i][1]); 118 pgfx_drawpixel(particles[i][0],particles[i][1]);
112#endif 119#endif
120#ifdef HAVE_REMOTE_LCD
121 if (particles[i][0] <= LCD_REMOTE_WIDTH
122 && particles[i][1] <= LCD_REMOTE_HEIGHT) {
123 rb->remote_bitmap(flake,particles[i][0],particles[i][1],
124 FLAKE_WIDTH,FLAKE_WIDTH,true);
125 }
126#endif
113 } 127 }
114 } 128 }
115} 129}
@@ -131,6 +145,9 @@ static void snow_init(void)
131 pgfx_display(8, 0); 145 pgfx_display(8, 0);
132 pgfx_clear_display(); 146 pgfx_clear_display();
133#endif 147#endif
148#ifdef HAVE_REMOTE_LCD
149 rb->remote_clear_display();
150#endif
134} 151}
135 152
136enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 153enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
@@ -155,6 +172,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
155#else 172#else
156 pgfx_update(); 173 pgfx_update();
157#endif 174#endif
175#ifdef HAVE_REMOTE_LCD
176 rb->remote_update();
177#endif
158 rb->sleep(HZ/20); 178 rb->sleep(HZ/20);
159 179
160 button = rb->button_get(false); 180 button = rb->button_get(false);
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config
index 461be862c1..9106739388 100644
--- a/apps/plugins/viewers.config
+++ b/apps/plugins/viewers.config
@@ -18,4 +18,4 @@ wv,wv2wav.rock, 00 00 00 00 00 00
18m3u,iriverify.rock,00 00 00 00 00 00 18m3u,iriverify.rock,00 00 00 00 00 00
19mpc,mpc2wav.rock, 00 00 00 00 00 00 19mpc,mpc2wav.rock, 00 00 00 00 00 00
20mid,midi2wav.rock, 20 70 70 3F 00 00 20mid,midi2wav.rock, 20 70 70 3F 00 00
21rsp,searchengine.rock, 00 00 00 00 00 00 21rsp,searchengine.rock, 06 03 5B 5B 0F 06