Skip to content

Commit

Permalink
Merge pull request qmk#22 from ilc/trackball
Browse files Browse the repository at this point in the history
trackball: Fix initial issues with dual trackballs.
  • Loading branch information
morganvenable authored Apr 3, 2024
2 parents e022c84 + 28437ec commit b316978
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 7 deletions.
16 changes: 15 additions & 1 deletion keyboards/svalboard/keymaps/vial/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,22 @@ void mouse_mode(bool);
#endif

#if defined(POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE)
report_mouse_t pointing_device_task_combined_user(report_mouse_t reportMouse1, report_mouse_t reportMouse2) {
if (reportMouse1.x == 0 && reportMouse1.y == 0 && reportMouse2.x == 0 && reportMouse2.y == 0)
return pointing_device_combine_reports(reportMouse1, reportMouse2);

if (mh_auto_buttons_timer) {
mh_auto_buttons_timer = timer_read();
} else {
mouse_mode(true);
#if defined CONSOLE_ENABLE
print("mh_auto_buttons: on\n");
#endif
}
return pointing_device_combine_reports(reportMouse1, reportMouse2);
}

report_mouse_t pointing_device_task_user(report_mouse_t reportMouse) {
print("mh_auto_buttons: called\n");
if (reportMouse.x == 0 && reportMouse.y == 0)
return reportMouse;

Expand Down
3 changes: 2 additions & 1 deletion keyboards/svalboard/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ BOOTLOADER = rp2040
BOARD = GENERIC_RP_RP2040

CUSTOM_MATRIX = lite
SRC += matrix.c

SRC += matrix.c $(EXTRA_SRC)

SERIAL_DRIVER = vendor
# this turns on trackpoint -- dupe in info.json?
Expand Down
9 changes: 9 additions & 0 deletions keyboards/svalboard/trackball.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "quantum.h"
#include "pointing_device.h"
#include "keyboard.h"

void keyboard_post_init_kb(void) {
pointing_device_set_cpi_on_side(true, 5000); // Right.
pointing_device_set_cpi_on_side(false, 5000); // Left.
keyboard_post_init_user();
}
9 changes: 5 additions & 4 deletions keyboards/svalboard/trackball/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#define MOUSE_EXTENDED_REPORT

#undef PS2_MOUSE_ENABLE
// in config.h:

Expand All @@ -34,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Pointing device stuff
#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_COMBINED
#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
#define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE

#if defined(POINTING_DEVICE_IS_PIMORONI)

Expand Down Expand Up @@ -62,6 +64,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// there's supposed to be support for multiple PMW33XX sensors, with different
// CS pins.
#define PMW33XX_CS_PIN GP25
#define PMW33XX_CS_PIN_RIGHT GP25
#else
//for Separate Pimoroni Connector
#define SPI_DRIVER SPID0
Expand All @@ -76,10 +79,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// CS pins.
#define PMW33XX_CS_PIN GP17
#endif
#define PMW33XX_CS_DIVISOR 4
#define PMW33XX_CPI 2000
#define POINTING_DEVICE_COMBINED
#define POINTING_DEVICE_INVERT_Y_RIGHT
#define POINTING_DEVICE_INVERT_Y
//#define POINTING_DEVICE_INVERT_X_RIGHT
#define ROTATIONAL_TRANSFORM_ANGLE 90
#endif
Expand Down
2 changes: 2 additions & 0 deletions keyboards/svalboard/trackball/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ POINTING_DEVICE_DRIVER = pmw3360
# pimoroni_trackball
# pmw3389
MH_AUTO_BUTTONS = yes

EXTRA_SRC += trackball.c
3 changes: 3 additions & 0 deletions keyboards/svalboard/trackpoint/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BTN_MIDDLE) /* Default -- tap to enter relative scroll, hold to use direct scroll*/
#endif

#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_LEFT
#define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE

//@manna-harbour's automousekeys
#if defined MH_AUTO_BUTTONS
Expand Down
5 changes: 4 additions & 1 deletion keyboards/svalboard/trackpoint/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ PS2_MOUSE_ENABLE = yes
# this turns on Manna-Harbour's automousekeys:
MH_AUTO_BUTTONS = yes


POINTING_DEVICE_ENABLE = yes
# this selects trackball driver
POINTING_DEVICE_DRIVER = custom
# pimoroni_trackball

0 comments on commit b316978

Please sign in to comment.