From 5f67067082fd0ebb473bf63ec28f5a15f81b476d Mon Sep 17 00:00:00 2001 From: Mikael Manukyan Date: Sun, 23 Jun 2024 21:35:08 -0700 Subject: [PATCH] add cirque on peripheral side --- .../shields/hillside_view/hillside_view.conf | 10 ++-- .../shields/hillside_view/hillside_view.dtsi | 39 +++++++++++---- .../hillside_view/hillside_view_left.conf | 5 ++ .../hillside_view/hillside_view_left.overlay | 42 ++++++++-------- .../hillside_view/hillside_view_right.conf | 25 ++++------ .../hillside_view/hillside_view_right.overlay | 49 ++++++++++++++----- config/hillside_view.conf | 1 - 7 files changed, 109 insertions(+), 62 deletions(-) diff --git a/config/boards/shields/hillside_view/hillside_view.conf b/config/boards/shields/hillside_view/hillside_view.conf index e44a61f..01f8d91 100644 --- a/config/boards/shields/hillside_view/hillside_view.conf +++ b/config/boards/shields/hillside_view/hillside_view.conf @@ -1,9 +1,9 @@ # Set Bluetooth to max power CONFIG_BT_CTLR_TX_PWR_PLUS_8=y -# Enable displays -CONFIG_ZMK_DISPLAY=y -CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE=n +# # Enable displays +# CONFIG_ZMK_DISPLAY=y +# CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE=n # Enable encoders # CONFIG_EC11=y @@ -17,9 +17,11 @@ CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE=n # CONFIG_ZMK_RGB_UNDERGLOW_BRT_START=60 # CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y + +CONFIG_ZMK_MOUSE=y + CONFIG_I2C=y CONFIG_PINNACLE=y CONFIG_NFCT_PINS_AS_GPIOS=y -CONFIG_ZMK_MOUSE=y CONFIG_INPUT=y CONFIG_INPUT_PINNACLE=y diff --git a/config/boards/shields/hillside_view/hillside_view.dtsi b/config/boards/shields/hillside_view/hillside_view.dtsi index 804cf80..d3c90fc 100644 --- a/config/boards/shields/hillside_view/hillside_view.dtsi +++ b/config/boards/shields/hillside_view/hillside_view.dtsi @@ -163,18 +163,35 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC }; &i2c0 { + status = "disabled"; + glidepoint: glidepoint@2a { + compatible = "cirque,pinnacle"; + reg = <0x2a>; status = "disabled"; - glidepoint: glidepoint@2a { - compatible = "cirque,pinnacle"; - reg = <0x2a>; - status = "disabled"; - dr-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH)>; - - sensitivity = "5x"; - // sleep; - // no-taps; - }; + dr-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH)>; + + sensitivity = "1x"; + // sleep; + // no-taps; + }; +}; +/ { + /* 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>; + }; }; nice_view_spi: &spi1 { @@ -183,8 +200,10 @@ nice_view_spi: &spi1 { pinctrl-1 = <&spi1_sleep>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + status = "disabled"; nice_view: ls0xx@0 { + status = "disabled"; compatible = "sharp,ls0xx"; spi-max-frequency = <1000000>; reg = <0>; diff --git a/config/boards/shields/hillside_view/hillside_view_left.conf b/config/boards/shields/hillside_view/hillside_view_left.conf index d1c270c..778e455 100644 --- a/config/boards/shields/hillside_view/hillside_view_left.conf +++ b/config/boards/shields/hillside_view/hillside_view_left.conf @@ -1,3 +1,8 @@ +# # Enable displays +CONFIG_ZMK_DISPLAY=y +CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE=n +CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y + CONFIG_ZMK_MOUSE=y CONFIG_INPUT=y CONFIG_GPIO=y diff --git a/config/boards/shields/hillside_view/hillside_view_left.overlay b/config/boards/shields/hillside_view/hillside_view_left.overlay index 8057d8a..58f3ab1 100644 --- a/config/boards/shields/hillside_view/hillside_view_left.overlay +++ b/config/boards/shields/hillside_view/hillside_view_left.overlay @@ -17,11 +17,11 @@ ; }; -&left_encoder { - status = "okay"; - a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; - b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; -}; +// &left_encoder { +// status = "okay"; +// a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; +// b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; +// }; &chosen { zephyr,display = &nice_view; @@ -36,21 +36,23 @@ status = "okay"; }; -&i2c0 { - status = "okay"; - glidepoint: glidepoint@2a { - status = "okay"; - }; -}; / { - tpad0: tpad0 { - compatible = "zmk,input-listener"; - - device = <&glidepoint>; - // xy-swap; - // y-invert; - // x-invert; - }; + /* define virtual input, will be resurrected for emitting input event */ + /* NOTE: set `device = <&glidepoint1>` in `zmk,input-listener` */ + glidepoint_virtual: virtual_input { + compatible = "zmk,virtual-input"; + }; + + /* for central side, define (relay-channel)-to-(virtual-input) mapping */ + input_relay_config_102 { + compatible = "zmk,split-peripheral-input-relay"; + + /* channel id, used to filter incoming input event from split peripheral */ + /* NOTE: should matching relay-channel on peripheral overlay */ + relay-channel = <102>; + + /* virtual input device on central, which used to emit input event as an agent device */ + device = <&glidepoint_virtual>; + }; }; - diff --git a/config/boards/shields/hillside_view/hillside_view_right.conf b/config/boards/shields/hillside_view/hillside_view_right.conf index b44c732..bda1f03 100644 --- a/config/boards/shields/hillside_view/hillside_view_right.conf +++ b/config/boards/shields/hillside_view/hillside_view_right.conf @@ -1,22 +1,15 @@ ##### Point Devices #### -# CONFIG_ZMK_PD_DEDICATED_WORK_QUEUE_PRIORITY=2 -# CONFIG_ZMK_TRACKBALL_POLL_DURATION=8 -# CONFIG_ZMK_MOUSE=n -# CONFIG_ZMK_MOUSE_TICK_DURATION=10 -# CONFIG_ZMK_MOUSE_WORK_QUEUE_DEDICATED=y -# CONFIG_ZMK_MOUSE_DEDICATED_THREAD_PRIORITY=1 +CONFIG_ZMK_MOUSE=y +CONFIG_INPUT=y +CONFIG_GPIO=y + +CONFIG_I2C=y +CONFIG_PINCTRL=y +CONFIG_INPUT_PINNACLE=y + +# CONFIG_ZMK_USB_LOGGING=y -# CONFIG_PMW3610=n -# CONFIG_PMW3610_CPI=3000 -# CONFIG_PMW3610_CPI_DIVIDOR=1 -# CONFIG_PMW3610_ORIENTATION_90=y -# CONFIG_PMW3610_REST1_SAMPLE_TIME_MS=100 -# CONFIG_PMW3610_REST2_SAMPLE_TIME_MS=200 -# CONFIG_PMW3610_REST3_SAMPLE_TIME_MS=250 -# CONFIG_PMW3610_RUN_DOWNSHIFT_TIME_MS=500 -# CONFIG_PMW3610_REST1_DOWNSHIFT_TIME_MS=5000 -# CONFIG_PMW3610_REST2_DOWNSHIFT_TIME_MS=30000 ### Low latency Bluetooth for point devoce ### # CONFIG_BT_PERIPHERAL_PREF_MAX_INT=9 diff --git a/config/boards/shields/hillside_view/hillside_view_right.overlay b/config/boards/shields/hillside_view/hillside_view_right.overlay index 4e4b98c..bb79049 100644 --- a/config/boards/shields/hillside_view/hillside_view_right.overlay +++ b/config/boards/shields/hillside_view/hillside_view_right.overlay @@ -21,9 +21,9 @@ ; }; -&right_encoder { - status = "okay"; -}; +// &right_encoder { +// status = "okay"; +// }; // trackball bus /* &spi0 { */ @@ -40,15 +40,42 @@ /* }; */ -&chosen { - zephyr,display = &nice_view; -}; +// &chosen { +// zephyr,display = &nice_view; +// }; -&nice_view_spi { - status = "okay"; -}; +// &nice_view_spi { +// status = "okay"; +// }; + +// &nice_view { +// status = "okay"; +// }; -&nice_view { - status = "okay"; +&i2c0 { + status = "okay"; + glidepoint0: glidepoint@2a { + status = "okay"; + }; }; +/ { + /* THIS only makes keymap binding happy, nothing happens on peripheral side */ + glidepoint_virtual: virtual_input { + compatible = "zmk,virtual-input"; + }; + + 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>; + + /* 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.conf b/config/hillside_view.conf index 9afd36a..e8a848a 100644 --- a/config/hillside_view.conf +++ b/config/hillside_view.conf @@ -2,7 +2,6 @@ CONFIG_EC11=y CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y CONFIG_ZMK_KEYBOARD_NAME="Mikael HSV" -CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y CONFIG_BT_CTLR_TX_PWR_PLUS_8=y