diff options
| author | dbroqua <dbroqua@mousur.org> | 2017-05-26 20:35:31 +0200 |
|---|---|---|
| committer | dbroqua <dbroqua@mousur.org> | 2017-05-26 20:35:31 +0200 |
| commit | 81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0 (patch) | |
| tree | 34c6c60530bb980dd26ad790eb0bc09f4ff99edb /tmk_core/protocol | |
| parent | 0a4a966c6648e66a1129ae3af36639054d3e0ed3 (diff) | |
| download | qmk_firmware-81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0.tar.gz qmk_firmware-81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0.zip | |
- Added integration of IBM Trackpoint
Diffstat (limited to 'tmk_core/protocol')
| -rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index d9ccbecb4..4ed3cae1f 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c | |||
| @@ -72,12 +72,13 @@ void ps2_mouse_init_user(void) { | |||
| 72 | 72 | ||
| 73 | void ps2_mouse_task(void) { | 73 | void ps2_mouse_task(void) { |
| 74 | static uint8_t buttons_prev = 0; | 74 | static uint8_t buttons_prev = 0; |
| 75 | extern int tp_buttons; | ||
| 75 | 76 | ||
| 76 | /* receives packet from mouse */ | 77 | /* receives packet from mouse */ |
| 77 | uint8_t rcv; | 78 | uint8_t rcv; |
| 78 | rcv = ps2_host_send(PS2_MOUSE_READ_DATA); | 79 | rcv = ps2_host_send(PS2_MOUSE_READ_DATA); |
| 79 | if (rcv == PS2_ACK) { | 80 | if (rcv == PS2_ACK) { |
| 80 | mouse_report.buttons = ps2_host_recv_response(); | 81 | mouse_report.buttons = ps2_host_recv_response() | tp_buttons; |
| 81 | mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; | 82 | mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER; |
| 82 | mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; | 83 | mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER; |
| 83 | #ifdef PS2_MOUSE_ENABLE_SCROLLING | 84 | #ifdef PS2_MOUSE_ENABLE_SCROLLING |
| @@ -106,34 +107,34 @@ void ps2_mouse_task(void) { | |||
| 106 | #endif | 107 | #endif |
| 107 | host_mouse_send(&mouse_report); | 108 | host_mouse_send(&mouse_report); |
| 108 | } | 109 | } |
| 109 | 110 | ||
| 110 | ps2_mouse_clear_report(&mouse_report); | 111 | ps2_mouse_clear_report(&mouse_report); |
| 111 | } | 112 | } |
| 112 | 113 | ||
| 113 | void ps2_mouse_disable_data_reporting(void) { | 114 | void ps2_mouse_disable_data_reporting(void) { |
| 114 | PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); | 115 | PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | void ps2_mouse_enable_data_reporting(void) { | 118 | void ps2_mouse_enable_data_reporting(void) { |
| 118 | PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); | 119 | PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | void ps2_mouse_set_remote_mode(void) { | 122 | void ps2_mouse_set_remote_mode(void) { |
| 122 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode"); | 123 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode"); |
| 123 | ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE; | 124 | ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | void ps2_mouse_set_stream_mode(void) { | 127 | void ps2_mouse_set_stream_mode(void) { |
| 127 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode"); | 128 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode"); |
| 128 | ps2_mouse_mode = PS2_MOUSE_STREAM_MODE; | 129 | ps2_mouse_mode = PS2_MOUSE_STREAM_MODE; |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | void ps2_mouse_set_scaling_2_1(void) { | 132 | void ps2_mouse_set_scaling_2_1(void) { |
| 132 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); | 133 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); |
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | void ps2_mouse_set_scaling_1_1(void) { | 136 | void ps2_mouse_set_scaling_1_1(void) { |
| 136 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); | 137 | PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { | 140 | void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { |
| @@ -204,9 +205,9 @@ static inline void ps2_mouse_enable_scrolling(void) { | |||
| 204 | #define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) | 205 | #define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) |
| 205 | #define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK) | 206 | #define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK) |
| 206 | static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { | 207 | static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { |
| 207 | static enum { | 208 | static enum { |
| 208 | SCROLL_NONE, | 209 | SCROLL_NONE, |
| 209 | SCROLL_BTN, | 210 | SCROLL_BTN, |
| 210 | SCROLL_SENT, | 211 | SCROLL_SENT, |
| 211 | } scroll_state = SCROLL_NONE; | 212 | } scroll_state = SCROLL_NONE; |
| 212 | static uint16_t scroll_button_time = 0; | 213 | static uint16_t scroll_button_time = 0; |
| @@ -228,10 +229,10 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { | |||
| 228 | mouse_report->y = 0; | 229 | mouse_report->y = 0; |
| 229 | } | 230 | } |
| 230 | } else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) { | 231 | } else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) { |
| 231 | // None of the scroll buttons are pressed | 232 | // None of the scroll buttons are pressed |
| 232 | 233 | ||
| 233 | #if PS2_MOUSE_SCROLL_BTN_SEND | 234 | #if PS2_MOUSE_SCROLL_BTN_SEND |
| 234 | if (scroll_state == SCROLL_BTN | 235 | if (scroll_state == SCROLL_BTN |
| 235 | && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { | 236 | && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { |
| 236 | PRESS_SCROLL_BUTTONS; | 237 | PRESS_SCROLL_BUTTONS; |
| 237 | host_mouse_send(mouse_report); | 238 | host_mouse_send(mouse_report); |
