summaryrefslogtreecommitdiff
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
parenteda13cedc0f2bb7ca91e44e34e660d123696a401 (diff)
downloadrockbox-bce255d98b90f3345f03ab1639d36ec064862300.tar.gz
rockbox-bce255d98b90f3345f03ab1639d36ec064862300.zip
implement the gigabeat backlight driver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11434 a1c6a512-1295-4272-9138-f99709370657
-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 @@
21#include "system.h" 21#include "system.h"
22#include "backlight.h" 22#include "backlight.h"
23#include "lcd.h" 23#include "lcd.h"
24#include "sc606-meg-fx.h"
25
26int confval = SC606_LOW_FREQ;
24 27
25void __backlight_on(void) 28void __backlight_on(void)
26{ 29{
30 confval |= (SC606_LED_A1 | SC606_LED_A2);
31 sc606_write(SC606_REG_CONF, confval);
27} 32}
28 33
29void __backlight_off(void) 34void __backlight_off(void)
30{ 35{
36 confval &= ~(SC606_LED_A1 | SC606_LED_A2);
37 sc606_write(SC606_REG_CONF, confval);
31} 38}
32 39
33void __backlight_set_brightness(int val) 40void __backlight_set_brightness(int brightness)
34{ 41{
35 /* The SC606 LED driver of the gigabeat series 42 /* The SC606 LED driver can set the brightness in 64 steps */
36 * can set the brightness in 64 steps */ 43 brightness &= 0x3F;
37 val &= 0x3F; 44 sc606_write(SC606_REG_A, brightness);
38} 45}
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 @@
1#include "config.h"
2#include "cpu.h"
3#include <stdbool.h>
4#include "kernel.h"
5#include "system.h"
6#include "hwcompat.h"
7#include "logf.h"
8#include "debug.h"
9#include "string.h"
10
11#define SC606_REG_A 0
12#define SC606_REG_B 1
13#define SC606_REG_C 2
14#define SC606_REG_CONF 3
15
16#define SC606_LED_A1 1 << 0
17#define SC606_LED_A2 1 << 1
18#define SC606_LED_B1 1 << 2
19#define SC606_LED_B2 1 << 3
20#define SC606_LED_C1 1 << 4
21#define SC606_LED_C2 1 << 5
22
23#define SC606_LOW_FREQ 1 << 6
24
25int sc606_write(unsigned char reg, unsigned char data);
26
27int sc606_read(unsigned char reg, unsigned char* data);
28
29void sc606_init(void);