#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/pointing.h>
&mmv {
delay-ms = <0>;
time-to-max-speed-ms = <0>;
acceleration-exponent = <1>;
trigger-period-ms = <10>;
};
&msc {
trigger-period-ms = <10>;
delay-ms = <0>;
acceleration-exponent = <0>;
time-to-max-speed-ms = <0>;
};
/ {
behaviors {
ht_boot_reset: ht_boot_reset {
compatible = "zmk,behavior-hold-tap";
label = "HT_BOOT_RESET";
bindings = <&bootloader>, <&sys_reset>;
#binding-cells = <2>;
tapping-term-ms = <1000>;
};
mouse_scrl: mouse_wheel_scrl {
compatible = "zmk,behavior-sensor-rotate-var";
#sensor-binding-cells = <2>;
bindings = <&msc>, <&msc>;
tap-ms = <10>;
};
ul_move: move_up_left {
compatible = "zmk,behavior-mod-morph";
label = "MOVE UP LEFT";
#binding-cells = <0>;
bindings = <&mmv MOVE_UP>, <&mmv MOVE_LEFT>;
mods = <MOD_LALT>;
};
dr_move: move_down_right {
compatible = "zmk,behavior-mod-morph";
label = "MOVE DOWN RIGHT";
#binding-cells = <0>;
bindings = <&mmv MOVE_DOWN>, <&mmv MOVE_RIGHT>;
mods = <MOD_LALT>;
};
uldr_move: move_up_left_down_right {
compatible = "zmk,behavior-sensor-rotate";
#sensor-binding-cells = <0>;
bindings = <&ul_move>, <&dr_move>;
tap-ms = <10>;
};
};
combos {
compatible = "zmk,combos";
scroll {
bindings = <&to 6>;
key-positions = <50 44>;
};
scroll-snipe {
bindings = <&to 7>;
key-positions = <50 45>;
};
};
keymap {
compatible = "zmk,keymap";
layer_0 {
bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp LEFT_BRACKET &kp RIGHT_BRACKET &kp Y &kp U &kp I &kp O &kp P &mt DELETE BACKSPACE
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp CAPS &kp BACKSLASH &kp H &kp J &kp K &kp L &kp SEMICOLON &kp SQT
&kp LEFT_SHIFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp PERIOD &kp SLASH &kp RIGHT_SHIFT
&kp LEFT_CONTROL &kp LEFT_ALT &kp LEFT_COMMAND &kp SPACE &to 1 &to 2 &to 3 &to 4 &kp ENTER &to 0 &tog 5 &kp RIGHT_COMMAND &kp RIGHT_ALT &kp RIGHT_CONTROL
>;
};
....
....
....
Snipe {
bindings = <
&trans &none &none &none &none &none &trans &none &none &none &none &none &msc SCRL_UP &trans
&none &none &none &none &none &none &none &none &mkp LCLK &mkp MCLK &mkp RCLK &msc SCRL_LEFT &msc SCRL_DOWN &msc SCRL_RIGHT
&none &none &none &none &none &none &none &none &none &none &mmv MOVE_UP &none
&none &none &none &trans &trans &trans &trans &trans &trans &trans &trans &mmv MOVE_LEFT &mmv MOVE_DOWN &mmv MOVE_RIGHT
>;
sensor-bindings = <&uldr_move>, <&uldr_move>;
};
Scroll {
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
>;
sensor-bindings =
<&mouse_scrl SCRL_DOWN SCRL_UP>,
<&mouse_scrl SCRL_UP SCRL_DOWN>;
};
Scroll_snipe {
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
>;
sensor-bindings =
<&mouse_scrl SCRL_DOWN SCRL_UP>,
<&mouse_scrl SCRL_UP SCRL_DOWN>;
};
};
};
Created
July 13, 2025 18:18
-
-
Save nuovotaka/fc960f4f8efddd8f71b1e3de86cf1fc6 to your computer and use it in GitHub Desktop.
trackball_listener: trackball_listener {
compatible = "zmk,input-listener";
device = <&trackball>;
input-processors = <&zip_xy_transform (INPUT_TRANSFORM_XY_SWAP | INPUT_TRANSFORM_X_INVERT)>; // 一般的なカーソルの移動
snipe {
layers = <5>;
input-processors =
<&zip_xy_transform (INPUT_TRANSFORM_XY_SWAP | INPUT_TRANSFORM_X_INVERT)>, // ←90度回転
<&zip_xy_scaler 1 4>; // 1/4のスケールに変更 故に高精細にカーソルが移動する。さらに細かくしたければ、分母の4の数字を大きくする
};
scroll {
layers = <6>;
input-processors =
<&zip_xy_transform (INPUT_TRANSFORM_XY_SWAP | INPUT_TRANSFORM_X_INVERT)>,
<&zip_xy_to_scroll_mapper>; // 90度回転した情報をスクロールに
};
scroller_snipe {
layers = <7>;
input-processors =
<&zip_xy_transform (INPUT_TRANSFORM_XY_SWAP | INPUT_TRANSFORM_X_INVERT)>,
<&zip_xy_scaler 1 16>, // 1/16 に
<&zip_xy_to_scroll_mapper>;
};
};
};
&physical_layout0 {
kscan = <&kscan0>;
transform = <&default_transform>;
};
&pinctrl {
spi0_default: spi0_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 12)>,
<NRF_PSEL(SPIM_MOSI, 1, 9)>,
<NRF_PSEL(SPIM_MISO, 1, 9)>;
};
};
spi0_sleep: spi0_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 12)>,
<NRF_PSEL(SPIM_MOSI, 1, 9)>,
<NRF_PSEL(SPIM_MISO, 1, 9)>;
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 13 GPIO_ACTIVE_LOW>;
trackball: trackball@0 {
status = "okay";
compatible = "pixart,paw3222";
reg = <0>;
spi-max-frequency = <2000000>;
irq-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
// option
snipe-layers = <5>; //
scroll-layers = <6 7>; //
};
};
&trackball_listener {
status = "okay";
device = <&trackball>;
};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment