diff --git a/behaviors/combos.dtsi b/behaviors/combos.dtsi index 922bf3e..1bad9ba 100644 --- a/behaviors/combos.dtsi +++ b/behaviors/combos.dtsi @@ -16,8 +16,7 @@ ALL LAYERS ***********************/ -// TAB - Inner right thumbs, active on all layer -ZMK_COMBO(combo_tab, &kp TAB, RH0 RH1, ALL) +// NOTE: Other thumb key combos are in ./combos_34.dsti and combos_36.dtsi // NOTE: Other mouse keys related combos in ./mouse.dtsi diff --git a/behaviors/combos_34.dtsi b/behaviors/combos_34.dtsi new file mode 100644 index 0000000..8dff573 --- /dev/null +++ b/behaviors/combos_34.dtsi @@ -0,0 +1,19 @@ +#include +#include +#include "../zmk-nodefree-config/helper.h" +#include "../zmk-nodefree-config/keypos_def/keypos_36keys.h" +#include "../config/constants.h" +#include "./combos.dtsi" + +#pragma once + +// NOTE: Only thumb keys are different between 34/36 layouts +// All other combos should be in ./combos.dtsi + +/*********************** + THUMBS +***********************/ + +// TAB - Inner right thumbs, active on all layer +ZMK_COMBO(combo_tab_34, &kp TAB, LH0 RH0, ALL) + diff --git a/behaviors/combos_36.dtsi b/behaviors/combos_36.dtsi new file mode 100644 index 0000000..3cd0e79 --- /dev/null +++ b/behaviors/combos_36.dtsi @@ -0,0 +1,19 @@ +#include +#include +#include "../zmk-nodefree-config/helper.h" +#include "../zmk-nodefree-config/keypos_def/keypos_36keys.h" +#include "../config/constants.h" +#include "./combos.dtsi" + +#pragma once + +// NOTE: Only thumb keys are different between 34/36 layouts +// All other combos should be in ./combos.dtsi + +/*********************** + THUMBS +***********************/ + +// TAB - Inner right thumbs, active on all layer +ZMK_COMBO(combo_tab, &kp TAB, RH0 RH1, ALL) + diff --git a/build.yaml b/build.yaml index 228498f..3503c6f 100644 --- a/build.yaml +++ b/build.yaml @@ -17,3 +17,7 @@ include: shield: corne_left nice_view_adapter nice_view - board: nice_nano_v2 shield: corne_right nice_view_adapter nice_view + - board: nice_nano_v2 + shield: urchin_left nice_view_adapter nice_view + - board: nice_nano_v2 + shield: urchin_right nice_view_adapter nice_view diff --git a/config/boards/shields/urchin/Kconfig.defconfig b/config/boards/shields/urchin/Kconfig.defconfig new file mode 100644 index 0000000..c07f57a --- /dev/null +++ b/config/boards/shields/urchin/Kconfig.defconfig @@ -0,0 +1,17 @@ +# Copyright (c) 2022 Duccio Breschi +# SPDX-License-Identifier: MIT + +if SHIELD_URCHIN_LEFT + +config ZMK_KEYBOARD_NAME + default "urchin" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +endif + +if SHIELD_URCHIN_LEFT || SHIELD_URCHIN_RIGHT +config ZMK_SPLIT + default y +endif diff --git a/config/boards/shields/urchin/Kconfig.shield b/config/boards/shields/urchin/Kconfig.shield new file mode 100644 index 0000000..fe0a07c --- /dev/null +++ b/config/boards/shields/urchin/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2022 Duccio Breschi +# SPDX-License-Identifier: MIT + +config SHIELD_URCHIN_LEFT + def_bool $(shields_list_contains,urchin_left) + +config SHIELD_URCHIN_RIGHT + def_bool $(shields_list_contains,urchin_right) diff --git a/config/boards/shields/urchin/urchin.dtsi b/config/boards/shields/urchin/urchin.dtsi new file mode 100644 index 0000000..163945e --- /dev/null +++ b/config/boards/shields/urchin/urchin.dtsi @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Duccio Breschi + * + * SPDX-License-Identifier: MIT + */ + +#include + + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <10>; + 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(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(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(3,3) RC(3,4) RC(3,5) RC(3,6) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN0"; + }; +}; diff --git a/config/boards/shields/urchin/urchin.keymap b/config/boards/shields/urchin/urchin.keymap new file mode 100644 index 0000000..58103ec --- /dev/null +++ b/config/boards/shields/urchin/urchin.keymap @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2020 Duccio Breschi + * + * SPDX-License-Identifier: MIT + */ + +#include "../../../urchin.keymap" diff --git a/config/boards/shields/urchin/urchin.zmk.yml b/config/boards/shields/urchin/urchin.zmk.yml new file mode 100644 index 0000000..a1cc092 --- /dev/null +++ b/config/boards/shields/urchin/urchin.zmk.yml @@ -0,0 +1,11 @@ +file_format: "1" +id: urchin +name: urchin +type: shield +url: https://github.com/duckyb/urchin +requires: [pro_micro] +features: + - keys +siblings: + - urchin_left + - urchin_right diff --git a/config/boards/shields/urchin/urchin_left.overlay b/config/boards/shields/urchin/urchin_left.overlay new file mode 100644 index 0000000..43906e9 --- /dev/null +++ b/config/boards/shields/urchin/urchin_left.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 Duccio Breschi + * + * SPDX-License-Identifier: MIT + */ + +#include "urchin.dtsi" + +&kscan0 { + diode-direction = "col2row"; + col-gpios + = <&pro_micro 18 (GPIO_ACTIVE_HIGH)> // COL0 + , <&pro_micro 15 (GPIO_ACTIVE_HIGH)> // COL1 + , <&pro_micro 14 (GPIO_ACTIVE_HIGH)> // COL2 + , <&pro_micro 16 (GPIO_ACTIVE_HIGH)> // COL3 + , <&pro_micro 10 (GPIO_ACTIVE_HIGH)> // COL4 + ; + row-gpios + = <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW0 + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW1 + , <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW2 + , <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW3 + ; +}; diff --git a/config/boards/shields/urchin/urchin_right.overlay b/config/boards/shields/urchin/urchin_right.overlay new file mode 100644 index 0000000..1105446 --- /dev/null +++ b/config/boards/shields/urchin/urchin_right.overlay @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022 Duccio Breschi + * + * SPDX-License-Identifier: MIT + */ + +#include "urchin.dtsi" + +&default_transform { + col-offset = <5>; +}; + +&kscan0 { + diode-direction = "col2row"; + col-gpios + = <&pro_micro 5 (GPIO_ACTIVE_HIGH)> // COL0 + , <&pro_micro 6 (GPIO_ACTIVE_HIGH)> // COL1 + , <&pro_micro 7 (GPIO_ACTIVE_HIGH)> // COL2 + , <&pro_micro 8 (GPIO_ACTIVE_HIGH)> // COL3 + , <&pro_micro 9 (GPIO_ACTIVE_HIGH)> // COL4 + ; + row-gpios + = <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW0 + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW1 + , <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW2 + , <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW3 + ; +}; diff --git a/config/corne.keymap b/config/corne.keymap index 9136c51..8430f98 100644 --- a/config/corne.keymap +++ b/config/corne.keymap @@ -13,7 +13,7 @@ #include "../zmk-nodefree-config/symbols/typography.dtsi" #include "../layouts/canadian-multilingual-standard.dtsi" -#include "../behaviors/combos.dtsi" +#include "../behaviors/combos_36.dtsi" #include "../behaviors/hold-tap.dtsi" #include "../behaviors/macros.dtsi" #include "../behaviors/mod-morph.dtsi" diff --git a/config/urchin.conf b/config/urchin.conf new file mode 100644 index 0000000..14e298f --- /dev/null +++ b/config/urchin.conf @@ -0,0 +1,28 @@ +# increase bluetooth signal power +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y + +# enable deep sleep support +CONFIG_ZMK_SLEEP=y + +# the keyboard disconnects from bluetooth. +# uses very little power, but it may take +# a few seconds to reconnect after waking. +# 1.800.000 ms = 30 minutes +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000 + +# "Eager Debouncing" +# Trying to lower the input lag. +# CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=1 +# CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=5 + +# --- DISPLAY SETTINGS --- + +# disable the WPM widget +CONFIG_ZMK_WIDGET_WPM_STATUS=n + +# display battery as n% +CONFIG_ZMK_WIDGET_BATTERY_STATUS_SHOW_PERCENTAGE=y + +# Add mouse keys support +CONFIG_ZMK_MOUSE=y + diff --git a/config/urchin.keymap b/config/urchin.keymap new file mode 100644 index 0000000..929474d --- /dev/null +++ b/config/urchin.keymap @@ -0,0 +1,92 @@ +#include +#include +#include +#include +#include + +#include "constants.h" +#define HOST_OS LINUX // Needed for unicode international_chars + +#include "../zmk-nodefree-config/helper.h" +#include "../zmk-nodefree-config/international_chars/french.dtsi" +#include "../zmk-nodefree-config/symbols/math.dtsi" +#include "../zmk-nodefree-config/symbols/typography.dtsi" + +#include "../layouts/canadian-multilingual-standard.dtsi" +#include "../behaviors/combos_34.dtsi" +#include "../behaviors/hold-tap.dtsi" +#include "../behaviors/macros.dtsi" +#include "../behaviors/mod-morph.dtsi" +#include "../behaviors/mouse.dtsi" + +ZMK_LAYER(qwerty, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &hml GL A &hml AL S &hml CL D &hml SL F &kp G &kp H &hmr SL J &hmr CL K &hmr AL L &hmr GL SEMI +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &to ACC +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + < NAV RET &num_esc_clk &bspc_del < SYM SPACE +// ╰───────────┴─────────────╯ ╰───────────┴─────────────╯ +) + +ZMK_LAYER(accent, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + XXX XXX &TREM E XXX XXX XXX &TREM I &TREM O &TREM U &KPD ACC_TR +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &A_GR &CIRC E &E_CU &hrme SL 0 XXX XXX &hrmi SL 0 &O_CI &U_CI &KPD ACC_GR +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &A_CI XXX &CEDIL XXX XXX XXX XXX XXX &U_GR &KPD ACC_CI +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + ___ ___ ___ ___ +// ╰────────────┴────────────╯ ╰───────────┴─────────────╯ +) + +ZMK_LAYER(symbol, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + &kp HASH &kp AT &kp LBRAC &kp RBRAC &kp PLUS XXX &kp TILDS &GRA &kp DLLR XXX +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &kp SLSH &dash_tilde &kp LPAR &hml SL RPAR &kp EQUAL &CAR &kp QUEST &kp EXCL &kp AMPS &kp PIP +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &kp STAR &kp PRCNT &kp LBKET &kp RBKET &kp UNDER XXX &kp LETHAN &kp GRTHAN « » +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + ___ ___ ___ ___ +// ╰────────────┴────────────╯ ╰───────────┴─────────────╯ +) + +ZMK_LAYER(nav, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + &out OUT_TOG ___ ___ ___ &bt BT_CLR ___ ___ ___ ___ ___ +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &sk LGUI &kp C_PREV &kp C_PP &kp C_NEXT XXX &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp INS +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &bt BT_PRV &bt BT_NXT &kp C_VOL_DN &kp C_VOL_UP XXX &kp HOME &kp PG_DN &kp PG_UP &kp END &kp SLCK +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + ___ ___ ___ ___ +// ╰────────────┴────────────╯ ╰───────────┴─────────────╯ +) + +ZMK_LAYER(nums, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + &kp F1 &kp F2 &kp F3 &kp F4 &math_pm &math_1_4 &kp N7 &kp N8 &kp N9 &multi_div +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &kp F5 &kp F6 &kp F7 &hml SL F8 &kp DEG &math_1_2 &kp N4 &kp N5 &kp N6 &plus_minus +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + &kp F9 &kp F10 &kp F11 &kp F12 &math_micro &math_3_4 &kp N1 &kp N2 &kp N3 &comma_dot +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + ___ ___ ___ &kp N0 +// ╰────────────┴────────────╯ ╰───────────┴─────────────╯ +) + +ZMK_LAYER(mouse, +// ╭───────────┬───────────┬───────────┬────────────┬────────────╮ ╭───────────┬─────────────┬─────────────┬────────────┬────────────╮ + ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + ___ &mwh_lf &mwh_up &mwh_dn &mwh_rg &mmv_lf &mmv_dn &mmv_up &mmv_rg ___ +// ├───────────┼───────────┼───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┼────────────┼────────────┤ + ___ ___ ___ &mwh_tg ___ ___ ___ ___ ___ ___ +// ╰───────────┴───────────┴───────────┼────────────┼────────────┤ ├───────────┼─────────────┼─────────────┴────────────┴────────────╯ + &mkp_rg &mkp_lf ___ ___ +// ╰────────────┴────────────╯ ╰───────────┴─────────────╯ +) diff --git a/images/corne36.jpeg b/images/corne36.jpeg deleted file mode 100644 index d8d5745..0000000 Binary files a/images/corne36.jpeg and /dev/null differ diff --git a/images/corne36.jpg b/images/corne36.jpg new file mode 100644 index 0000000..6d73d0f Binary files /dev/null and b/images/corne36.jpg differ diff --git a/images/urchin-with-nano.jpg b/images/urchin-with-nano.jpg new file mode 100644 index 0000000..249d002 Binary files /dev/null and b/images/urchin-with-nano.jpg differ diff --git a/images/urchin.jpg b/images/urchin.jpg new file mode 100644 index 0000000..675b5f9 Binary files /dev/null and b/images/urchin.jpg differ diff --git a/readme.md b/readme.md index 4b1d3bc..25b59b8 100644 --- a/readme.md +++ b/readme.md @@ -1,29 +1,41 @@ # ZMK Config -Configuration of a Corne keyboard firmware for ZMK, optimized for English/French/Programming. +ZMK firmware configuration for Corne and Urchin keyboards, optimized for +English/French/Programming. -![My Corne 36 keys keyboard](images/corne36.jpeg) +![My Urchin 34 keys keyboard](images/urchin.jpg) + +Since the Corne (36 keys) and Urchin (34 keys) have similar layouts, both +keyboards use the same configuration. The only exception is the combos using +thumb keys, which are in their own files (combo_34 and combos_36). Keyboards +also have their own keymap files, but in pratice they use the same mappings. +This repos uses Github Actions to generate both firmwares simultaneously on each +push. + +![My Corne 36 keys keyboard](images/corne36.jpg) ## Features -* QWERTY layout -* Corne 5 columns with nice!nano v2 and nice!views -* Home row mods -* French characters support with a single dead key and accent layer -* Mouse keys support -* Cursor/Scroll toggle with [Ploopy Nano Trackball](https://github.com/ploopyco/nano-trackball) -* Easy to read files, thanks to the [zmk-nodefree-config](https://github.com/urob/zmk-nodefree-config) helper +- QWERTY layout +- 5 columns with nice!nano v2 and nice!views +- Home row mods +- French characters support with a single dead key and accent layer +- Mouse keys support +- Cursor/Scroll toggle with + [Ploopy Nano Trackball](https://github.com/ploopyco/nano-trackball) +- Easy to read files, thanks to the + [zmk-nodefree-config](https://github.com/urob/zmk-nodefree-config) helper ## Keymap The keymap has 6 layers: 1. QWERTY (DEF) -2. Accents (ACC) -3. Navigation (NAV) -4. Symbols (SYM) -5. Numbers (NUM) -6. Mouse (MOU) +1. Accents (ACC) +1. Navigation (NAV) +1. Symbols (SYM) +1. Numbers (NUM) +1. Mouse (MOU) For the complete layout, head to the [corne.keymap](config/corne.keymap) file. @@ -31,11 +43,25 @@ For the complete layout, head to the [corne.keymap](config/corne.keymap) file. The keymap uses a few behaviors in order to make everything work: - * [Combos](behaviors/combos.dtsi) - * [Hold-Tap (Home Row Mods)](behaviors/hold-tap.dtsi) - * [Macros](behaviors/macros.dtsi) - * [Mod-Morph](behaviors/mod-morph.dtsi) +- [Combos](behaviors/combos.dtsi) +- [Hold-Tap (Home Row Mods)](behaviors/hold-tap.dtsi) +- [Macros](behaviors/macros.dtsi) +- [Mod-Morph](behaviors/mod-morph.dtsi) ## Layouts -The layout is currently based on [Canadian Multilingual Standard (CSA)](https://commons.wikimedia.org/wiki/File:KB_Canadian_Multilingual_Standard.svg), but it can easily be adapted to other layout by copying [canadian-multilingual-standard.dtsi](layouts/canadian-multilingual-standard.dtsi) and changing the macros accordingly. I've always used this layout, it's just more convenient for me to base my layout on it. This way I don't have to change whenever I switch keyboards. +The layout is currently based on +[Canadian Multilingual Standard (CSA)](https://commons.wikimedia.org/wiki/File:KB_Canadian_Multilingual_Standard.svg), +but it can easily be adapted to other layout by copying +[canadian-multilingual-standard.dtsi](layouts/canadian-multilingual-standard.dtsi) +and changing the macros accordingly. I've always used this layout, it's just +more convenient for me to base my layout on it. This way I don't have to change +whenever I switch keyboards. + +![Urchin with Nano Trackball](images/urchin-with-nano.jpg) + +## References + +- [Corne Keyboard](https://github.com/foostan/crkbd) +- [Urchin Keyboard](https://github.com/duckyb/urchin) +- [Ploopy Nano Trackball](https://github.com/ploopyco/nano-trackball)