From 1adf0c071e6cdff68c6a5a2c636316690a9672ff Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Tue, 30 Sep 2025 23:05:58 +1000 Subject: [PATCH] ec11 encoders --- boards/shields/sofle/sofle_dongle.overlay | 23 +++++++++++++++++++++++ config/sofle_dongle.conf | 14 ++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/boards/shields/sofle/sofle_dongle.overlay b/boards/shields/sofle/sofle_dongle.overlay index 2647d6a..5f28904 100644 --- a/boards/shields/sofle/sofle_dongle.overlay +++ b/boards/shields/sofle/sofle_dongle.overlay @@ -18,6 +18,23 @@ events = <0>; }; + /* Rotary encoders (same logical wiring as halves; mark disabled until mapped to actual pins if needed) */ + left_encoder: left_encoder { + compatible = "alps,ec11"; + a-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH)>; + b-gpios = <&gpio0 20 (GPIO_ACTIVE_HIGH)>; + steps = <80>; + status = "okay"; + }; + + right_encoder: right_encoder { + compatible = "alps,ec11"; + a-gpios = <&gpio0 20 (GPIO_ACTIVE_HIGH)>; + b-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH)>; + steps = <80>; + status = "okay"; + }; + default_transform: keymap_transform_0 { compatible = "zmk,matrix-transform"; columns = <16>; @@ -30,4 +47,10 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) >; }; + + sensors: sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder &right_encoder>; + triggers-per-rotation = <20>; + }; }; \ No newline at end of file diff --git a/config/sofle_dongle.conf b/config/sofle_dongle.conf index 3733a98..1610d15 100644 --- a/config/sofle_dongle.conf +++ b/config/sofle_dongle.conf @@ -1,18 +1,20 @@ # Configuration for Sofle Dongle (Wireless Receiver) -# Dongle doesn't have display or encoders +# Acts as a central node; we want encoder events processed even if dongle has no physical encoders +# (some firmware paths expect sensor count to match halves for behavior consistency) -# Disable display for dongle +# No local display CONFIG_ZMK_DISPLAY=n -# Disable encoder for dongle -CONFIG_EC11=n +# Enable EC11 driver so encoder sensor behavior compiles & split forwarded events are handled +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y -# Keep other settings +# Power & Sleep CONFIG_ZMK_SLEEP=y CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=3600000 CONFIG_BT_CTLR_TX_PWR_PLUS_8=y -# Disable WPM widget since no display +# No display widgets CONFIG_ZMK_WIDGET_WPM_STATUS=n CONFIG_ZMK_STUDIO=y \ No newline at end of file