Button driver would insert erronous events when wheel position overflowed, this fixes it.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8277 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thom Johansen 2005-12-22 00:01:36 +00:00
parent f9295a6a65
commit 2e55f1c9b0

View file

@ -143,10 +143,16 @@ static int ipod_4g_button_read(void)
backlight_on();
if (old_wheel_value != -1) {
wheel_delta = new_wheel_value - old_wheel_value;
wheel_delta_abs = wheel_delta < 0 ? -wheel_delta : wheel_delta;
wheel_delta = new_wheel_value - old_wheel_value;
wheel_delta_abs = wheel_delta < 0 ? -wheel_delta
: wheel_delta;
if (wheel_delta_abs > 48) {
if (old_wheel_value > new_wheel_value)
/* wrapped around the top going clockwise */
wheel_delta += 96;
else if (old_wheel_value < new_wheel_value)
/* wrapped around the top going counterclockwise */ wheel_delta -= 96;
}
/* TODO: these thresholds should most definitely be
settings, and we're probably going to want a more
advanced scheme than this anyway. */
@ -189,8 +195,6 @@ static int ipod_4g_button_read(void)
return btn;
}
void ipod_4g_button_int(void)
{
PP5020_CPU_HI_INT_CLR = PP5020_I2C_MASK;