A very basic charging screen, probably buggy, the pro's would make it much nicer, but it's a starting point.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3841 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2003-07-17 20:29:51 +00:00
parent 782e2370e8
commit 5dd17b1857
3 changed files with 71 additions and 3 deletions

View File

@ -51,6 +51,8 @@
#include "playlist.h"
#include "buffer.h"
#include "rolo.h"
#include "screens.h"
#include "power.h"
char appsversion[]=APPSVERSION;
@ -98,7 +100,8 @@ void init(void)
{
int rc, i;
struct partinfo* pinfo;
bool coldstart; /* starting from Flash */
/* if nobody initialized ATA before, I consider this a cold start */
bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */
system_init();
kernel_init();
@ -133,8 +136,14 @@ void init(void)
button_init();
/* if nobody initialized ATA before, I consider this a cold start */
coldstart = (PACR2 & 0x4000) != 0;
if (coldstart && charger_inserted())
{
rc = charging_screen(); /* display a "charging" screen */
if (rc == 1 || rc == 2) /* charger removed or "Off/Stop" pressed */
power_off();
/* "On" pressed or USB connected: proceed */
ide_power_enable(true);
}
rc = ata_init();
if(rc)
@ -222,3 +231,4 @@ int main(void)
return 0;
}
#endif

View File

@ -32,6 +32,7 @@
#include "playlist.h"
#include "sprintf.h"
#include "kernel.h"
#include "power.h"
#ifdef HAVE_LCD_BITMAP
#define BMPHEIGHT_usb_logo 32
@ -116,6 +117,60 @@ void usb_screen(void)
#endif
}
/* blocks while charging, returns on event:
1 if charger cable was removed
2 if Off/Stop key was pressed
3 if On key was pressed
4 if USB was connected */
int charging_screen(void)
{
int button;
int rc = 0;
#ifdef HAVE_RECORDER_KEYPAD
const int offbutton = BUTTON_OFF;
#else
const int offbutton = BUTTON_STOP;
#endif
ide_power_enable(false); /* power down the disk, else would be spinning */
backlight_on();
lcd_clear_display();
status_draw(true);
#ifdef HAVE_LCD_BITMAP
lcd_puts(0, 3, "[Rockbox charging]"); /* ToDo: show some logo instead */
lcd_update();
#else
status_set_playmode(STATUS_STOP);
lcd_puts(0, 1, "[charging]");
#endif
charger_enable(true);
do
{
status_draw(false);
button = button_get_w_tmo(HZ/2);
if (button == BUTTON_ON)
rc = 3;
else if (button == offbutton)
rc = 2;
else
{
if (usb_detect())
rc = 4;
else if (!charger_inserted())
rc = 1;
}
} while (!rc);
return rc;
}
#ifdef HAVE_RECORDER_KEYPAD
/* returns:
0 if no key was pressed
@ -643,3 +698,4 @@ void splash(int ticks, /* how long */
sleep(ticks);
}
}

View File

@ -21,6 +21,7 @@
void usb_display_info(void);
void usb_screen(void);
int charging_screen(void);
#ifdef HAVE_RECORDER_KEYPAD
int on_screen(void);
@ -36,3 +37,4 @@ void splash(int ticks, /* how long */
...);
#endif