summaryrefslogtreecommitdiff
path: root/apps/recorder/icons.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/icons.c')
-rw-r--r--apps/recorder/icons.c169
1 files changed, 169 insertions, 0 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 50475eb8c9..482c764b52 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -19,6 +19,12 @@
19#include <lcd.h> 19#include <lcd.h>
20 20
21#include "icons.h" 21#include "icons.h"
22#ifndef SIMULATOR
23#include "sprintf.h"
24#endif
25#ifdef HAVE_RTC
26#include "rtc.h"
27#endif
22 28
23#ifdef HAVE_LCD_BITMAP 29#ifdef HAVE_LCD_BITMAP
24 30
@@ -34,6 +40,12 @@ unsigned char slider_bar[] =
34 0x7c, 0x28, 0x28, 0x28, 0x28, 0x38 40 0x7c, 0x28, 0x28, 0x28, 0x28, 0x38
35}; 41};
36 42
43static unsigned char bitmap_icon_5x8[][5] =
44{
45 /* Lock */
46 {0x78,0x7f,0x49,0x7f,0x78}
47};
48
37unsigned char bitmap_icons_6x8[LastIcon][6] = 49unsigned char bitmap_icons_6x8[LastIcon][6] =
38{ 50{
39 /* Box_Filled */ 51 /* Box_Filled */
@@ -58,6 +70,36 @@ unsigned char bitmap_icons_6x8[LastIcon][6] =
58 { 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x00 }, 70 { 0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x00 },
59}; 71};
60 72
73static unsigned char bitmap_icon_7x8[][7] =
74{
75 /* Power plug */
76 {0x08,0x1c,0x1c,0x3e,0x3e,0x14,0x14},
77 /* Speaker */
78 {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00},
79 /* Speaker mute */
80 {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40},
81 /* Play */
82 {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00},
83 /* Stop */
84 {0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f},
85 /* Pause */
86 {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00},
87 /* Fast forward */
88 {0x7f,0x3e,0x1c,0x7f,0x3e,0x1c,0x08},
89 /* Fast backward */
90 {0x08,0x1c,0x3e,0x7f,0x1c,0x3e,0x7f},
91 /* Record */
92 {0x1c,0x3e,0x7f,0x7f,0x7f,0x3e,0x1c},
93 /* Record pause */
94 {0x1c,0x3e,0x7f,0x00,0x7f,0x3e,0x1c},
95 /* Normal playmode */
96 {0x08,0x08,0x08,0x08,0x3e,0x1c,0x08},
97 /* Repeat playmode */
98 {0x38,0x44,0x44,0x4e,0x5f,0x44,0x38},
99 /* Shuffle playmode (dice) */
100 {0x3e,0x41,0x51,0x41,0x45,0x41,0x3e}
101};
102
61unsigned char rockbox112x37[]={ 103unsigned char rockbox112x37[]={
62 0x00, 0x00, 0x02, 0xff, 0x02, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 104 0x00, 0x00, 0x02, 0xff, 0x02, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa,
63 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 105 0xf8, 0xf8, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xf8, 0xfc,
@@ -111,4 +153,131 @@ unsigned char rockbox112x37[]={
111 153
112}; 154};
113 155
156/*
157 * Wipe statusbar
158 */
159void statusbar_wipe(void)
160{
161 int x;
162
163 for (x = 0; x < LCD_WIDTH; x++)
164 lcd_framebuffer[x][STATUSBAR_Y_POS/8]=0x00;
165}
166
167/*
168 * Print battery icon to status bar
169 */
170void statusbar_icon_battery(int percent, bool charging)
171{
172 int i,j;
173 int fill;
174
175 /* draw battery */
176 for(i=0;i<17;i++) {
177 DRAW_PIXEL((ICON_BATTERY_X_POS+i),STATUSBAR_Y_POS);
178 DRAW_PIXEL((ICON_BATTERY_X_POS+i),(STATUSBAR_Y_POS+6));
179 }
180 for(i=1;i<6;i++) {
181 DRAW_PIXEL(ICON_BATTERY_X_POS,(STATUSBAR_Y_POS+i));
182 DRAW_PIXEL((ICON_BATTERY_X_POS+16),(STATUSBAR_Y_POS+i));
183 }
184 for(i=2;i<5;i++)
185 DRAW_PIXEL((ICON_BATTERY_X_POS+17),(STATUSBAR_Y_POS+i));
186
187 /* fill battery */
188 fill=percent;
189 if(fill<0)
190 fill=0;
191 if(fill>100)
192 fill=100;
193 fill=fill*15/100;
194
195 for(i=1;i<=fill;i++)
196 for(j=1;j<6;j++)
197 DRAW_PIXEL((ICON_BATTERY_X_POS+i),(STATUSBAR_Y_POS+j));
198
199 if(charging)
200 lcd_bitmap(bitmap_icon_7x8[Icon_Plug], ICON_PLUG_X_POS, STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false);
201};
202
203/*
204 * Print volume gauge to status bar
205 */
206void statusbar_icon_volume(int percent)
207{
208 int i,j;
209 int volume;
210 int step=0;
211
212 volume=percent;
213 if(volume<0)
214 volume=0;
215 if(volume>100)
216 volume=100;
217
218 if(volume==0)
219 lcd_bitmap(bitmap_icon_7x8[Icon_Mute], ICON_VOLUME_X_POS+ICON_VOLUME_WIDTH/2-4, STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false);
220 else {
221 volume=volume*14/100;
222 for(i=0;i<volume;i++) {
223 if(i%2 == 0)
224 step++;
225 for(j=1;j<=step;j++)
226 DRAW_PIXEL((ICON_VOLUME_X_POS+i),(STATUSBAR_Y_POS+7-j));
227 }
228 }
229}
230
231/*
232 * Print play state to status bar
233 */
234void statusbar_icon_play_state(int state)
235{
236 lcd_bitmap(bitmap_icon_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false);
237}
238
239/*
240 * Print play mode to status bar
241 */
242void statusbar_icon_play_mode(int mode)
243{
244 lcd_bitmap(bitmap_icon_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS, ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT, false);
245}
246
247/*
248 * Print shuffle mode to status bar
249 */
250void statusbar_icon_shuffle(void)
251{
252 lcd_bitmap(bitmap_icon_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT, false);
253}
254
255/*
256 * Print lock when keys are locked
257 */
258void statusbar_icon_lock(void)
259{
260 lcd_bitmap(bitmap_icon_5x8[Icon_Lock], LOCK_X_POS, STATUSBAR_Y_POS, 5, 8, false);
261}
262
263#ifdef HAVE_RTC
264/*
265 * Print time to status bar
266 */
267void statusbar_time(void)
268{
269 int hour,minute;
270 unsigned char buffer[6];
271
272 hour = rtc_read(0x03);
273 minute = rtc_read(0x02);
274
275 snprintf(buffer, sizeof(buffer), "%d%d:%d%d",
276 (hour & 0x30) >> 4,
277 hour & 0x0f,
278 (minute & 0xf0) >> 4,
279 minute & 0x0f);
280 lcd_putsxy(TIME_X_POS, STATUSBAR_Y_POS, buffer, 0);
281}
282#endif
114#endif 283#endif