diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clip/backlight-clip.c')
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/backlight-clip.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-clip/backlight-clip.c b/firmware/target/arm/as3525/sansa-clip/backlight-clip.c new file mode 100644 index 0000000000..2064f0992f --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clip/backlight-clip.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright © 2008 Rafaël Carré | ||
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 | |||
22 | #include "backlight-target.h" | ||
23 | #include "as3525.h" | ||
24 | |||
25 | /* TODO : backlight brightness */ | ||
26 | |||
27 | /* XXX : xpd is used for SD/MCI interface | ||
28 | * If interrupts are used to access this interface, they should be | ||
29 | * disabled in _buttonlight_on/off () | ||
30 | */ | ||
31 | |||
32 | void _buttonlight_on(void) | ||
33 | { | ||
34 | int saved_ccu_io; | ||
35 | |||
36 | saved_ccu_io = CCU_IO; /* save XPD setting */ | ||
37 | |||
38 | CCU_IO &= ~(3<<2); /* setup xpd as GPIO */ | ||
39 | |||
40 | GPIOD_DIR |= (1<<7); | ||
41 | GPIOD_PIN(7) = (1<<7); /* set pin d7 high */ | ||
42 | |||
43 | CCU_IO = saved_ccu_io; /* restore the previous XPD setting */ | ||
44 | } | ||
45 | |||
46 | void _buttonlight_off(void) | ||
47 | { | ||
48 | int saved_ccu_io; | ||
49 | |||
50 | saved_ccu_io = CCU_IO; /* save XPD setting */ | ||
51 | |||
52 | CCU_IO &= ~(3<<2); /* setup xpd as GPIO */ | ||
53 | |||
54 | GPIOD_DIR |= (1<<7); | ||
55 | GPIOD_PIN(7) = 0; /* set pin d7 low */ | ||
56 | |||
57 | CCU_IO = saved_ccu_io; /* restore the previous XPD setting */ | ||
58 | } | ||