diff options
Diffstat (limited to 'firmware/target/arm/s3c2440/mini2440/button-mini2440.c')
-rw-r--r-- | firmware/target/arm/s3c2440/mini2440/button-mini2440.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/firmware/target/arm/s3c2440/mini2440/button-mini2440.c b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c new file mode 100644 index 0000000000..787c04d1ef --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 "cpu.h" | ||
24 | #include "system.h" | ||
25 | #include "button.h" | ||
26 | #include "kernel.h" | ||
27 | |||
28 | void button_init_device(void) | ||
29 | { | ||
30 | /* Configure port directions and enable internal pullups on button inputs */ | ||
31 | |||
32 | /* These are the standard 6 buttons on the Mini2440 */ | ||
33 | S3C2440_GPIO_CONFIG (GPGCON, 0, GPIO_INPUT); | ||
34 | S3C2440_GPIO_CONFIG (GPGCON, 3, GPIO_INPUT); | ||
35 | S3C2440_GPIO_CONFIG (GPGCON, 5, GPIO_INPUT); | ||
36 | S3C2440_GPIO_CONFIG (GPGCON, 6, GPIO_INPUT); | ||
37 | S3C2440_GPIO_CONFIG (GPGCON, 7, GPIO_INPUT); | ||
38 | S3C2440_GPIO_CONFIG (GPGCON, 11, GPIO_INPUT); | ||
39 | |||
40 | S3C2440_GPIO_PULLUP (GPGUP, 0, GPIO_PULLUP_ENABLE); | ||
41 | S3C2440_GPIO_PULLUP (GPGUP, 3, GPIO_PULLUP_ENABLE); | ||
42 | S3C2440_GPIO_PULLUP (GPGUP, 5, GPIO_PULLUP_ENABLE); | ||
43 | S3C2440_GPIO_PULLUP (GPGUP, 6, GPIO_PULLUP_ENABLE); | ||
44 | S3C2440_GPIO_PULLUP (GPGUP, 7, GPIO_PULLUP_ENABLE); | ||
45 | S3C2440_GPIO_PULLUP (GPGUP, 11, GPIO_PULLUP_ENABLE); | ||
46 | |||
47 | /* These are additional buttons on my add on keypad */ | ||
48 | S3C2440_GPIO_CONFIG (GPGCON, 9, GPIO_INPUT); | ||
49 | S3C2440_GPIO_CONFIG (GPGCON, 10, GPIO_INPUT); | ||
50 | S3C2440_GPIO_PULLUP (GPGUP, 9, GPIO_PULLUP_ENABLE); | ||
51 | S3C2440_GPIO_PULLUP (GPGUP, 10, GPIO_PULLUP_ENABLE); | ||
52 | |||
53 | } | ||
54 | |||
55 | inline bool button_hold(void) | ||
56 | { | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | int button_read_device(void) | ||
61 | { | ||
62 | int btn = BUTTON_NONE; | ||
63 | |||
64 | /* Read the buttons - active low */ | ||
65 | btn = (GPGDAT & BUTTON_MAIN) ^ BUTTON_MAIN; | ||
66 | |||
67 | return btn; | ||
68 | } | ||
69 | |||
70 | void touchpad_set_sensitivity(int level) | ||
71 | { | ||
72 | (void)level; | ||
73 | /* No touchpad */ | ||
74 | } | ||
75 | |||
76 | bool headphones_inserted(void) | ||
77 | { | ||
78 | /* No detect */ | ||
79 | return false; | ||
80 | } | ||