From 47785ca7f95c8a1e17bc1056a0d9afa0e7b53c5e Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 15 Jul 2013 09:39:51 +0200 Subject: fuzeplus: add touchpad sensitivity Change-Id: I0252c0967716a4f1a628191dcde7ffc80279370b Reviewed-on: http://gerrit.rockbox.org/515 Reviewed-by: Amaury Pouly --- firmware/export/config/sansafuzeplus.h | 5 +++++ .../target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | 14 +++++++++++++- firmware/target/arm/imx233/sansa-fuzeplus/button-target.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h index fda2390fb7..1c5c2e0193 100644 --- a/firmware/export/config/sansafuzeplus.h +++ b/firmware/export/config/sansafuzeplus.h @@ -87,6 +87,11 @@ #define HAVE_SW_TONE_CONTROLS #define CONFIG_KEYPAD SANSA_FUZEPLUS_PAD +#define HAVE_TOUCHPAD +#define HAVE_TOUCHPAD_SENSITIVITY_SETTING +#define MIN_TOUCHPAD_SENSITIVITY_SETTING -25 +#define MAX_TOUCHPAD_SENSITIVITY_SETTING 25 +#define DEFAULT_TOUCHPAD_SENSITIVITY_SETTING 13 /* Define this to enable morse code input */ #define HAVE_MORSE_INPUT diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index ad0dd16ff3..1474e067c1 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c @@ -198,7 +198,8 @@ static struct button_area_t button_areas[] = {0, 0, 0, 0, 0}, }; -#define RMI_INTERRUPT 1 +#define RMI_INTERRUPT 1 +#define RMI_SET_SENSITIVITY 2 static int touchpad_btns = 0; static long rmi_stack [DEFAULT_STACK_SIZE/sizeof(long)]; @@ -232,6 +233,11 @@ static void rmi_attn_cb(int bank, int pin, intptr_t user) queue_post(&rmi_queue, RMI_INTERRUPT, 0); } +void touchpad_set_sensitivity(int level) +{ + queue_post(&rmi_queue, RMI_SET_SENSITIVITY, level); +} + static void rmi_thread(void) { struct queue_event ev; @@ -245,6 +251,12 @@ static void rmi_thread(void) usb_acknowledge(SYS_USB_CONNECTED_ACK); continue; } + else if(ev.id == RMI_SET_SENSITIVITY) + { + /* handle negative values as well ! */ + rmi_write_single(RMI_2D_SENSITIVITY_ADJ, (unsigned char)(int8_t)ev.data); + continue; + } else if(ev.id != RMI_INTERRUPT) continue; /* clear interrupt */ diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h index b431c94f45..58e8d3179c 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h @@ -23,6 +23,7 @@ #include bool button_debug_screen(void); +void touchpad_set_sensitivity(int level); /* Main unit's buttons */ #define BUTTON_POWER 0x00000001 -- cgit v1.2.3