diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/status.c | 99 | ||||
-rw-r--r-- | apps/status.h | 33 |
2 files changed, 132 insertions, 0 deletions
diff --git a/apps/status.c b/apps/status.c new file mode 100644 index 0000000000..781fa90842 --- /dev/null +++ b/apps/status.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "lcd.h" | ||
20 | #include "debug.h" | ||
21 | #include "kernel.h" | ||
22 | #include "power.h" | ||
23 | #include "thread.h" | ||
24 | #include "settings.h" | ||
25 | #include "status.h" | ||
26 | |||
27 | static enum playmode current_mode; | ||
28 | |||
29 | void status_init(void) | ||
30 | { | ||
31 | status_set_playmode(STATUS_STOP); | ||
32 | } | ||
33 | |||
34 | void status_set_playmode(enum playmode mode) | ||
35 | { | ||
36 | current_mode = mode; | ||
37 | } | ||
38 | |||
39 | void status_draw(void) | ||
40 | { | ||
41 | int battlevel = battery_level(); | ||
42 | |||
43 | #ifdef HAVE_LCD_CHARCELLS | ||
44 | lcd_icon(ICON_BATTERY, true); | ||
45 | if(battlevel > 25) | ||
46 | lcd_icon(ICON_BATTERY_1, true); | ||
47 | else | ||
48 | lcd_icon(ICON_BATTERY_1, false); | ||
49 | if(battlevel > 50) | ||
50 | lcd_icon(ICON_BATTERY_2, true); | ||
51 | else | ||
52 | lcd_icon(ICON_BATTERY_2, false); | ||
53 | if(battlevel > 75) | ||
54 | lcd_icon(ICON_BATTERY_3, true); | ||
55 | else | ||
56 | lcd_icon(ICON_BATTERY_3, false); | ||
57 | |||
58 | |||
59 | lcd_icon(ICON_VOLUME, true); | ||
60 | if(global_settings.volume > 10) | ||
61 | lcd_icon(ICON_VOLUME_1, true); | ||
62 | else | ||
63 | lcd_icon(ICON_VOLUME_1, false); | ||
64 | if(global_settings.volume > 30) | ||
65 | lcd_icon(ICON_VOLUME_2, true); | ||
66 | else | ||
67 | lcd_icon(ICON_VOLUME_2, false); | ||
68 | if(global_settings.volume > 50) | ||
69 | lcd_icon(ICON_VOLUME_3, true); | ||
70 | else | ||
71 | lcd_icon(ICON_VOLUME_3, false); | ||
72 | if(global_settings.volume > 70) | ||
73 | lcd_icon(ICON_VOLUME_4, true); | ||
74 | else | ||
75 | lcd_icon(ICON_VOLUME_4, false); | ||
76 | if(global_settings.volume > 90) | ||
77 | lcd_icon(ICON_VOLUME_5, true); | ||
78 | else | ||
79 | lcd_icon(ICON_VOLUME_5, false); | ||
80 | |||
81 | switch(current_mode) | ||
82 | { | ||
83 | case STATUS_PLAY: | ||
84 | lcd_icon(ICON_PLAY, true); | ||
85 | lcd_icon(ICON_PAUSE, false); | ||
86 | break; | ||
87 | |||
88 | case STATUS_STOP: | ||
89 | lcd_icon(ICON_PLAY, false); | ||
90 | lcd_icon(ICON_PAUSE, false); | ||
91 | break; | ||
92 | |||
93 | case STATUS_PAUSE: | ||
94 | lcd_icon(ICON_PLAY, false); | ||
95 | lcd_icon(ICON_PAUSE, true); | ||
96 | break; | ||
97 | } | ||
98 | #endif | ||
99 | } | ||
diff --git a/apps/status.h b/apps/status.h new file mode 100644 index 0000000000..344d12f91b --- /dev/null +++ b/apps/status.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _STATUS_H | ||
20 | #define _STATUS_H | ||
21 | |||
22 | enum playmode | ||
23 | { | ||
24 | STATUS_PLAY, | ||
25 | STATUS_STOP, | ||
26 | STATUS_PAUSE | ||
27 | }; | ||
28 | |||
29 | void status_init(void); | ||
30 | void status_set_playmode(enum playmode mode); | ||
31 | void status_draw(void); | ||
32 | |||
33 | #endif | ||