Skip to content

Commit

Permalink
add mouse scroll on num layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mike1808 committed Jun 25, 2024
1 parent 4689589 commit faa104e
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 36 deletions.
36 changes: 18 additions & 18 deletions config/boards/shields/hillside_view/hillside_view.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC

&i2c0 {
status = "disabled";
glidepoint: glidepoint@2a {
glidepoint0: glidepoint@2a {
compatible = "cirque,pinnacle";
reg = <0x2a>;
status = "disabled";
Expand All @@ -176,23 +176,23 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC
};
};

/ {
/* assign `input-listener` to all pointing devices */
/* &glidepoint0 on central, &glidepoint1 on peripheral */
tpad_central_listener {
compatible = "zmk,input-listener";
device = <&glidepoint>;
};

tpad_peripheral_listener {
compatible = "zmk,input-listener";
device = <&glidepoint_virtual>;
y-invert;
// xy-swap;
// x-invert;
scale-multiplier = <3>;
};
};
// / {
// /* assign `input-listener` to all pointing devices */
// /* &glidepoint0 on central, &glidepoint1 on peripheral */
// tpad_central_listener {
// compatible = "zmk,input-listener";
// device = <&glidepoint0>;
// };

// tpad_peripheral_listener {
// compatible = "zmk,input-listener";
// device = <&glidepoint1>;
// y-invert;
// // xy-swap;
// // x-invert;
// scale-multiplier = <3>;
// };
// };

nice_view_spi: &spi1 {
compatible = "nordic,nrf-spim";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/ {
/* define virtual input, will be resurrected for emitting input event */
/* NOTE: set `device = <&glidepoint1>` in `zmk,input-listener` */
glidepoint_virtual: virtual_input {
glidepoint1: virtual_input {
compatible = "zmk,virtual-input";
};

Expand All @@ -53,6 +53,6 @@
relay-channel = <102>;

/* virtual input device on central, which used to emit input event as an agent device */
device = <&glidepoint_virtual>;
device = <&glidepoint1>;
};
};
32 changes: 16 additions & 16 deletions config/boards/shields/hillside_view/hillside_view_right.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,29 @@
// };

&i2c0 {
status = "okay";
glidepoint0: glidepoint@2a {
status = "okay";
};
status = "okay";
glidepoint0: glidepoint@2a {
status = "okay";
};
};

/ {
/* THIS only makes keymap binding happy, nothing happens on peripheral side */
glidepoint_virtual: virtual_input {
glidepoint1: virtual_input {
compatible = "zmk,virtual-input";
};

input_relay_config_102 {
compatible = "zmk,split-peripheral-input-relay";
input_relay_config_102 {
compatible = "zmk,split-peripheral-input-relay";

/* peripheral side input device, used to... */
/* - be intecepted on peripheral; */
/* - and then, be resurrected as `zmk,virtual-device` on central; */
device = <&glidepoint>;
/* peripheral side input device, used to... */
/* - be intecepted on peripheral; */
/* - and then, be resurrected as `zmk,virtual-device` on central; */
device = <&glidepoint0>;

/* channel id, used to be be transfered along with all input events. */
/* NOTE 1: pick any 8bit integer. (1 - 255) */
/* TE 2: should matching relay-channel on central overlay */
relay-channel = <102>;
};
/* channel id, used to be be transfered along with all input events. */
/* NOTE 1: pick any 8bit integer. (1 - 255) */
/* TE 2: should matching relay-channel on central overlay */
relay-channel = <102>;
};
};
44 changes: 44 additions & 0 deletions config/hillside_view.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,50 @@
quick-release;
};

/ {
/* assign `input-listener` to all pointing devices */
/* &glidepoint0 on central, &glidepoint1 on peripheral */
tpad_central_listener {
compatible = "zmk,input-behavior-listener";
device = <&glidepoint0>;
y-invert;
scale-multiplier = <3>;
// xy-swap;
// x-invert;
};

tpad_peripheral_listener {
compatible = "zmk,input-behavior-listener";
device = <&glidepoint1>;
layers = <DEF WIN SWP SYM ADJ>;
y-invert;
scale-multiplier = <3>;
/* NOTE: do NOT override event code here, */
/* let Cirque glidepoint reports click from taps */
// evt-type = <INPUT_EV_REL>;
// x-input-code = <INPUT_REL_X>;
// y-input-code = <INPUT_REL_Y>;
};

tpad_peripheral_scroll {
compatible = "zmk,input-behavior-listener";
device = <&glidepoint1>;
layers = <NUM>;
/* NOTE: only apply input-code overriding for INPUT_EV_REL */
evt-type = <INPUT_EV_REL>;
x-input-code = <INPUT_REL_MISC>;
y-input-code = <INPUT_REL_WHEEL>;
bindings = <&ib_wheel_scaler 1 8>;
};

ib_wheel_scaler: ib_wheel_scaler {
compatible = "zmk,input-behavior-scaler";
#binding-cells = <2>;
evt-type = <INPUT_EV_REL>;
input-code = <INPUT_REL_WHEEL>;
};
};

/ {
conditional_layers {
compatible = "zmk,conditional-layers";
Expand Down

0 comments on commit faa104e

Please sign in to comment.