summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
index 8460e29..9f6d54d 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
@@ -122,10 +122,21 @@ int button_read_device(void)
buttonlight_on();
}
- /* the touchpad */
- touchpad = GPJDAT & 0x10C9;
+ /* the touchpad - only watch the lines we actually read */
+ touchpad = GPJDAT & (((1 << 12) | (1 << 11)) | /* right++, right+ */
+ ((1 << 8) | (1 << 7)) | /* left+, left++ */
+ ((1 << 6) | (1 << 5)) | /* down++, down+ */
+ ((1 << 1) | (1 << 0)) | /* up+, up++ */
+ (1 << 3)); /* center */
if (touchpad)
{
+ if (touchpad & (1 << 3))
+ {
+ btn |= BUTTON_SELECT;
+ /* Desensitize middle (+) detectors one level */
+ touchpad &= ~((1 << 11) | (1 << 8) | (1 << 5) | (1 << 1));
+ }
+
if (touchpad & ((1 << 1) | (1 << 0)))
btn |= BUTTON_UP;
@@ -138,8 +149,6 @@ int button_read_device(void)
if (touchpad & ((1 << 8) | (1 << 7)))
btn |= BUTTON_LEFT;
- if (touchpad & (1 << 3))
- btn |= BUTTON_SELECT;
buttonlight_on();
}