summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-07 05:21:00 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-07 05:21:00 +0000
commita4b45ee1311f3848e2f16d88ca9f67e49f3e41c6 (patch)
tree717cf97c6e7c60ae93ae1f630d624e15dac4f6e3 /firmware/drivers/button.c
parentb5648000ba63476b99823046a6702881a28fd6c0 (diff)
downloadrockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.tar.gz
rockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.zip
Additional minor button interrupt tweaks, in a completely unscientific way, this seems to make the 5g more responsive at 30mhz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index cdbb9f5374..573d57fd0a 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -124,28 +124,22 @@ static void opto_i2c_init(void)
124 124
125static int ipod_4g_button_read(void) 125static int ipod_4g_button_read(void)
126{ 126{
127 unsigned reg, status;
128 static int clickwheel_down = 0;
129 static int old_wheel_value = -1;
130 int wheel_keycode = BUTTON_NONE;
131 int new_wheel_value;
132 int btn = BUTTON_NONE;
133
134 /* The ipodlinux source had a udelay(250) here, but testing has shown that 127 /* The ipodlinux source had a udelay(250) here, but testing has shown that
135 it is not needed - tested on Nano, Color/Photo and Video. */ 128 it is not needed - tested on Nano, Color/Photo and Video. */
136 /* udelay(250);*/ 129 /* udelay(250);*/
137 130
138 reg = 0x7000c104; 131 int btn = BUTTON_NONE;
132 unsigned reg = 0x7000c104;
139 if ((inl(0x7000c104) & 0x4000000) != 0) { 133 if ((inl(0x7000c104) & 0x4000000) != 0) {
140 reg = reg + 0x3C; /* 0x7000c140 */ 134 unsigned status = inl(0x7000c140);
141 135
142 status = inl(0x7000c140); 136 reg = reg + 0x3C; /* 0x7000c140 */
143 outl(0x0, 0x7000c140); /* clear interrupt status? */ 137 outl(0x0, 0x7000c140); /* clear interrupt status? */
144 138
145 if ((status & 0x800000ff) == 0x8000001a) { 139 if ((status & 0x800000ff) == 0x8000001a) {
146 /* NB: highest wheel = 0x5F, clockwise increases */ 140 static int clickwheel_down IDATA_ATTR = 0;
147 new_wheel_value = ((status << 9) >> 25) & 0xff; 141 static int old_wheel_value IDATA_ATTR = -1;
148 142
149 if (status & 0x100) 143 if (status & 0x100)
150 btn |= BUTTON_SELECT; 144 btn |= BUTTON_SELECT;
151 if (status & 0x200) 145 if (status & 0x200)
@@ -157,10 +151,14 @@ static int ipod_4g_button_read(void)
157 if (status & 0x1000) 151 if (status & 0x1000)
158 btn |= BUTTON_MENU; 152 btn |= BUTTON_MENU;
159 if (status & 0x40000000) { 153 if (status & 0x40000000) {
154 /* NB: highest wheel = 0x5F, clockwise increases */
155 int new_wheel_value = ((status << 9) >> 25) & 0xff;
156
160 /* scroll wheel down */ 157 /* scroll wheel down */
161 clickwheel_down = 1; 158 clickwheel_down = 1;
162 backlight_on(); 159 backlight_on();
163 if (old_wheel_value != -1) { 160 if (old_wheel_value >= 0) {
161 int wheel_keycode = BUTTON_NONE;
164 int wheel_delta; 162 int wheel_delta;
165 if (old_wheel_value > new_wheel_value + 48) { 163 if (old_wheel_value > new_wheel_value + 48) {
166 /* Forward wrapping case */ 164 /* Forward wrapping case */