From faa104e1ec89525b38930346f7f74f102663fd31 Mon Sep 17 00:00:00 2001 From: Mikael Manukyan Date: Mon, 24 Jun 2024 17:39:57 -0700 Subject: [PATCH] add mouse scroll on num layer --- .../shields/hillside_view/hillside_view.dtsi | 36 +++++++-------- .../hillside_view/hillside_view_left.overlay | 4 +- .../hillside_view/hillside_view_right.overlay | 32 +++++++------- config/hillside_view.keymap | 44 +++++++++++++++++++ 4 files changed, 80 insertions(+), 36 deletions(-) diff --git a/config/boards/shields/hillside_view/hillside_view.dtsi b/config/boards/shields/hillside_view/hillside_view.dtsi index d3c90fc..2cff37a 100644 --- a/config/boards/shields/hillside_view/hillside_view.dtsi +++ b/config/boards/shields/hillside_view/hillside_view.dtsi @@ -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"; @@ -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"; diff --git a/config/boards/shields/hillside_view/hillside_view_left.overlay b/config/boards/shields/hillside_view/hillside_view_left.overlay index 58f3ab1..8ef25fa 100644 --- a/config/boards/shields/hillside_view/hillside_view_left.overlay +++ b/config/boards/shields/hillside_view/hillside_view_left.overlay @@ -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"; }; @@ -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>; }; }; diff --git a/config/boards/shields/hillside_view/hillside_view_right.overlay b/config/boards/shields/hillside_view/hillside_view_right.overlay index bb79049..1e549f7 100644 --- a/config/boards/shields/hillside_view/hillside_view_right.overlay +++ b/config/boards/shields/hillside_view/hillside_view_right.overlay @@ -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>; + }; }; diff --git a/config/hillside_view.keymap b/config/hillside_view.keymap index 0eca87e..88c14b6 100644 --- a/config/hillside_view.keymap +++ b/config/hillside_view.keymap @@ -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 = ; + y-invert; + scale-multiplier = <3>; + /* NOTE: do NOT override event code here, */ + /* let Cirque glidepoint reports click from taps */ + // evt-type = ; + // x-input-code = ; + // y-input-code = ; + }; + + tpad_peripheral_scroll { + compatible = "zmk,input-behavior-listener"; + device = <&glidepoint1>; + layers = ; + /* NOTE: only apply input-code overriding for INPUT_EV_REL */ + evt-type = ; + x-input-code = ; + y-input-code = ; + bindings = <&ib_wheel_scaler 1 8>; + }; + + ib_wheel_scaler: ib_wheel_scaler { + compatible = "zmk,input-behavior-scaler"; + #binding-cells = <2>; + evt-type = ; + input-code = ; + }; +}; + / { conditional_layers { compatible = "zmk,conditional-layers";