1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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 ****************************************************************************/
22 #define NUM_ADC_CHANNELS 8
26 #define ADC_MMC_SWITCH 0 /* low values if MMC inserted */
27 #define ADC_USB_POWER 1 /* USB, reads 0x000 when USB is inserted */
28 #define ADC_BUTTON_OPTION 2 /* the option button, low value if pressed */
29 #define ADC_BUTTON_ONOFF 3 /* the on/off button, high value if pressed */
30 #define ADC_BUTTON_ROW1 4 /* Used for scanning the keys, different
31 voltages for different keys */
32 #define ADC_UNREG_POWER 7 /* Battery voltage */
33 /* FixMe: this doesn't exist, just to make the compiler happy */
34 #define ADC_EXT_POWER 5 /* The external power voltage, V=X*0.0148 */
37 /* normal JBR channel assignment */
38 #define ADC_BATTERY 0 /* Battery voltage always reads 0x3FF due to
41 #define ADC_CHARGE_REGULATOR 0 /* Uh, we read the battery voltage? */
42 #define ADC_USB_POWER 1 /* USB, reads 0x000 when USB is inserted */
44 #define ADC_CHARGE_REGULATOR 1 /* Regulator reference voltage, should read
45 about 0x1c0 when charging, else 0x3FF */
46 #define ADC_USB_POWER 2 /* USB, reads 0x3FF when USB is inserted */
49 #define ADC_BUTTON_ROW1 4 /* Used for scanning the keys, different
50 voltages for different keys */
51 #define ADC_BUTTON_ROW2 5 /* Used for scanning the keys, different
52 voltages for different keys */
53 #define ADC_UNREG_POWER 6 /* Battery voltage with a better scaling */
54 #define ADC_EXT_POWER 7 /* The external power voltage, V=X*0.0148 */
58 #define EXT_SCALE_FACTOR 14800
60 unsigned short adc_read(int channel
);