summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit-common.c8
-rw-r--r--firmware/drivers/lcd-1bit-vert.c2
-rw-r--r--firmware/drivers/lcd-bitmap-common.c10
-rw-r--r--firmware/drivers/lcd-charcell.c6
-rw-r--r--firmware/export/lcd-remote.h3
-rw-r--r--firmware/export/lcd.h4
-rw-r--r--firmware/export/scroll_engine.h24
-rw-r--r--firmware/rolo.c2
-rw-r--r--firmware/scroll_engine.c36
9 files changed, 53 insertions, 42 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index f8673ec6db..dffc1cf075 100644
--- a/firmware/drivers/lcd-16bit-common.c
+++ b/firmware/drivers/lcd-16bit-common.c
@@ -144,13 +144,9 @@ void lcd_clear_viewport(void)
144 } 144 }
145 145
146 if (current_vp == &default_vp) 146 if (current_vp == &default_vp)
147 { 147 lcd_scroll_stop();
148 lcd_scroll_info.lines = 0;
149 }
150 else 148 else
151 { 149 lcd_scroll_stop_viewport(current_vp);
152 lcd_scroll_stop(current_vp);
153 }
154} 150}
155 151
156/*** parameter handling ***/ 152/*** parameter handling ***/
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index 5cacf0a740..668c685187 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -226,7 +226,7 @@ void LCDFN(clear_viewport)(void)
226 226
227 current_vp->drawmode = oldmode; 227 current_vp->drawmode = oldmode;
228 228
229 LCDFN(scroll_stop)(current_vp); 229 LCDFN(scroll_stop_viewport)(current_vp);
230 } 230 }
231} 231}
232 232
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index a17ac51006..10a567edf1 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -178,6 +178,12 @@ void LCDFN(set_viewport)(struct viewport* vp)
178#endif 178#endif
179} 179}
180 180
181struct viewport *LCDFN(get_viewport)(bool *is_default)
182{
183 *is_default = (current_vp == &default_vp);
184 return current_vp;
185}
186
181void LCDFN(update_viewport)(void) 187void LCDFN(update_viewport)(void)
182{ 188{
183 LCDFN(update_rect)(current_vp->x, current_vp->y, 189 LCDFN(update_rect)(current_vp->x, current_vp->y,
@@ -405,7 +411,7 @@ void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str,
405 int style, int x_offset, int y_offset) 411 int style, int x_offset, int y_offset)
406{ 412{
407 int xpos, ypos, h; 413 int xpos, ypos, h;
408 LCDFN(scroll_stop_line)(current_vp, y); 414 LCDFN(scroll_stop_viewport_line)(current_vp, y);
409 if(!str) 415 if(!str)
410 return; 416 return;
411 417
@@ -491,7 +497,7 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string
491 if (restart) 497 if (restart)
492 { 498 {
493 /* remove any previously scrolling line at the same location */ 499 /* remove any previously scrolling line at the same location */
494 LCDFN(scroll_stop_line)(current_vp, y); 500 LCDFN(scroll_stop_viewport_line)(current_vp, y);
495 501
496 if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return; 502 if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
497 LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset); 503 LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c
index b59b270f9b..bdd02de1b6 100644
--- a/firmware/drivers/lcd-charcell.c
+++ b/firmware/drivers/lcd-charcell.c
@@ -377,7 +377,7 @@ void lcd_clear_viewport(void)
377 for (y = 0; y < current_vp->height; y++) 377 for (y = 0; y < current_vp->height; y++)
378 lcd_putxchar(x, y, xspace); 378 lcd_putxchar(x, y, xspace);
379 379
380 lcd_scroll_stop(current_vp); 380 lcd_scroll_stop_viewport(current_vp);
381 } 381 }
382} 382}
383 383
@@ -486,7 +486,7 @@ void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
486 return; 486 return;
487 487
488 /* make sure scrolling is turned off on the line we are updating */ 488 /* make sure scrolling is turned off on the line we are updating */
489 lcd_scroll_stop_line(current_vp, y); 489 lcd_scroll_stop_viewport_line(current_vp, y);
490 490
491 x = lcd_putsxyofs(x, y, offset, str); 491 x = lcd_putsxyofs(x, y, offset, str);
492 while (x < current_vp->width) 492 while (x < current_vp->width)
@@ -509,7 +509,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
509 return; 509 return;
510 510
511 /* remove any previously scrolling line at the same location */ 511 /* remove any previously scrolling line at the same location */
512 lcd_scroll_stop_line(current_vp, y); 512 lcd_scroll_stop_viewport_line(current_vp, y);
513 513
514 if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; 514 if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return;
515 515
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 6a3371fef2..74b668db3d 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -187,9 +187,6 @@ extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
187extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str, 187extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str,
188 int style, int x_offset, int y_offset); 188 int style, int x_offset, int y_offset);
189extern void lcd_remote_putc(int x, int y, unsigned short ch); 189extern void lcd_remote_putc(int x, int y, unsigned short ch);
190extern void lcd_remote_stop_scroll(void);
191extern void lcd_remote_scroll_speed(int speed);
192extern void lcd_remote_scroll_delay(int ms);
193extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); 190extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
194extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, 191extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
195 int style); 192 int style);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 5ad2d83513..7ea053f241 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -207,10 +207,6 @@ extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset);
207extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, 207extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
208 int offset); 208 int offset);
209extern void lcd_putc(int x, int y, unsigned long ucs); 209extern void lcd_putc(int x, int y, unsigned long ucs);
210extern void lcd_stop_scroll(void);
211extern void lcd_bidir_scroll(int threshold);
212extern void lcd_scroll_speed(int speed);
213extern void lcd_scroll_delay(int ms);
214extern void lcd_puts_scroll(int x, int y, const unsigned char* string); 210extern void lcd_puts_scroll(int x, int y, const unsigned char* string);
215extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, 211extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string,
216 int style); 212 int style);
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index 55f4120893..01a9a5e33d 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -29,14 +29,24 @@
29#include <lcd.h> 29#include <lcd.h>
30#include "file.h" 30#include "file.h"
31 31
32void scroll_init(void) INIT_ATTR; 32extern void scroll_init(void) INIT_ATTR;
33void lcd_scroll_stop(const struct viewport* vp); 33
34void lcd_scroll_stop_line(const struct viewport* vp, int y); 34extern void lcd_bidir_scroll(int threshold);
35void lcd_scroll_fn(void); 35extern void lcd_scroll_speed(int speed);
36extern void lcd_scroll_delay(int ms);
37
38extern void lcd_scroll_stop(void);
39extern void lcd_scroll_stop_viewport(const struct viewport *vp);
40extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line);
41extern void lcd_scroll_fn(void);
36#ifdef HAVE_REMOTE_LCD 42#ifdef HAVE_REMOTE_LCD
37void lcd_remote_scroll_fn(void); 43extern void lcd_remote_scroll_speed(int speed);
38void lcd_remote_scroll_stop(const struct viewport* vp); 44extern void lcd_remote_scroll_delay(int ms);
39void lcd_remote_scroll_stop_line(const struct viewport* vp, int y); 45
46extern void lcd_remote_scroll_stop(void);
47extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp);
48extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line);
49extern void lcd_remote_scroll_fn(void);
40#endif 50#endif
41 51
42/* internal usage, but in multiple drivers */ 52/* internal usage, but in multiple drivers */
diff --git a/firmware/rolo.c b/firmware/rolo.c
index 325e17e97f..79969bbbcf 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -115,7 +115,7 @@ static void rolo_error(const char *text)
115 button_get(true); 115 button_get(true);
116 button_get(true); 116 button_get(true);
117 button_get(true); 117 button_get(true);
118 lcd_stop_scroll(); 118 lcd_scroll_stop();
119} 119}
120 120
121#if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX 121#if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index bc356a8281..82af26afa8 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -41,6 +41,10 @@ static const char scroll_tick_table[18] = {
41 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 41 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1
42}; 42};
43 43
44/* imported private functions from lcd-bitmap-common.c */
45extern struct viewport *lcd_get_viewport(void);
46extern struct viewport *lcd_remote_get_viewport(void);
47
44static void scroll_thread(void); 48static void scroll_thread(void);
45static char scroll_stack[DEFAULT_STACK_SIZE*3]; 49static char scroll_stack[DEFAULT_STACK_SIZE*3];
46static const char scroll_name[] = "scroll"; 50static const char scroll_name[] = "scroll";
@@ -80,20 +84,21 @@ struct scroll_screen_info lcd_remote_scroll_info =
80}; 84};
81#endif /* HAVE_REMOTE_LCD */ 85#endif /* HAVE_REMOTE_LCD */
82 86
83void lcd_stop_scroll(void) 87void lcd_scroll_stop(void)
84{ 88{
85 lcd_scroll_info.lines = 0; 89 lcd_scroll_info.lines = 0;
86} 90}
87 91
88/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ 92/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */
89void lcd_scroll_stop_line(const struct viewport* current_vp, int y) 93void lcd_scroll_stop_viewport_line(const struct viewport *current_vp, int line)
90{ 94{
91 int i = 0; 95 int i = 0;
92 96
93 while (i < lcd_scroll_info.lines) 97 while (i < lcd_scroll_info.lines)
94 { 98 {
95 if ((lcd_scroll_info.scroll[i].vp == current_vp) && 99 struct viewport *vp = lcd_scroll_info.scroll[i].vp;
96 ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) 100 if (((vp == current_vp)) &&
101 ((line < 0) || (lcd_scroll_info.scroll[i].y == line)))
97 { 102 {
98 /* If i is not the last active line in the array, then move 103 /* If i is not the last active line in the array, then move
99 the last item to position i */ 104 the last item to position i */
@@ -106,7 +111,7 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y)
106 111
107 /* A line can only appear once, so we're done, 112 /* A line can only appear once, so we're done,
108 * unless we are clearing the whole viewport */ 113 * unless we are clearing the whole viewport */
109 if (y >= 0) 114 if (line >= 0)
110 return ; 115 return ;
111 } 116 }
112 else 117 else
@@ -117,9 +122,9 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y)
117} 122}
118 123
119/* Stop all scrolling lines in the specified viewport */ 124/* Stop all scrolling lines in the specified viewport */
120void lcd_scroll_stop(const struct viewport* vp) 125void lcd_scroll_stop_viewport(const struct viewport *current_vp)
121{ 126{
122 lcd_scroll_stop_line(vp, -1); 127 lcd_scroll_stop_viewport_line(current_vp, -1);
123} 128}
124 129
125void lcd_scroll_speed(int speed) 130void lcd_scroll_speed(int speed)
@@ -157,20 +162,21 @@ void lcd_jump_scroll_delay(int ms)
157#endif 162#endif
158 163
159#ifdef HAVE_REMOTE_LCD 164#ifdef HAVE_REMOTE_LCD
160void lcd_remote_stop_scroll(void) 165void lcd_remote_scroll_stop(void)
161{ 166{
162 lcd_remote_scroll_info.lines = 0; 167 lcd_remote_scroll_info.lines = 0;
163} 168}
164 169
165/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ 170/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */
166void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) 171void lcd_remote_scroll_stop_viewport_line(const struct viewport *current_vp, int line)
167{ 172{
168 int i = 0; 173 int i = 0;
169 174
170 while (i < lcd_remote_scroll_info.lines) 175 while (i < lcd_scroll_info.lines)
171 { 176 {
172 if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && 177 struct viewport *vp = lcd_remote_scroll_info.scroll[i].vp;
173 ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) 178 if (((vp == current_vp)) &&
179 ((line < 0) || (lcd_remote_scroll_info.scroll[i].y == line)))
174 { 180 {
175 /* If i is not the last active line in the array, then move 181 /* If i is not the last active line in the array, then move
176 the last item to position i */ 182 the last item to position i */
@@ -183,7 +189,7 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y)
183 189
184 /* A line can only appear once, so we're done, 190 /* A line can only appear once, so we're done,
185 * unless we are clearing the whole viewport */ 191 * unless we are clearing the whole viewport */
186 if (y >= 0) 192 if (line >= 0)
187 return ; 193 return ;
188 } 194 }
189 else 195 else
@@ -194,9 +200,9 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y)
194} 200}
195 201
196/* Stop all scrolling lines in the specified viewport */ 202/* Stop all scrolling lines in the specified viewport */
197void lcd_remote_scroll_stop(const struct viewport* vp) 203void lcd_remote_scroll_stop_viewport(const struct viewport *current_vp)
198{ 204{
199 lcd_remote_scroll_stop_line(vp, -1); 205 lcd_remote_scroll_stop_viewport_line(current_vp, -1);
200} 206}
201 207
202void lcd_remote_scroll_speed(int speed) 208void lcd_remote_scroll_speed(int speed)