diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd.c | 57 | ||||
-rw-r--r-- | firmware/drivers/lcd.h | 53 |
2 files changed, 81 insertions, 29 deletions
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) | |||
375 | lcd_write(true,on?9:8); | 375 | lcd_write(true,on?9:8); |
376 | } | 376 | } |
377 | 377 | ||
378 | unsigned char icon_mirror[11]; | ||
379 | static char icon_pos[] = | ||
380 | { | ||
381 | 0, 0, 0, 0, /* Battery */ | ||
382 | 2, /* USB */ | ||
383 | 3, /* Play */ | ||
384 | 4, /* Record */ | ||
385 | 5, /* Pause */ | ||
386 | 5, /* Audio */ | ||
387 | 6, /* Repeat */ | ||
388 | 7, /* 1 */ | ||
389 | 9, /* Volume */ | ||
390 | 9, /* Volume 1 */ | ||
391 | 9, /* Volume 2 */ | ||
392 | 10, /* Volume 3 */ | ||
393 | 10, /* Volume 4 */ | ||
394 | 10, /* Volume 5 */ | ||
395 | 10, /* Param */ | ||
396 | }; | ||
397 | |||
398 | static char icon_mask[] = | ||
399 | { | ||
400 | 0x02, 0x08, 0x04, 0x10, /* Battery */ | ||
401 | 0x04, /* USB */ | ||
402 | 0x10, /* Play */ | ||
403 | 0x10, /* Record */ | ||
404 | 0x02, /* Pause */ | ||
405 | 0x10, /* Audio */ | ||
406 | 0x02, /* Repeat */ | ||
407 | 0x01, /* 1 */ | ||
408 | 0x04, /* Volume */ | ||
409 | 0x02, /* Volume 1 */ | ||
410 | 0x01, /* Volume 2 */ | ||
411 | 0x08, /* Volume 3 */ | ||
412 | 0x04, /* Volume 4 */ | ||
413 | 0x01, /* Volume 5 */ | ||
414 | 0x10, /* Param */ | ||
415 | }; | ||
416 | |||
417 | void lcd_icon(int icon, bool enable) | ||
418 | { | ||
419 | int pos, mask; | ||
420 | |||
421 | pos = icon_pos[icon]; | ||
422 | mask = icon_mask[icon]; | ||
423 | |||
424 | lcd_write(true, LCD_ICON(pos)); | ||
425 | |||
426 | if(enable) | ||
427 | icon_mirror[pos] |= mask; | ||
428 | else | ||
429 | icon_mirror[pos] &= ~mask; | ||
430 | |||
431 | lcd_write(false, icon_mirror[pos]); | ||
432 | } | ||
378 | #endif /* !SIMULATOR */ | 433 | #endif /* !SIMULATOR */ |
379 | 434 | ||
380 | #endif /* HAVE_LCD_CHARCELLS */ | 435 | #endif /* HAVE_LCD_CHARCELLS */ |
@@ -384,6 +439,8 @@ void lcd_init (void) | |||
384 | { | 439 | { |
385 | create_thread(scroll_thread, scroll_stack, | 440 | create_thread(scroll_thread, scroll_stack, |
386 | sizeof(scroll_stack), scroll_name); | 441 | sizeof(scroll_stack), scroll_name); |
442 | |||
443 | memset(icon_mirror, sizeof(icon_mirror), 0); | ||
387 | } | 444 | } |
388 | #endif | 445 | #endif |
389 | 446 | ||
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); | |||
30 | extern void lcd_backlight(bool on); | 30 | extern void lcd_backlight(bool on); |
31 | extern void lcd_puts(int x, int y, unsigned char *string); | 31 | extern void lcd_puts(int x, int y, unsigned char *string); |
32 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); | 32 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); |
33 | extern void lcd_icon(int icon, bool enable); | ||
33 | extern void lcd_stop_scroll(void); | 34 | extern void lcd_stop_scroll(void); |
34 | extern void lcd_scroll_speed( int speed ); | 35 | extern void lcd_scroll_speed( int speed ); |
35 | 36 | ||
@@ -40,35 +41,29 @@ extern void lcd_scroll_speed( int speed ); | |||
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | #ifdef HAVE_LCD_CHARCELLS | 43 | #ifdef HAVE_LCD_CHARCELLS |
43 | # define LCD_ICON_BATTERY 0 | 44 | |
44 | # define LCD_BATTERY_FRAME 0x02 | 45 | /* Icon definitions for lcd_icon() */ |
45 | # define LCD_BATTERY_BAR1 0x08 | 46 | enum |
46 | # define LCD_BATTERY_BAR2 0x04 | 47 | { |
47 | # define LCD_BATTERY_BAR3 0x10 | 48 | ICON_BATTERY = 0, |
48 | # define LCD_ICON_USB 2 | 49 | ICON_BATTERY_1, |
49 | # define LCD_USB_LOGO 0xFF | 50 | ICON_BATTERY_2, |
50 | # define LCD_ICON_PLAY 3 | 51 | ICON_BATTERY_3, |
51 | # define LCD_PLAY_ICON 0xFF | 52 | ICON_USB, |
52 | # define LCD_ICON_RECORD 4 | 53 | ICON_PLAY, |
53 | # define LCD_RECORD_ICON 0x10 | 54 | ICON_RECORD, |
54 | # define LCD_ICON_STOP 5 | 55 | ICON_PAUSE, |
55 | # define LCD_STOP_ICON 0x0F | 56 | ICON_AUDIO, |
56 | # define LCD_ICON_AUDIO 5 | 57 | ICON_REPEAT, |
57 | # define LCD_AUDIO_ICON 0xF0 | 58 | ICON_1, |
58 | # define LCD_ICON_REVERSE 6 | 59 | ICON_VOLUME, |
59 | # define LCD_REVERSE_ICON 0xFF | 60 | ICON_VOLUME_1, |
60 | # define LCD_ICON_SINGLE 7 | 61 | ICON_VOLUME_2, |
61 | # define LCD_SINGLE_ICON 0xFF | 62 | ICON_VOLUME_3, |
62 | # define LCD_ICON_VOLUME0 9 | 63 | ICON_VOLUME_4, |
63 | # define LCD_VOLUME_ICON 0x04 | 64 | ICON_VOLUME_5, |
64 | # define LCD_VOLUME_BAR1 0x02 | 65 | ICON_PARAM |
65 | # define LCD_VOLUME_BAR2 0x01 | 66 | }; |
66 | # define LCD_ICON_VOLUME1 10 | ||
67 | # define LCD_VOLUME_BAR3 0x08 | ||
68 | # define LCD_VOLUME_BAR4 0x04 | ||
69 | # define LCD_VOLUME_BAR5 0x01 | ||
70 | # define LCD_ICON_PARAM 10 | ||
71 | # define LCD_PARAM_SYMBOL 0xF0 | ||
72 | 67 | ||
73 | extern void lcd_define_pattern (int which,char *pattern,int length); | 68 | extern void lcd_define_pattern (int which,char *pattern,int length); |
74 | extern void lcd_double_height (bool on); | 69 | extern void lcd_double_height (bool on); |