From cc22cd0736e465f47f4017bd6f4a4729c767456a Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 22 Jul 2002 22:37:03 +0000 Subject: Added icon functions for the Player model git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1404 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ firmware/drivers/lcd.h | 53 +++++++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 29 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index ef1c3fc262..89f00d220a 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c @@ -375,6 +375,61 @@ void lcd_double_height(bool on) lcd_write(true,on?9:8); } +unsigned char icon_mirror[11]; +static char icon_pos[] = +{ + 0, 0, 0, 0, /* Battery */ + 2, /* USB */ + 3, /* Play */ + 4, /* Record */ + 5, /* Pause */ + 5, /* Audio */ + 6, /* Repeat */ + 7, /* 1 */ + 9, /* Volume */ + 9, /* Volume 1 */ + 9, /* Volume 2 */ + 10, /* Volume 3 */ + 10, /* Volume 4 */ + 10, /* Volume 5 */ + 10, /* Param */ +}; + +static char icon_mask[] = +{ + 0x02, 0x08, 0x04, 0x10, /* Battery */ + 0x04, /* USB */ + 0x10, /* Play */ + 0x10, /* Record */ + 0x02, /* Pause */ + 0x10, /* Audio */ + 0x02, /* Repeat */ + 0x01, /* 1 */ + 0x04, /* Volume */ + 0x02, /* Volume 1 */ + 0x01, /* Volume 2 */ + 0x08, /* Volume 3 */ + 0x04, /* Volume 4 */ + 0x01, /* Volume 5 */ + 0x10, /* Param */ +}; + +void lcd_icon(int icon, bool enable) +{ + int pos, mask; + + pos = icon_pos[icon]; + mask = icon_mask[icon]; + + lcd_write(true, LCD_ICON(pos)); + + if(enable) + icon_mirror[pos] |= mask; + else + icon_mirror[pos] &= ~mask; + + lcd_write(false, icon_mirror[pos]); +} #endif /* !SIMULATOR */ #endif /* HAVE_LCD_CHARCELLS */ @@ -384,6 +439,8 @@ void lcd_init (void) { create_thread(scroll_thread, scroll_stack, sizeof(scroll_stack), scroll_name); + + memset(icon_mirror, sizeof(icon_mirror), 0); } #endif diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index 6651fe52e4..581ec3461d 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h @@ -30,6 +30,7 @@ extern void lcd_clear_display(void); extern void lcd_backlight(bool on); extern void lcd_puts(int x, int y, unsigned char *string); extern void lcd_puts_scroll(int x, int y, unsigned char* string ); +extern void lcd_icon(int icon, bool enable); extern void lcd_stop_scroll(void); extern void lcd_scroll_speed( int speed ); @@ -40,35 +41,29 @@ extern void lcd_scroll_speed( int speed ); #endif #ifdef HAVE_LCD_CHARCELLS -# define LCD_ICON_BATTERY 0 -# define LCD_BATTERY_FRAME 0x02 -# define LCD_BATTERY_BAR1 0x08 -# define LCD_BATTERY_BAR2 0x04 -# define LCD_BATTERY_BAR3 0x10 -# define LCD_ICON_USB 2 -# define LCD_USB_LOGO 0xFF -# define LCD_ICON_PLAY 3 -# define LCD_PLAY_ICON 0xFF -# define LCD_ICON_RECORD 4 -# define LCD_RECORD_ICON 0x10 -# define LCD_ICON_STOP 5 -# define LCD_STOP_ICON 0x0F -# define LCD_ICON_AUDIO 5 -# define LCD_AUDIO_ICON 0xF0 -# define LCD_ICON_REVERSE 6 -# define LCD_REVERSE_ICON 0xFF -# define LCD_ICON_SINGLE 7 -# define LCD_SINGLE_ICON 0xFF -# define LCD_ICON_VOLUME0 9 -# define LCD_VOLUME_ICON 0x04 -# define LCD_VOLUME_BAR1 0x02 -# define LCD_VOLUME_BAR2 0x01 -# define LCD_ICON_VOLUME1 10 -# define LCD_VOLUME_BAR3 0x08 -# define LCD_VOLUME_BAR4 0x04 -# define LCD_VOLUME_BAR5 0x01 -# define LCD_ICON_PARAM 10 -# define LCD_PARAM_SYMBOL 0xF0 + +/* Icon definitions for lcd_icon() */ +enum +{ + ICON_BATTERY = 0, + ICON_BATTERY_1, + ICON_BATTERY_2, + ICON_BATTERY_3, + ICON_USB, + ICON_PLAY, + ICON_RECORD, + ICON_PAUSE, + ICON_AUDIO, + ICON_REPEAT, + ICON_1, + ICON_VOLUME, + ICON_VOLUME_1, + ICON_VOLUME_2, + ICON_VOLUME_3, + ICON_VOLUME_4, + ICON_VOLUME_5, + ICON_PARAM +}; extern void lcd_define_pattern (int which,char *pattern,int length); extern void lcd_double_height (bool on); -- cgit v1.2.3