Robert Hak | 4db2ded | 2002-08-13 09:19:21 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2002 by Robert E. Hak <rhak@ramapo.edu> |
| 11 | * |
| 12 | * Windows Copyright (C) 2002 by Felix Arends |
| 13 | * X11 Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se> |
| 14 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License |
| 17 | * as published by the Free Software Foundation; either version 2 |
| 18 | * of the License, or (at your option) any later version. |
Robert Hak | 4db2ded | 2002-08-13 09:19:21 +0000 | [diff] [blame] | 19 | * |
| 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 21 | * KIND, either express or implied. |
| 22 | * |
| 23 | ****************************************************************************/ |
| 24 | |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 25 | #include <stdbool.h> |
Thomas Martitz | a7f4e1f | 2009-04-29 22:24:40 +0000 | [diff] [blame] | 26 | #include "config.h" |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 27 | #include "system.h" |
Robert Hak | e7a6a82 | 2002-08-13 09:32:56 +0000 | [diff] [blame] | 28 | #include "lcd.h" |
Thomas Martitz | a7f4e1f | 2009-04-29 22:24:40 +0000 | [diff] [blame] | 29 | |
| 30 | #ifdef HAVE_LCD_ENABLE |
| 31 | static bool lcd_enabled = false; |
| 32 | #endif |
| 33 | #ifdef HAVE_LCD_SLEEP |
| 34 | static bool lcd_sleeping = true; |
| 35 | #endif |
Daniel Stenberg | 41cfe30 | 2003-12-15 10:25:51 +0000 | [diff] [blame] | 36 | |
Jörg Hohensohn | a5e1d06 | 2003-12-20 10:00:37 +0000 | [diff] [blame] | 37 | void lcd_set_flip(bool yesno) |
| 38 | { |
| 39 | (void)yesno; |
Jens Arnold | e8bb31e | 2004-04-21 09:44:07 +0000 | [diff] [blame] | 40 | } |
| 41 | |
Daniel Stenberg | ac31e6a | 2005-05-23 16:23:25 +0000 | [diff] [blame] | 42 | void lcd_set_invert_display(bool invert) |
| 43 | { |
| 44 | (void)invert; |
| 45 | } |
| 46 | |
Jens Arnold | 9051afa | 2006-07-25 11:15:50 +0000 | [diff] [blame] | 47 | int lcd_default_contrast(void) |
Daniel Stenberg | ac31e6a | 2005-05-23 16:23:25 +0000 | [diff] [blame] | 48 | { |
Jens Arnold | 9051afa | 2006-07-25 11:15:50 +0000 | [diff] [blame] | 49 | return 28; |
Daniel Stenberg | ac31e6a | 2005-05-23 16:23:25 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | #ifdef HAVE_REMOTE_LCD |
| 53 | void lcd_remote_set_contrast(int val) |
| 54 | { |
| 55 | (void)val; |
| 56 | } |
| 57 | void lcd_remote_backlight_on(int val) |
| 58 | { |
| 59 | (void)val; |
| 60 | } |
| 61 | void lcd_remote_backlight_off(int val) |
| 62 | { |
| 63 | (void)val; |
| 64 | } |
Jens Arnold | 22c15b7 | 2005-06-17 22:03:56 +0000 | [diff] [blame] | 65 | |
| 66 | void lcd_remote_set_flip(bool yesno) |
| 67 | { |
| 68 | (void)yesno; |
| 69 | } |
Jens Arnold | 9051afa | 2006-07-25 11:15:50 +0000 | [diff] [blame] | 70 | |
| 71 | void lcd_remote_set_invert_display(bool invert) |
| 72 | { |
| 73 | (void)invert; |
| 74 | } |
Daniel Stenberg | ac31e6a | 2005-05-23 16:23:25 +0000 | [diff] [blame] | 75 | #endif |
Thomas Martitz | a7f4e1f | 2009-04-29 22:24:40 +0000 | [diff] [blame] | 76 | |
| 77 | #ifdef HAVE_LCD_SLEEP |
| 78 | void lcd_sleep(void) |
| 79 | { |
| 80 | lcd_sleeping = true; |
| 81 | } |
| 82 | |
| 83 | void lcd_awake(void) |
| 84 | { |
| 85 | if (lcd_sleeping) |
| 86 | { |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 87 | send_event(LCD_EVENT_ACTIVATION, NULL); |
Thomas Martitz | a7f4e1f | 2009-04-29 22:24:40 +0000 | [diff] [blame] | 88 | lcd_sleeping = false; |
| 89 | } |
| 90 | } |
| 91 | #endif |
| 92 | #ifdef HAVE_LCD_ENABLE |
| 93 | void lcd_enable(bool on) |
| 94 | { |
| 95 | if (on && !lcd_enabled) |
| 96 | { |
| 97 | #ifdef HAVE_LCD_SLEEP |
| 98 | /* lcd_awake will handle the activation call */ |
| 99 | lcd_awake(); |
| 100 | #else |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 101 | send_event(LCD_EVENT_ACTIVATION, NULL); |
Thomas Martitz | a7f4e1f | 2009-04-29 22:24:40 +0000 | [diff] [blame] | 102 | #endif |
| 103 | } |
| 104 | lcd_enabled = on; |
| 105 | } |
| 106 | #endif |
| 107 | |
| 108 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
| 109 | bool lcd_active(void) |
| 110 | { |
| 111 | bool retval = false; |
| 112 | #ifdef HAVE_LCD_ENABLE |
| 113 | retval = lcd_enabled; |
| 114 | #endif |
| 115 | #ifdef HAVE_LCD_SLEEP |
| 116 | if (!retval) |
| 117 | retval = !lcd_sleeping; |
| 118 | #endif |
| 119 | return retval; |
| 120 | } |
| 121 | #endif |