1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * $Id: button-e200v2.c 19035 2008-11-07 05:31:05Z jdgordon $
10 * Copyright (C) 2006 by Barry Wardell
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include "button-target.h"
25 #include "backlight.h"
26 #include "powermgmt.h"
29 static unsigned short _dbop_din
= 0xFFFF;
31 /* in the lcd driver */
32 extern unsigned short int lcd_dbop_input(void);
34 static bool hold_button
= false;
36 static bool hold_button_old
= false;
39 /* for the debug menu */
40 unsigned short button_dbop_data(void)
45 void button_init_device(void)
50 bool button_hold(void)
56 * Get button pressed from hardware
58 int button_read_device(void)
60 int btn
= BUTTON_NONE
;
62 _dbop_din
= lcd_dbop_input();
64 /* hold button handling */
65 hold_button
= ((_dbop_din
& (1<<12)) == 0);
68 if (hold_button
!= hold_button_old
)
70 hold_button_old
= hold_button
;
71 backlight_hold_changed(hold_button
);
73 #endif /* BOOTLOADER */
78 /* direct GPIO connections */
83 if(!(_dbop_din
& (1<<2)))
85 if(!(_dbop_din
& (1<<3)))
87 if(!(_dbop_din
& (1<<4)))
89 if(!(_dbop_din
& (1<<5)))
91 if(!(_dbop_din
& (1<<6)))
93 if(!(_dbop_din
& (1<<13)))
95 if(!(_dbop_din
& (1<<14)))
96 btn
|= BUTTON_VOL_DOWN
;
97 if(!(_dbop_din
& (1<<15)))