From 58c726aca8045c340dc78b141b4736c0a5e11781 Mon Sep 17 00:00:00 2001 From: jnfengke Date: Sat, 27 Apr 2024 18:49:19 -0700 Subject: [PATCH] copied from jscotto github --- build.yaml | 19 +- .../boards/shields/scotto63/Kconfig.defconfig | 6 + config/boards/shields/scotto63/Kconfig.shield | 3 + .../boards/shields/scotto63/scotto63.keymap | 193 ++++++++++++++++++ .../boards/shields/scotto63/scotto63.overlay | 50 +++++ config/scotto63.conf | 5 + config/west.yml | 22 +- 7 files changed, 274 insertions(+), 24 deletions(-) create mode 100644 config/boards/shields/scotto63/Kconfig.defconfig create mode 100644 config/boards/shields/scotto63/Kconfig.shield create mode 100644 config/boards/shields/scotto63/scotto63.keymap create mode 100644 config/boards/shields/scotto63/scotto63.overlay create mode 100644 config/scotto63.conf diff --git a/build.yaml b/build.yaml index cae99c3..47a73e8 100644 --- a/build.yaml +++ b/build.yaml @@ -1,9 +1,8 @@ -# This file generates the GitHub Actions matrix. -# For simple board + shield combinations, add them to the top level board and -# shield arrays, for more control, add individual board + shield combinations -# to the `include` property. You can also use the `cmake-args` property to -# pass flags to the build command and `artifact-name` to assign a name to -# distinguish build outputs from each other: +# This file generates the GitHub Actions matrix +# For simple board + shield combinations, add them +# to the top level board and shield arrays, for more +# control, add individual board + shield combinations to +# the `include` property, e.g: # # board: [ "nice_nano_v2" ] # shield: [ "corne_left", "corne_right" ] @@ -11,12 +10,8 @@ # - board: bdn9_rev2 # - board: nice_nano_v2 # shield: reviung41 -# - board: nice_nano_v2 -# shield: corne_left -# cmake-args: -DCONFIG_ZMK_USB_LOGGING=y -# artifact-name: corne_left_with_logging # --- include: - - board: nice_nano_v2 - shield: boardsource5x12 + - board: nice_nano_v2 + shield: scotto63 diff --git a/config/boards/shields/scotto63/Kconfig.defconfig b/config/boards/shields/scotto63/Kconfig.defconfig new file mode 100644 index 0000000..3c5d163 --- /dev/null +++ b/config/boards/shields/scotto63/Kconfig.defconfig @@ -0,0 +1,6 @@ +if SHIELD_SCOTTO63 + +config ZMK_KEYBOARD_NAME + default "Scotto63" + +endif diff --git a/config/boards/shields/scotto63/Kconfig.shield b/config/boards/shields/scotto63/Kconfig.shield new file mode 100644 index 0000000..7b73683 --- /dev/null +++ b/config/boards/shields/scotto63/Kconfig.shield @@ -0,0 +1,3 @@ +config SHIELD_SCOTTO63 + def_bool $(shields_list_contains,scotto63) + \ No newline at end of file diff --git a/config/boards/shields/scotto63/scotto63.keymap b/config/boards/shields/scotto63/scotto63.keymap new file mode 100644 index 0000000..f06783f --- /dev/null +++ b/config/boards/shields/scotto63/scotto63.keymap @@ -0,0 +1,193 @@ +#include +#include +#include + +#define MAC 0 +#define MAC_CODE 1 +#define MAC_NUMBER 2 +#define MAC_FUNCTION 3 +#define WINDOWS 4 +#define WINDOWS_CODE 5 +#define WINDOWS_NUMBER 6 +#define WINDOWS_FUNCTION 7 + + // Behavior Overrides + < { + tapping-term-ms = <200>; + flavor = "hold-preferred"; + }; + +/ { + //combos { + // compatible = "zmk,combos"; + + //combo_tab { + // timeout-ms = <20>; + // key-positions = <1 2>; + // bindings = <&kp TAB>; + //}; + + // combo_enter { + // timeout-ms = <20>; + // key-positions = <13 14>; + //bindings = <&kp ENTER>; + //}; + //}; + + macros { + spotlight: spotlight { + label = "spotlight"; + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + bindings = <¯o_press &kp LGUI>, <¯o_tap &kp SPACE>, <¯o_release &kp LGUI>; + }; + + // Emoji + mac_emoji: mac_emoji { + label = "mac_emoji"; + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + bindings = <¯o_press &kp LGUI>, <¯o_press &kp LCTRL>, <¯o_tap &kp SPACE>, <¯o_release &kp LCTRL>, <¯o_release &kp LGUI>; + }; + + win_emoji: win_emoji { + label = "win_emoji"; + compatible = "zmk,behavior-macro"; + #binding-cells = <0>; + bindings = <¯o_press &kp LGUI>, <¯o_tap &kp DOT>, <¯o_release &kp LGUI>; + }; + }; + + behaviors { + td_multi_mac: tap_dance_multi_mac { + compatible = "zmk,behavior-tap-dance"; + label = "TAP_DANCE_MULTI_MAC"; + #binding-cells = <0>; + tapping-term-ms = <200>; + bindings = <&kp ESC>, <&spotlight>, <&mac_emoji>; + }; + + td_multi_windows: tap_dance_multi_windows { + compatible = "zmk,behavior-tap-dance"; + label = "TAP_DANCE_MULTI_WINDOWS"; + #binding-cells = <0>; + tapping-term-ms = <200>; + bindings = <&kp ESC>, <&kp LGUI>, <&win_emoji>; + }; + + bm: bottom_row_mods { + compatible = "zmk,behavior-hold-tap"; + label = "BOTTOM_ROW_MODS"; + #binding-cells = <2>; + tapping-term-ms = <135>; + quick-tap-ms = <0>; + flavor = "tap-preferred"; + bindings = <&kp>, <&kp>; + }; + + cm: code_row_mods { + compatible = "zmk,behavior-hold-tap"; + label = "CODE_ROW_MODS"; + #binding-cells = <2>; + tapping-term-ms = <200>; + quick-tap-ms = <0>; + flavor = "tap-preferred"; + bindings = <&kp>, <&kp>; + retro-tap; + }; + + sm: space_mod { + compatible = "zmk,behavior-hold-tap"; + label = "SPACE_MOD"; + #binding-cells = <2>; + flavor = "balanced"; + tapping-term-ms = <200>; + quick-tap-ms = <125>; + bindings = <&kp>, <&kp>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + mac_default_layer { + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BACKSPACE + &kp TAB &kp Q &kp W &kp F &kp P &kp G &kp J &kp L &kp U &kp Y &kp BACKSPACE &kp BACKSLASH + &kp CAPS &kp A &kp R &kp S &kp T &kp D &none &none &none &kp H &kp N &kp E &kp I &kp O &kp ENTER + &kp LSHIFT &bm LSHIFT Z &kp X &kp C &kp V &kp B &none &none &none &kp K &kp M &kp COMMA &kp PERIOD &bm RSHIFT FSLH &kp RSHIFT + &none &kp LCTRL &kp LALT &sm LGUI SPACE &none < MAC_CODE TAB < MAC_NUMBER ENTER &td_multi_mac &none + >; + }; + + mac_code_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &none &trans + &trans &kp UNDER &kp MINUS &kp PLUS &kp EQUAL &kp COLON &kp GRAVE &kp C_PREVIOUS &kp C_PLAY_PAUSE &kp C_NEXT &kp DELETE &trans + &trans &kp LEFT_BRACE &kp LEFT_PARENTHESIS &kp RIGHT_PARENTHESIS &kp RIGHT_BRACE &kp PIPE &trans &trans &trans &kp ESC &kp LEFT &kp UP &kp DOWN &kp RIGHT &trans + &trans &cm LSHIFT LEFT_BRACKET &kp APOSTROPHE &kp DOUBLE_QUOTES &kp RIGHT_BRACKET &kp SEMICOLON &trans &trans &trans &kp TILDE &kp C_VOLUME_DOWN &kp C_MUTE &kp C_VOLUME_UP &cm RSHIFT BACKSLASH &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + mac_number_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &none &trans + &trans &kp EXCLAMATION &kp AT_SIGN &kp HASH &kp DOLLAR &kp PERCENT &kp CARET &kp AMPERSAND &kp ASTERISK &kp CAPS &kp BACKSPACE &trans + &trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &trans &trans &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans + &trans &kp LSHIFT &none &none &none &mo MAC_FUNCTION &trans &trans &trans &none &none &kp COMMA &kp PERIOD &kp RSHIFT &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + mac_function_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &to WINDOWS &trans + &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &none &none &trans + &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &trans &trans &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans + &trans &kp F11 &none &bt BT_CLR &bootloader &none &trans &trans &trans &none &none &none &none &cm RSHIFT F12 &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + windows_default_layer { + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BACKSPACE + &kp TAB &kp Q &kp W &kp F &kp P &kp G &kp J &kp L &kp U &kp Y &kp BACKSPACE &kp BACKSLASH + &kp CAPS &kp A &kp R &kp S &kp T &kp D &none &none &none &kp H &kp N &kp E &kp I &kp O &kp ENTER + &kp LSHIFT &bm LSHIFT Z &kp X &kp C &kp V &kp B &none &none &none &kp K &kp M &kp COMMA &kp PERIOD &bm RSHIFT FSLH &kp RSHIFT + &none &kp LGUI &kp LALT &sm LCTRL SPACE &none < WINDOWS_CODE TAB < WINDOWS_NUMBER ENTER &td_multi_windows &none + >; + }; + + windows_code_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &none &trans + &trans &kp UNDER &kp MINUS &kp PLUS &kp EQUAL &kp COLON &kp GRAVE &kp C_PREVIOUS &kp C_PLAY_PAUSE &kp C_NEXT &kp DELETE &trans + &trans &kp LEFT_BRACE &kp LEFT_PARENTHESIS &kp RIGHT_PARENTHESIS &kp RIGHT_BRACE &kp PIPE &trans &trans &trans &kp ESC &kp LEFT &kp UP &kp DOWN &kp RIGHT &trans + &trans &cm LSHIFT LEFT_BRACKET &kp APOSTROPHE &kp DOUBLE_QUOTES &kp RIGHT_BRACKET &kp SEMICOLON &trans &trans &trans &kp TILDE &kp C_VOLUME_DOWN &kp C_MUTE &kp C_VOLUME_UP &cm RSHIFT BACKSLASH &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + windows_number_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &none &trans + &trans &kp EXCLAMATION &kp AT_SIGN &kp HASH &kp DOLLAR &kp PERCENT &kp CARET &kp AMPERSAND &kp ASTERISK &kp CAPS &kp BACKSPACE &trans + &trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &trans &trans &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans + &trans &kp LSHIFT &none &none &none &mo WINDOWS_FUNCTION &trans &trans &trans &none &none &kp COMMA &kp PERIOD &kp RSHIFT &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + windows_function_layer { + bindings = < + &trans &none &none &none &none &none &none &none &none &none &to MAC &trans + &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &none &none &trans + &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &trans &trans &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans + &trans &kp F11 &none &bt BT_CLR &bootloader &none &trans &trans &trans &none &none &none &none &cm RSHIFT F12 &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + }; +}; \ No newline at end of file diff --git a/config/boards/shields/scotto63/scotto63.overlay b/config/boards/shields/scotto63/scotto63.overlay new file mode 100644 index 0000000..c667dfe --- /dev/null +++ b/config/boards/shields/scotto63/scotto63.overlay @@ -0,0 +1,50 @@ +#include + +/ { + chosen { + zmk,kscan = &kscan; + zmk,matrix_transform = &transform; + }; + + kscan: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + row-gpios = <&pro_micro 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>, + <&pro_micro 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>, + <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>, + <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>, + <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + + col-gpios = <&pro_micro 2 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 3 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 4 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 5 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 6 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 7 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 8 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 9 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 21 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 20 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 19 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 18 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 15 (GPIO_ACTIVE_HIGH)>, + <&pro_micro 14(GPIO_ACTIVE_HIGH)>, + <&pro_micro 16 (GPIO_ACTIVE_HIGH)>; + }; + + transform: matrix_transform { + compatible = "zmk,matrix-transform"; + rows = <5>; + columns = <15>; + + map = < + RC(0, 0) RC(0, 1) RC(0, 2) RC(0, 3) RC(0, 4) RC(0, 5) RC(0, 9) RC(0, 10) RC(0, 11) RC(0, 12) RC(0, 13) RC(0, 14) + RC(1, 0) RC(1, 1) RC(1, 2) RC(1, 3) RC(1, 4) RC(1, 5) RC(1, 9) RC(1, 10) RC(1, 11) RC(1, 12) RC(1, 13) RC(1, 14) + 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(2, 12) RC(2, 13) RC(2, 14) + 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) RC(3, 9) RC(3, 10) RC(3, 11) RC(3, 12) RC(3, 13) RC(3, 14) + RC(4, 3) RC(4, 4) RC(4, 5) RC(4, 6) RC(4, 7) RC(4, 8) RC(4, 9) RC(4, 10) RC(4, 11) + >; + }; +}; diff --git a/config/scotto63.conf b/config/scotto63.conf new file mode 100644 index 0000000..5103547 --- /dev/null +++ b/config/scotto63.conf @@ -0,0 +1,5 @@ +# Make Bluetooth stronger +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y + +# Turn on logging, and set ZMK logging to debug output +CONFIG_ZMK_USB_LOGGING=y \ No newline at end of file diff --git a/config/west.yml b/config/west.yml index b886cbe..b79e5c8 100644 --- a/config/west.yml +++ b/config/west.yml @@ -1,13 +1,11 @@ manifest: - remotes: - - name: zmkfirmware - url-base: https://github.com/zmkfirmware - # Additional modules containing boards/shields/custom code can be listed here as well - # See https://docs.zephyrproject.org/3.2.0/develop/west/manifest.html#projects - projects: - - name: zmk - remote: zmkfirmware - revision: main - import: app/west.yml - self: - path: config + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + self: + path: config