1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Dave Chapman
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 ****************************************************************************/
27 Results of button testing:
29 HOLD: GPIOA & 0x0002 (0=pressed, 0x0002 = released)
30 POWER: GPIOA & 0x8000 (0=pressed, 0x8000 = released)
32 ADC[0]: (approx values)
43 Values of ADC[0] tested in OF disassembly: 0x50, 0x96, 0xdc, 0x208, 0x384
47 void button_init_device(void)
52 int button_read_device(void)
54 int btn
= BUTTON_NONE
;
57 adc
= adc_read(ADC_BUTTONS
);
63 btn
|= BUTTON_RIGHT
; /* 0x00..0x4f */
65 btn
|= BUTTON_LEFT
; /* 0x50..0x95 */
69 btn
|= BUTTON_SELECT
; /* 0x96..0xdf */
71 btn
|= BUTTON_UP
; /* 0xe0..0x13f */
77 btn
|= BUTTON_DOWN
; /* 0x140..0x1af */
79 btn
|= BUTTON_MODE
; /* 0x1b0..0x207 */
83 btn
|= BUTTON_PRESET
; /* 0x208..0x28f */
85 btn
|= BUTTON_REC
; /* 0x290..0x383 */
94 if (!(GPIOA
& 0x8000))
95 btn
|= BUTTON_POWERPLAY
;