summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/olympus
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-09-21 02:05:02 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-09-21 02:05:02 +0000
commitc5d22bce6e69c047157e7106404269c0c2be236b (patch)
tree2b69bd5da421d2e52f8eeaf08576f9035a3ab619 /firmware/target/arm/olympus
parenta576657011ec1f0268ad1b1902e27ac378cda3de (diff)
downloadrockbox-c5d22bce6e69c047157e7106404269c0c2be236b.tar.gz
rockbox-c5d22bce6e69c047157e7106404269c0c2be236b.zip
minor fix for remote button code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/olympus')
-rw-r--r--firmware/target/arm/olympus/mrobe-500/button-mr500.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/firmware/target/arm/olympus/mrobe-500/button-mr500.c b/firmware/target/arm/olympus/mrobe-500/button-mr500.c
index f85eeca912..a25a71e1fc 100644
--- a/firmware/target/arm/olympus/mrobe-500/button-mr500.c
+++ b/firmware/target/arm/olympus/mrobe-500/button-mr500.c
@@ -29,6 +29,11 @@
#include "uart-target.h"
#define BUTTON_TIMEOUT 50
+
+#define BUTTON_START_BYTE 0xF0
+#define BUTTON_START_BYTE2 0xF4 /* not sure why, but sometimes you get F0 or F4, */
+ /* but always the same one for the session? */
+
void button_init_device(void)
{
/* GIO is the power button, set as input */
@@ -43,6 +48,7 @@ inline bool button_hold(void)
int button_read_device(void)
{
char data[5], c;
+ int val;
int i = 0;
int btn = BUTTON_NONE, timeout = BUTTON_TIMEOUT;
@@ -52,14 +58,16 @@ int button_read_device(void)
uartHeartbeat();
while (timeout > 0)
{
- c = uartPollch(BUTTON_TIMEOUT*100);
- if (c > -1)
+ val = uartPollch(BUTTON_TIMEOUT*100);
+ if (val > -1)
{
- if (i && data[0] == 0xf4)
+ c = val&0xff;
+ if (i && (data[0] == BUTTON_START_BYTE || data[0] == BUTTON_START_BYTE2))
{
data[i++] = c;
}
- else if (c == 0xf4)
+ else if (c == BUTTON_START_BYTE ||
+ c == BUTTON_START_BYTE2)
{
data[0] = c;
i = 1;