From 53c0350d6fa39b04151e8d9020ce1be4e1c63bca Mon Sep 17 00:00:00 2001 From: daniel Date: Sun, 25 May 2025 16:24:10 +0200 Subject: [PATCH] feat: initial commit of corax module --- CMakeLists.txt | 0 Kconfig | 0 LICENSE | 2 +- README.md | 24 ++- boards/arm/.gitkeep | 0 boards/shields/.gitkeep | 0 boards/shields/corax/Kconfig.defconfig | 15 ++ boards/shields/corax/Kconfig.shield | 5 + boards/shields/corax/corax.dtsi | 49 ++++++ boards/shields/corax/corax.keymap | 195 +++++++++++++++++++++++ boards/shields/corax/corax_left.overlay | 54 +++++++ boards/shields/corax/corax_right.overlay | 58 +++++++ dts/.gitkeep | 0 include/.gitkeep | 0 snippets/.gitkeep | 0 src/.gitkeep | 0 west.yml | 11 -- zephyr/module.yml | 14 +- 18 files changed, 400 insertions(+), 27 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 Kconfig delete mode 100644 boards/arm/.gitkeep delete mode 100644 boards/shields/.gitkeep create mode 100644 boards/shields/corax/Kconfig.defconfig create mode 100644 boards/shields/corax/Kconfig.shield create mode 100644 boards/shields/corax/corax.dtsi create mode 100644 boards/shields/corax/corax.keymap create mode 100644 boards/shields/corax/corax_left.overlay create mode 100644 boards/shields/corax/corax_right.overlay delete mode 100644 dts/.gitkeep delete mode 100644 include/.gitkeep delete mode 100644 snippets/.gitkeep delete mode 100644 src/.gitkeep delete mode 100644 west.yml diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Kconfig b/Kconfig deleted file mode 100644 index e69de29..0000000 diff --git a/LICENSE b/LICENSE index 38b56e7..d2b9c85 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 The ZMK Contributors +Copyright (c) 2025 Daniel Bauer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 100a029..7c8b665 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,30 @@ # ZMK Module Template -This repository contains a template for a ZMK module, as it would most frequently be used. +This repository contains a shield files for the [Corax Keyboard]() to allow users to build their own firmware. ## Usage -Read through the [ZMK Module Creation](https://zmk.dev/docs/development/module-creation) page for details on how to configure this template. +Edit your west.yaml file found in your zmk config's config directory to add the corax module. + +Example: +```yaml +manifest: + remotes: + - name: dnlbauer + url-base: https://github.com/dnlbauer + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + - name: zmk-keyboards-corax + remote: dnlbauer + revision: main + self: + path: config +``` ## More Info diff --git a/boards/arm/.gitkeep b/boards/arm/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/boards/shields/.gitkeep b/boards/shields/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/boards/shields/corax/Kconfig.defconfig b/boards/shields/corax/Kconfig.defconfig new file mode 100644 index 0000000..caa642b --- /dev/null +++ b/boards/shields/corax/Kconfig.defconfig @@ -0,0 +1,15 @@ +if SHIELD_CORAX_LEFT + +config ZMK_KEYBOARD_NAME + default "Corax" + +config ZMK_SPLIT_ROLE_CENTRAL + default y +endif + +if SHIELD_CORAX_LEFT || SHIELD_CORAX_RIGHT + +config ZMK_SPLIT + default y + +endif diff --git a/boards/shields/corax/Kconfig.shield b/boards/shields/corax/Kconfig.shield new file mode 100644 index 0000000..ba017b3 --- /dev/null +++ b/boards/shields/corax/Kconfig.shield @@ -0,0 +1,5 @@ +config SHIELD_CORAX_LEFT + def_bool $(shields_list_contains,corax_left) + +config SHIELD_CORAX_RIGHT + def_bool $(shields_list_contains,corax_right) diff --git a/boards/shields/corax/corax.dtsi b/boards/shields/corax/corax.dtsi new file mode 100644 index 0000000..c3d025a --- /dev/null +++ b/boards/shields/corax/corax.dtsi @@ -0,0 +1,49 @@ +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + rows = <5>; + columns = <16>; + + 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,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(0,0) 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(0,11) + RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) + RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,7) RC(4,8) RC(4,9) RC(4,10) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + wakeup-source; + }; + + encoder_left: encoder_left { + compatible = "alps,ec11"; + a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + steps = <30>; + status = "disabled"; + }; + + encoder_right: encoder_right { + compatible = "alps,ec11"; + a-gpios = <&pro_micro 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + steps = <30>; + status = "disabled"; + }; + + sensors: sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&encoder_left &encoder_right>; + triggers-per-rotation = <15>; + }; +}; diff --git a/boards/shields/corax/corax.keymap b/boards/shields/corax/corax.keymap new file mode 100644 index 0000000..e73c815 --- /dev/null +++ b/boards/shields/corax/corax.keymap @@ -0,0 +1,195 @@ +#include +#include +#include +#include +#include + +#define COLEMAK 0 +#define QWERTY 1 +#define WASD 2 +#define SYM 3 +#define NAV 4 +#define ADJUST 5 + +// additional caps word keys +&caps_word { + continue-list = ; +}; + +/ { + + behaviors { + lthp: layer_tap_hold_preferred { + compatible = "zmk,behavior-hold-tap"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <200>; + bindings = <&mo>, <&kp>; + }; + + mthp: mod_tap_hold_preferred { + compatible = "zmk,behavior-hold-tap"; + #binding-cells = <2>; + flavor = "hold-preferred"; + tapping-term-ms = <200>; + bindings = <&kp>, <&kp>; + }; + }; + + macros { + // undead ` + ud_grave: ud_grave { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp GRAVE &kp SPACE>; + }; + + // undead ~ + ud_tilde: ud_tilde { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp TILDE &kp SPACE>; + }; + + // undead ^ + ud_caret: ud_caret { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp CARET &kp SPACE>; + }; + + // undead ' + ud_sqt: ud_sqt { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp SQT &kp SPACE>; + }; + + // undead " + ud_dqt: ud_dqt { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp LS(SQT) &kp SPACE>; + }; + + // ascii arrow -> + asc_arr: asc_arr { + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + wait-ms = <10>; + tap-ms = <10>; + bindings = <&kp MINUS &kp LS(DOT)>; + }; + + }; + + combos { + compatible = "zmk,combos"; + + gm_capsword { + bindings = <&caps_word>; + // caps on G+M + key-positions = <28 29>; + }; + + sticky_adjust { + bindings = <&sl ADJUST>; + // sticky adjust layer on LALT+RALT + key-positions = <51 56>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + colemak_layer { + display-name = "Colemak"; + bindings = < + &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 + &kp TAB &kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &ud_sqt &kp RC(RA(F13)) +&kp ESC &kp LCTRL &kp A &kp R &kp S &kp T &kp G &kp M &kp N &kp E &kp I &kp O &kp BSPC &kp RC(RA(F13)) + &mt LSHFT LBRC &kp Z &kp X &kp C &kp D &kp V &kp C_MUTE &kp C_PP &kp K &kp H &kp COMMA &kp DOT &kp DEL &mt RSHFT RBRC + &kp LGUI &kp LALT <hp SYM ESC &kp SPACE &kp ENTER < NAV ESC &kp RALT &kp RGUI + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_DN PG_UP>; + }; + + qwerty_layer { + display-name = "QWERTY"; + bindings = < + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &trans &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &trans +&trans &trans &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &trans &trans + &trans &kp Z &kp X &kp C &kp V &kp B &trans &trans &kp N &kp M &kp COMMA &kp DOT &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_DN PG_UP>; + }; + + gaming_layer { + display-name = "WASD"; + bindings = < + &kp TILDE &kp N1 &kp N2 &kp N3 &kp N4 &trans &trans &trans &trans &trans + &kp ESC &kp N5 &kp Q &kp W &kp E &kp R &trans &trans &trans &trans &trans &trans +&trans &kp TAB &kp LCTRL &kp A &kp S &kp D &kp F &trans &trans &trans &trans &trans &trans &trans + &kp M &kp LSHIFT &kp Z &kp X &kp C &kp V &trans &trans &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_DN PG_UP>; + }; + + // left mod + sym_layer { + display-name = "Symbols"; + bindings = < + &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 + &trans &none &kp BSLH &kp PRCNT &kp DLLR &kp RA(LS(S)) &none &kp PIPE &ud_caret &kp SLASH &kp RA(N5) &kp F11 +&trans &trans &none &kp LPAR &kp RPAR &kp COLON &asc_arr &none &ud_dqt &kp UNDER &kp LBKT &kp RBKT &kp F12 &trans + &trans &none &ud_grave &kp AT &kp AMPS &kp RC(RA(F14)) &trans &trans &none &kp HASH &kp QMARK &kp EXCL &trans &trans + &trans &trans &trans &trans &trans &kp LGUI &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_DN PG_UP>; + }; + + // right mod + nav_layer { + display-name = "Num/Nav"; + bindings = < + &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 + &trans &kp MINUS &kp N7 &kp N8 &kp N9 &kp STAR &kp INS &kp HOME &kp END &kp PSCRN &none &trans +&trans &trans &kp DOT &kp N1 &kp N2 &kp N3 &kp EQUAL &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp SEMI &trans &trans + &trans &ud_tilde &kp N4 &kp N5 &kp N6 &kp PLUS &trans &trans &kp PAUSE_BREAK &kp PG_DN &kp PG_UP &none &trans &trans + &trans &mt LALT MINUS &mt LGUI N0 &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp C_PREV C_NEXT>; + }; + + adjust_layer { + display-name = "Adjust"; + bindings = < + &none &none &none &none &sys_reset &sys_reset &none &none &none &none + &none &to QWERTY &none &to WASD &ext_power EP_ON &none &none &none &none &none &none &none +&none &none &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &out OUT_TOG &none &none &none + &none &none &none &to COLEMAK &none &none &trans &trans &none &none &none &none &none &none + &trans &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_DN PG_UP>; + }; + }; +}; diff --git a/boards/shields/corax/corax_left.overlay b/boards/shields/corax/corax_left.overlay new file mode 100644 index 0000000..8ebfff6 --- /dev/null +++ b/boards/shields/corax/corax_left.overlay @@ -0,0 +1,54 @@ +#include "corax.dtsi" + +&kscan0 { + diode-direction = "col2row"; + + // top to bottom + row-gpios + = <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 0 (NUM) + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 1 (UPPER) + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 2 (HOME) + , <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 3 (LOWER) + , <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 4 (THUMB + ROT) + ; + + // left to right + col-gpios + = <&pro_micro 19 GPIO_ACTIVE_HIGH> // ROW 0 (outer) + , <&pro_micro 18 GPIO_ACTIVE_HIGH> // ROW 1 (pinky) + , <&pro_micro 15 GPIO_ACTIVE_HIGH> // ROW 2 (ring) + , <&pro_micro 14 GPIO_ACTIVE_HIGH> // ROW 3 (middle) + , <&pro_micro 16 GPIO_ACTIVE_HIGH> // ROW 4 (index) + , <&pro_micro 10 GPIO_ACTIVE_HIGH> // ROW 5 (inner) + ; +}; + +&encoder_left { + status = "okay"; +}; + +&pinctrl { + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +nice_view_spi: &spi0 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; + cs-gpios = <&pro_micro 4 GPIO_ACTIVE_HIGH>; +}; diff --git a/boards/shields/corax/corax_right.overlay b/boards/shields/corax/corax_right.overlay new file mode 100644 index 0000000..0bea774 --- /dev/null +++ b/boards/shields/corax/corax_right.overlay @@ -0,0 +1,58 @@ +#include "corax.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&kscan0 { + diode-direction = "col2row"; + + // top to bottom + row-gpios + = <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 0 (NUM) + , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 1 (UPPER) + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 2 (HOME) + , <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 3 (LOWER) + , <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // COL 4 (THUMB + ROT) + ; + + // left to right + col-gpios + = <&pro_micro 9 GPIO_ACTIVE_HIGH> // ROW 0 (outer) + , <&pro_micro 8 GPIO_ACTIVE_HIGH> // ROW 1 (pinky) + , <&pro_micro 7 GPIO_ACTIVE_HIGH> // ROW 2 (ring) + , <&pro_micro 6 GPIO_ACTIVE_HIGH> // ROW 3 (middle) + , <&pro_micro 5 GPIO_ACTIVE_HIGH> // ROW 4 (index) + , <&pro_micro 4 GPIO_ACTIVE_HIGH> // ROW 5 (inner) + ; +}; + +&encoder_right { + status = "okay"; +}; + +&pinctrl { + spi0_default: spi0_default { + group1 { + psels = , + , + ; + }; + }; + spi0_sleep: spi0_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +nice_view_spi: &spi0 { + compatible = "nordic,nrf-spim"; + pinctrl-0 = <&spi0_default>; + pinctrl-1 = <&spi0_sleep>; + pinctrl-names = "default", "sleep"; + cs-gpios = <&pro_micro 19 GPIO_ACTIVE_HIGH>; +}; \ No newline at end of file diff --git a/dts/.gitkeep b/dts/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/include/.gitkeep b/include/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/snippets/.gitkeep b/snippets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/.gitkeep b/src/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/west.yml b/west.yml deleted file mode 100644 index 270e112..0000000 --- a/west.yml +++ /dev/null @@ -1,11 +0,0 @@ -manifest: - remotes: - - name: remote-name - url-base: https://github.com/remote-name - projects: - # Together with the above defined remote, this refers to a module located at - # https://github.com/remote-name/repository-name - - name: repository-name - remote: remote-name - # This points to a west manifest file in the remote module for further imports - import: west.yml \ No newline at end of file diff --git a/zephyr/module.yml b/zephyr/module.yml index 243136a..17e8da1 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -1,19 +1,7 @@ # Delete all unused properties. # Give your module a name -name: zmk-module-template +name: zmk-keyboards-corax build: - # List your dependencies - depends: - - zmk-example-dependency - # Folder containing a "CMakeLists.txt" (. = root) - cmake: . - # Kconfig filepath - kconfig: Kconfig settings: - # Folder containing a "boards" folder (. = root) board_root: . - # Folder containing a "dts" folder (. = root) - dts_root: . - # Folder containing a "snippets" folder (. = root) - snippet_root: .