summaryrefslogtreecommitdiff
path: root/firmware/scroll_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/scroll_engine.c')
-rw-r--r--firmware/scroll_engine.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index 599e7f58b5..4783e9f1ef 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -82,6 +82,40 @@ void lcd_stop_scroll(void)
82 lcd_scroll_info.lines = 0; 82 lcd_scroll_info.lines = 0;
83} 83}
84 84
85/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */
86void lcd_scroll_stop_line(struct viewport* current_vp, int y)
87{
88 int i = 0;
89
90 while (i < lcd_scroll_info.lines)
91 {
92 if ((lcd_scroll_info.scroll[i].vp == current_vp) &&
93 ((y < 0) || (lcd_scroll_info.scroll[i].y == y)))
94 {
95 /* If i is not the last active line in the array, then move
96 the last item to position i */
97 if ((i + 1) != lcd_scroll_info.lines)
98 {
99 lcd_scroll_info.scroll[i] = lcd_scroll_info.scroll[lcd_scroll_info.lines-1];
100 }
101 lcd_scroll_info.lines--;
102
103 /* A line can only appear once, so we're done. */
104 return ;
105 }
106 else
107 {
108 i++;
109 }
110 }
111}
112
113/* Stop all scrolling lines in the specified viewport */
114void lcd_scroll_stop(struct viewport* vp)
115{
116 lcd_scroll_stop_line(vp, -1);
117}
118
85void lcd_scroll_speed(int speed) 119void lcd_scroll_speed(int speed)
86{ 120{
87 lcd_scroll_info.ticks = scroll_tick_table[speed]; 121 lcd_scroll_info.ticks = scroll_tick_table[speed];
@@ -122,6 +156,40 @@ void lcd_remote_stop_scroll(void)
122 lcd_remote_scroll_info.lines = 0; 156 lcd_remote_scroll_info.lines = 0;
123} 157}
124 158
159/* Stop scrolling line y in the specified viewport, or all lines if y < 0 */
160void lcd_remote_scroll_stop_line(struct viewport* current_vp, int y)
161{
162 int i = 0;
163
164 while (i < lcd_remote_scroll_info.lines)
165 {
166 if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) &&
167 ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y)))
168 {
169 /* If i is not the last active line in the array, then move
170 the last item to position i */
171 if ((i + 1) != lcd_remote_scroll_info.lines)
172 {
173 lcd_remote_scroll_info.scroll[i] = lcd_remote_scroll_info.scroll[lcd_remote_scroll_info.lines-1];
174 }
175 lcd_remote_scroll_info.lines--;
176
177 /* A line can only appear once, so we're done. */
178 return ;
179 }
180 else
181 {
182 i++;
183 }
184 }
185}
186
187/* Stop all scrolling lines in the specified viewport */
188void lcd_remote_scroll_stop(struct viewport* vp)
189{
190 lcd_remote_scroll_stop_line(vp, -1);
191}
192
125void lcd_remote_scroll_speed(int speed) 193void lcd_remote_scroll_speed(int speed)
126{ 194{
127 lcd_remote_scroll_info.ticks = scroll_tick_table[speed]; 195 lcd_remote_scroll_info.ticks = scroll_tick_table[speed];