Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(boards): add encoder support to planck #2155

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/boards/arm/planck/planck_rev6.dts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@
;
};

encoder: encoder {
compatible = "alps,ec11";
a-gpios = <&gpiob 12 GPIO_PULL_UP>;
b-gpios = <&gpiob 13 GPIO_PULL_UP>;
steps = <80>;
status = "disabled";
};

sensors: sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder>;
triggers-per-rotation = <20>;
};

layout_grid_transform:
keymap_transform_0 {
compatible = "zmk,matrix-transform";
Expand Down
6 changes: 6 additions & 0 deletions app/boards/arm/planck/planck_rev6.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>

/* Uncomment this block if using an encoder */
//&encoder {
// status = "okay";
//};

/ {
keymap {
compatible = "zmk,keymap";
Expand All @@ -23,6 +28,7 @@
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH &kp RET
&trans &kp LCTL &kp LALT &kp LGUI &mo 1 &trans &kp SPACE &mo 2 &kp LEFT &kp DOWN &kp UP &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};

lower {
Expand Down
1 change: 1 addition & 0 deletions app/boards/arm/planck/planck_rev6.zmk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type: board
arch: arm
features:
- keys
- encoder
outputs:
- usb
url: https://olkb.com/collections/planck
4 changes: 4 additions & 0 deletions app/boards/arm/planck/planck_rev6_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ CONFIG_GPIO=y
CONFIG_CLOCK_CONTROL=y

CONFIG_ZMK_USB=y

# Uncomment these two lines to add support for encoder to your firmware
#CONFIG_EC11=y
#CONFIG_EC11_TRIGGER_OWN_THREAD=y
Loading