summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-player.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-15 20:30:29 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-15 20:30:29 +0000
commit566eae2e119f3c57b1df0782ddcc29fccedbf816 (patch)
treefc8cced8cd199734b2185a20efdfd2ebbcce41bb /firmware/drivers/lcd-player.c
parent672305f0a1fe8e423904f95d5cb22aea68ff4c62 (diff)
downloadrockbox-566eae2e119f3c57b1df0782ddcc29fccedbf816.tar.gz
rockbox-566eae2e119f3c57b1df0782ddcc29fccedbf816.zip
Logarithmic scroll speed setting: speed doubles every 3 steps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5288 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-player.c')
-rw-r--r--firmware/drivers/lcd-player.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 01d7cfdb6e..8dd97cac0a 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -88,7 +88,7 @@ struct cursorinfo {
88static void scroll_thread(void); 88static void scroll_thread(void);
89static char scroll_stack[DEFAULT_STACK_SIZE]; 89static char scroll_stack[DEFAULT_STACK_SIZE];
90static const char scroll_name[] = "scroll"; 90static const char scroll_name[] = "scroll";
91static char scroll_speed = 8; /* updates per second */ 91static char scroll_ticks = 12; /* # of ticks between updates */
92static int scroll_delay = HZ/2; /* delay before starting scroll */ 92static int scroll_delay = HZ/2; /* delay before starting scroll */
93static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */ 93static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */
94static char scroll_spacing = 3; /* spaces between end and start of text */ 94static char scroll_spacing = 3; /* spaces between end and start of text */
@@ -547,7 +547,7 @@ void lcd_puts_scroll(int x, int y, const unsigned char* string )
547 s->direction=+1; 547 s->direction=+1;
548 s->jump_scroll=0; 548 s->jump_scroll=0;
549 s->jump_scroll_steps=0; 549 s->jump_scroll_steps=0;
550 if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) { 550 if (jump_scroll && jump_scroll_delay<scroll_ticks*(s->textlen-11+x)) {
551 s->jump_scroll_steps=11-x; 551 s->jump_scroll_steps=11-x;
552 s->jump_scroll=jump_scroll; 552 s->jump_scroll=jump_scroll;
553 } 553 }
@@ -593,9 +593,15 @@ void lcd_allow_bidirectional_scrolling(bool on)
593 allow_bidirectional_scrolling=on; 593 allow_bidirectional_scrolling=on;
594} 594}
595 595
596static const char scroll_tick_table[16] = {
597 /* Hz values:
598 1, 1.25, 1.55, 2, 2.5, 3.12, 4, 5, 6.25, 8.33, 10, 12.5, 16.7, 20, 25, 33 */
599 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
600};
601
596void lcd_scroll_speed(int speed) 602void lcd_scroll_speed(int speed)
597{ 603{
598 scroll_speed = speed; 604 scroll_ticks = scroll_tick_table[speed];
599} 605}
600 606
601void lcd_scroll_delay(int ms) 607void lcd_scroll_delay(int ms)
@@ -723,7 +729,7 @@ static void scroll_thread(void)
723 } 729 }
724 } 730 }
725 731
726 sleep(HZ/scroll_speed); 732 sleep(scroll_ticks);
727 } 733 }
728} 734}
729 735