diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:30:43 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:34:45 +0200 |
commit | a0728672bf07f626049f8dc0007772794ae95ee1 (patch) | |
tree | bb8ca610c9d0c8fb441a99ccf33102964cafd003 /firmware/target/arm/imx233/creative-zen/button-zen.c | |
parent | d3bc64833c76adca4d6300e5b5880ee8ea63de02 (diff) | |
download | rockbox-a0728672bf07f626049f8dc0007772794ae95ee1.tar.gz rockbox-a0728672bf07f626049f8dc0007772794ae95ee1.zip |
Initial commit for the Creative ZEN and ZEN X-Fi
Change-Id: Ibd7b1b0b957ef11c200cb63eff7da53f11774748
Diffstat (limited to 'firmware/target/arm/imx233/creative-zen/button-zen.c')
-rw-r--r-- | firmware/target/arm/imx233/creative-zen/button-zen.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/creative-zen/button-zen.c b/firmware/target/arm/imx233/creative-zen/button-zen.c new file mode 100644 index 0000000000..cacc47d448 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zen/button-zen.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
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 | #include "button-target.h" | ||
22 | #include "system.h" | ||
23 | #include "system-target.h" | ||
24 | #include "pinctrl-imx233.h" | ||
25 | #include "power-imx233.h" | ||
26 | #include "button-lradc-imx233.h" | ||
27 | |||
28 | struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = | ||
29 | { | ||
30 | #if defined(CREATIVE_ZEN) | ||
31 | {200, IMX233_BUTTON_LRADC_HOLD}, | ||
32 | {250, BUTTON_MENU}, | ||
33 | {520, BUTTON_SHORTCUT}, | ||
34 | {1490, BUTTON_UP}, | ||
35 | {1740, BUTTON_SELECT}, | ||
36 | {2015, BUTTON_LEFT}, | ||
37 | {2255, BUTTON_RIGHT}, | ||
38 | {2485, BUTTON_DOWN}, | ||
39 | {2700, BUTTON_BACK}, | ||
40 | {2945, BUTTON_PLAYPAUSE}, | ||
41 | {3400, 0}, | ||
42 | {0, IMX233_BUTTON_LRADC_END}, | ||
43 | #elif defined(CREATIVE_ZENXFI) | ||
44 | {0, IMX233_BUTTON_LRADC_HOLD}, | ||
45 | {200, BUTTON_MENU}, | ||
46 | {445, BUTTON_SHORTCUT}, | ||
47 | {645, BUTTON_UP}, | ||
48 | {860, BUTTON_LEFT}, | ||
49 | {1060, BUTTON_RIGHT}, | ||
50 | {1260, BUTTON_DOWN}, | ||
51 | {1480, BUTTON_SELECT}, | ||
52 | {1700, BUTTON_TOPRIGHT}, | ||
53 | {1920, BUTTON_BOTTOMLEFT}, | ||
54 | {2145, BUTTON_TOPLEFT}, | ||
55 | {2460, BUTTON_BOTTOMRIGHT}, | ||
56 | {2700, BUTTON_BACK}, | ||
57 | {2945, BUTTON_PLAYPAUSE}, | ||
58 | {3400, 0}, | ||
59 | {0, IMX233_BUTTON_LRADC_END}, | ||
60 | #else | ||
61 | #error wrong target | ||
62 | #endif | ||
63 | }; | ||
64 | |||
65 | void button_init_device(void) | ||
66 | { | ||
67 | imx233_button_lradc_init(); | ||
68 | } | ||
69 | |||
70 | bool button_hold(void) | ||
71 | { | ||
72 | return imx233_button_lradc_hold(); | ||
73 | } | ||
74 | |||
75 | #ifdef CREATIVE_ZENXFI | ||
76 | bool headphones_inserted(void) | ||
77 | { | ||
78 | return !imx233_pinctrl_get_gpio(2, 8); | ||
79 | } | ||
80 | #endif | ||
81 | |||
82 | int button_read_device(void) | ||
83 | { | ||
84 | int btn = 0; | ||
85 | if(BF_RD(POWER_STS, PSWITCH) == 1) | ||
86 | btn |= BUTTON_POWER; | ||
87 | return imx233_button_lradc_read(btn); | ||
88 | } | ||