Skip to content

Commit

Permalink
Enable ZMK Studio (#3)
Browse files Browse the repository at this point in the history
This PR enables ZMK studio for following boards:
- hammer40
- hana
- acorn (corne wireless)
  • Loading branch information
numToStr authored Sep 25, 2024
1 parent 9393e57 commit 1adde72
Show file tree
Hide file tree
Showing 24 changed files with 368 additions and 130 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: "Build ZMK Firmware"
on: [push, pull_request, workflow_dispatch]

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
build:
uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main
72 changes: 66 additions & 6 deletions boards/shields/acorn/acorn.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,78 @@
#include <dt-bindings/zmk/bt.h>

/ {
combos {
compatible = "zmk,combos";

combo_studio_unlock {
timeout-ms = <50>;
key-positions = <0 1>;
bindings = <&studio_unlock>;
};
};

keymap {
compatible = "zmk,keymap";

default_layer {
display-name = "base";
sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp C_VOL_UP C_VOL_DN>;
// -----------------------------------------------------------------------------------------
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BSPC |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHFT | Z | X | C | V | B | | N | M | , | . | / | ESC |
// | GUI | LWR | SPC | | ENT | RSE | ALT |
bindings = <
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC
&kp LGUI &kp ESC &kp SPACE &kp RET &mo 2 &kp LALT
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ESC
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
>;
};

lower_layer {
display-name = "lower";
// -----------------------------------------------------------------------------------------
// | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BSPC |
// | BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | |
// | SHFT | | | | | | | | | | | | |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};

raise_layer {
display-name = "raise";
// -----------------------------------------------------------------------------------------
// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BSPC |
// | CTRL | | | | | | | - | = | [ | ] | \ | ` |
// | SHFT | | | | | | | _ | + | { | } | "|" | ~ |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp BSPC
&kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE
&kp LSHFT &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};

extra_layer0 {
display-name = "extra_layer0";
status = "reserved";
};

extra_layer1 {
display-name = "extra_layer1";
status = "reserved";
};

extra_layer2 {
display-name = "extra_layer2";
status = "reserved";
};
};
};
};
3 changes: 1 addition & 2 deletions boards/shields/acorn/acorn.zmk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: acorn
name: acorn
type: shield
url: https://github.com/keeb-it/acorn
requires: [seeeduino_xiao_ble, seeeduino_xiao_rp2040]
requires: [nice_nano_v2]
exposes: [i2c_oled, spi_oled]
siblings:
- acorn_central_dongle
Expand All @@ -14,4 +14,3 @@ features:
- keys
- encoder
- display
- pointer
7 changes: 0 additions & 7 deletions boards/shields/acorn/acorn_central_dongle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
CONFIG_BT_MAX_CONN=5
CONFIG_BT_MAX_PAIRED=5

# combo config
CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=7

# dongle mode
CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2

Expand All @@ -13,7 +10,3 @@ CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2
# CONFIG_ZMK_IDLE_TIMEOUT=60000
# CONFIG_BT_BAS=n
# CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING=y

# Turn on logging, and set ZMK logging to debug output
# CONFIG_ZMK_USB_LOGGING=y
# CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000
2 changes: 1 addition & 1 deletion boards/shields/acorn/acorn_central_dongle.overlay
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "acorn_matrix.dtsi"

/delete-node/ &kscan0;
/delete-node/ &kscan;

/ {
chosen {
Expand Down
8 changes: 2 additions & 6 deletions boards/shields/acorn/acorn_central_left.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
CONFIG_BT_MAX_CONN=4
CONFIG_BT_MAX_PAIRED=4

# combo config
CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY=7

# battery reporting
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY=y

# Turn on logging, and set ZMK logging to debug output
# CONFIG_ZMK_USB_LOGGING=y
# CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000
# Enable the OLED Display
# CONFIG_ZMK_DISPLAY=y
24 changes: 24 additions & 0 deletions boards/shields/acorn/acorn_central_left.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,27 @@
a-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
};

// &pro_micro_i2c {
// oled: ssd1306@3c {
// compatible = "solomon,ssd1306fb";
// reg = <0x3c>;
// width = <128>;
// height = <32>;
// segment-offset = <0>;
// page-offset = <0>;
// display-offset = <0>;
// multiplex-ratio = <31>;
// segment-remap;
// com-invdir;
// com-sequential;
// inversion-on;
// prechargep = <0x22>;
// };
// };
//
// / {
// chosen {
// zephyr,display = &oled;
// };
// };
36 changes: 29 additions & 7 deletions boards/shields/acorn/acorn_matrix.dtsi
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#include <dt-bindings/zmk/matrix_transform.h>
#include <physical_layouts.dtsi>
#include <layouts/foostan/corne.dtsi>

&foostan_corne_6col_layout {
transform = <&six_col_transform>;
};

&foostan_corne_5col_layout {
transform = <&five_col_transform>;
};

/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
zmk,kscan = &kscan;
zmk,physical-layout = &foostan_corne_6col_layout;
};

kscan0: kscan {
kscan: kscan {
compatible = "zmk,kscan-gpio-matrix";
wakeup-source;

Expand All @@ -19,7 +29,7 @@
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

// NOTE: Below are LHS columns, RHS columns are different
// NOTE: Below are LHS columns, RHS columns are different and re-defined in their respective .overlay files
col-gpios
= <&pro_micro 21 (GPIO_ACTIVE_HIGH)>
, <&pro_micro 4 (GPIO_ACTIVE_HIGH)>
Expand All @@ -30,17 +40,29 @@
;
};

default_transform: default_transform {
six_col_transform: six_col_transform {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <3>;
columns = <12>;
rows = <4>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

five_col_transform: five_col_transform {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10)
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10)
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

left_encoder: left_encoder {
compatible = "alps,ec11";
Expand Down
12 changes: 8 additions & 4 deletions boards/shields/acorn/acorn_peripheral_right.overlay
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "acorn.dtsi"

&default_transform {
&six_col_transform {
col-offset = <6>;
};

&kscan0 {
&five_col_transform {
col-offset = <6>;
};

&kscan {
col-gpios
= <&pro_micro 18 (GPIO_ACTIVE_HIGH)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH)>
Expand All @@ -18,6 +22,6 @@

&right_encoder {
status = "okay";
a-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
a-gpios = <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
};
6 changes: 6 additions & 0 deletions boards/shields/hammer40/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ if SHIELD_HAMMER40
config ZMK_KEYBOARD_NAME
default "hammer40"

config SPI
default y

config I2C
default y

if ZMK_DISPLAY

config SSD1306
Expand Down
42 changes: 0 additions & 42 deletions boards/shields/hammer40/hammer40.conf

This file was deleted.

21 changes: 21 additions & 0 deletions boards/shields/hammer40/hammer40.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
combos {
compatible = "zmk,combos";

combo_studio_unlock {
timeout-ms = <50>;
key-positions = <0 11>;
bindings = <&studio_unlock>;
};

combo_capsw {
timeout-ms = <50>;
key-positions = <16 19>;
Expand Down Expand Up @@ -86,5 +92,20 @@
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
>;
};

fn_layer {
display-name = "fn";
status = "reserved";
};

num_layer {
display-name = "num";
status = "reserved";
};

sys_layer {
display-name = "sys";
status = "reserved";
};
};
};
Loading

0 comments on commit 1adde72

Please sign in to comment.