include Car Adapter Mode description on all players that have it. Fixes FS#7431.
[Rockbox.git] / firmware / drivers / led.c
blob36748a1b188c34e4cf6ac8e91e27e52683cccec5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Alan Korr
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "config.h"
20 #include <stdbool.h>
21 #include "cpu.h"
22 #include "led.h"
23 #include "system.h"
24 #include "kernel.h"
26 #if (CONFIG_LED == LED_REAL)
28 void led(bool on)
30 if ( on )
32 or_b(0x40, &PBDRL);
34 else
36 and_b(~0x40, &PBDRL);
40 #elif (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
42 static bool current;
43 static long last_on; /* timestamp of switching off */
45 void led(bool on)
47 if (current && !on) /* switching off */
49 last_on = current_tick; /* remember for off delay */
51 current = on;
54 bool led_read(int delayticks) /* read by status bar update */
56 /* reading "off" is delayed by user-supplied monoflop value */
57 return (current || TIME_BEFORE(current_tick, last_on+delayticks));
60 #else
62 void led(bool on)
64 (void)on;
66 #endif /* CONFIG_LED, HAVE_REMOTE_LCD */