Skip to content

Commit

Permalink
feat(shields): add right encoders support to waterfowl
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoDoreto committed Mar 21, 2023
1 parent c5fde6d commit fb7c374
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 15 deletions.
41 changes: 33 additions & 8 deletions app/boards/shields/waterfowl/waterfowl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,50 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)

};

left_encoder: encoder_left { //roller
roller_left_encoder: encoder_left_roller {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
label = "ROLLER_LEFT_ENCODER";
a-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};

right_encoder: encoder_right { //Standard encoder on left half
dial_left_encoder: encoder_left_dial {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
label = "DIAL_LEFT_ENCODER";
a-gpios = <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <2>;
resolution = <4>;
status = "disabled";
};

roller_right_encoder: encoder_right_roller {
compatible = "alps,ec11";
label = "ROLLER_RIGHT_ENCODER";
a-gpios = <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};

dial_right_encoder: encoder_right_dial {
compatible = "alps,ec11";
label = "DIAL_RIGHT_ENCODER";
a-gpios = <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder &right_encoder>;
sensors = <
&roller_left_encoder
&dial_left_encoder
&dial_right_encoder
&roller_right_encoder
>;
};

// TODO: RGB node(s)
Expand Down
30 changes: 25 additions & 5 deletions app/boards/shields/waterfowl/waterfowl.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
&kp N1 &lt 3 DEL &lt 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC &lt 2 RET &kp N4
>;

sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>;
sensor-bindings = <
&inc_dec_kp PAGE_DOWN PAGE_UP
&inc_dec_kp C_VOL_DN C_VOL_UP
&inc_dec_kp DOWN UP
&inc_dec_kp LEFT RIGHT
>;
};

navnum_layer {
Expand All @@ -57,7 +62,12 @@
&kp N1 &lt 3 DEL &lt 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC &lt 2 RET &kp N4
>;

sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>;
sensor-bindings = <
&inc_dec_kp PAGE_DOWN PAGE_UP
&inc_dec_kp C_VOL_DN C_VOL_UP
&inc_dec_kp DOWN UP
&inc_dec_kp LEFT RIGHT
>;
};

symbol_layer {
Expand All @@ -81,7 +91,12 @@
&kp N1 &lt 3 DEL &lt 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC &lt 2 RET &kp N4
>;

sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>;
sensor-bindings = <
&inc_dec_kp PAGE_DOWN PAGE_UP
&inc_dec_kp C_VOL_DN C_VOL_UP
&inc_dec_kp DOWN UP
&inc_dec_kp LEFT RIGHT
>;
};

function_layer {
Expand All @@ -105,8 +120,13 @@
&kp N1 &lt 3 DEL &lt 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC &lt 2 RET &kp N4
>;

sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>;
sensor-bindings = <
&inc_dec_kp PAGE_DOWN PAGE_UP
&inc_dec_kp C_VOL_DN C_VOL_UP
&inc_dec_kp DOWN UP
&inc_dec_kp LEFT RIGHT
>;
};

};
};
};
6 changes: 5 additions & 1 deletion app/boards/shields/waterfowl/waterfowl_left.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
;
};

&left_encoder {
&roller_left_encoder {
status = "okay";
};

&dial_left_encoder {
status = "okay";
};
5 changes: 4 additions & 1 deletion app/boards/shields/waterfowl/waterfowl_right.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
;
};

&roller_right_encoder {
status = "okay";
};

&right_encoder {
&dial_right_encoder {
status = "okay";
};

0 comments on commit fb7c374

Please sign in to comment.