PMW3360 driver implementation for ZMK with at least Zephyr 3.5
THIS driver is ganked from inorichi's PMW3610 driver which is based off of ufan's implementation of the driver.
Important to note that the PMW3360 is very power hungry compared to the PMW3610. If going fully wireless, you'll need big batteries and, even then, your battery life won't be great.
Only GitHub actions builds are covered here. Local builds are different for each user, therefore it's not possible to cover all cases.
Include this project on your ZMK's west manifest in config/west.yml:
manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
- name: KOHSUK
url-base: https://github.com/KOHSUK
projects:
- name: zmk
remote: zmkfirmware
revision: main
import: app/west.yml
- name: zmk-pmw3360-driver
remote: KOHSUK
revision: pmw3360
self:
path: configThen, edit your build.yml to look like this:
on: [workflow_dispatch]
jobs:
build:
uses: petejohanson/zmk/.github/workflows/build-user-config.yml@core/zephyr-3.5-updateNow, update your board.overlay adding the necessary bits (update the pins for your board accordingly):
&pinctrl {
spi0_default: spi0_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
<NRF_PSEL(SPIM_MISO, 0, 17)>;
};
};
spi0_sleep: spi0_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
<NRF_PSEL(SPIM_MISO, 0, 17)>;
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 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
/* optional features */
// snipe-layers = <1>;
// scroll-layers = <2 3>;
// automouse-layer = <4>;
};
};
Now enable the driver config in your board.config file (read the Kconfig file to find out all possible options):
CONFIG_SPI=y
CONFIG_INPUT=y
CONFIG_ZMK_MOUSE=y
CONFIG_PMW3360=y