summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2006-11-05 07:54:08 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2006-11-05 07:54:08 +0000
commitbce255d98b90f3345f03ab1639d36ec064862300 (patch)
tree9867fa1c06bb495f7a8204da83bc4f978b77eb68 /firmware/target
parenteda13cedc0f2bb7ca91e44e34e660d123696a401 (diff)
implement the gigabeat backlight driver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11434 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c15
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h29
2 files changed, 40 insertions, 4 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
index 8f7c30b5d7..9abf34ccf9 100644
--- a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
@@ -21,18 +21,25 @@
#include "system.h"
#include "backlight.h"
#include "lcd.h"
+#include "sc606-meg-fx.h"
+
+int confval = SC606_LOW_FREQ;
void __backlight_on(void)
{
+ confval |= (SC606_LED_A1 | SC606_LED_A2);
+ sc606_write(SC606_REG_CONF, confval);
}
void __backlight_off(void)
{
+ confval &= ~(SC606_LED_A1 | SC606_LED_A2);
+ sc606_write(SC606_REG_CONF, confval);
}
-void __backlight_set_brightness(int val)
+void __backlight_set_brightness(int brightness)
{
- /* The SC606 LED driver of the gigabeat series
- * can set the brightness in 64 steps */
- val &= 0x3F;
+ /* The SC606 LED driver can set the brightness in 64 steps */
+ brightness &= 0x3F;
+ sc606_write(SC606_REG_A, brightness);
}
diff --git a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h
new file mode 100644
index 0000000000..2637c067e0
--- /dev/null
+++ b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.h
@@ -0,0 +1,29 @@
+#include "config.h"
+#include "cpu.h"
+#include <stdbool.h>
+#include "kernel.h"
+#include "system.h"
+#include "hwcompat.h"
+#include "logf.h"
+#include "debug.h"
+#include "string.h"
+
+#define SC606_REG_A 0
+#define SC606_REG_B 1
+#define SC606_REG_C 2
+#define SC606_REG_CONF 3
+
+#define SC606_LED_A1 1 << 0
+#define SC606_LED_A2 1 << 1
+#define SC606_LED_B1 1 << 2
+#define SC606_LED_B2 1 << 3
+#define SC606_LED_C1 1 << 4
+#define SC606_LED_C2 1 << 5
+
+#define SC606_LOW_FREQ 1 << 6
+
+int sc606_write(unsigned char reg, unsigned char data);
+
+int sc606_read(unsigned char reg, unsigned char* data);
+
+void sc606_init(void);