diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-05 15:09:40 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-09-05 15:09:40 +0000 |
commit | e1446381675be454d91081a2db1d275129970556 (patch) | |
tree | fdaaab97282d3c5e339840a13c29311fa6085fd9 /firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c | |
parent | e0646947c9d36d5095659939f73294c2b425fda8 (diff) | |
download | rockbox-e1446381675be454d91081a2db1d275129970556.tar.gz rockbox-e1446381675be454d91081a2db1d275129970556.zip |
Add Onda VX767 target
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18422 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c new file mode 100644 index 0000000000..8b033a1bee --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/button-ondavx767.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "jz4740.h" | ||
25 | #include "button-target.h" | ||
26 | |||
27 | #define BTN_VOL_DOWN (1 << 27) | ||
28 | #define BTN_VOL_UP (1 << 0) | ||
29 | #define BTN_MENU (1 << 1) | ||
30 | #define BTN_OFF (1 << 29) | ||
31 | #define BTN_HOLD (1 << 16) | ||
32 | #define BTN_MASK (BTN_VOL_DOWN | BTN_VOL_UP \ | ||
33 | | BTN_MENU | BTN_OFF ) | ||
34 | |||
35 | bool button_hold(void) | ||
36 | { | ||
37 | return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0); | ||
38 | } | ||
39 | |||
40 | void button_init_device(void) | ||
41 | { | ||
42 | __gpio_port_as_input(3, 29); | ||
43 | __gpio_port_as_input(3, 27); | ||
44 | __gpio_port_as_input(3, 16); | ||
45 | __gpio_port_as_input(3, 1); | ||
46 | __gpio_port_as_input(3, 0); | ||
47 | } | ||
48 | |||
49 | int button_read_device(void) | ||
50 | { | ||
51 | if(button_hold()) | ||
52 | return 0; | ||
53 | |||
54 | unsigned int key = ~(__gpio_get_port(3)); | ||
55 | int ret = 0; | ||
56 | |||
57 | if(key & BTN_MASK) | ||
58 | { | ||
59 | if(key & BTN_VOL_DOWN) | ||
60 | ret |= BUTTON_VOL_DOWN; | ||
61 | if(key & BTN_VOL_UP) | ||
62 | ret |= BUTTON_VOL_UP; | ||
63 | if(key & BTN_MENU) | ||
64 | ret |= BUTTON_MENU; | ||
65 | if(key & BTN_OFF) | ||
66 | ret |= BUTTON_POWER; | ||
67 | } | ||
68 | |||
69 | return ret; | ||
70 | } | ||