diff options
author | Dave Chapman <dave@dchapman.com> | 2009-07-17 22:40:36 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2009-07-17 22:40:36 +0000 |
commit | 6432941f10d0ed76a4f944b7c8c4e8b2f6ecfe70 (patch) | |
tree | dcf05ab048f4fcb322be830ab83743620f2afc86 | |
parent | 92a7418415e738e51d36e4f9406c07352f12bddf (diff) | |
download | rockbox-6432941f10d0ed76a4f944b7c8c4e8b2f6ecfe70.tar.gz rockbox-6432941f10d0ed76a4f944b7c8c4e8b2f6ecfe70.zip |
Basic backlight driver for Nano 2G
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21935 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/backlight-nano2g.c | 67 |
2 files changed, 68 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index add88848dc..a3359cf8e7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1302,6 +1302,7 @@ target/arm/s5l8700/udacodec-meizu.c | |||
1302 | 1302 | ||
1303 | #ifdef IPOD_NANO2G | 1303 | #ifdef IPOD_NANO2G |
1304 | target/arm/s5l8700/kernel-s5l8700.c | 1304 | target/arm/s5l8700/kernel-s5l8700.c |
1305 | target/arm/s5l8700/ipodnano2g/backlight-nano2g.c | ||
1305 | target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 1306 | target/arm/s5l8700/ipodnano2g/lcd-nano2g.c |
1306 | #endif | 1307 | #endif |
1307 | 1308 | ||
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/backlight-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/backlight-nano2g.c new file mode 100644 index 0000000000..8a2e0d41a8 --- /dev/null +++ b/firmware/target/arm/s5l8700/ipodnano2g/backlight-nano2g.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Dave Chapman | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include <stdbool.h> | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "backlight.h" | ||
25 | #include "backlight-target.h" | ||
26 | #include "i2c-s5l8700.h" | ||
27 | |||
28 | |||
29 | static unsigned char bl_i2c_readbyte(int address) | ||
30 | { | ||
31 | unsigned char tmp; | ||
32 | |||
33 | i2c_read(0xe6, address, 1, &tmp); | ||
34 | |||
35 | return tmp; | ||
36 | } | ||
37 | |||
38 | static void bl_i2c_writebyte(int address, unsigned char val) | ||
39 | { | ||
40 | i2c_write(0xe6, address, 1, &val); | ||
41 | } | ||
42 | |||
43 | void _backlight_set_brightness(int brightness) | ||
44 | { | ||
45 | (void)brightness; | ||
46 | } | ||
47 | |||
48 | void _backlight_on(void) | ||
49 | { | ||
50 | bl_i2c_writebyte(0x2b,10); | ||
51 | bl_i2c_writebyte(0x2a,6); | ||
52 | bl_i2c_writebyte(0x28,0x2e); | ||
53 | bl_i2c_writebyte(0x29,(bl_i2c_readbyte(0x29)&0xf0)|1); | ||
54 | bl_i2c_writebyte(0x2a,7); | ||
55 | } | ||
56 | |||
57 | void _backlight_off(void) | ||
58 | { | ||
59 | bl_i2c_writebyte(0x2b,10); | ||
60 | bl_i2c_writebyte(0x29,bl_i2c_readbyte(0x29)&0xf0); | ||
61 | bl_i2c_writebyte(0x2a,7); | ||
62 | } | ||
63 | |||
64 | bool _backlight_init(void) | ||
65 | { | ||
66 | _backlight_on(); | ||
67 | } | ||