From d95154c35be3cef524e6fce750c48db485ec0dd2 Mon Sep 17 00:00:00 2001 From: honorless <86894501+lesshonor@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:19:35 -0500 Subject: [PATCH] feat: restore experimental mouse support --- README.md | 24 ++++++ boards/arm/eyelash_corne/eyelash_corne.keymap | 75 +++++++++++++++++++ config/eyelash_corne.conf | 2 +- config/eyelash_corne.keymap | 60 ++++++++++----- config/west.yml | 6 +- 5 files changed, 144 insertions(+), 23 deletions(-) create mode 100644 boards/arm/eyelash_corne/eyelash_corne.keymap diff --git a/README.md b/README.md index 63328bd3b..ad60fa091 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,27 @@ If you need a 3D model of this keyboard, email `380465425@qq.com`. ## Keymap Diagram ![Diagram of config/eyelash_corne.keymap](keymap-drawer/eyelash_corne.svg "generated by @caksoylar's Keymap Drawer") + +## Mouse Support + +:warning: This repository defaults to an EXPERIMENTAL mouse movement branch which is slated for eventual merge into ZMK, but is not guaranteed to be stable. For more information, see [beta testing](https://zmk.dev/docs/features/modules#beta-testing) and [PR #2477](https://github.com/zmkfirmware/zmk/pull/2477). + +If desired, edit your `config/west.yml` to switch back to `zmkfirmware`'s `main` branch: + +```diff +diff --git a/config/west.yml b/config/west.yml +index ac30a68..70ad540 100644 +--- a/config/west.yml ++++ b/config/west.yml +@@ -13,8 +13,8 @@ manifest: + url: https://github.com/a741725193/zmk-new_corne + revision: main + - name: zmk +- remote: petejohanson +- revision: feat/pointers-with-input-processors ++ remote: zmkfirmware ++ revision: main + import: app/west.yml + self: + path: config +``` diff --git a/boards/arm/eyelash_corne/eyelash_corne.keymap b/boards/arm/eyelash_corne/eyelash_corne.keymap new file mode 100644 index 000000000..1dfd78c51 --- /dev/null +++ b/boards/arm/eyelash_corne/eyelash_corne.keymap @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include + +/ { + behaviors { + td0: td0 { + compatible = "zmk,behavior-tap-dance"; + #binding-cells = <0>; + bindings = <&kp LEFT_SHIFT>, <&kp CAPS>; + }; + }; + + rgb_encoder: rgb_encoder { + compatible = "zmk,behavior-sensor-rotate"; + #sensor-binding-cells = <0>; + bindings = <&rgb_ug RGB_BRI>, <&rgb_ug RGB_BRD>; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + display-name = "QWERTY"; + + bindings = < +&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp UP &kp Y &kp U &kp I &kp O &kp P &kp BSPC +&td0 &kp A &kp S &kp D &kp F &kp G &kp LEFT &kp ENTER &kp RIGHT &kp H &kp J &kp K &kp L &kp SEMI &kp SQT +&kp LCTRL &kp Z &kp X &kp C &kp V &kp B &kp SPACE &kp DOWN &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC + &kp LGUI &mo 1 < 3 SPACE < 3 ENTER &mo 2 &kp RALT + >; + + sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; + }; + + lower_layer { + display-name = "NUMBER"; + bindings = < +&trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC +&trans &bt BT_CLR_ALL &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &trans &mkp LCLK &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp HOME &kp PG_UP +&trans &rgb_ug RGB_OFF &rgb_ug RGB_ON &trans &trans &rgb_ug RGB_EFF &kp C_MUTE &trans &rgb_ug RGB_EFR &rgb_ug RGB_SPI &rgb_ug RGB_BRI &rgb_ug RGB_BRD &kp END &kp PG_DN + &trans &trans &trans &kp INS &kp DEL &trans + >; + + sensor-bindings = <&inc_dec_kp PG_UP PG_DN>; + }; + + raise_layer { + display-name = "SYMBOL"; + bindings = < +&trans &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &trans &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC +&trans &bt BT_CLR &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &trans &mkp LCLK &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE +&trans &out OUT_USB &out OUT_BLE &none &none &mkp MB5 &kp C_MUTE &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE + &trans &trans &kp SPACE &kp RET &trans &trans + >; + + sensor-bindings = <&inc_dec_kp PG_UP PG_DN>; + }; + + layer_3 { + display-name = "Fn"; + bindings = < +&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 +&trans &trans &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &trans &mkp LCLK &trans &bootloader &mkp LCLK &mkp MCLK &mkp RCLK &kp PRINTSCREEN &kp F12 +&trans &sys_reset &trans &bootloader &trans &mkp MB5 &kp C_MUTE &trans &trans &trans &bootloader &sys_reset &kp SCROLLLOCK &kp PAUSE_BREAK + &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&rgb_encoder>; + }; + }; +}; diff --git a/config/eyelash_corne.conf b/config/eyelash_corne.conf index 384525153..097a728c5 100644 --- a/config/eyelash_corne.conf +++ b/config/eyelash_corne.conf @@ -22,7 +22,7 @@ CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=3 CONFIG_EC11=y CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y -# Mouse clicks +# Mouse enable CONFIG_ZMK_MOUSE=y CONFIG_ZMK_BACKLIGHT=y diff --git a/config/eyelash_corne.keymap b/config/eyelash_corne.keymap index 1dfd78c51..caf85bb4c 100644 --- a/config/eyelash_corne.keymap +++ b/config/eyelash_corne.keymap @@ -5,10 +5,28 @@ #include #include +#include + +/* + + &mmv_input_listener { + input-processors = <&zip_xy_scaler 2 1>; + }; + + &msc_input_listener { + input-processors = <&zip_xy_scaler 2 1>; + }; + + */ + +#define ZMK_MOUSE_DEFAULT_MOVE_VAL 1200 // 600 +#define ZMK_MOUSE_DEFAULT_SCRL_VAL 20 // 10 + / { behaviors { td0: td0 { compatible = "zmk,behavior-tap-dance"; + display-name = "Shift/Caps Lock Tap Dance"; #binding-cells = <0>; bindings = <&kp LEFT_SHIFT>, <&kp CAPS>; }; @@ -20,56 +38,58 @@ bindings = <&rgb_ug RGB_BRI>, <&rgb_ug RGB_BRD>; }; + scroll_encoder: scroll_encoder { + compatible = "zmk,behavior-sensor-rotate"; + #sensor-binding-cells = <0>; + bindings = <&msc SCRL_DOWN>, <&msc SCRL_UP>; + tap-ms = <30>; + }; + keymap { compatible = "zmk,keymap"; default_layer { display-name = "QWERTY"; - bindings = < &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp UP &kp Y &kp U &kp I &kp O &kp P &kp BSPC &td0 &kp A &kp S &kp D &kp F &kp G &kp LEFT &kp ENTER &kp RIGHT &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp LCTRL &kp Z &kp X &kp C &kp V &kp B &kp SPACE &kp DOWN &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC &kp LGUI &mo 1 < 3 SPACE < 3 ENTER &mo 2 &kp RALT >; - sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; }; lower_layer { display-name = "NUMBER"; bindings = < -&trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC -&trans &bt BT_CLR_ALL &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &trans &mkp LCLK &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp HOME &kp PG_UP -&trans &rgb_ug RGB_OFF &rgb_ug RGB_ON &trans &trans &rgb_ug RGB_EFF &kp C_MUTE &trans &rgb_ug RGB_EFR &rgb_ug RGB_SPI &rgb_ug RGB_BRI &rgb_ug RGB_BRD &kp END &kp PG_DN - &trans &trans &trans &kp INS &kp DEL &trans +&trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &mmv MOVE_UP &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC +&trans &bt BT_CLR_ALL &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &mmv MOVE_LEFT &mkp LCLK &mmv MOVE_RIGHT &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp HOME &kp PG_UP +&trans &rgb_ug RGB_OFF &rgb_ug RGB_ON &trans &trans &rgb_ug RGB_EFF &kp C_MUTE &mmv MOVE_DOWN &rgb_ug RGB_EFR &rgb_ug RGB_SPI &rgb_ug RGB_BRI &rgb_ug RGB_BRD &kp END &kp PG_DN + &trans &trans &trans &kp INS &kp DEL &trans >; - - sensor-bindings = <&inc_dec_kp PG_UP PG_DN>; + sensor-bindings = <&scroll_encoder>; }; raise_layer { display-name = "SYMBOL"; bindings = < -&trans &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &trans &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC -&trans &bt BT_CLR &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &trans &mkp LCLK &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE -&trans &out OUT_USB &out OUT_BLE &none &none &mkp MB5 &kp C_MUTE &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE - &trans &trans &kp SPACE &kp RET &trans &trans +&trans &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &mmv MOVE_UP &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC +&trans &bt BT_CLR &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &mmv MOVE_LEFT &mkp LCLK &mmv MOVE_RIGHT &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE +&trans &out OUT_USB &out OUT_BLE &none &none &mkp MB5 &trans &mmv MOVE_DOWN &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE + &trans &trans &kp SPACE &kp RET &trans &trans >; - - sensor-bindings = <&inc_dec_kp PG_UP PG_DN>; + sensor-bindings = <&scroll_encoder>; }; layer_3 { display-name = "Fn"; bindings = < -&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 -&trans &trans &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &trans &mkp LCLK &trans &bootloader &mkp LCLK &mkp MCLK &mkp RCLK &kp PRINTSCREEN &kp F12 -&trans &sys_reset &trans &bootloader &trans &mkp MB5 &kp C_MUTE &trans &trans &trans &bootloader &sys_reset &kp SCROLLLOCK &kp PAUSE_BREAK - &trans &trans &trans &trans &trans &trans +&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &mmv MOVE_UP &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 +&trans &trans &mkp LCLK &mkp MCLK &mkp RCLK &mkp MB4 &mmv MOVE_LEFT &mkp LCLK &mmv MOVE_RIGHT &bootloader &mkp LCLK &mkp MCLK &mkp RCLK &kp PRINTSCREEN &kp F12 +&trans &sys_reset &trans &bootloader &trans &mkp MB5 &kp C_MUTE &mmv MOVE_DOWN &trans &trans &bootloader &sys_reset &kp SCROLLLOCK &kp PAUSE_BREAK + &trans &trans &trans &trans &trans &trans >; - - sensor-bindings = <&rgb_encoder>; + sensor-bindings = <&scroll_encoder>; }; }; }; diff --git a/config/west.yml b/config/west.yml index eeff17912..ac30a68c3 100644 --- a/config/west.yml +++ b/config/west.yml @@ -6,13 +6,15 @@ manifest: # See: # - https://zmk.dev/docs/features/modules # - https://docs.zephyrproject.org/3.5.0/develop/west/manifest.html#projects + - name: petejohanson + url-base: https://github.com/petejohanson projects: - name: eyelash_corne url: https://github.com/a741725193/zmk-new_corne revision: main - name: zmk - remote: zmkfirmware - revision: main + remote: petejohanson + revision: feat/pointers-with-input-processors import: app/west.yml self: path: config