summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/olympus
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2008-04-15 23:38:45 +0000
committerRobert Kukla <roolku@rockbox.org>2008-04-15 23:38:45 +0000
commit4c86e345173b72d0b42d366d8f256065d2604ce1 (patch)
tree2104a86971c2c93a90061df4c81f04bc38c8fd22 /firmware/target/arm/olympus
parent620e6b4d933532c48a8995ab495b02505791c347 (diff)
downloadrockbox-4c86e345173b72d0b42d366d8f256065d2604ce1.tar.gz
rockbox-4c86e345173b72d0b42d366d8f256065d2604ce1.tar.bz2
rockbox-4c86e345173b72d0b42d366d8f256065d2604ce1.zip
m:robe 100 - enable setting for buttonlight brightness
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17134 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/olympus')
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-mr100.c28
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-target.h1
2 files changed, 13 insertions, 16 deletions
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
index 24a62d232f..f5a7370590 100644
--- a/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
@@ -19,9 +19,10 @@
#include "backlight-target.h"
#include "system.h"
-#include "lcd.h"
-#include "backlight.h"
-#include "i2c-pp.h"
+
+#define MIN_BRIGHTNESS 0x80ff08ff
+
+static const int log_brightness[12] = {0,4,8,12,20,28,40,60,88,124,176,255};
void _backlight_on(void)
{
@@ -33,23 +34,18 @@ void _backlight_off(void)
GPO32_ENABLE &= ~0x1000000;
}
+void _buttonlight_set_brightness(int brightness)
+{
+ /* clamp the brightness value */
+ brightness = MAX(0, MIN(15, brightness));
+
+ outl(MIN_BRIGHTNESS-(log_brightness[brightness - 1] << 16), 0x7000a010);
+}
+
void _buttonlight_on(void)
{
/* turn on all touchpad leds */
GPIOA_OUTPUT_VAL |= BUTTONLIGHT_ALL;
-
-#if 0
- /* Writing to 0x7000a010 controls the brightness of the leds.
- This routine fades the leds from dim to bright, like when
- you first turn the unit on. */
- unsigned long val = 0x80ff08ff;
- int i = 0;
- for (i = 0; i < 16; i++)
- outl(val, 0x7000a010);
- udelay(100000);
- val -= 0x110000;
- }
-#endif
}
void _buttonlight_off(void)
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-target.h b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
index e6c8387222..7b4787fec3 100644
--- a/firmware/target/arm/olympus/mrobe-100/backlight-target.h
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
@@ -35,6 +35,7 @@ void _backlight_off(void);
BUTTONLIGHT_DISPLAY | BUTTONLIGHT_LEFT | \
BUTTONLIGHT_RIGHT | BUTTONLIGHT_SCROLL)
+void _buttonlight_set_brightness(int brightness);
void _buttonlight_on(void);
void _buttonlight_off(void);