diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:28:09 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:34:44 +0200 |
commit | d3bc64833c76adca4d6300e5b5880ee8ea63de02 (patch) | |
tree | 621978b661c875364c878ba31a9cfed61cf55015 /firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | |
parent | 9ed980785429db35f51f8d324cc75c23f2e5fb20 (diff) | |
download | rockbox-d3bc64833c76adca4d6300e5b5880ee8ea63de02.tar.gz rockbox-d3bc64833c76adca4d6300e5b5880ee8ea63de02.zip |
Initial commit for the Creative ZEN Mozaic
Change-Id: Ib65aad9f5de37e514047955cad7ca40dc0af4f74
Diffstat (limited to 'firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c')
-rw-r--r-- | firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c new file mode 100644 index 0000000000..bf6729a273 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | |||
@@ -0,0 +1,69 @@ | |||
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 | {0, IMX233_BUTTON_LRADC_HOLD}, | ||
31 | {200, BUTTON_MENU}, | ||
32 | {445, BUTTON_SHORTCUT}, | ||
33 | {645, BUTTON_UP}, | ||
34 | {860, BUTTON_LEFT}, | ||
35 | {1060, BUTTON_RIGHT}, | ||
36 | {1260, BUTTON_DOWN}, | ||
37 | {1480, BUTTON_SELECT}, | ||
38 | {2700, BUTTON_BACK}, | ||
39 | {2945, BUTTON_PLAYPAUSE}, | ||
40 | {3400, 0}, | ||
41 | {0, IMX233_BUTTON_LRADC_END}, | ||
42 | }; | ||
43 | |||
44 | void button_init_device(void) | ||
45 | { | ||
46 | imx233_button_lradc_init(); | ||
47 | |||
48 | imx233_pinctrl_acquire(2, 8, "jack_detect"); | ||
49 | imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO); | ||
50 | imx233_pinctrl_enable_gpio(2, 8, false); | ||
51 | } | ||
52 | |||
53 | bool headphones_inserted(void) | ||
54 | { | ||
55 | return imx233_pinctrl_get_gpio(2, 8); | ||
56 | } | ||
57 | |||
58 | bool button_hold(void) | ||
59 | { | ||
60 | return imx233_button_lradc_hold(); | ||
61 | } | ||
62 | |||
63 | int button_read_device(void) | ||
64 | { | ||
65 | int btn = 0; | ||
66 | if(BF_RD(POWER_STS, PSWITCH) == 1) | ||
67 | btn |= BUTTON_POWER; | ||
68 | return imx233_button_lradc_read(btn); | ||
69 | } | ||