summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2008-04-25 20:06:42 +0000
committerRobert Kukla <roolku@rockbox.org>2008-04-25 20:06:42 +0000
commitb39f9bffde554713c8e5268bfcf72e4ace8839db (patch)
tree5afa345f64d7034f1d14a34ef9393a71824a6276
parentdb7333971699eaa306b2fa9b519132da917bba68 (diff)
downloadrockbox-b39f9bffde554713c8e5268bfcf72e4ace8839db.tar.gz
rockbox-b39f9bffde554713c8e5268bfcf72e4ace8839db.tar.bz2
rockbox-b39f9bffde554713c8e5268bfcf72e4ace8839db.zip
m:robe 100 - backlight PWM fading
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17248 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/config-mrobe100.h6
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-mr100.c13
-rw-r--r--firmware/target/arm/olympus/mrobe-100/backlight-target.h17
3 files changed, 27 insertions, 9 deletions
diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h
index 0365bb381f..dd8b170f9e 100644
--- a/firmware/export/config-mrobe100.h
+++ b/firmware/export/config-mrobe100.h
@@ -4,8 +4,6 @@
#define TARGET_TREE
-#define OLYMPUS_MROBE_100 1
-
/* For Rolo and boot loader */
#define MODEL_NUMBER 23
#define MODEL_NAME "Olympus m:robe MR-100"
@@ -65,7 +63,9 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
-/* TODO #define HAVE_BACKLIGHT_BRIGHTNESS */
+
+/* We can fade the backlight by using PWM */
+#define HAVE_BACKLIGHT_PWM_FADING
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
index f5a7370590..07c97dfb58 100644
--- a/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-mr100.c
@@ -17,19 +17,26 @@
*
****************************************************************************/
-#include "backlight-target.h"
+#include "config.h"
#include "system.h"
+#include "backlight-target.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)
+/* Returns the current state of the backlight (true=ON, false=OFF). */
+bool _backlight_init(void)
+{
+ return (GPO32_ENABLE & 0x1000000) ? true : false;
+}
+
+void _backlight_hw_on(void)
{
GPO32_ENABLE |= 0x1000000;
}
-void _backlight_off(void)
+void _backlight_hw_off(void)
{
GPO32_ENABLE &= ~0x1000000;
}
diff --git a/firmware/target/arm/olympus/mrobe-100/backlight-target.h b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
index 7b4787fec3..9aeac85541 100644
--- a/firmware/target/arm/olympus/mrobe-100/backlight-target.h
+++ b/firmware/target/arm/olympus/mrobe-100/backlight-target.h
@@ -20,9 +20,20 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define _backlight_init() true
-void _backlight_on(void);
-void _backlight_off(void);
+bool _backlight_init(void); /* Returns backlight current state (true=ON). */
+void _backlight_hw_on(void);
+void _backlight_hw_off(void);
+
+#ifdef BOOTLOADER
+#define _backlight_on() _backlight_hw_on()
+#define _backlight_off() _backlight_hw_off()
+#else
+#define _backlight_on_isr() _backlight_hw_on()
+#define _backlight_off_isr() _backlight_hw_off()
+#define _backlight_on_normal() _backlight_hw_on()
+#define _backlight_off_normal() _backlight_hw_off()
+#define _BACKLIGHT_FADE_BOOST
+#endif
/* Button lights are controlled by GPIOA_OUTPUT_VAL */
#define BUTTONLIGHT_PLAY 0x01