Skip to content

Commit

Permalink
refactor(shields): MurphPad
Browse files Browse the repository at this point in the history
* Added matrix transforms for three optional layouts.
* Tweaked default keymap to be more immediately useful for ZMK and more
  closely resemble the default keymaps of non-ZMK firmware.
* Removed deprecated label properties and tidied formatting.
* Aligned encoder configuration with current standards.
  • Loading branch information
lesshonor committed Nov 3, 2023
1 parent 34c8b3f commit f944c84
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 36 deletions.
1 change: 0 additions & 1 deletion app/boards/shields/murphpad/boards/nice_nano.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
Expand Down
1 change: 0 additions & 1 deletion app/boards/shields/murphpad/boards/nice_nano_v2.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
Expand Down
55 changes: 29 additions & 26 deletions app/boards/shields/murphpad/murphpad.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,64 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/rgb.h>


#define TIMEOUT 300

&encoder_1 {
&left_middle_encoder {
status = "okay";
};

&encoder_2 {
&top_right_encoder {
status = "okay";
};

&sensors {
sensors = <&left_middle_encoder &top_right_encoder>;
};

/ {
combos {
compatible = "zmk,combos";
combo_btclr {
timeout-ms = <TIMEOUT>;
key-positions = <1 6>;
key-positions = <0 4>;
bindings = <&bt BT_CLR>;
};
combo_reset {
timeout-ms = <TIMEOUT>;
key-positions = <1 3>;
key-positions = <0 2>;
bindings = <&sys_reset>;
};
combo_bootloader {
timeout-ms = <TIMEOUT>;
key-positions = <1 2>;
key-positions = <0 1>;
bindings = <&bootloader>;
};
combo_bt_nxt {
timeout-ms = <TIMEOUT>;
key-positions = <1 4>;
key-positions = <0 3>;
bindings = <&bt BT_NXT>;
};
};

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

chosen { zmk,matrix_transform = &all_1u; };

keymap0: keymap {
compatible = "zmk,keymap";

default_layer {
label = "default layer";
bindings = <
&bt BT_CLR &kp TAB &kp F5 &kp LC(LA(C)) &kp LG(D)
&rgb_ug RGB_TOG &kp ESC &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
&rgb_ug RGB_EFF &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_PLUS
&kp C_MUTE &kp KP_N4 &kp KP_N5 &kp KP_N6 &trans
&mo 1 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER
&kp BSPC &kp KP_N0 &trans &kp KP_DOT &trans
&kp F1 &kp F2 &kp F3 &kp F4
&kp KP_NUM &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
&kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_PLUS
&kp C_MUTE &kp KP_N4 &kp KP_N5 &kp KP_N6 &trans
&mo 1 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER
&kp BSPC &kp KP_N0 &trans &kp KP_DOT &trans

&bt BT_CLR &rgb_ug RGB_TOG &rgb_ug RGB_EFF
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;

Expand All @@ -72,15 +73,17 @@
fn_layer {
label = "fn layer";
bindings = <
&trans &trans &trans &trans &trans
&trans &kp KP_NUM &trans &trans &trans
&trans &trans &trans &trans &trans
&bt BT_CLR &trans &trans &trans &trans
&trans &trans &trans &trans &trans
&kp DEL &trans &trans &trans &trans
&out OUT_TOG &bt BT_PRV &bt BT_NXT &trans
&trans &trans &trans &trans
&rgb_ug RGB_HUD &rgb_ug RGB_SPI &rgb_ug RGB_HUI &trans
&bt BT_CLR &rgb_ug RGB_EFR &rgb_ug RGB_TOG &rgb_ug RGB_EFF &trans
&trans &rgb_ug RGB_BRD &rgb_ug RGB_SPD &rgb_ug RGB_BRI &trans
&kp DEL &rgb_ug RGB_SAD &trans &rgb_ug RGB_SAI &trans

&trans &trans &trans
>;
sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN>;

};
};
};
};
68 changes: 60 additions & 8 deletions app/boards/shields/murphpad/murphpad.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,74 @@

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";

diode-direction = "col2row";
row-gpios
= <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
= <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&pro_micro 9 GPIO_ACTIVE_HIGH>
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
, <&pro_micro 4 GPIO_ACTIVE_HIGH>
, <&pro_micro 10 GPIO_ACTIVE_HIGH>
, <&pro_micro 10 GPIO_ACTIVE_HIGH>
;
};

encoder_1: encoder_1 {
all_1u: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <6>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4)
RC(1,1) RC(1,2) RC(1,3) RC(1,4)
RC(2,1) RC(2,2) RC(2,3) RC(2,4)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4)
RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4)

RC(0,0) RC(1,0) RC(2,0)
>;
};

rh_numpad: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <6>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4)
RC(1,1) RC(1,2) RC(1,3) RC(1,4)
RC(2,1) RC(2,2) RC(2,3) RC(2,4)
RC(3,0) RC(3,2) RC(3,3) RC(3,4)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4)
RC(5,0) RC(5,2) RC(5,4)

RC(0,0) RC(1,0) RC(2,0)
>;
};

lh_numpad: keymap_transform_2 {
compatible = "zmk,matrix-transform";
columns = <5>;
rows = <6>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4)
RC(1,1) RC(1,2) RC(1,3) RC(1,4)
RC(2,1) RC(2,2) RC(2,3) RC(2,4)
RC(3,0) RC(3,1) RC(3,2) RC(3,3)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4)
RC(5,0) RC(5,1) RC(5,3)

RC(0,0) RC(1,0) RC(2,0)
>;
};

encoder_1: left_middle_encoder: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&pro_micro 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
Expand All @@ -43,7 +90,7 @@
status = "disabled";
};

encoder_2: encoder_2 {
encoder_2: top_right_encoder: encoder_2 {
compatible = "alps,ec11";
label = "Encoder 2";
a-gpios = <&pro_micro 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
Expand All @@ -52,6 +99,12 @@
status = "disabled";
};

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

};

&pro_micro_i2c {
Expand All @@ -60,7 +113,6 @@
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
label = "DISPLAY";
width = <128>;
height = <32>;
segment-offset = <0>;
Expand Down

0 comments on commit f944c84

Please sign in to comment.