From e616fc2c8124a98e2abe2279d952783ea98b5cd5 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 28 Aug 2020 20:36:43 -0700 Subject: [PATCH] Added left encoder support --- app/.gitignore | 3 ++ app/boards/shields/lily58/lily58.conf | 4 ++ app/boards/shields/lily58/lily58.dtsi | 14 +++++++ app/boards/shields/lily58/lily58.keymap | 52 ++++++++++++++----------- 4 files changed, 50 insertions(+), 23 deletions(-) diff --git a/app/.gitignore b/app/.gitignore index 567609b1..73a4457f 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,4 @@ build/ +build_left.bat +flash.bat +prj.conf \ No newline at end of file diff --git a/app/boards/shields/lily58/lily58.conf b/app/boards/shields/lily58/lily58.conf index 73f0d9de..14c1841b 100644 --- a/app/boards/shields/lily58/lily58.conf +++ b/app/boards/shields/lily58/lily58.conf @@ -1,2 +1,6 @@ +# Enable encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + # Uncomment the following line to enable the Lily58 OLED Display # CONFIG_ZMK_DISPLAY=y diff --git a/app/boards/shields/lily58/lily58.dtsi b/app/boards/shields/lily58/lily58.dtsi index 23f5644e..aea36c8b 100644 --- a/app/boards/shields/lily58/lily58.dtsi +++ b/app/boards/shields/lily58/lily58.dtsi @@ -45,6 +45,20 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) }; + left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder>; + }; + bt_unpair_combo: bt_unpair_combo { compatible = "zmk,bt-unpair-combo"; }; diff --git a/app/boards/shields/lily58/lily58.keymap b/app/boards/shields/lily58/lily58.keymap index 71bf4adb..590d7b6e 100644 --- a/app/boards/shields/lily58/lily58.keymap +++ b/app/boards/shields/lily58/lily58.keymap @@ -16,41 +16,47 @@ &kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp GRAV &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp MINUS &kp LCTL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT -&kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LBKT &kp RBKT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT - &kp LALT &kp LGUI &mo 1 &kp SPC &kp RET &mo 2 &kp BKSP &kp RGUI +&kp LSFT &kp Z &kp X &kp C &kp V &kp B &cp M_PLAY &kp DEL &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT + &kp LGUI &kp LALT &kp BKSP &mo 1 &mo 2 &kp SPC &kp RET &kp RGUI >; + + sensor-bindings = <&inc_dec_cp LBKT RBKT>; }; lower_layer { // ------------------------------------------------------------------------------------------------------------ // | | | | | | | | | | | | | | -// | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | -// | ` | ! | @ | # | $ | % | | ^ | & | * | ( | ) | ~ | -// | | | | | | | | | | | _ | + | { | } | "|" | -// | | | | | | | | | | - bindings = < -&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans -&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 -&kp GRAV &kp BANG &kp ATSN &kp HASH &kp CURU &kp PRCT &kp CRRT &kp AMPS &kp KMLT &kp LPRN &kp RPRN &kp TILD -&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp MINUS &kp KPLS &kp LCUR &kp RCUR &kp PIPE - &trans &trans &trans &trans &trans &trans &trans &trans - >; - }; - - raise_layer { -// ------------------------------------------------------------------------------------------------------------ -// | | | | | | | | | | | | | | // | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | // | F1 | F2 | F3 | F4 | F5 | F6 | | | <- | ^ | v | -> | | // | F7 | F8 | F9 | F10 | F11 | F12 | | | | + | - | = | [ | ] | \ | // | | | | | | | | | | bindings = < -&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans -&kp GRAV &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &trans -&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &trans &kp LARW &kp DARW &kp UARW &kp RARW &trans -&kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &trans &kp KPLS &kp MINUS &kp EQL &kp LBKT &kp RBKT &kp BSLH - &trans &trans &trans &trans &trans &trans &trans &trans +&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 +&trans &kp LCUR &kp AMPS &kp KMLT &kp LPRN &kp RCUR &trans &trans &trans &trans &trans &kp F12 +&trans &kp COLN &kp CURU &kp PRCT &kp CRRT &kp KPLS &kp CLCK &kp LARW &kp DARW &kp UARW &kp RARW &trans +&trans &kp GRAV &kp BANG &kp ATSN &kp HASH &kp PIPE &trans &trans &kp INS &kp HOME &kp PGDN &kp PGUP &kp END &trans + &kp LPRN &kp RPRN &trans &trans &trans &trans &trans &trans >; + + sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD>; + }; + + raise_layer { +// ------------------------------------------------------------------------------------------------------------ +// | | | | | | | | | | | | | | +// | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | +// | ` | ! | @ | # | $ | % | | ^ | & | * | ( | ) | ~ | +// | | | | | | | | | | | _ | + | { | } | "|" | +// | | | | | | | | | | + bindings = < +&trans &tog 2 &kp KPLS &kp KDIV &kp KMLT &kp KMIN &trans &trans &trans &trans &trans &trans +&trans &kp LBKT &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp RBKT &trans &trans &trans &trans &trans &trans +&trans &kp SCLN &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp EQL &trans &cp M_PREV &cp M_VOLD &cp M_VOLU &cp M_NEXT &trans +&trans &kp TILD &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp BSLH &trans &trans &cp M_STOP &cp M_PLAY &cp M_MUTE &trans &trans &trans + &kp NUM_0 &kp DOT &kp RET &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD>; }; }; };