summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
authordbroqua <dbroqua@mousur.org>2017-05-26 20:35:31 +0200
committerdbroqua <dbroqua@mousur.org>2017-05-26 20:35:31 +0200
commit81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0 (patch)
tree34c6c60530bb980dd26ad790eb0bc09f4ff99edb /tmk_core
parent0a4a966c6648e66a1129ae3af36639054d3e0ed3 (diff)
downloadqmk_firmware-81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0.tar.gz
qmk_firmware-81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0.tar.xz
- Added integration of IBM Trackpoint
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/action.c34
-rw-r--r--tmk_core/protocol/ps2_mouse.c29
2 files changed, 45 insertions, 18 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index a534f818e..f73b0fe80 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -34,6 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nodebug.h"
#endif
+int tp_buttons;
+
#ifdef FAUXCLICKY_ENABLE
#include <fauxclicky.h>
#endif
@@ -311,11 +313,35 @@ void process_action(keyrecord_t *record, action_t action)
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
- mousekey_on(action.key.code);
- mousekey_send();
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons |= (1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons |= (1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons |= (1<<2);
+ break;
+ default:
+ mousekey_on(action.key.code);
+ mousekey_send();
+ }
} else {
- mousekey_off(action.key.code);
- mousekey_send();
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons &= ~(1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons &= ~(1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons &= ~(1<<2);
+ break;
+ default:
+ mousekey_off(action.key.code);
+ mousekey_send();
+ }
}
break;
#endif
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) {
void ps2_mouse_task(void) {
static uint8_t buttons_prev = 0;
+ extern int tp_buttons;
/* receives packet from mouse */
uint8_t rcv;
rcv = ps2_host_send(PS2_MOUSE_READ_DATA);
if (rcv == PS2_ACK) {
- mouse_report.buttons = ps2_host_recv_response();
+ mouse_report.buttons = ps2_host_recv_response() | tp_buttons;
mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER;
mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER;
#ifdef PS2_MOUSE_ENABLE_SCROLLING
@@ -106,34 +107,34 @@ void ps2_mouse_task(void) {
#endif
host_mouse_send(&mouse_report);
}
-
+
ps2_mouse_clear_report(&mouse_report);
}
void ps2_mouse_disable_data_reporting(void) {
- PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
+ PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
}
void ps2_mouse_enable_data_reporting(void) {
PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
}
-void ps2_mouse_set_remote_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
+void ps2_mouse_set_remote_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE;
}
-void ps2_mouse_set_stream_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
+void ps2_mouse_set_stream_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
}
void ps2_mouse_set_scaling_2_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
}
void ps2_mouse_set_scaling_1_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
}
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
@@ -204,9 +205,9 @@ static inline void ps2_mouse_enable_scrolling(void) {
#define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK)
#define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK)
static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
- static enum {
- SCROLL_NONE,
- SCROLL_BTN,
+ static enum {
+ SCROLL_NONE,
+ SCROLL_BTN,
SCROLL_SENT,
} scroll_state = SCROLL_NONE;
static uint16_t scroll_button_time = 0;
@@ -228,10 +229,10 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
mouse_report->y = 0;
}
} else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) {
- // None of the scroll buttons are pressed
+ // None of the scroll buttons are pressed
#if PS2_MOUSE_SCROLL_BTN_SEND
- if (scroll_state == SCROLL_BTN
+ if (scroll_state == SCROLL_BTN
&& timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) {
PRESS_SCROLL_BUTTONS;
host_mouse_send(mouse_report);