diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/main.c | 4 | ||||
-rw-r--r-- | apps/recorder/icons.c | 8 | ||||
-rw-r--r-- | apps/recorder/icons.h | 3 | ||||
-rw-r--r-- | apps/status.c | 36 |
4 files changed, 36 insertions, 15 deletions
diff --git a/apps/main.c b/apps/main.c index 568a7efd09..9b9bae5098 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -230,6 +230,10 @@ void init(void) | |||
230 | usb_screen(); | 230 | usb_screen(); |
231 | mounted = true; /* mounting done @ end of USB mode */ | 231 | mounted = true; /* mounting done @ end of USB mode */ |
232 | } | 232 | } |
233 | #ifdef HAVE_USB_POWER | ||
234 | if (usb_powered()) /* avoid deadlock */ | ||
235 | break; | ||
236 | #endif | ||
233 | } | 237 | } |
234 | 238 | ||
235 | if (!mounted) | 239 | if (!mounted) |
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index c77050e322..a10f2e1699 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -58,6 +58,7 @@ const unsigned char bitmap_icons_6x8[LastIcon][6] = | |||
58 | const unsigned char bitmap_icons_7x8[][7] = | 58 | const unsigned char bitmap_icons_7x8[][7] = |
59 | { | 59 | { |
60 | {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ | 60 | {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ |
61 | {0x1c,0x14,0x3e,0x2a,0x22,0x1c,0x08}, /* USB plug */ | ||
61 | {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, /* Speaker */ | 62 | {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, /* Speaker */ |
62 | {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */ | 63 | {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */ |
63 | {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */ | 64 | {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */ |
@@ -239,7 +240,7 @@ const unsigned char rockbox160x53[] = { | |||
239 | /* | 240 | /* |
240 | * Print battery icon to status bar | 241 | * Print battery icon to status bar |
241 | */ | 242 | */ |
242 | void statusbar_icon_battery(int percent, bool charging) | 243 | void statusbar_icon_battery(int percent) |
243 | { | 244 | { |
244 | int i; | 245 | int i; |
245 | int fill; | 246 | int fill; |
@@ -292,11 +293,6 @@ void statusbar_icon_battery(int percent, bool charging) | |||
292 | STATUSBAR_Y_POS, "?"); | 293 | STATUSBAR_Y_POS, "?"); |
293 | lcd_setfont(FONT_UI); | 294 | lcd_setfont(FONT_UI); |
294 | } | 295 | } |
295 | |||
296 | /* draw power plug if charging */ | ||
297 | if (charging) | ||
298 | lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS, | ||
299 | STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); | ||
300 | } | 296 | } |
301 | 297 | ||
302 | /* | 298 | /* |
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 77a310d053..b2900a1566 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -43,6 +43,7 @@ enum icons_5x8 { | |||
43 | 43 | ||
44 | enum icons_7x8 { | 44 | enum icons_7x8 { |
45 | Icon_Plug, | 45 | Icon_Plug, |
46 | Icon_USBPlug, | ||
46 | Icon_Speaker, | 47 | Icon_Speaker, |
47 | Icon_Mute, | 48 | Icon_Mute, |
48 | Icon_Play, | 49 | Icon_Play, |
@@ -97,7 +98,7 @@ extern const unsigned char rockbox160x53[]; | |||
97 | #define TIME_X_END STATUSBAR_WIDTH-1 | 98 | #define TIME_X_END STATUSBAR_WIDTH-1 |
98 | 99 | ||
99 | extern void statusbar_wipe(void); | 100 | extern void statusbar_wipe(void); |
100 | extern void statusbar_icon_battery(int percent, bool charging); | 101 | extern void statusbar_icon_battery(int percent); |
101 | extern bool statusbar_icon_volume(int percent); | 102 | extern bool statusbar_icon_volume(int percent); |
102 | extern void statusbar_icon_play_state(int state); | 103 | extern void statusbar_icon_play_state(int state); |
103 | extern void statusbar_icon_play_mode(int mode); | 104 | extern void statusbar_icon_play_mode(int mode); |
diff --git a/apps/status.c b/apps/status.c index 8d3d1748cb..2218768451 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -40,13 +40,15 @@ | |||
40 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 40 | #if CONFIG_KEYPAD == IRIVER_H100_PAD |
41 | #include "button.h" | 41 | #include "button.h" |
42 | #endif | 42 | #endif |
43 | #include "usb.h" | ||
43 | 44 | ||
44 | static enum playmode ff_mode; | 45 | static enum playmode ff_mode; |
45 | 46 | ||
46 | static long switch_tick; | 47 | static long switch_tick; |
47 | static int battery_charge_step = 0; | ||
48 | static bool plug_state; | ||
49 | static bool battery_state = true; | 48 | static bool battery_state = true; |
49 | #ifdef HAVE_CHARGING | ||
50 | static int battery_charge_step = 0; | ||
51 | #endif | ||
50 | 52 | ||
51 | struct status_info { | 53 | struct status_info { |
52 | int battlevel; | 54 | int battlevel; |
@@ -63,6 +65,10 @@ struct status_info { | |||
63 | #if CONFIG_LED == LED_VIRTUAL | 65 | #if CONFIG_LED == LED_VIRTUAL |
64 | bool led; /* disk LED simulation in the status bar */ | 66 | bool led; /* disk LED simulation in the status bar */ |
65 | #endif | 67 | #endif |
68 | #ifdef HAVE_USB_POWER | ||
69 | bool usb_power; | ||
70 | #endif | ||
71 | |||
66 | }; | 72 | }; |
67 | 73 | ||
68 | void status_init(void) | 74 | void status_init(void) |
@@ -170,6 +176,9 @@ void status_draw(bool force_redraw) | |||
170 | #if CONFIG_LED == LED_VIRTUAL | 176 | #if CONFIG_LED == LED_VIRTUAL |
171 | info.led = led_read(HZ/2); /* delay should match polling interval */ | 177 | info.led = led_read(HZ/2); /* delay should match polling interval */ |
172 | #endif | 178 | #endif |
179 | #ifdef HAVE_USB_POWER | ||
180 | info.usb_power = usb_powered(); | ||
181 | #endif | ||
173 | 182 | ||
174 | /* only redraw if forced to, or info has changed */ | 183 | /* only redraw if forced to, or info has changed */ |
175 | if (force_redraw || | 184 | if (force_redraw || |
@@ -183,10 +192,10 @@ void status_draw(bool force_redraw) | |||
183 | /* players always "redraw" */ | 192 | /* players always "redraw" */ |
184 | { | 193 | { |
185 | #endif | 194 | #endif |
186 | 195 | ||
196 | #ifdef HAVE_CHARGING | ||
187 | if (info.inserted) { | 197 | if (info.inserted) { |
188 | battery_state = true; | 198 | battery_state = true; |
189 | plug_state = true; | ||
190 | #if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 | 199 | #if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 |
191 | /* zero battery run time if charging */ | 200 | /* zero battery run time if charging */ |
192 | if (charge_state > 0) { | 201 | if (charge_state > 0) { |
@@ -212,8 +221,9 @@ void status_draw(bool force_redraw) | |||
212 | } | 221 | } |
213 | } | 222 | } |
214 | } | 223 | } |
215 | else { | 224 | else |
216 | plug_state=false; | 225 | #endif /* HAVE_CHARGING */ |
226 | { | ||
217 | if (info.battery_safe) | 227 | if (info.battery_safe) |
218 | battery_state = true; | 228 | battery_state = true; |
219 | else { | 229 | else { |
@@ -228,8 +238,18 @@ void status_draw(bool force_redraw) | |||
228 | 238 | ||
229 | #ifdef HAVE_LCD_BITMAP | 239 | #ifdef HAVE_LCD_BITMAP |
230 | if (battery_state) | 240 | if (battery_state) |
231 | statusbar_icon_battery(info.battlevel, plug_state); | 241 | statusbar_icon_battery(info.battlevel); |
232 | 242 | ||
243 | /* draw power plug if charging */ | ||
244 | if (info.inserted) | ||
245 | lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS, | ||
246 | STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); | ||
247 | #ifdef HAVE_USB_POWER | ||
248 | else if (info.usb_power) | ||
249 | lcd_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS, | ||
250 | STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); | ||
251 | #endif | ||
252 | |||
233 | info.redraw_volume = statusbar_icon_volume(info.volume); | 253 | info.redraw_volume = statusbar_icon_volume(info.volume); |
234 | statusbar_icon_play_state(current_playmode() + Icon_Play); | 254 | statusbar_icon_play_state(current_playmode() + Icon_Play); |
235 | switch (info.repeat) { | 255 | switch (info.repeat) { |