diff --git a/build.yaml b/build.yaml index 4f589c4..344db94 100644 --- a/build.yaml +++ b/build.yaml @@ -25,3 +25,5 @@ include: shield: flea_left - board: nice_nano_v2 shield: flea_right + - board: seeeduino_xiao_ble + shield: moon diff --git a/config/.base_lower.keymap.swp b/config/.base_lower.keymap.swp new file mode 100644 index 0000000..cdcd1c3 Binary files /dev/null and b/config/.base_lower.keymap.swp differ diff --git a/config/base_lower.keymap b/config/base_lower.keymap new file mode 100644 index 0000000..8bc4238 --- /dev/null +++ b/config/base_lower.keymap @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include + +#include + +/* Layers */ +#define DEF_L 0 +#define NAV_L 1 +#define UPP_L 2 +#define SYM_L 3 +#define NUM_L 4 +#define EXL_L 5 + +/* Behavior Settings */ +&caps_word { + continue-list = ; +}; + +&sk { + release-after-ms = <60000>; +}; + + +/ { + +macros { + #include "macros.dtsi" +}; + + ZMK_MACRO(mo_nav, + wait-ms = <0>; + tap-ms = <0>; + bindings + = <¯o_tap &kp K_CANCEL> + , <¯o_press &mo NAV_L> + , <¯o_pause_for_release> + , <¯o_release &mo NAV_L>;) + + ZMK_MACRO(mo_upp, + wait-ms = <0>; + tap-ms = <0>; + bindings + = <¯o_tap &kp K_CANCEL> + , <¯o_press &mo UPP_L> + , <¯o_pause_for_release> + , <¯o_release &mo UPP_L>;) + + ZMK_MACRO(leq, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp LT &kp EQUAL>;) + + ZMK_MACRO(eq, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp EQUAL &kp EQUAL>;) + + ZMK_MACRO(geq, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp GT &kp EQUAL>;) + + ZMK_MACRO(neq, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp EXCL &kp EQUAL>;) + + ZMK_MACRO(gprev, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp SPACE &kp M &kp P>;) + + ZMK_MACRO(gnext, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp SPACE &kp M &kp N>;) + + ZMK_MACRO(pprev, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp SPACE &kp O &kp B>;) + + ZMK_MACRO(pnext, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp SPACE &kp O &kp F>;) + + ZMK_MACRO(neoclip, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp SPACE &kp O &kp Y>;) + + ZMK_MACRO(arrow, + wait-ms = <30>; + tap-ms = <40>; + bindings = <&kp MINUS &kp GT>;) + + ZMK_MACRO(mo_sym, + wait-ms = <0>; + tap-ms = <0>; + bindings + = <¯o_tap &kp K_CANCEL> + , <¯o_press &mo SYM_L> + , <¯o_pause_for_release> + , <¯o_release &mo SYM_L>;) + + ZMK_MACRO(mo_exl, + wait-ms = <0>; + tap-ms = <0>; + bindings + = <¯o_tap &kp K_CANCEL> + , <¯o_press &mo EXL_L> + , <¯o_pause_for_release> + , <¯o_release &mo EXL_L>;) + + combos { + compatible = "zmk,combos"; + + #define COMBO(NAME, BINDINGS, KEYPOS, LAYERS) \ + combo_##NAME { \ + bindings = ; \ + key-positions = ; \ + layers = ; \ + }; + + /* KEY POSITIONS + + ╭────────────────────╮ ╭────────────────────╮ + │ 0 1 2 3 │ │ 4 5 6 7 │ + │ 8 9 10 11 12 │ │ 13 14 15 16 17 │ + │ 18 19 20 21 │ │ 22 23 24 25 │ + ╰───────────╮ 26 27 │ │ 28 29 ╭───────────╯ + ╰────────╯ ╰────────╯ */ + + /* Letters */ + COMBO(lower_v, &kp V, 20 21, DEF_L) + COMBO(lower_x, &kp X, 22 23, DEF_L) + COMBO(lower_z, &kp Z, 23 24, DEF_L) + COMBO(forward_slash, &kp FSLH, 19 20, DEF_L) + COMBO(upper_v, &kp LS(V), 20 21, UPP_L) + COMBO(upper_x, &kp LS(X), 22 23, UPP_L) + COMBO(upper_z, &kp LS(Z), 23 24, UPP_L) + COMBO(question_mark, &kp LS(FSLH), 19 20, UPP_L) + + /* Brackets */ + COMBO(left_bracket, &kp LBKT, 0 9, DEF_L UPP_L SYM_L NUM_L) + COMBO(right_bracket, &kp RBKT, 7 16, DEF_L UPP_L SYM_L NUM_L) + COMBO(left_parenthesis, &kp LPAR, 1 10, DEF_L UPP_L SYM_L NUM_L) + COMBO(right_parenthesis, &kp RPAR, 6 15, DEF_L UPP_L SYM_L NUM_L) + COMBO(left_brace, &kp LBRC, 2 11, DEF_L UPP_L SYM_L NUM_L) + COMBO(right_brace, &kp RBRC, 5 14, DEF_L UPP_L SYM_L NUM_L) + + /* Convenience */ + COMBO(esc, &kp ESC, 1 2, DEF_L) + COMBO(ent, &kp ENTER, 15 16, DEF_L) + COMBO(del, &kp DEL, 4 5, DEF_L) + COMBO(tab, &kp TAB, 9 10, DEF_L) + COMBO(select_all, &kp LC(A), 19 20, NAV_L) + COMBO(tmux_prefix, &kp LC(B), 22 24, DEF_L UPP_L SYM_L NUM_L) + COMBO(caps_word, &caps_word, 18 25, DEF_L) + + COMBO(vim_increment, &kp LC(A), 14 22, DEF_L) + COMBO(vim_decrement, &kp LC(X), 14 22, DEF_L) + + + }; + + conditional_layers { + compatible = "zmk,conditional-layers"; + tri_layer { + if-layers = ; + then-layer = ; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &kp P &kp U &kp O &kp K &kp B &kp D &kp R &kp F + &kp W &kp I &kp E &kp A &kp DOT &kp G &kp T &kp N &kp S &kp H + &kp J &kp Y &kp QUOT < EXL_L COMMA &kp M &kp L &kp C &kp Q + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &mo_nav &kp SPACE &mo_upp &mo_sym + // ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯ + + >; + }; + + nav_layer { + label = "Nav"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &gprev &kp LC(O) &kp HOME &pprev &kp PG_UP &kp END &kp LC(I) &gnext + &sk LGUI &sk LALT &sk LCTRL &sk LSHFT &pnext &kp PG_DN &kp LARW &kp DARW &kp UARW &kp RARW + &kp LC(Z) &kp LC(X) &kp LC(C) &kp LC(V) &neoclip &kp LS(TAB) &key_repeat &caps_word + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &trans &trans &kp BSPC &kp DEL + // ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯ + >; + }; + + upper_layer { + label = "Upp"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &kp LS(P) &kp LS(U) &kp LS(O) &kp LS(K) &kp LS(B) &kp LS(D) &kp LS(R) &kp LS(F) + &kp LS(W) &kp LS(I) &kp LS(E) &kp LS(A) &kp GT &kp LS(G) &kp LS(T) &kp LS(N) &kp LS(S) &kp LS(H) + &kp LS(J) &kp LS(Y) &kp DQT &kp LT &kp LS(M) &kp LS(L) &kp LS(C) &kp LS(Q) + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &trans &kp LS(SPACE) &trans &trans + // ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯ + >; + }; + + sym_layer { + label = "Sym"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &kp AMPS &kp ASTRK &kp BSLH &kp PLUS &none &leq &eq &geq + &kp COLON &kp DLLR &kp PRCNT &kp CARET &kp EQUAL &none &sk LSHFT &sk LCTRL &sk LALT &sk LGUI + &kp SEMI &kp EXCL &kp AT &kp POUND &kp LT &kp PIPE &kp GT &arrow + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &kp UNDER &kp MINUS &trans &trans + // ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯ + >; + }; + + num_layer { + label = "Num"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &kp N7 &kp N4 &kp N3 &kp PLUS &kp K &kp W &kp B &kp G + &kp GRAVE &kp N2 &kp N1 &kp N0 &kp EQUAL &kp J &sk LSHFT &sk LCTRL &sk LALT &sk LGUI + &kp TILDE &kp N8 &kp N6 &kp N5 &kp D &none &none &kp Y + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &kp N9 &kp MINUS &trans &trans + // ╰─────────────┴─────────────╯ ╰─────────────┴───────────── + >; + }; + + exl_layer { + label = "Exl"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &none &none &none &none &exl_nav_beg &exl_sel_row &exl_cmt_ins &exl_sel_col + &none &none &none &none &none &exl_nav_end &exl_sel_pre &kp F2 &exl_sel_dep &exl_auto_sum + &none &none &none &none &exl_cur_fmt &exl_pct_fmt &exl_num_fmt &none + // ╰─────────────┴─────────────┴─────────────╮ ╭─────────────┴─────────────┴─────────────╯ + &none &none &exl_rpt_act &exl_tgl_df + // ╰─────────────┴─────────────╯ ╰─────────────┴─────────────╯ + >; + }; + }; +}; diff --git a/config/boards/shields/moon/Kconfig.defconfig b/config/boards/shields/moon/Kconfig.defconfig new file mode 100644 index 0000000..61d28bc --- /dev/null +++ b/config/boards/shields/moon/Kconfig.defconfig @@ -0,0 +1,12 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_MOON + +config ZMK_KEYBOARD_NAME + default "Moon" + +config ZMK_USB + default y + +endif diff --git a/config/boards/shields/moon/Kconfig.shield b/config/boards/shields/moon/Kconfig.shield new file mode 100644 index 0000000..c451ac5 --- /dev/null +++ b/config/boards/shields/moon/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_HUMMINGBIRD + def_bool $(shields_list_contains,hummingbird) diff --git a/config/boards/shields/moon/boards/seeeduino_xiao.conf b/config/boards/shields/moon/boards/seeeduino_xiao.conf new file mode 100644 index 0000000..76bc71f --- /dev/null +++ b/config/boards/shields/moon/boards/seeeduino_xiao.conf @@ -0,0 +1,4 @@ +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_UART_INTERRUPT_DRIVEN=n +CONFIG_SERIAL=n \ No newline at end of file diff --git a/config/boards/shields/moon/boards/seeeduino_xiao_ble.conf b/config/boards/shields/moon/boards/seeeduino_xiao_ble.conf new file mode 100644 index 0000000..ac18990 --- /dev/null +++ b/config/boards/shields/moon/boards/seeeduino_xiao_ble.conf @@ -0,0 +1,5 @@ +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_UART_INTERRUPT_DRIVEN=n +CONFIG_ZMK_USB=y +CONFIG_ZMK_BLE=y \ No newline at end of file diff --git a/config/boards/shields/moon/moon.overlay b/config/boards/shields/moon/moon.overlay new file mode 100644 index 0000000..fbc7a84 --- /dev/null +++ b/config/boards/shields/moon/moon.overlay @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + /delete-property/ zephyr,console; + /delete-property/ zephyr,shell-uart; + }; + + default_transform: 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(3,0) RC(3,1) RC(3,2) RC(3,3) + RC(0,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(3,4) + RC(1,0) RC(2,0) RC(2,1) RC(2,2) RC(5,2) RC(5,3) RC(5,4) RC(4,4) + RC(2,3) RC(2,4) RC(5,0) RC(5,2) + >; + }; + + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + col-gpios + = <&xiao_d 0 GPIO_ACTIVE_HIGH> + , <&xiao_d 1 GPIO_ACTIVE_HIGH> + , <&xiao_d 2 GPIO_ACTIVE_HIGH> + , <&xiao_d 3 GPIO_ACTIVE_HIGH> + , <&xiao_d 4 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&xiao_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; + +}; + +&xiao_spi { status = "disabled"; }; +&xiao_i2c { status = "disabled"; }; +&xiao_serial { status = "disabled"; }; diff --git a/config/moon.keymap b/config/moon.keymap new file mode 100644 index 0000000..3c6cb90 --- /dev/null +++ b/config/moon.keymap @@ -0,0 +1 @@ +#include "base_lower.keymap"