forked from len0rd/rockbox
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:
parent
f9295a6a65
commit
2e55f1c9b0
1 changed files with 10 additions and 6 deletions
|
@ -143,10 +143,16 @@ static int ipod_4g_button_read(void)
|
||||||
backlight_on();
|
backlight_on();
|
||||||
if (old_wheel_value != -1) {
|
if (old_wheel_value != -1) {
|
||||||
wheel_delta = new_wheel_value - old_wheel_value;
|
wheel_delta = new_wheel_value - old_wheel_value;
|
||||||
wheel_delta_abs = wheel_delta < 0 ? -wheel_delta : wheel_delta;
|
wheel_delta_abs = wheel_delta < 0 ? -wheel_delta
|
||||||
|
: wheel_delta;
|
||||||
wheel_delta = new_wheel_value - old_wheel_value;
|
|
||||||
|
|
||||||
|
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
|
/* TODO: these thresholds should most definitely be
|
||||||
settings, and we're probably going to want a more
|
settings, and we're probably going to want a more
|
||||||
advanced scheme than this anyway. */
|
advanced scheme than this anyway. */
|
||||||
|
@ -189,8 +195,6 @@ static int ipod_4g_button_read(void)
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ipod_4g_button_int(void)
|
void ipod_4g_button_int(void)
|
||||||
{
|
{
|
||||||
PP5020_CPU_HI_INT_CLR = PP5020_I2C_MASK;
|
PP5020_CPU_HI_INT_CLR = PP5020_I2C_MASK;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue