blob: 1b61f31ea44afc4e865e23ccfb020060f7310c4a [file] [log] [blame]
Jonathan Gordon139f9f22006-10-30 08:56:06 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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.
Jonathan Gordon139f9f22006-10-30 08:56:06 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "kernel.h"
24#include "thread.h"
25#include "system.h"
26#include "backlight.h"
27#include "lcd.h"
28
Miika Pekkarinen73cd9f32007-01-12 20:26:23 +000029/* Returns the current state of the backlight (true=ON, false=OFF). */
Jens Arnoldef12b3b2007-11-12 18:49:53 +000030bool _backlight_init(void)
Michael Sevakis58825f62006-11-10 18:47:41 +000031{
32 or_l(0x00020000, &GPIO1_ENABLE);
33 or_l(0x00020000, &GPIO1_FUNCTION);
Miika Pekkarinen73cd9f32007-01-12 20:26:23 +000034
35 return (GPIO1_OUT & 0x00020000) ? false : true;
Michael Sevakis58825f62006-11-10 18:47:41 +000036}
37
Jens Arnoldef12b3b2007-11-12 18:49:53 +000038void _backlight_hw_on(void)
Jonathan Gordon139f9f22006-10-30 08:56:06 +000039{
40 and_l(~0x00020000, &GPIO1_OUT);
41}
42
Jens Arnoldef12b3b2007-11-12 18:49:53 +000043void _backlight_hw_off(void)
Jonathan Gordon139f9f22006-10-30 08:56:06 +000044{
45 or_l(0x00020000, &GPIO1_OUT);
46}
47
Jens Arnoldef12b3b2007-11-12 18:49:53 +000048void _remote_backlight_on(void)
Jonathan Gordon139f9f22006-10-30 08:56:06 +000049{
50 and_l(~0x00000800, &GPIO_OUT);
51}
52
Jens Arnoldef12b3b2007-11-12 18:49:53 +000053void _remote_backlight_off(void)
Jonathan Gordon139f9f22006-10-30 08:56:06 +000054{
55 or_l(0x00000800, &GPIO_OUT);
56}