diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-01-11 23:48:29 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-01-11 23:48:29 +0000 |
commit | 267ac4b79b4533043731141115acf45e8018ba38 (patch) | |
tree | 9e6fcdfe27d0941779bfa4b2d0e13c29d40bb7d2 | |
parent | fd240ab240352c43159929f20f8ce63e56c60133 (diff) | |
download | rockbox-267ac4b79b4533043731141115acf45e8018ba38.tar.gz rockbox-267ac4b79b4533043731141115acf45e8018ba38.zip |
SA9200: Adjust touchpad sensitivities so that actual contact with the player is needed to cause button presses and hopefully those settings will work nicely. Add a parameter read function to the MEP driver for debugging and RE purposes; enable compilation of it if you want to use it. Make a note in power-sa9200.c about button inits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29032 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/synaptics-mep.c | 33 | ||||
-rw-r--r-- | firmware/export/synaptics-mep.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/button-sa9200.c | 46 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/power-sa9200.c | 2 |
4 files changed, 80 insertions, 2 deletions
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c index f5b619053b..98c8829ead 100644 --- a/firmware/drivers/synaptics-mep.c +++ b/firmware/drivers/synaptics-mep.c | |||
@@ -608,6 +608,39 @@ int touchpad_set_parameter(char mod_nr, char par_nr, unsigned int param) | |||
608 | return val; | 608 | return val; |
609 | } | 609 | } |
610 | 610 | ||
611 | #if 0 | ||
612 | /* Not used normally, but useful for pulling settings or determining | ||
613 | which parameters are supported */ | ||
614 | int touchpad_get_parameter(char mod_nr, char par_nr, unsigned int *param_p) | ||
615 | { | ||
616 | char data[4]; | ||
617 | int val = 0; | ||
618 | |||
619 | if (syn_status) | ||
620 | { | ||
621 | syn_enable_int(false); | ||
622 | |||
623 | /* 'Get MEP Parameter' command packet */ | ||
624 | data[0]=0x01 | (mod_nr << 5); /* header - addr=mod_nr,global:0,ctrl:0,len:1 */ | ||
625 | data[1]=0x40+par_nr; /* parameter number */ | ||
626 | syn_send(data,2); | ||
627 | |||
628 | /* Must not be an error packet; check size */ | ||
629 | if (syn_read(data,4) == 3) | ||
630 | { | ||
631 | /* ACK: param_hi[15:8], param_lo[7:0] */ | ||
632 | if (param_p) | ||
633 | *param_p = ((unsigned int)data[2] << 8) | data[3]; | ||
634 | val = 3; | ||
635 | } | ||
636 | |||
637 | syn_enable_int(true); | ||
638 | } | ||
639 | |||
640 | return val; | ||
641 | } | ||
642 | #endif | ||
643 | |||
611 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness) | 644 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness) |
612 | { | 645 | { |
613 | char data[6]; | 646 | char data[6]; |
diff --git a/firmware/export/synaptics-mep.h b/firmware/export/synaptics-mep.h index 4eb57382a7..c3894d3e7c 100644 --- a/firmware/export/synaptics-mep.h +++ b/firmware/export/synaptics-mep.h | |||
@@ -25,5 +25,6 @@ int touchpad_init(void); | |||
25 | int touchpad_read_device(char *data, int len); | 25 | int touchpad_read_device(char *data, int len); |
26 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness); | 26 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness); |
27 | int touchpad_set_parameter(char mod_nr, char par_nr, unsigned int param); | 27 | int touchpad_set_parameter(char mod_nr, char par_nr, unsigned int param); |
28 | int touchpad_get_parameter(char mod_nr, char par_nr, unsigned int *param_p); | ||
28 | 29 | ||
29 | #endif | 30 | #endif |
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index e3d569f422..1e92325c73 100644 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c | |||
@@ -32,10 +32,52 @@ static int int_btn = BUTTON_NONE; | |||
32 | #ifndef BOOTLOADER | 32 | #ifndef BOOTLOADER |
33 | static bool hold_button_old = false; | 33 | static bool hold_button_old = false; |
34 | 34 | ||
35 | /* Capacitive buttons - lowest setting is still very sensitive */ | ||
36 | static const signed char button_sensitivity = -8; /* -8 to 7 */ | ||
37 | |||
38 | /* Strip - decent amount of contact needed */ | ||
39 | static const signed char strip_sensitivity = 0; /* -8 to 7 */ | ||
40 | static const unsigned char strip_pressure = 25; /* 0 to 255 */ | ||
41 | |||
35 | void button_init_device(void) | 42 | void button_init_device(void) |
36 | { | 43 | { |
37 | /* The touchpad is powered on and initialized in power-sa9200.c | 44 | /* The touchpad is powered on and initialized in power-sa9200.c |
38 | since it needs to be ready for both buttons and button lights. */ | 45 | since it needs to be ready for both buttons and button lights. */ |
46 | |||
47 | /* perform button-specific inits here */ | ||
48 | |||
49 | /* Besides $00, only common parameters $20 and $21 are supported */ | ||
50 | |||
51 | /* Report modes: | ||
52 | * [15:12] cap btn sens : xxxx, | ||
53 | * [11: 8] pos sen sens : xxxx, | ||
54 | * [ 7: 6] rate: 10 (40 rps), | ||
55 | * [ 5] no filter: 0, | ||
56 | * [ 4] reserved: 0, | ||
57 | * [ 3] en scr: 0, | ||
58 | * [ 2] en btns: 1, | ||
59 | * [ 1] en rel: 0, | ||
60 | * [ 0] en abs: 1 */ | ||
61 | touchpad_set_parameter(0, 0x20, | ||
62 | ((button_sensitivity & 0xf) << 12) | | ||
63 | ((strip_sensitivity & 0xf) << 8) | | ||
64 | (0x2 << 6) | | ||
65 | (0x1 << 2) | | ||
66 | (0x1 << 0)); | ||
67 | |||
68 | /* Enhanced operating configuration: | ||
69 | * [15: 9] reserved : 0000000 | ||
70 | * [ 8] Min abs reporting : 0 | ||
71 | * [ 7] reserved : 0 | ||
72 | * [ 6] not all cap btns : 1 | ||
73 | * [ 5] single cap btn : 0 | ||
74 | * [ 4] en 50ms debounce : 1 | ||
75 | * [ 3] motion reporting : 0 | ||
76 | * [ 2] clip z if no finger : 0 | ||
77 | * [ 1] disable decel : 0 | ||
78 | * [ 0] enable dribble : 0 */ | ||
79 | touchpad_set_parameter(0, 0x21, | ||
80 | (0x1 << 6) | (0x1 << 4)); | ||
39 | } | 81 | } |
40 | 82 | ||
41 | /* | 83 | /* |
@@ -43,7 +85,7 @@ void button_init_device(void) | |||
43 | */ | 85 | */ |
44 | void button_int(void) | 86 | void button_int(void) |
45 | { | 87 | { |
46 | char data[4]; | 88 | unsigned char data[4]; |
47 | int val; | 89 | int val; |
48 | 90 | ||
49 | int_btn = BUTTON_NONE; | 91 | int_btn = BUTTON_NONE; |
@@ -59,7 +101,7 @@ void button_int(void) | |||
59 | if (data[1] & 0x8) int_btn |= BUTTON_LEFT; | 101 | if (data[1] & 0x8) int_btn |= BUTTON_LEFT; |
60 | if (data[2] & 0x1) int_btn |= BUTTON_MENU; | 102 | if (data[2] & 0x1) int_btn |= BUTTON_MENU; |
61 | } | 103 | } |
62 | else if (val == MEP_ABSOLUTE_HEADER) | 104 | else if (val == MEP_ABSOLUTE_HEADER && data[3] >= strip_pressure) |
63 | { | 105 | { |
64 | /* Absolute packet - the finger is on the vertical strip. | 106 | /* Absolute packet - the finger is on the vertical strip. |
65 | Position ranges from 1-4095, with 1 at the bottom. */ | 107 | Position ranges from 1-4095, with 1 at the bottom. */ |
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c index 1570954fcc..b6a3929e8b 100644 --- a/firmware/target/arm/philips/sa9200/power-sa9200.c +++ b/firmware/target/arm/philips/sa9200/power-sa9200.c | |||
@@ -66,6 +66,8 @@ void power_init(void) | |||
66 | { | 66 | { |
67 | logf("touchpad not ready"); | 67 | logf("touchpad not ready"); |
68 | } | 68 | } |
69 | |||
70 | /* Setups specifically for buttons are handled in button-sa9200.c */ | ||
69 | #endif | 71 | #endif |
70 | } | 72 | } |
71 | 73 | ||