summaryrefslogtreecommitdiff
path: root/firmware/backlight.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-08-15 13:56:06 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-08-15 13:56:06 +0000
commit3ed34a6227fbb87884aa50b3494d6686ffe5bb50 (patch)
tree03e5cca572b9f37690f89dc48696caf519d1831f /firmware/backlight.c
parent1330bfbb7ccd88554c6ec1e8d83c58faff0f6fc4 (diff)
New backlight settings with always-off
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1766 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/backlight.c')
-rw-r--r--firmware/backlight.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 9fe73f4d9a..b7f4761415 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -37,6 +37,11 @@ static struct event_queue backlight_queue;
static int backlight_timer;
static int backlight_timeout = 5;
+static char timeout_value[19] =
+{
+ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
+};
+
void backlight_thread(void)
{
struct event ev;
@@ -47,8 +52,17 @@ void backlight_thread(void)
switch(ev.id)
{
case BACKLIGHT_ON:
- backlight_timer = HZ*backlight_timeout;
- if(backlight_timer)
+ backlight_timer = HZ*timeout_value[backlight_timeout];
+ if(backlight_timer < 0)
+ {
+#ifdef HAVE_RTC
+ /* Disable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+#else
+ PADR |= 0x4000;
+#endif
+ }
+ else if(backlight_timer)
{
#ifdef HAVE_RTC
/* Enable square wave */
@@ -65,7 +79,7 @@ void backlight_thread(void)
rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
#else
PADR |= 0x4000;
-#endif
+#endif
break;
case SYS_USB_CONNECTED:
@@ -91,9 +105,9 @@ void backlight_off(void)
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
}
-void backlight_time(int seconds)
+void backlight_time(int value)
{
- backlight_timeout = seconds;
+ backlight_timeout = value;
backlight_on();
}