summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2014-04-11 11:04:06 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2014-04-15 08:18:56 +0200
commitbd10245e8940c05e9c4bfe13744571daf43a164a (patch)
treeabb6a4e23f9d51ff7dafa93273990d34f7f8eca9
parenta18c33a498dd21b5cb083f1076987448fce259cc (diff)
downloadrockbox-bd10245.tar.gz
rockbox-bd10245.tar.bz2
rockbox-bd10245.zip
MPIO HD300: Fix occasional scrollstrip hang
Scrollstrip works as quadrature encoder. We set pin change interrupt for both edges of signal both lines and sample the state in ISR. From time to time the sequence is out-of-sync which was properly detected but erroneously handled leaving scrollstip interrupts disabled. Change-Id: I08e4f99c6c27df0f8180aa16e6e1d9e4203bafa7 Reviewed-on: http://gerrit.rockbox.org/782 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com> Tested: Marcin Bukat <marcin.bukat@gmail.com>
-rw-r--r--firmware/target/coldfire/mpio/hd300/button-hd300.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/firmware/target/coldfire/mpio/hd300/button-hd300.c b/firmware/target/coldfire/mpio/hd300/button-hd300.c
index f59c046cdb..fda26dd0df 100644
--- a/firmware/target/coldfire/mpio/hd300/button-hd300.c
+++ b/firmware/target/coldfire/mpio/hd300/button-hd300.c
@@ -90,20 +90,20 @@ void scrollstrip_isr(void)
/* read GPIO6 and GPIO7 state*/
new_scroll_lines = (GPIO_READ >> 6) & 0x03;
+ /* was it initialized? */
if ( prev_scroll_lines == -1 )
{
prev_scroll_lines = new_scroll_lines;
- ack_scrollstrip_interrupt();
- enable_scrollstrip_interrupts();
- return;
+ goto end;
}
+ /* calculate the direction according to the sequence order */
scroll_dir = scroll_state[prev_scroll_lines][new_scroll_lines];
prev_scroll_lines = new_scroll_lines;
/* catch sequence error */
if (scroll_dir == BUTTON_NONE)
- return;
+ goto end;
/* direction reversal */
if (direction != scroll_dir)
@@ -116,9 +116,7 @@ void scrollstrip_isr(void)
direction = scroll_dir;
count = 0;
- ack_scrollstrip_interrupt();
- enable_scrollstrip_interrupts();
- return;
+ goto end;
}
/* poke backlight */
@@ -129,12 +127,9 @@ void scrollstrip_isr(void)
next_backlight_on = current_tick + HZ/4;
}
+ /* apply sensitivity filter */
if (++count < SLIDER_BASE_SENSITIVITY)
- {
- ack_scrollstrip_interrupt();
- enable_scrollstrip_interrupts();
- return;
- }
+ goto end;
count = 0;
@@ -146,6 +141,10 @@ void scrollstrip_isr(void)
scroll.timeout = current_tick + SLIDER_REL_TIMEOUT;
scroll.rel = false;
+end:
+ /* acknowledge the interrupt
+ * and reenable scrollstrip interrupts
+ */
ack_scrollstrip_interrupt();
enable_scrollstrip_interrupts();
}