Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2006 by Linus Nielsen Feltzing |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 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 "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 Pekkarinen | 73cd9f3 | 2007-01-12 20:26:23 +0000 | [diff] [blame] | 29 | /* Returns the current state of the backlight (true=ON, false=OFF). */ |
Jens Arnold | ef12b3b | 2007-11-12 18:49:53 +0000 | [diff] [blame] | 30 | bool _backlight_init(void) |
Michael Sevakis | 58825f6 | 2006-11-10 18:47:41 +0000 | [diff] [blame] | 31 | { |
| 32 | or_l(0x00020000, &GPIO1_ENABLE); |
| 33 | or_l(0x00020000, &GPIO1_FUNCTION); |
Miika Pekkarinen | 73cd9f3 | 2007-01-12 20:26:23 +0000 | [diff] [blame] | 34 | |
| 35 | return (GPIO1_OUT & 0x00020000) ? false : true; |
Michael Sevakis | 58825f6 | 2006-11-10 18:47:41 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Jens Arnold | ef12b3b | 2007-11-12 18:49:53 +0000 | [diff] [blame] | 38 | void _backlight_hw_on(void) |
Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 39 | { |
| 40 | and_l(~0x00020000, &GPIO1_OUT); |
| 41 | } |
| 42 | |
Jens Arnold | ef12b3b | 2007-11-12 18:49:53 +0000 | [diff] [blame] | 43 | void _backlight_hw_off(void) |
Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 44 | { |
| 45 | or_l(0x00020000, &GPIO1_OUT); |
| 46 | } |
| 47 | |
Jens Arnold | ef12b3b | 2007-11-12 18:49:53 +0000 | [diff] [blame] | 48 | void _remote_backlight_on(void) |
Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 49 | { |
| 50 | and_l(~0x00000800, &GPIO_OUT); |
| 51 | } |
| 52 | |
Jens Arnold | ef12b3b | 2007-11-12 18:49:53 +0000 | [diff] [blame] | 53 | void _remote_backlight_off(void) |
Jonathan Gordon | 139f9f2 | 2006-10-30 08:56:06 +0000 | [diff] [blame] | 54 | { |
| 55 | or_l(0x00000800, &GPIO_OUT); |
| 56 | } |