diff options
Diffstat (limited to 'firmware/drivers/lcd-player.c')
-rw-r--r-- | firmware/drivers/lcd-player.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 3344a7478a..90e1d48e00 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -105,7 +105,7 @@ static char pattern_size; /* Last pattern, 3 for old LCD, 7 for new LCD */ | |||
105 | 105 | ||
106 | static bool new_lcd; | 106 | static bool new_lcd; |
107 | 107 | ||
108 | extern unsigned short *lcd_ascii; | 108 | unsigned short *lcd_ascii; |
109 | static char lcd_contrast_set; | 109 | static char lcd_contrast_set; |
110 | static char lcd_cram; | 110 | static char lcd_cram; |
111 | static char lcd_pram; | 111 | static char lcd_pram; |
@@ -130,7 +130,9 @@ static void lcd_free_pat(int map_ch) | |||
130 | 130 | ||
131 | substitute_char=lcd_player_extended_lcd_to_rocklatin1[map_ch]; | 131 | substitute_char=lcd_player_extended_lcd_to_rocklatin1[map_ch]; |
132 | 132 | ||
133 | /* TODO: use a define for the screen width! */ | ||
133 | for (x=0; x<11; x++) { | 134 | for (x=0; x<11; x++) { |
135 | /* TODO: use a define for the screen height! */ | ||
134 | for (y=0; y<2; y++) { | 136 | for (y=0; y<2; y++) { |
135 | if (map_ch==lcd_ascii[buffer_xlcd[x][y]]-512) { | 137 | if (map_ch==lcd_ascii[buffer_xlcd[x][y]]-512) { |
136 | buffer_xlcd[x][y]=substitute_char; | 138 | buffer_xlcd[x][y]=substitute_char; |
@@ -480,7 +482,11 @@ void lcd_set_contrast(int val) | |||
480 | 482 | ||
481 | void lcd_init (void) | 483 | void lcd_init (void) |
482 | { | 484 | { |
485 | #ifdef HAVE_NEO_LCD | ||
486 | new_lcd = true; | ||
487 | #else | ||
483 | new_lcd = has_new_lcd(); | 488 | new_lcd = has_new_lcd(); |
489 | #endif | ||
484 | memset(extended_chars_mapped, NO_CHAR, sizeof(extended_chars_mapped)); | 490 | memset(extended_chars_mapped, NO_CHAR, sizeof(extended_chars_mapped)); |
485 | memset(extended_pattern_content, NO_CHAR,sizeof(extended_pattern_content)); | 491 | memset(extended_pattern_content, NO_CHAR,sizeof(extended_pattern_content)); |
486 | memset(extended_pattern_usage, 0, sizeof(extended_pattern_usage)); | 492 | memset(extended_pattern_usage, 0, sizeof(extended_pattern_usage)); |
@@ -491,7 +497,7 @@ void lcd_init (void) | |||
491 | lcd_cram = NEW_LCD_CRAM; | 497 | lcd_cram = NEW_LCD_CRAM; |
492 | lcd_pram = NEW_LCD_PRAM; | 498 | lcd_pram = NEW_LCD_PRAM; |
493 | lcd_iram = NEW_LCD_IRAM; | 499 | lcd_iram = NEW_LCD_IRAM; |
494 | pattern_size=7; /* Last pattern, 3 for old LCD, 7 for new LCD */ | 500 | pattern_size=7; /* Last pattern, 7 for new LCD */ |
495 | } | 501 | } |
496 | else { | 502 | else { |
497 | lcd_ascii = old_lcd_rocklatin1_to_xlcd; | 503 | lcd_ascii = old_lcd_rocklatin1_to_xlcd; |
@@ -499,7 +505,7 @@ void lcd_init (void) | |||
499 | lcd_cram = OLD_LCD_CRAM; | 505 | lcd_cram = OLD_LCD_CRAM; |
500 | lcd_pram = OLD_LCD_PRAM; | 506 | lcd_pram = OLD_LCD_PRAM; |
501 | lcd_iram = OLD_LCD_IRAM; | 507 | lcd_iram = OLD_LCD_IRAM; |
502 | pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */ | 508 | pattern_size=3; /* Last pattern, 3 for old LCD */ |
503 | } | 509 | } |
504 | 510 | ||
505 | lcd_set_contrast(lcd_default_contrast()); | 511 | lcd_set_contrast(lcd_default_contrast()); |
@@ -719,4 +725,46 @@ static void scroll_thread(void) | |||
719 | } | 725 | } |
720 | } | 726 | } |
721 | 727 | ||
728 | #ifdef HAVE_NEO_LCD | ||
729 | |||
730 | /* | ||
731 | * Function use by the Neo code, but could/should be made a generic one. | ||
732 | */ | ||
733 | void lcd_cursor(int x, int y) | ||
734 | { | ||
735 | /* If we make sure the display size is setup with proper defines in the | ||
736 | config-*.h files, this should work on all displays */ | ||
737 | if ((cursor.y_pos==y && cursor.x_pos==x) || | ||
738 | x>=20 || | ||
739 | y>3 || | ||
740 | x<0 || | ||
741 | y<0) { | ||
742 | DEBUGF("ignoring request for cursor to %d,%d - currently %d,%d\n", | ||
743 | x,y,cursor.x_pos,cursor.y_pos); | ||
744 | return; | ||
745 | } | ||
746 | |||
747 | char value=0; | ||
748 | |||
749 | cursor.y_pos=y; | ||
750 | cursor.x_pos=x; | ||
751 | |||
752 | switch (y) { | ||
753 | case 0: | ||
754 | value=0x80|x; | ||
755 | break; | ||
756 | case 1: | ||
757 | value=0x80|(x+0x40); | ||
758 | break; | ||
759 | case 2: | ||
760 | value=0x80|(x+0x14); | ||
761 | break; | ||
762 | case 3: | ||
763 | value=0x80|(x+0x54); | ||
764 | break; | ||
765 | } | ||
766 | lcd_write(true,value); | ||
767 | } | ||
768 | #endif | ||
769 | |||
722 | #endif /* HAVE_LCD_CHARCELLS */ | 770 | #endif /* HAVE_LCD_CHARCELLS */ |