diff options
| author | Kjell Ericson <kjell@haxx.se> | 2003-01-27 14:37:03 +0000 |
|---|---|---|
| committer | Kjell Ericson <kjell@haxx.se> | 2003-01-27 14:37:03 +0000 |
| commit | 565505abd4f4fe6aec3ac3a8c12f1b55018cb4d3 (patch) | |
| tree | d926d521f4af3b15645ef750c09e31eb4f5f1a5d /firmware | |
| parent | cc11e885d1ab32f11b322071260376de3788c62e (diff) | |
| download | rockbox-565505abd4f4fe6aec3ac3a8c12f1b55018cb4d3.zip rockbox-565505abd4f4fe6aec3ac3a8c12f1b55018cb4d3.tar.gz rockbox-565505abd4f4fe6aec3ac3a8c12f1b55018cb4d3.tar.bz2 rockbox-565505abd4f4fe6aec3ac3a8c12f1b55018cb4d3.tar.xz | |
Added a "cursor"-function for the keyvoard.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/drivers/lcd-player.c | 35 | ||||
| -rw-r--r-- | firmware/drivers/lcd.h | 1 |
2 files changed, 35 insertions, 1 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 0ca551c..a03b1b0 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c @@ -72,6 +72,17 @@ struct scrollinfo { int direction; /* +1 for right or -1 for left*/ }; +#define MAX_CURSOR_CHARS 8 +struct cursorinfo { + int len; + char text[MAX_CURSOR_CHARS]; + int textpos; + int y_pos; + int x_pos; + int divider; + int downcount; +} cursor; + static void scroll_thread(void); static char scroll_stack[DEFAULT_STACK_SIZE]; static char scroll_name[] = "scroll"; @@ -265,6 +276,7 @@ void lcd_clear_display(void) bool update=false; DEBUGF("lcd_clear_display()\n"); lcd_stop_scroll(); + cursor.len=0; /* Stop cursor */ for (i=0;i<22;i++) update|=lcdx_putc(i%11, i/11, ' '); if (update) @@ -301,6 +313,18 @@ void lcd_puts(int x, int y, unsigned char *string) return lcd_puts_cont_scroll(x, y, string); } +void lcd_put_cursor(int x, int y, char cursor_char) +{ + cursor.text[0]=buffer_xlcd[x][y]; + cursor.text[1]=cursor_char; + cursor.len=2; + cursor.textpos=0; + cursor.y_pos=y; + cursor.x_pos=x; + cursor.downcount=0; + cursor.divider=4; +} + void lcd_putc(int x, int y, unsigned short ch) { bool update; @@ -573,7 +597,16 @@ static void scroll_thread(void) lcd_puts_cont_scroll(s->startx, s->starty, buffer); } } - + if (cursor.len>0) { + if (cursor.downcount--<0) { + cursor.downcount=cursor.divider; + cursor.textpos++; + if (cursor.textpos>=cursor.len) + cursor.textpos=0; + update|=lcdx_putc(cursor.x_pos, cursor.y_pos, + cursor.text[cursor.textpos]); + } + } if (update) { lcd_update(); } diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index 6fe07c1..b4623c2 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h @@ -85,6 +85,7 @@ unsigned char lcd_get_locked_pattern(void); void lcd_unlock_pattern(unsigned char pat); void lcd_allow_bidirectional_scrolling(bool on); extern void lcd_bidir_scroll(int threshold); +void lcd_put_cursor(int x, int y, char cursor_char); #endif #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) |