Skip to content

Commit

Permalink
feat(boards): add encoder support to planck
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Milliken authored and petejohanson committed Feb 20, 2024
1 parent ccf0380 commit b44ec38
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
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

0 comments on commit b44ec38

Please sign in to comment.