diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 185f572182..1aed98e5f6 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -34,13 +34,11 @@ | |||
34 | 34 | ||
35 | #define SCROLLABLE_LINES 26 | 35 | #define SCROLLABLE_LINES 26 |
36 | 36 | ||
37 | #define RGB_PACK(r,g,b) (htobe16(((r)<<11)|((g)<<5)|(b))) | ||
38 | |||
39 | /*** globals ***/ | 37 | /*** globals ***/ |
40 | fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (4))); | 38 | fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (4))); |
41 | 39 | ||
42 | static unsigned fg_pattern; | 40 | static unsigned fg_pattern = LCD_DEFAULT_FG; |
43 | static unsigned bg_pattern; | 41 | static unsigned bg_pattern = LCD_DEFAULT_BG; |
44 | static int drawmode = DRMODE_SOLID; | 42 | static int drawmode = DRMODE_SOLID; |
45 | static int xmargin = 0; | 43 | static int xmargin = 0; |
46 | static int ymargin = 0; | 44 | static int ymargin = 0; |
@@ -72,9 +70,6 @@ int lcd_default_contrast(void) | |||
72 | /* LCD init */ | 70 | /* LCD init */ |
73 | void lcd_init(void) | 71 | void lcd_init(void) |
74 | { | 72 | { |
75 | fg_pattern = 0x0000; /* Black */ | ||
76 | bg_pattern = RGB_PACK(0x17, 0x31, 0x1d); /* "Rockbox blue" */ | ||
77 | |||
78 | lcd_clear_display(); | 73 | lcd_clear_display(); |
79 | /* Call device specific init */ | 74 | /* Call device specific init */ |
80 | lcd_init_device(); | 75 | lcd_init_device(); |
@@ -94,43 +89,32 @@ int lcd_get_drawmode(void) | |||
94 | return drawmode; | 89 | return drawmode; |
95 | } | 90 | } |
96 | 91 | ||
97 | void lcd_set_foreground(struct rgb color) | 92 | void lcd_set_foreground(unsigned color) |
98 | { | 93 | { |
99 | fg_pattern = RGB_PACK(color.red, color.green, color.blue); | 94 | fg_pattern = color; |
100 | } | 95 | } |
101 | 96 | ||
102 | struct rgb lcd_get_foreground(void) | 97 | unsigned lcd_get_foreground(void) |
103 | { | 98 | { |
104 | struct rgb colour; | 99 | return fg_pattern; |
105 | |||
106 | colour.red = (fg_pattern >> 11) & 0x1f; | ||
107 | colour.green = (fg_pattern >> 5) & 0x3f; | ||
108 | colour.blue = fg_pattern & 0x1f; | ||
109 | return colour; | ||
110 | } | 100 | } |
111 | 101 | ||
112 | void lcd_set_background(struct rgb color) | 102 | void lcd_set_background(unsigned color) |
113 | { | 103 | { |
114 | bg_pattern = RGB_PACK(color.red, color.green, color. blue); | 104 | bg_pattern = color; |
115 | } | 105 | } |
116 | 106 | ||
117 | 107 | ||
118 | struct rgb lcd_get_background(void) | 108 | unsigned lcd_get_background(void) |
119 | { | 109 | { |
120 | struct rgb colour; | 110 | return bg_pattern; |
121 | |||
122 | colour.red = (bg_pattern >> 11) & 0x1f; | ||
123 | colour.green = (bg_pattern >> 5) & 0x3f; | ||
124 | colour.blue = bg_pattern & 0x1f; | ||
125 | return colour; | ||
126 | } | 111 | } |
127 | 112 | ||
128 | void lcd_set_drawinfo(int mode, struct rgb fg_color, | 113 | void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) |
129 | struct rgb bg_color) | ||
130 | { | 114 | { |
131 | lcd_set_drawmode(mode); | 115 | lcd_set_drawmode(mode); |
132 | lcd_set_foreground(fg_color); | 116 | fg_pattern = fg_color; |
133 | lcd_set_background(bg_color); | 117 | bg_pattern = bg_color; |
134 | } | 118 | } |
135 | 119 | ||
136 | void lcd_setmargins(int x, int y) | 120 | void lcd_setmargins(int x, int y) |