diff options
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/screens.c b/apps/screens.c index eb31eff5cf..df9c19eda5 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "playlist.h" | 32 | #include "playlist.h" |
33 | #include "sprintf.h" | 33 | #include "sprintf.h" |
34 | #include "kernel.h" | 34 | #include "kernel.h" |
35 | #include "power.h" | ||
35 | 36 | ||
36 | #ifdef HAVE_LCD_BITMAP | 37 | #ifdef HAVE_LCD_BITMAP |
37 | #define BMPHEIGHT_usb_logo 32 | 38 | #define BMPHEIGHT_usb_logo 32 |
@@ -116,6 +117,60 @@ void usb_screen(void) | |||
116 | #endif | 117 | #endif |
117 | } | 118 | } |
118 | 119 | ||
120 | |||
121 | /* blocks while charging, returns on event: | ||
122 | 1 if charger cable was removed | ||
123 | 2 if Off/Stop key was pressed | ||
124 | 3 if On key was pressed | ||
125 | 4 if USB was connected */ | ||
126 | int charging_screen(void) | ||
127 | { | ||
128 | int button; | ||
129 | int rc = 0; | ||
130 | #ifdef HAVE_RECORDER_KEYPAD | ||
131 | const int offbutton = BUTTON_OFF; | ||
132 | #else | ||
133 | const int offbutton = BUTTON_STOP; | ||
134 | #endif | ||
135 | |||
136 | ide_power_enable(false); /* power down the disk, else would be spinning */ | ||
137 | |||
138 | backlight_on(); | ||
139 | lcd_clear_display(); | ||
140 | status_draw(true); | ||
141 | |||
142 | #ifdef HAVE_LCD_BITMAP | ||
143 | lcd_puts(0, 3, "[Rockbox charging]"); /* ToDo: show some logo instead */ | ||
144 | lcd_update(); | ||
145 | #else | ||
146 | status_set_playmode(STATUS_STOP); | ||
147 | lcd_puts(0, 1, "[charging]"); | ||
148 | #endif | ||
149 | |||
150 | charger_enable(true); | ||
151 | |||
152 | do | ||
153 | { | ||
154 | status_draw(false); | ||
155 | button = button_get_w_tmo(HZ/2); | ||
156 | if (button == BUTTON_ON) | ||
157 | rc = 3; | ||
158 | else if (button == offbutton) | ||
159 | rc = 2; | ||
160 | else | ||
161 | { | ||
162 | if (usb_detect()) | ||
163 | rc = 4; | ||
164 | else if (!charger_inserted()) | ||
165 | rc = 1; | ||
166 | } | ||
167 | } while (!rc); | ||
168 | |||
169 | return rc; | ||
170 | } | ||
171 | |||
172 | |||
173 | |||
119 | #ifdef HAVE_RECORDER_KEYPAD | 174 | #ifdef HAVE_RECORDER_KEYPAD |
120 | /* returns: | 175 | /* returns: |
121 | 0 if no key was pressed | 176 | 0 if no key was pressed |
@@ -643,3 +698,4 @@ void splash(int ticks, /* how long */ | |||
643 | sleep(ticks); | 698 | sleep(ticks); |
644 | } | 699 | } |
645 | } | 700 | } |
701 | |||