diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-05-29 21:27:44 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-05-29 21:27:44 +0000 |
commit | c541e046325f97307f34b2e51ca7994126dd1969 (patch) | |
tree | e7144cb6cd2478669b79dd197d464cbc6752bdb7 /firmware/target | |
parent | f76122f0e7a3b82962dbe005d58a643c835013d0 (diff) | |
download | rockbox-c541e046325f97307f34b2e51ca7994126dd1969.tar.gz rockbox-c541e046325f97307f34b2e51ca7994126dd1969.zip |
Gigabeat F/X:
Allow chaning of touchpad sensitivity in the System settings menu. Some
units are dodgey at "Normal" senitivity and some at "High". "High" can make
some units difficult to navigate and may even require a settings reset so try
it and don't use "High" again if it doesn't work out :-). Defaults to "Normal"
which behaves like older builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17656 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c | 51 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/button-target.h | 1 |
2 files changed, 41 insertions, 11 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 9f6d54df9d..c43d1884f4 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c @@ -30,6 +30,20 @@ static bool headphones_detect; static bool hold_button = false; +#define TOUCHPAD_SENS_NORMAL ((1 << 12) | /* right++ */ \ + (1 << 7) | /* left++ */ \ + (1 << 6) | /* down++*/ \ + (1 << 0) | /* up++ */ \ + (1 << 3)) /* center */ + +#define TOUCHPAD_SENS_HIGH (((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 */ + +static int touchpad_mask = TOUCHPAD_SENS_NORMAL; + static int const remote_buttons[] = { BUTTON_NONE, /* Headphones connected - remote disconnected */ @@ -123,30 +137,31 @@ int button_read_device(void) } /* 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 */ + touchpad = GPJDAT & touchpad_mask; + if (touchpad) { if (touchpad & (1 << 3)) { btn |= BUTTON_SELECT; - /* Desensitize middle (+) detectors one level */ - touchpad &= ~((1 << 11) | (1 << 8) | (1 << 5) | (1 << 1)); + /* Desensitize all but outer detectors and still allow a combo if + * that's really intended. */ + touchpad &= TOUCHPAD_SENS_NORMAL; } - if (touchpad & ((1 << 1) | (1 << 0))) + /* Simply include all lines in checks since "touchpad" has been + * masked to desired sensitivity already - allows any mask to be + * used without changing this code. */ + if (touchpad & ((1 << 2) | (1 << 1) | (1 << 0))) btn |= BUTTON_UP; - if (touchpad & ((1 << 12) | (1 << 11))) + if (touchpad & ((1 << 12) | (1 << 11) | (1 << 10))) btn |= BUTTON_RIGHT; - if (touchpad & ((1 << 6) | (1 << 5))) + if (touchpad & ((1 << 6) | (1 << 5) | (1 << 4))) btn |= BUTTON_DOWN; - if (touchpad & ((1 << 8) | (1 << 7))) + if (touchpad & ((1 << 9) | (1 << 8) | (1 << 7))) btn |= BUTTON_LEFT; buttonlight_on(); @@ -155,6 +170,20 @@ int button_read_device(void) return btn; } +void touchpad_set_sensitivity(int level) +{ + static const int masks[] = + { + TOUCHPAD_SENS_NORMAL, + TOUCHPAD_SENS_HIGH + }; + + if ((unsigned)level >= ARRAYLEN(masks)) + level = 0; + + touchpad_mask = masks[level]; +} + bool headphones_inserted(void) { return headphones_detect; diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h index 7a39212de9..a5876aadde 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h +++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h @@ -27,6 +27,7 @@ bool button_hold(void); void button_init_device(void); int button_read_device(void); +void touchpad_set_sensitivity(int level); /* Toshiba Gigabeat specific button codes */ |