diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/pbell/vibe500/button-target.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/pbell/vibe500/button-vibe500.c | 47 |
2 files changed, 30 insertions, 18 deletions
diff --git a/firmware/target/arm/pbell/vibe500/button-target.h b/firmware/target/arm/pbell/vibe500/button-target.h index 8190b4313b..fa29c275c0 100644 --- a/firmware/target/arm/pbell/vibe500/button-target.h +++ b/firmware/target/arm/pbell/vibe500/button-target.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define MEP_BUTTON_HEADER 0x19 | 27 | #define MEP_BUTTON_HEADER 0x19 |
28 | #define MEP_BUTTON_ID 0x09 | 28 | #define MEP_BUTTON_ID 0x09 |
29 | #define MEP_ABSOLUTE_HEADER 0x0b | 29 | #define MEP_ABSOLUTE_HEADER 0x0b |
30 | #define MEP_FINGER 0x01 | ||
30 | 31 | ||
31 | #define HAS_BUTTON_HOLD | 32 | #define HAS_BUTTON_HOLD |
32 | 33 | ||
diff --git a/firmware/target/arm/pbell/vibe500/button-vibe500.c b/firmware/target/arm/pbell/vibe500/button-vibe500.c index 7beaeeba81..b129cfea2d 100644 --- a/firmware/target/arm/pbell/vibe500/button-vibe500.c +++ b/firmware/target/arm/pbell/vibe500/button-vibe500.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "powermgmt.h" | ||
26 | #include "synaptics-mep.h" | 27 | #include "synaptics-mep.h" |
27 | 28 | ||
28 | static int int_btn = BUTTON_NONE; | 29 | static int int_btn = BUTTON_NONE; |
@@ -44,7 +45,7 @@ void button_int(void) | |||
44 | 45 | ||
45 | val = touchpad_read_device(data, 4); | 46 | val = touchpad_read_device(data, 4); |
46 | 47 | ||
47 | if (val == MEP_BUTTON_HEADER) | 48 | if (data[0] == MEP_BUTTON_HEADER) |
48 | { | 49 | { |
49 | /* Buttons packet */ | 50 | /* Buttons packet */ |
50 | if (data[1] & 0x1) | 51 | if (data[1] & 0x1) |
@@ -56,19 +57,19 @@ void button_int(void) | |||
56 | if (data[1] & 0x8) | 57 | if (data[1] & 0x8) |
57 | int_btn |= BUTTON_PREV; | 58 | int_btn |= BUTTON_PREV; |
58 | } | 59 | } |
59 | else if (val == MEP_ABSOLUTE_HEADER) | 60 | else if (data[0] == MEP_ABSOLUTE_HEADER) |
60 | { | 61 | { |
61 | /* Absolute packet - the finger is on the vertical strip. | 62 | if (data[1] & MEP_FINGER) |
62 | Position ranges from 1-4095, with 1 at the bottom. */ | 63 | { |
63 | val = ((data[1] >> 4) << 8) | data[2]; /* position */ | 64 | /* Absolute packet - the finger is on the vertical strip. |
65 | Position ranges from 1-4095, with 1 at the bottom. */ | ||
66 | val = ((data[1] >> 4) << 8) | data[2]; /* position */ | ||
64 | 67 | ||
65 | if (val > 0) | 68 | int scr_pos = val >> 8; /* split the scrollstrip into 16 regions */ |
66 | { | 69 | if ((old_pos<scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_DOWN; |
67 | int scr_pos = val >> 8; /* split the scrollstrip into 16 regions */ | 70 | if ((old_pos>scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_UP; |
68 | if ((old_pos<scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_DOWN; | 71 | old_pos = scr_pos; |
69 | if ((old_pos>scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_UP; | 72 | } |
70 | old_pos = scr_pos; | ||
71 | } | ||
72 | else old_pos=-1; | 73 | else old_pos=-1; |
73 | } | 74 | } |
74 | } | 75 | } |
@@ -94,13 +95,24 @@ int button_read_device(void) | |||
94 | if (!hold_button) | 95 | if (!hold_button) |
95 | { | 96 | { |
96 | /* Read Record, OK, C */ | 97 | /* Read Record, OK, C */ |
97 | state = GPIOA_INPUT_VAL; | 98 | state = GPIOA_INPUT_VAL; |
98 | if ((state & 0x01)==0) buttons|=BUTTON_REC; | 99 | if ((state & 0x01)==0) buttons|=BUTTON_REC; |
99 | if ((state & 0x40)==0) buttons|=BUTTON_OK; | 100 | if ((state & 0x40)==0) buttons|=BUTTON_OK; |
100 | if ((state & 0x08)==0) buttons|=BUTTON_CANCEL; | 101 | if ((state & 0x08)==0) buttons|=BUTTON_CANCEL; |
101 | 102 | ||
102 | /* Read POWER button */ | 103 | /* Read POWER button */ |
103 | if ((GPIOD_INPUT_VAL & 0x40)==0) buttons|=BUTTON_POWER; | 104 | if ((GPIOD_INPUT_VAL & 0x40)==0) buttons|=BUTTON_POWER; |
105 | |||
106 | /* Scrollstrip direct button post - much better response */ | ||
107 | if ((buttons==BUTTON_UP) || (buttons==BUTTON_DOWN)) | ||
108 | { | ||
109 | queue_post(&button_queue,buttons,0); | ||
110 | backlight_on(); | ||
111 | buttonlight_on(); | ||
112 | reset_poweroff_timer(); | ||
113 | buttons = BUTTON_NONE; | ||
114 | int_btn = BUTTON_NONE; | ||
115 | } | ||
104 | } | 116 | } |
105 | else return BUTTON_NONE; | 117 | else return BUTTON_NONE; |
106 | return buttons; | 118 | return buttons; |
@@ -111,4 +123,3 @@ bool button_hold(void) | |||
111 | /* GPIOK 01000000B - HOLD when bit not set */ | 123 | /* GPIOK 01000000B - HOLD when bit not set */ |
112 | return (GPIOK_INPUT_VAL & 0x40)?false:true; | 124 | return (GPIOK_INPUT_VAL & 0x40)?false:true; |
113 | } | 125 | } |
114 | |||