feat(boards): add encoder support to planck

This commit is contained in:
Seth Milliken 2024-02-09 01:02:49 -08:00 committed by Pete Johanson
parent ccf0380179
commit b44ec381f6
4 changed files with 25 additions and 0 deletions

View file

@ -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: layout_grid_transform:
keymap_transform_0 { keymap_transform_0 {
compatible = "zmk,matrix-transform"; compatible = "zmk,matrix-transform";

View file

@ -7,6 +7,11 @@
#include <behaviors.dtsi> #include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h> #include <dt-bindings/zmk/keys.h>
/* Uncomment this block if using an encoder */
//&encoder {
// status = "okay";
//};
/ { / {
keymap { keymap {
compatible = "zmk,keymap"; compatible = "zmk,keymap";
@ -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 &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 &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 { lower {

View file

@ -5,6 +5,7 @@ type: board
arch: arm arch: arm
features: features:
- keys - keys
- encoder
outputs: outputs:
- usb - usb
url: https://olkb.com/collections/planck url: https://olkb.com/collections/planck

View file

@ -14,3 +14,7 @@ CONFIG_GPIO=y
CONFIG_CLOCK_CONTROL=y CONFIG_CLOCK_CONTROL=y
CONFIG_ZMK_USB=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