diff options
Diffstat (limited to 'firmware/target/arm/s5l8700/yps3/button-yps3.c')
-rw-r--r-- | firmware/target/arm/s5l8700/yps3/button-yps3.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/firmware/target/arm/s5l8700/yps3/button-yps3.c b/firmware/target/arm/s5l8700/yps3/button-yps3.c index afcf89666b..bde322633c 100644 --- a/firmware/target/arm/s5l8700/yps3/button-yps3.c +++ b/firmware/target/arm/s5l8700/yps3/button-yps3.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include "inttypes.h" | 25 | #include "inttypes.h" |
26 | #include "s5l8700.h" | 26 | #include "s5l8700.h" |
27 | #include "button.h" | ||
27 | #include "button-target.h" | 28 | #include "button-target.h" |
28 | 29 | ||
29 | /* Button driver for the touch keys on the Samsung YP-S3 | 30 | /* Button driver for the touch keys on the Samsung YP-S3 |
@@ -63,7 +64,8 @@ void button_init_device(void) | |||
63 | PCON4 &= ~0x0000F000; | 64 | PCON4 &= ~0x0000F000; |
64 | } | 65 | } |
65 | 66 | ||
66 | static unsigned int tkey_read(void) | 67 | /* returns the raw 20-bit word from the touch key controller */ |
68 | static int tkey_read(void) | ||
67 | { | 69 | { |
68 | static int value = 0; | 70 | static int value = 0; |
69 | int i; | 71 | int i; |
@@ -103,7 +105,7 @@ static unsigned int tkey_read(void) | |||
103 | int button_read_device(void) | 105 | int button_read_device(void) |
104 | { | 106 | { |
105 | int buttons = 0; | 107 | int buttons = 0; |
106 | static unsigned int data; | 108 | int tkey_data; |
107 | 109 | ||
108 | /* hold switch */ | 110 | /* hold switch */ |
109 | if (button_hold()) { | 111 | if (button_hold()) { |
@@ -116,26 +118,26 @@ int button_read_device(void) | |||
116 | } | 118 | } |
117 | 119 | ||
118 | /* touch keys */ | 120 | /* touch keys */ |
119 | data = tkey_read(); | 121 | tkey_data = tkey_read(); |
120 | if (data & (1 << 9)) { | 122 | if (tkey_data & (1 << 9)) { |
121 | buttons |= BUTTON_BACK; | 123 | buttons |= BUTTON_BACK; |
122 | } | 124 | } |
123 | if (data & (1 << 8)) { | 125 | if (tkey_data & (1 << 8)) { |
124 | buttons |= BUTTON_UP; | 126 | buttons |= BUTTON_UP; |
125 | } | 127 | } |
126 | if (data & (1 << 7)) { | 128 | if (tkey_data & (1 << 7)) { |
127 | buttons |= BUTTON_MENU; | 129 | buttons |= BUTTON_MENU; |
128 | } | 130 | } |
129 | if (data & (1 << 6)) { | 131 | if (tkey_data & (1 << 6)) { |
130 | buttons |= BUTTON_LEFT; | 132 | buttons |= BUTTON_LEFT; |
131 | } | 133 | } |
132 | if (data & (1 << 5)) { | 134 | if (tkey_data & (1 << 5)) { |
133 | buttons |= BUTTON_SELECT; | 135 | buttons |= BUTTON_SELECT; |
134 | } | 136 | } |
135 | if (data & (1 << 4)) { | 137 | if (tkey_data & (1 << 4)) { |
136 | buttons |= BUTTON_RIGHT; | 138 | buttons |= BUTTON_RIGHT; |
137 | } | 139 | } |
138 | if (data & (1 << 3)) { | 140 | if (tkey_data & (1 << 3)) { |
139 | buttons |= BUTTON_DOWN; | 141 | buttons |= BUTTON_DOWN; |
140 | } | 142 | } |
141 | 143 | ||