From d4bfd14f057fdaa20cda84bf7e667ac3d7ec5828 Mon Sep 17 00:00:00 2001 From: Trent Rand Date: Sat, 4 May 2024 12:12:24 -0700 Subject: [PATCH] Add support for PMW3360 trackball sensor --- .../dactyl_manuform_5x7.keymap | 1 + .../dactyl_manuform_5x7_right.overlay | 41 +++++++++++++++++++ config/dactyl_manuform_5x7.conf | 5 ++- config/west.yml | 9 +++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7.keymap b/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7.keymap index 4a873b6..706c060 100644 --- a/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7.keymap +++ b/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7_right.overlay b/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7_right.overlay index 2fc8acd..f7ff851 100644 --- a/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7_right.overlay +++ b/boards/shields/dactyl_manuform_5x7/dactyl_manuform_5x7_right.overlay @@ -23,3 +23,44 @@ , <&gpio0 9 GPIO_ACTIVE_HIGH> ; }; + +&pinctrl { + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&spi0 { + status = "okay"; + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; + cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + + trackball: trackball@0 { + status = "okay"; + compatible = "pixart,pmw3360"; + reg = <0>; + spi-max-frequency = <2000000>; + irq-gpios = <&gpio0 17 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + + /* optional features */ + // snipe-layers = <1>; + // scroll-layers = <2 3>; + // automouse-layer = <4>; + }; +}; diff --git a/config/dactyl_manuform_5x7.conf b/config/dactyl_manuform_5x7.conf index 31007d8..0fd8887 100644 --- a/config/dactyl_manuform_5x7.conf +++ b/config/dactyl_manuform_5x7.conf @@ -1,5 +1,8 @@ CONFIG_ZMK_SLEEP=y CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 CONFIG_ZMK_BATTERY_REPORT_INTERVAL=900 -CONFIG_ZMK_MOUSE=y CONFIG_ZMK_BLE_EXPERIMENTAL_CONN=y +CONFIG_SPI=y +CONFIG_INPUT=y +CONFIG_ZMK_MOUSE=y +CONFIG_PMW3360=y diff --git a/config/west.yml b/config/west.yml index 379d291..a770b02 100644 --- a/config/west.yml +++ b/config/west.yml @@ -1,11 +1,16 @@ manifest: remotes: - name: zmkfirmware - url-base: https://github.com/zmkfirmware + url-base: https://github.com/petejohanson + - name: trackball-driver + url-base: https://github.com/bigtree908 projects: - name: zmk remote: zmkfirmware - revision: main + revision: feat/pointers-move-scroll import: app/west.yml + - name: pmw3360 + remote: trackball-driver + revision: pmw3360 self: path: config