From 4ddda7e024996480051c2c24cf1302a7d0685533 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Sun, 3 Jan 2021 18:13:49 -0600 Subject: [PATCH 01/31] docs(shield): Remove SPLIT_BLE_ROLE_PERIPHERAL Removes CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL from the new shield docs See: #510 Refs: 4db5b169bff1f3de5353324baef5724be4f9a6a5 --- docs/docs/development/new-shield.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index 18f8b420..9de05b7a 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -278,7 +278,6 @@ CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y // Peripheral Half (Usually the right side: my_awesome_split_board_right.conf) CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_Peripheral=y ``` Using the .conf file that affects both halves of a split board would be for adding features like deep-sleep or rotary encoders. From 74b397ab9136ba23b96e1fd8120bd7e32a1944af Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 4 Jan 2021 11:59:25 -0500 Subject: [PATCH 02/31] fix(docs): Add closing bracket for new shield. --- docs/docs/development/new-shield.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index 9de05b7a..acc636fd 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -203,6 +203,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7) ; }; +}; ``` :::note From a55b1397c9558cead989dfc5920b162f7c8b4c8b Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 29 Dec 2020 00:19:25 -0500 Subject: [PATCH 03/31] feat(keymap): API for retrieving label for a layer --- app/include/zmk/keymap.h | 1 + app/src/keymap.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 9192772f..4bcdc2b4 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -16,5 +16,6 @@ int zmk_keymap_layer_activate(uint8_t layer); int zmk_keymap_layer_deactivate(uint8_t layer); int zmk_keymap_layer_toggle(uint8_t layer); int zmk_keymap_layer_to(uint8_t layer); +const char *zmk_keymap_layer_label(uint8_t layer); int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t timestamp); diff --git a/app/src/keymap.c b/app/src/keymap.c index 786a1773..322a9369 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -59,6 +59,8 @@ static uint8_t _zmk_keymap_layer_default = 0; #endif /* ZMK_KEYMAP_HAS_SENSORS */ +#define LAYER_LABEL(node) COND_CODE_0(DT_NODE_HAS_PROP(node, label), (NULL), (DT_LABEL(node))), + // State // When a behavior handles a key position "down" event, we record the layer state @@ -69,6 +71,9 @@ static uint32_t zmk_keymap_active_behavior_layer[ZMK_KEYMAP_LEN]; static struct zmk_behavior_binding zmk_keymap[ZMK_KEYMAP_LAYERS_LEN][ZMK_KEYMAP_LEN] = { DT_INST_FOREACH_CHILD(0, TRANSFORMED_LAYER)}; +static const char *zmk_keymap_layer_names[ZMK_KEYMAP_LAYERS_LEN] = { + DT_INST_FOREACH_CHILD(0, LAYER_LABEL)}; + #if ZMK_KEYMAP_HAS_SENSORS static struct zmk_behavior_binding zmk_sensor_keymap[ZMK_KEYMAP_LAYERS_LEN] @@ -143,6 +148,18 @@ int zmk_keymap_layer_to(uint8_t layer) { return 0; } +bool is_active_layer(uint8_t layer, zmk_keymap_layers_state_t layer_state) { + return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default; +} + +const char *zmk_keymap_layer_label(uint8_t layer) { + if (layer >= ZMK_KEYMAP_LAYERS_LEN) { + return NULL; + } + + return zmk_keymap_layer_names[layer]; +} + int zmk_keymap_apply_position_state(int layer, uint32_t position, bool pressed, int64_t timestamp) { struct zmk_behavior_binding *binding = &zmk_keymap[layer][position]; const struct device *behavior; From 992cee1bac816696839e52eb1f7c4e5f3e51c4db Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 29 Dec 2020 00:19:51 -0500 Subject: [PATCH 04/31] feat(display): Show layer label in widget. --- app/src/display/widgets/layer_status.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/display/widgets/layer_status.c b/app/src/display/widgets/layer_status.c index fb9f6897..6700bb30 100644 --- a/app/src/display/widgets/layer_status.c +++ b/app/src/display/widgets/layer_status.c @@ -33,12 +33,23 @@ void layer_status_init() { void set_layer_symbol(lv_obj_t *label) { int active_layer_index = zmk_keymap_highest_layer_active(); - char text[6] = {}; LOG_DBG("Layer changed to %i", active_layer_index); - sprintf(text, LV_SYMBOL_KEYBOARD "%i ", active_layer_index); - lv_label_set_text(label, text); + const char *layer_label = zmk_keymap_layer_label(active_layer_index); + if (layer_label == NULL) { + char text[6] = {}; + + sprintf(text, LV_SYMBOL_KEYBOARD "%i", active_layer_index); + + lv_label_set_text(label, text); + } else { + char text[12] = {}; + + snprintf(text, 12, LV_SYMBOL_KEYBOARD "%s", layer_label); + + lv_label_set_text(label, text); + } } int zmk_widget_layer_status_init(struct zmk_widget_layer_status *widget, lv_obj_t *parent) { From e5b1f1e1beb3ca9ad11de2cc3aac64bfa8b4ca4c Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Mon, 4 Jan 2021 12:20:31 -0600 Subject: [PATCH 05/31] fix(shield): BFO9000 uses USB on right --- app/boards/shields/bfo9000/Kconfig.defconfig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/boards/shields/bfo9000/Kconfig.defconfig b/app/boards/shields/bfo9000/Kconfig.defconfig index e4b02e8c..1251113f 100644 --- a/app/boards/shields/bfo9000/Kconfig.defconfig +++ b/app/boards/shields/bfo9000/Kconfig.defconfig @@ -3,12 +3,12 @@ if SHIELD_BFO9000_LEFT -config ZMK_SPLIT_BLE_ROLE_CENTRAL - default y - config ZMK_KEYBOARD_NAME default "BFO9000 Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_BFO9000_RIGHT @@ -16,6 +16,9 @@ if SHIELD_BFO9000_RIGHT config ZMK_KEYBOARD_NAME default "BFO9000 Right" +config USB + default y + endif if SHIELD_BFO9000_LEFT || SHIELD_BFO9000_RIGHT From a4703537603d1ae7f5a904fc57d61af7382b6f9f Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Mon, 4 Jan 2021 12:42:22 -0600 Subject: [PATCH 06/31] docs(shield): Add docs based on #510 changes --- docs/docs/development/new-shield.md | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index acc636fd..ceb81d10 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -91,6 +91,9 @@ endif ``` Similarly to defining the halves of a split board in `Kconfig.shield` it is important to set the `ZMK_KEYBOARD_NAME` for each half of a split keyboard. +You'll also want to set which half is the central side. Most boards set it to the left. +Then on the peripheral half, you'll want to turn USB on so that it shows USB status on displays properly. +Finally, you'll want to turn on the split option for both sides. This can all be seen below. ``` if SHIELD_MY_BOARD_LEFT @@ -98,6 +101,9 @@ if SHIELD_MY_BOARD_LEFT config ZMK_KEYBOARD_NAME default "My Awesome Keyboard Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_MY_BOARD_RIGHT @@ -105,6 +111,16 @@ if SHIELD_MY_BOARD_RIGHT config ZMK_KEYBOARD_NAME default "My Awesome Keyboard Right" +config USB + default y + +endif + +if SHIELD_MY_BOARD_LEFT || SHIELD_MY_BOARD_RIGHT + +config ZMK_SPLIT + default y + endif ``` @@ -265,23 +281,7 @@ For example, a split board called `my_awesome_split_board` would have the follow - `my_awesome_split_board_left.conf` - Configuration elements only affect left half - `my_awesome_split_board_right.conf` - Configuration elements only affect right half -For proper communication between keyboard halves and that between the central half and the computer, -the **the central and peripheral halves of the keyboard must be defined**. This can be seen below. - -``` -// Central Half (Usually the left side: my_awesome_split_board_left.conf) - -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -``` - -``` -// Peripheral Half (Usually the right side: my_awesome_split_board_right.conf) - -CONFIG_ZMK_SPLIT=y -``` - -Using the .conf file that affects both halves of a split board would be for adding features like deep-sleep or rotary encoders. +In most case you'll only need to use the .conf file that affects both halves of a split board. It's used for adding features like deep-sleep or rotary encoders. ``` // my_awesome_split_board.conf From 5c11962d986753d5da9244cf572242f43f4d126c Mon Sep 17 00:00:00 2001 From: KingCoinless <33333456+KingCoinless@users.noreply.github.com> Date: Tue, 5 Jan 2021 10:56:47 -0800 Subject: [PATCH 07/31] feat(shields): add helix shield PR: #429 --- .github/workflows/build.yml | 2 + app/boards/shields/helix/Kconfig.defconfig | 29 ++++++ app/boards/shields/helix/Kconfig.shield | 8 ++ app/boards/shields/helix/README.md | 12 +++ .../shields/helix/boards/nice_nano.overlay | 34 +++++++ app/boards/shields/helix/helix.conf | 6 ++ app/boards/shields/helix/helix.dtsi | 47 ++++++++++ app/boards/shields/helix/helix.keymap | 88 +++++++++++++++++++ app/boards/shields/helix/helix_left.overlay | 19 ++++ app/boards/shields/helix/helix_right.overlay | 23 +++++ docs/docs/hardware.md | 1 + docs/static/setup.ps1 | 6 +- docs/static/setup.sh | 5 +- 13 files changed, 275 insertions(+), 5 deletions(-) create mode 100644 app/boards/shields/helix/Kconfig.defconfig create mode 100644 app/boards/shields/helix/Kconfig.shield create mode 100644 app/boards/shields/helix/README.md create mode 100644 app/boards/shields/helix/boards/nice_nano.overlay create mode 100644 app/boards/shields/helix/helix.conf create mode 100644 app/boards/shields/helix/helix.dtsi create mode 100644 app/boards/shields/helix/helix.keymap create mode 100644 app/boards/shields/helix/helix_left.overlay create mode 100644 app/boards/shields/helix/helix_right.overlay diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58da8c41..d7011283 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,8 @@ jobs: - cradio_right - crbn - eek + - helix_left + - helix_right - iris_left - iris_right - jian_left diff --git a/app/boards/shields/helix/Kconfig.defconfig b/app/boards/shields/helix/Kconfig.defconfig new file mode 100644 index 00000000..f58684a8 --- /dev/null +++ b/app/boards/shields/helix/Kconfig.defconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_HELIX_LEFT + +config ZMK_KEYBOARD_NAME + default "Helix Left" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +endif + +if SHIELD_HELIX_RIGHT + +config ZMK_KEYBOARD_NAME + default "Helix Right" + +config USB + default y + +endif + +if SHIELD_HELIX_LEFT || SHIELD_HELIX_RIGHT + +config ZMK_SPLIT + default y + +endif \ No newline at end of file diff --git a/app/boards/shields/helix/Kconfig.shield b/app/boards/shields/helix/Kconfig.shield new file mode 100644 index 00000000..7e5bb9ae --- /dev/null +++ b/app/boards/shields/helix/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_HELIX_LEFT + def_bool $(shields_list_contains,helix_left) + +config SHIELD_HELIX_RIGHT + def_bool $(shields_list_contains,helix_right) \ No newline at end of file diff --git a/app/boards/shields/helix/README.md b/app/boards/shields/helix/README.md new file mode 100644 index 00000000..f8b0e13f --- /dev/null +++ b/app/boards/shields/helix/README.md @@ -0,0 +1,12 @@ +#### Note to user: + +- If desired, RGB underglow must be manually enabled before building and flashing. Check 'helix.conf' to do so. +- Peripheral RGB function is impaired until full support is implemented in the master branch. +- OLED displays are not currently included in this shield. This will be updated after OLED support is live. +- 'KANA' and 'EISUU' input is currently utilized under the 'LANG1' and 'LANG2' keycodes respectively. + +--- + +Thanks to Nicell, KemoNine, petejohanson, TJ "Chormbo The Great", joelspadin/Rinh, Wofiel, Okke, innovaker, +and the rest of the ZMK contributors for their support in constructing this shield. I appreciate your assistance greatly. +This has been a valuable learning experience for me. May this contribution serve the community well. diff --git a/app/boards/shields/helix/boards/nice_nano.overlay b/app/boards/shields/helix/boards/nice_nano.overlay new file mode 100644 index 00000000..78576d13 --- /dev/null +++ b/app/boards/shields/helix/boards/nice_nano.overlay @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <6>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <32>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/helix/helix.conf b/app/boards/shields/helix/helix.conf new file mode 100644 index 00000000..a8e57338 --- /dev/null +++ b/app/boards/shields/helix/helix.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Enables RGB functionality (Uncomment lines below to enable.) +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/app/boards/shields/helix/helix.dtsi b/app/boards/shields/helix/helix.dtsi new file mode 100644 index 00000000..8df943f0 --- /dev/null +++ b/app/boards/shields/helix/helix.dtsi @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <14>; + rows = <5>; +// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | +// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | +// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | +// | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 | SW25 | | SW25 | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 | +// | SW26 | SW27 | SW28 | SW29 | SW30 | SW31 | SW32 | | SW32 | SW31 | SW30 | SW29 | SW28 | SW27 | SW26 | + map = < +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(0,12) RC(0,13) +RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) +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(4,0) RC(4,1) RC(4,2) 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) RC(4,12) RC(4,13) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; +}; \ No newline at end of file diff --git a/app/boards/shields/helix/helix.keymap b/app/boards/shields/helix/helix.keymap new file mode 100644 index 00000000..82327c32 --- /dev/null +++ b/app/boards/shields/helix/helix.keymap @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + + #include + #include + #include + #include + #include + #include + + #define DEFAULT 0 + #define LOWER 1 + #define RAISE 2 + #define ADJUST 3 + +/* NOTE: At the time of the creation of this keymap, there are no specified codes for 'eisuu' and 'kana' input in ZMK. +However, 'LANG1' and 'LANG2' are fully-functioning candidates for 'kana' and 'eisuu' input respectively. +As such, those are in use within the default layer at this time.*/ + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + // --------------------------------------------------------------------------------------------------------------------------------- + // | GRAVE | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | DEL | + // | TAB | Q | W | E | R | T | | Y | U | I | O | P | BSPC | + // | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' | + // | SHIFT | Z | X | C | V | B | LBKT | | RBKT | N | M | , | . | / | RET | + // | ADJUST | ESC | ALT | LGUI | EISUU | LOWER | SPACE | | SPACE | RAISE | KANA | LEFT | DOWN | UP | RIGHT | + bindings = < + &kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL + &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 LBKT &kp RBKT &kp N &kp M &kp COMMA &kp PERIOD &kp SLASH &kp RET + &mo ADJUST &kp ESC &kp LALT &kp LGUI &kp LANG2 &mo LOWER &kp SPACE &kp SPACE &mo RAISE &kp LANG1 &kp LEFT &kp DOWN &kp UP &kp RIGHT + >; + }; + lower_layer { + // --------------------------------------------------------------------------------------------------------------------------------- + // | | | | | | | | | | | | | | + // | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + // | | | | | | | | | _ | + | { | } | PIPE | + // | | | | | | | ( | | ) | | | | HOME | END | | + // | | | | | | | | | | | | | | | | + bindings = < + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &kp TILDE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &trans + &trans &trans &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE + &trans &trans &trans &trans &trans &trans &kp LPAR &kp RPAR &trans &trans &trans &kp HOME &kp END &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + raise_layer { + // --------------------------------------------------------------------------------------------------------------------------------- + // | | | | | | | | | | | | | | + // | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | DEL | + // | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + // | | F7 | F8 | F9 | F10 | F11 | | | | F12 | | PSCRN | PG_DN | PG_UP | | + // | | | | | | | | | | | | NEXT | VOL- | VOL+ | PLAY | + bindings = < + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL + &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH + &trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &trans &trans &kp F12 &trans &kp PSCRN &kp PG_DN &kp PG_UP &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP + >; + }; + adjust_layer { + // --------------------------------------------------------------------------------------------------------------------------------- + // | ` | ! | @ | # | $ | % | | ^ | & | * | ( | ) | EP TOG | + // | BT CLR | BT SEL0 | BT SEL1 | BT SEL2 | BGT SEL3 | BT SEL4 | | RGB EFF+ | RGB HUE+ | RGB SAT+ | RGB SPD+ | RGB BRI+ | RGB TOG | + // | BT NXT | OUT TOG | OUT USB | OUT BLE | | | | RGB EFF- | RGB HUE- | RGB SAT- | RGB SPD- | RGB BRI- | | + // | BT PRV | | | | | | { | | } | | | | | | | + // | | | | | | | | | | | | | | | | + bindings = < + &kp GRAVE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &ext_power EP_TOG + &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &rgb_ug RGB_EFF &rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_SPI &rgb_ug RGB_BRI &rgb_ug RGB_TOG + &bt BT_NXT &out OUT_TOG &out OUT_USB &out OUT_BLE &trans &trans &rgb_ug RGB_EFR &rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_SPD &rgb_ug RGB_BRD &trans + &bt BT_PRV &trans &trans &trans &trans &trans &kp LBRC &kp RBRC &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + }; +}; \ No newline at end of file diff --git a/app/boards/shields/helix/helix_left.overlay b/app/boards/shields/helix/helix_left.overlay new file mode 100644 index 00000000..733e55f9 --- /dev/null +++ b/app/boards/shields/helix/helix_left.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "helix.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro_a 3 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 15 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/app/boards/shields/helix/helix_right.overlay b/app/boards/shields/helix/helix_right.overlay new file mode 100644 index 00000000..2383a30e --- /dev/null +++ b/app/boards/shields/helix/helix_right.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "helix.dtsi" + +&default_transform { + col-offset = <7>; +}; + +&kscan0 { + col-gpios + = <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 15 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 3 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 244bdd60..0dc17782 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -25,6 +25,7 @@ That being said, there are currently only a few specific [boards](/docs/faq#what - [Kyria](https://splitkb.com/products/kyria-pcb-kit) (`kyria_left` and `kyria_right`) - [Corne](https://github.com/foostan/crkbd) (`corne_left` and `corne_right`) +- [Helix](https://github.com/mcmadhatter/helix) (`helix_left` and `helix_right`) - [Lily58](https://github.com/kata0510/Lily58) (`lily58_left` and `lily58_right`) - [Sofle](https://github.com/josefadamcik/SofleKeyboard) (`sofle_left` and `sofle_right`) - [Splitreus62](https://github.com/Na-Cly/splitreus62) (`splitreus62_left` and `splitreus62_right`) diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1 index ffd938f4..63cdb725 100644 --- a/docs/static/setup.ps1 +++ b/docs/static/setup.ps1 @@ -91,9 +91,9 @@ Write-Host "Keyboard Shield Selection:" $prompt = "Pick a keyboard" # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. -$options = "Kyria", "Lily58", "Corne", "Splitreus62", "Sofle", "Iris", "Reviung41", "RoMac", "RoMac+", "makerdiary M60", "Microdox", "TG4X", "QAZ", "NIBBLE", "Jorne", "Jian", "CRBN", "Tidbit", "Eek!", "BFO-9000" -$names = "kyria", "lily58", "corne", "splitreus62", "sofle", "iris", "reviung41", "romac", "romac_plus", "m60", "microdox", "tg4x", "qaz", "nibble", "jorne", "jian", "crbn", "tidbit", "eek", "bfo9000" -$splits = "y", "y", "y", "y", "y", "y", "n", "n", "n", "n", "y", "n", "n", "n", "y", "y", "n", "n", "n", "n" +$options = "Kyria", "Lily58", "Corne", "Splitreus62", "Sofle", "Iris", "Reviung41", "RoMac", "RoMac+", "makerdiary M60", "Microdox", "TG4X", "QAZ", "NIBBLE", "Jorne", "Jian", "CRBN", "Tidbit", "Eek!", "BFO-9000", "Helix" +$names = "kyria", "lily58", "corne", "splitreus62", "sofle", "iris", "reviung41", "romac", "romac_plus", "m60", "microdox", "tg4x", "qaz", "nibble", "jorne", "jian", "crbn", "tidbit", "eek", "bfo9000", "helix" +$splits = "y", "y", "y", "y", "y", "y", "n", "n", "n", "n", "y", "n", "n", "n", "y", "y", "n", "n", "n", "n", "y" $choice = Get-Choice-From-Options -Options $options -Prompt $prompt $shield_title = $($options[$choice]) diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 486bb06c..89fd1af2 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -92,7 +92,7 @@ echo "" echo "Keyboard Shield Selection:" prompt="Pick an keyboard:" -options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "Reviung41" "RoMac" "RoMac+" "makerdiary M60" "Microdox" "TG4X" "QAZ" "Jorne" "Jian" "CRBN" "Tidbit" "Eek!" "BF0-9000") +options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "Reviung41" "RoMac" "RoMac+" "makerdiary M60" "Microdox" "TG4X" "QAZ" "Jorne" "Jian" "CRBN" "Tidbit" "Eek!" "BF0-9000" "Helix") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. @@ -120,7 +120,8 @@ select opt in "${options[@]}" "Quit"; do 17 ) shield_title="CRBN" shield="crbn"; split="n"; break;; 18 ) shield_title="Tidbit" shield="tidbit"; split="n" break;; 19 ) shield_title="Eek!" shield="eek"; split="n" break;; - 17 ) shield_title="BFO-9000" shield="bfo9000"; split="y"; break;; + 20 ) shield_title="BFO-9000" shield="bfo9000"; split="y"; break;; + 21 ) shield_title="Helix" shield="helix"; split"y"; break;; # Add link to docs on adding your own custom shield in your ZMK config! # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; From 4c1f615714e84a5b05fe76af69faf446cd09fb45 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Tue, 5 Jan 2021 20:29:47 +0100 Subject: [PATCH 08/31] docs(troubleshooting): fix reset uf2 download instructions PR: #512 Co-authored-by: innovaker <66737976+innovaker@users.noreply.github.com> --- docs/docs/troubleshooting.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index 0fe0b665..23403eec 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -54,7 +54,10 @@ Since then, a much simpler procedure of performing a bluetooth reset for split k **New Procedure:** -1. Log into Github and download the "settings clear" UF2 image from the [latest build in Github Actions](https://github.com/zmkfirmware/zmk/actions?query=workflow%3ABuild+branch%3Amain) +1. [Open the GitHub `Actions` tab and select the `Build` workflow](https://github.com/zmkfirmware/zmk/actions?query=workflow%3ABuild+branch%3Amain). +1. Select the top 'result' on that page. +1. From the next page under "Artifacts", download the `$boardname-settings_reset-zmk` zip file. +1. Unzip the downloaded file. 1. Put each half of the split keyboard into bootloader mode 1. Flash one of the halves of the split with the "settings clear" UF2 image from step 1. Immediately after flashing "settings clear" to the chosen half, immediately put it into bootloader mode to avoid accidental bonding between the halves. From ad238d63dff93bcf33c9f91256699cc4ace09c4b Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Wed, 30 Dec 2020 19:07:03 -0600 Subject: [PATCH 09/31] docs(intro): Update feature table --- docs/docs/intro.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 564eedb7..1e801a46 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -23,16 +23,16 @@ ZMK is currently missing some features found in other popular firmware. This tab | [Keyboard Codes](codes/#keyboard) | ✅ | ✅ | ✅ | | [Media](codes/#media-controls) & [Consumer](codes/#consumer-controls) Codes | ✅ | ✅ | ✅ | | [Encoders](features/encoders)[^1] | ✅ | | ✅ | -| [OLED Display Support](features/displays)[^2] | 🚧 | 🚧 | ✅ | +| [Display Support](features/displays)[^2] | 🚧 | 🚧 | ✅ | | [RGB Underglow](features/underglow) | ✅ | ✅ | ✅ | -| One Shot Keys | 🚧 | ✅ | ✅ | -| Combo Keys | 🚧 | | ✅ | +| One Shot Keys | ✅ | ✅ | ✅ | +| [Combo Keys](https://github.com/zmkfirmware/zmk/pull/504) | 🚧 | | ✅ | | Macros | 🚧 | ✅ | ✅ | | Mouse Keys | | ✅ | ✅ | | Low Active Power Usage | ✅ | | | -| [Low Power Sleep States](https://github.com/zmkfirmware/zmk/pull/211) | 🚧 | ✅ | | -| [Low Power Mode (VCC Shutoff)](https://github.com/zmkfirmware/zmk/pull/242) | 🚧 | | | -| [Battery Reporting](https://github.com/zmkfirmware/zmk/issues/47) | 🚧 | ✅ | | +| Low Power Sleep States | ✅ | ✅ | | +| [Low Power Mode (VCC Shutoff)](behaviors/power) | ✅ | | | +| Battery Reporting | ✅ | ✅ | | | Shell over BLE | | | | | Realtime Keymap Updating | 💡 | | ✅ | | AVR/8 Bit | | | ✅ | From 56ec200bae7610bae32c558cf1302b02d433471d Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Mon, 4 Jan 2021 15:29:55 -0600 Subject: [PATCH 10/31] =?UTF-8?q?docs(intro):=20Add=20=F0=9F=92=A1=20to=20?= =?UTF-8?q?Mouse=20Keys=20and=20BLE=20Shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs/intro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 1e801a46..57670ea0 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -28,12 +28,12 @@ ZMK is currently missing some features found in other popular firmware. This tab | One Shot Keys | ✅ | ✅ | ✅ | | [Combo Keys](https://github.com/zmkfirmware/zmk/pull/504) | 🚧 | | ✅ | | Macros | 🚧 | ✅ | ✅ | -| Mouse Keys | | ✅ | ✅ | +| Mouse Keys | 💡 | ✅ | ✅ | | Low Active Power Usage | ✅ | | | | Low Power Sleep States | ✅ | ✅ | | | [Low Power Mode (VCC Shutoff)](behaviors/power) | ✅ | | | | Battery Reporting | ✅ | ✅ | | -| Shell over BLE | | | | +| Shell over BLE | 💡 | | | | Realtime Keymap Updating | 💡 | | ✅ | | AVR/8 Bit | | | ✅ | | [Wide Range of ARM Chips Supported](https://docs.zephyrproject.org/latest/boards/index.html) | ✅ | | | From f17584ca0ee4d6bbc0893c0a62a0dc2fa293d2b8 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Fri, 1 Jan 2021 22:37:34 +0000 Subject: [PATCH 11/31] chore: standardize # style headers Changes made with regex plus some manual tweaks. Find: /(?:(?" exit 1 diff --git a/app/scripts/west-commands.yml b/app/scripts/west-commands.yml index 75be89da..81d6946f 100644 --- a/app/scripts/west-commands.yml +++ b/app/scripts/west-commands.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2020, ZMK Contributors +# Copyright (c) 2020 ZMK Contributors # SPDX-License-Identifier: MIT west-commands: diff --git a/app/scripts/west_commands/test.py b/app/scripts/west_commands/test.py index f79547b9..ac64bb6f 100644 --- a/app/scripts/west_commands/test.py +++ b/app/scripts/west_commands/test.py @@ -1,5 +1,4 @@ # Copyright (c) 2020 The ZMK Contributors -# # SPDX-License-Identifier: MIT '''Test runner for ZMK.''' diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1 index 63cdb725..bcea9f7a 100644 --- a/docs/static/setup.ps1 +++ b/docs/static/setup.ps1 @@ -1,5 +1,4 @@ # Copyright (c) 2020 The ZMK Contributors -# # SPDX-License-Identifier: MIT $ErrorActionPreference = "Stop" diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 89fd1af2..652160b4 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -1,7 +1,6 @@ #!/bin/bash # Copyright (c) 2020 The ZMK Contributors -# # SPDX-License-Identifier: MIT set -e From d9265fa470bb916adf5f52e191db0e735dd67867 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 2 Jan 2021 14:36:04 +0000 Subject: [PATCH 12/31] ci: add dependabot Checks (daily): - github-actions - npm (docs) --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1df0848c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "npm" + directory: "/docs" + schedule: + interval: "daily" From 561e535a583c437b96f1f4dd9d3325d42a8a9156 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Fri, 1 Jan 2021 15:17:19 +0000 Subject: [PATCH 13/31] refactor(shields): standardize README.md filenames Renames instances of `readme.md` to `README.md` so that it's easily noticed. PR: #561 --- app/boards/shields/bfo9000/{readme.md => README.md} | 0 app/boards/shields/clueboard_california/{readme.md => README.md} | 0 app/boards/shields/crbn/{readme.md => README.md} | 0 app/boards/shields/eek/{readme.md => README.md} | 0 app/boards/shields/m60/{readme.md => README.md} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename app/boards/shields/bfo9000/{readme.md => README.md} (100%) rename app/boards/shields/clueboard_california/{readme.md => README.md} (100%) rename app/boards/shields/crbn/{readme.md => README.md} (100%) rename app/boards/shields/eek/{readme.md => README.md} (100%) rename app/boards/shields/m60/{readme.md => README.md} (100%) diff --git a/app/boards/shields/bfo9000/readme.md b/app/boards/shields/bfo9000/README.md similarity index 100% rename from app/boards/shields/bfo9000/readme.md rename to app/boards/shields/bfo9000/README.md diff --git a/app/boards/shields/clueboard_california/readme.md b/app/boards/shields/clueboard_california/README.md similarity index 100% rename from app/boards/shields/clueboard_california/readme.md rename to app/boards/shields/clueboard_california/README.md diff --git a/app/boards/shields/crbn/readme.md b/app/boards/shields/crbn/README.md similarity index 100% rename from app/boards/shields/crbn/readme.md rename to app/boards/shields/crbn/README.md diff --git a/app/boards/shields/eek/readme.md b/app/boards/shields/eek/README.md similarity index 100% rename from app/boards/shields/eek/readme.md rename to app/boards/shields/eek/README.md diff --git a/app/boards/shields/m60/readme.md b/app/boards/shields/m60/README.md similarity index 100% rename from app/boards/shields/m60/readme.md rename to app/boards/shields/m60/README.md From 3e4f2a3dc3555be055d1ae6f1ab91c246438008c Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:44:47 +0000 Subject: [PATCH 14/31] feat(tg4x): Add underglow support for tg4x + nice_nano --- app/boards/shields/tg4x/boards/nice_nano.conf | 7 ++++ .../shields/tg4x/boards/nice_nano.overlay | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 app/boards/shields/tg4x/boards/nice_nano.conf create mode 100644 app/boards/shields/tg4x/boards/nice_nano.overlay diff --git a/app/boards/shields/tg4x/boards/nice_nano.conf b/app/boards/shields/tg4x/boards/nice_nano.conf new file mode 100644 index 00000000..7b077948 --- /dev/null +++ b/app/boards/shields/tg4x/boards/nice_nano.conf @@ -0,0 +1,7 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Enable underglow +CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/app/boards/shields/tg4x/boards/nice_nano.overlay b/app/boards/shields/tg4x/boards/nice_nano.overlay new file mode 100644 index 00000000..60492bec --- /dev/null +++ b/app/boards/shields/tg4x/boards/nice_nano.overlay @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <8>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <7>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; From cd8567071be4e24a28fdcb91b33ad4d9bf9186c8 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:45:55 +0000 Subject: [PATCH 15/31] fix(tg4x): Fix tg4x keyboard name in Kconfig --- app/boards/shields/tg4x/Kconfig.defconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/boards/shields/tg4x/Kconfig.defconfig b/app/boards/shields/tg4x/Kconfig.defconfig index ca9fa2c3..6312c080 100644 --- a/app/boards/shields/tg4x/Kconfig.defconfig +++ b/app/boards/shields/tg4x/Kconfig.defconfig @@ -4,6 +4,6 @@ if SHIELD_TG4X config ZMK_KEYBOARD_NAME - default "TG4X" + default "TG4x" -endif \ No newline at end of file +endif From 185ff462d6d1fe488829f20e6664489d4fe371ea Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:46:38 +0000 Subject: [PATCH 16/31] docs(tg4x): Add readme for tg4x --- app/boards/shields/tg4x/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/boards/shields/tg4x/README.md diff --git a/app/boards/shields/tg4x/README.md b/app/boards/shields/tg4x/README.md new file mode 100644 index 00000000..087ce251 --- /dev/null +++ b/app/boards/shields/tg4x/README.md @@ -0,0 +1,11 @@ +# TG4x + +Standard setup for the [TG4x](https://github.com/MythosMann/tg4x/) 40% keyboard. + +## Board Revision and Layout Notes + +This TG4x implementation is for... + +* rev 2.1 of the board +* Split spacebar with 2.25U on the left and 2.75U on the right +* 2U right shift From de6ce053918f709cc66412746508d27fc91e22b6 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:32:18 +0000 Subject: [PATCH 17/31] chore(tg4x): fix copyright header --- app/boards/shields/tg4x/tg4x.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/shields/tg4x/tg4x.overlay b/app/boards/shields/tg4x/tg4x.overlay index 4b9d4f5b..4de960a3 100644 --- a/app/boards/shields/tg4x/tg4x.overlay +++ b/app/boards/shields/tg4x/tg4x.overlay @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The ZMK Contrbutors + * Copyright (c) 2020 The ZMK Contributors * * SPDX-License-Identifier: MIT */ From 7fc28328d04ced9ff419c5cead6f1a971cb94e9d Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:34:04 +0000 Subject: [PATCH 18/31] refactor(tg4x): Cleanup tg4x overlay Tidies pin definitions and map. --- app/boards/shields/tg4x/tg4x.overlay | 71 ++++++++++++++-------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/app/boards/shields/tg4x/tg4x.overlay b/app/boards/shields/tg4x/tg4x.overlay index 4de960a3..38e4faa7 100644 --- a/app/boards/shields/tg4x/tg4x.overlay +++ b/app/boards/shields/tg4x/tg4x.overlay @@ -7,50 +7,49 @@ #include / { - chosen { - zmk,kscan = &kscan0; - zmk,matrix_transform = &default_transform; - }; - - default_transform: keymap_transform_0 { - compatible = "zmk,matrix-transform"; - columns = <7>; - rows = <8>; - map = < - RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,5) - RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) - RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) - RC(3,0) RC(3,1) RC(3,2) RC(3,4) RC(3,5) RC(7,1) RC(7,2) RC(7,3) RC(7,4) - >; - }; - kscan0: kscan { compatible = "zmk,kscan-gpio-matrix"; label = "KSCAN"; - diode-direction = "col2row"; - col-gpios - = <&pro_micro_d 1 GPIO_ACTIVE_HIGH> - , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> - , <&pro_micro_d 15 GPIO_ACTIVE_HIGH> - , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> - , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> - , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> - , <&pro_micro_a 3 GPIO_ACTIVE_HIGH> - ; + diode-direction = "col2row"; row-gpios - = <&pro_micro_a 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_a 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_a 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_a 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + = <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> ; + col-gpios + = <&pro_micro_d 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 15 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 3 GPIO_ACTIVE_HIGH> + ; }; -}; + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + rows = <8>; + columns = <7>; + map = < +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) +RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(6,0) RC(6,1) RC(6,2) RC(6,4) +RC(3,0) RC(3,1) RC(3,2) RC(3,4) RC(3,5) RC(7,1) RC(7,2) RC(7,3) RC(7,4) + >; + }; + + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; +}; From 7fd8561b457e83bea667b130d6c891bc738db9ab Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:50:33 +0000 Subject: [PATCH 19/31] fix(tg4x): Add tg4x.conf to mirror other shield setups --- app/boards/shields/tg4x/tg4x.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/boards/shields/tg4x/tg4x.conf diff --git a/app/boards/shields/tg4x/tg4x.conf b/app/boards/shields/tg4x/tg4x.conf new file mode 100644 index 00000000..9d65bb60 --- /dev/null +++ b/app/boards/shields/tg4x/tg4x.conf @@ -0,0 +1,2 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT \ No newline at end of file From 28bec8541b8bd8fe10d52c590700bb5022845f54 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:51:04 +0000 Subject: [PATCH 20/31] style(tg4x): Convert Kconfig spaces to tabs --- app/boards/shields/tg4x/Kconfig.shield | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/shields/tg4x/Kconfig.shield b/app/boards/shields/tg4x/Kconfig.shield index 7e98b710..27166b10 100644 --- a/app/boards/shields/tg4x/Kconfig.shield +++ b/app/boards/shields/tg4x/Kconfig.shield @@ -2,4 +2,4 @@ # SPDX-License-Identifier: MIT config SHIELD_TG4X - def_bool $(shields_list_contains,tg4x) + def_bool $(shields_list_contains,tg4x) From 5880a284c1074d145bf90e66f1420f544502ed83 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 5 Jan 2021 21:51:59 +0000 Subject: [PATCH 21/31] feat(tg4x): Reconcile with official keymap and tidy-up --- app/boards/shields/tg4x/tg4x.keymap | 88 ++++++++++++++--------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/app/boards/shields/tg4x/tg4x.keymap b/app/boards/shields/tg4x/tg4x.keymap index cadc41a4..d5e20094 100644 --- a/app/boards/shields/tg4x/tg4x.keymap +++ b/app/boards/shields/tg4x/tg4x.keymap @@ -8,51 +8,47 @@ #include #include -#define DEFAULT 0 -#define LOWER 1 -#define RAISE 2 - / { - behaviors { - hm: homerow_mods { - compatible = "zmk,behavior-hold-tap"; - label = "homerow mods"; - #binding-cells = <2>; - tapping_term_ms = <225>; - flavor = "tap-preferred"; - bindings = <&kp>, <&kp>; - }; - }; + behaviors { + ht: hold_tap { + compatible = "zmk,behavior-hold-tap"; + label = "Hold Tap"; + #binding-cells = <2>; + tapping_term_ms = <200>; + flavor = "tap-preferred"; + bindings = <&kp>, <&kp>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < +&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp SEMI &kp BSPC +&ht CAPS TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp APOS &kp RET +&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp RSHFT +&kp LCTRL &kp LGUI &kp LALT < 1 SPACE &kp SPACE &kp RALT &kp RGUI &mo 2 &kp RCTRL + >; + }; + + function_layer { + bindings = < +&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp DEL +&none &kp HOME &kp PG_UP &trans &trans &trans &kp LBKT &kp RBKT &kp EQUAL &kp BSLH &kp FSLH &trans +&trans &kp END &kp PG_DN &trans &trans &trans &trans &trans &trans &kp UP &trans +&trans &trans &trans &trans &trans &trans &kp LEFT &kp DOWN &kp RIGHT + >; + }; + + other_layer { + bindings = < +&kp PRINTSCREEN &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 +&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans +&trans &bt BT_CLR &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &bootloader &reset &trans +&trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_VOL_DN &kp C_PP + >; + }; + + }; }; - -/ { - keymap { - compatible = "zmk,keymap"; - - default_layer { - bindings = < - &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC - &kp TAB &hm LGUI A &hm LALT S &hm LCTRL D &hm LSHFT F &kp G &kp H &hm RSHFT J &hm RCTRL K &hm RALT L &hm RGUI SEMI &kp RET - &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp SQT - &kp LCTRL &kp LALT &kp LGUI < 1 BSPC < 2 SPACE &kp LEFT &kp DOWN &kp UP &kp RIGHT - >; - }; - lower { - bindings = < - &kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp PSCRN - &kp DEL &trans &kp K_VOL_UP &trans &trans &trans &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans - &trans &trans &kp K_VOL_DN &trans &trans &trans &trans &trans &trans &bt BT_PRV &bt BT_NXT &bt BT_CLR - &bootloader &reset &trans &trans &trans &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 - >; - }; - - raise { - bindings = < - &kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp PSCRN - &kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH - &trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp TILDE &kp HOME &kp PG_UP &kp PG_DN &kp END - &trans &trans &trans &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP - >; - }; - }; -}; \ No newline at end of file From f0312092c7f3b9b24124b615bf438ad52aa4643f Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Fri, 8 Jan 2021 15:55:51 +0000 Subject: [PATCH 22/31] fix(setup.sh): add NIBBLE to options This was missing from its original commit. Refs: f3153b17d293466160c03f7cb618a2be939c55f7 --- docs/static/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 652160b4..5384277b 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -91,7 +91,7 @@ echo "" echo "Keyboard Shield Selection:" prompt="Pick an keyboard:" -options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "Reviung41" "RoMac" "RoMac+" "makerdiary M60" "Microdox" "TG4X" "QAZ" "Jorne" "Jian" "CRBN" "Tidbit" "Eek!" "BF0-9000" "Helix") +options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "Reviung41" "RoMac" "RoMac+" "makerdiary M60" "Microdox" "TG4X" "QAZ" "NIBBLE" "Jorne" "Jian" "CRBN" "Tidbit" "Eek!" "BF0-9000" "Helix") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. From 964b613e982a707e00c8cb5cb07d8dfcfab25419 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 8 Jan 2021 11:11:20 -0500 Subject: [PATCH 23/31] fix(setup): Fix typo for split variable assignment --- docs/static/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 5384277b..8ac39435 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -120,7 +120,7 @@ select opt in "${options[@]}" "Quit"; do 18 ) shield_title="Tidbit" shield="tidbit"; split="n" break;; 19 ) shield_title="Eek!" shield="eek"; split="n" break;; 20 ) shield_title="BFO-9000" shield="bfo9000"; split="y"; break;; - 21 ) shield_title="Helix" shield="helix"; split"y"; break;; + 21 ) shield_title="Helix" shield="helix"; split="y"; break;; # Add link to docs on adding your own custom shield in your ZMK config! # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; From 97ed0cc733bc3fb411fe13ee776e37f932e67aa4 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Thu, 7 Jan 2021 00:08:34 -0600 Subject: [PATCH 24/31] feat(core): Add USB logging Kconfig option --- app/Kconfig | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/app/Kconfig b/app/Kconfig index 4341df11..f4860210 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -293,6 +293,50 @@ config ZMK_KSCAN_COMPOSITE_DRIVER #KSCAN Settings endmenu +menu "USB Logging" + +config ZMK_USB_LOGGING + bool "Enable USB CDC ACM logging to help debug" + select LOG + select USB + select USB_DEVICE_STACK + select USB_CDC_ACM + select SERIAL + select CONSOLE + select UART_INTERRUPT_DRIVEN + select UART_LINE_CTRL + select UART_CONSOLE + select USB_UART_CONSOLE + +if ZMK_USB_LOGGING + +config ZMK_LOG_LEVEL + default 4 + +config USB_CDC_ACM_RINGBUF_SIZE + default 1024 + +config USB_CDC_ACM_DEVICE_NAME + default "CDC_ACM" + +config USB_CDC_ACM_DEVICE_COUNT + default 1 + +config UART_CONSOLE_ON_DEV_NAME + default "CDC_ACM_0" + +config LOG_BUFFER_SIZE + default 8192 + +config LOG_STRDUP_BUF_COUNT + default 16 + +#ZMK_USB_LOGGING +endif + +#USB Logging +endmenu + if SETTINGS config ZMK_SETTINGS_SAVE_DEBOUNCE From 167600f01d0000539bf1f963dbcee0d9b15600cc Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Wed, 30 Dec 2020 20:09:24 -0600 Subject: [PATCH 25/31] docs(logging): Update documentation on USB logging --- docs/docs/development/usb-logging.md | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/docs/docs/development/usb-logging.md b/docs/docs/development/usb-logging.md index 420b98d1..4149ef43 100644 --- a/docs/docs/development/usb-logging.md +++ b/docs/docs/development/usb-logging.md @@ -20,8 +20,8 @@ It is recommended to only enable logging when needed, and not leaving it on by d ## Kconfig -The following KConfig values need to be set, either by copy and pasting into the `app/prj.conf` file, or by running -`west build -t menuconfig` and manually enabling the various settings in that UI. +The `CONFIG_ZMK_USB_LOGGING` KConfig value needs to be set, either by copy and pasting into the `app/prj.conf` file, or by running +`west build -t menuconfig` and manually enabling the setting in that UI at `ZMK -> Advanced -> USB Logging`. :::note If you are debugging your own keyboard in your [user config repository](./user-setup.md), use @@ -32,27 +32,7 @@ for you successfully. ``` # Turn on logging, and set ZMK logging to debug output -CONFIG_LOG=y -CONFIG_ZMK_LOG_LEVEL_DBG=y - -# Turn on USB CDC ACM device -CONFIG_USB=y -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 -CONFIG_USB_CDC_ACM_DEVICE_NAME="CDC_ACM" -CONFIG_USB_CDC_ACM_DEVICE_COUNT=1 - -# Enable serial console -CONFIG_SERIAL=y -CONFIG_CONSOLE=y -CONFIG_UART_INTERRUPT_DRIVEN=y -CONFIG_UART_LINE_CTRL=y - -# Enable USB UART, and set the console device -CONFIG_UART_CONSOLE=y -CONFIG_USB_UART_CONSOLE=y -CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" +CONFIG_ZMK_USB_LOGGING=y ``` ## Viewing Logs From 99f932a47d4705c7ddde83256fada9aa7aa3bda6 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 15 Dec 2020 06:00:52 +0000 Subject: [PATCH 26/31] (feat) Allow setting underglow color by key press --- app/dts/behaviors/rgb_underglow.dtsi | 2 +- .../behaviors/zmk,behavior-rgb-underglow.yaml | 2 +- app/include/dt-bindings/zmk/rgb.h | 37 +++++++++++++------ app/include/zmk/rgb_underglow.h | 1 + app/src/behaviors/behavior_rgb_underglow.c | 25 +++++++------ app/src/rgb_underglow.c | 13 +++++++ 6 files changed, 56 insertions(+), 24 deletions(-) diff --git a/app/dts/behaviors/rgb_underglow.dtsi b/app/dts/behaviors/rgb_underglow.dtsi index 22aff93f..8b88f8c8 100644 --- a/app/dts/behaviors/rgb_underglow.dtsi +++ b/app/dts/behaviors/rgb_underglow.dtsi @@ -9,7 +9,7 @@ rgb_ug: behavior_rgb_underglow { compatible = "zmk,behavior-rgb-underglow"; label = "RGB_UNDERGLOW"; - #binding-cells = <1>; + #binding-cells = <2>; }; }; }; diff --git a/app/dts/bindings/behaviors/zmk,behavior-rgb-underglow.yaml b/app/dts/bindings/behaviors/zmk,behavior-rgb-underglow.yaml index 2cb74b9c..d301998a 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-rgb-underglow.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-rgb-underglow.yaml @@ -5,4 +5,4 @@ description: RGB Underglow Action compatible: "zmk,behavior-rgb-underglow" -include: one_param.yaml +include: two_param.yaml diff --git a/app/include/dt-bindings/zmk/rgb.h b/app/include/dt-bindings/zmk/rgb.h index eb721807..1f7b44ec 100644 --- a/app/include/dt-bindings/zmk/rgb.h +++ b/app/include/dt-bindings/zmk/rgb.h @@ -4,14 +4,29 @@ * SPDX-License-Identifier: MIT */ -#define RGB_TOG 0 -#define RGB_HUI 1 -#define RGB_HUD 2 -#define RGB_SAI 3 -#define RGB_SAD 4 -#define RGB_BRI 5 -#define RGB_BRD 6 -#define RGB_SPI 7 -#define RGB_SPD 8 -#define RGB_EFF 9 -#define RGB_EFR 10 +#define RGB_TOG_CMD 0 +#define RGB_HUI_CMD 1 +#define RGB_HUD_CMD 2 +#define RGB_SAI_CMD 3 +#define RGB_SAD_CMD 4 +#define RGB_BRI_CMD 5 +#define RGB_BRD_CMD 6 +#define RGB_SPI_CMD 7 +#define RGB_SPD_CMD 8 +#define RGB_EFF_CMD 9 +#define RGB_EFR_CMD 10 +#define RGB_COLOR_HSB_CMD 11 + +#define RGB_TOG RGB_TOG_CMD 0 +#define RGB_HUI RGB_HUI_CMD 0 +#define RGB_HUD RGB_HUD_CMD 0 +#define RGB_SAI RGB_SAI_CMD 0 +#define RGB_SAD RGB_SAD_CMD 0 +#define RGB_BRI RGB_BRI_CMD 0 +#define RGB_BRD RGB_BRD_CMD 0 +#define RGB_SPI RGB_SPI_CMD 0 +#define RGB_SPD RGB_SPD_CMD 0 +#define RGB_EFF RGB_EFF_CMD 0 +#define RGB_EFR RGB_EFR_CMD 0 +#define RGB_COLOR_HSB(h, s, v) RGB_COLOR_HSB_CMD(((h) << 16) + ((s) << 8) + (v)) +#define RGB_COLOR_HSV RGB_COLOR_HSB \ No newline at end of file diff --git a/app/include/zmk/rgb_underglow.h b/app/include/zmk/rgb_underglow.h index 94cc32cc..7fcd42dd 100644 --- a/app/include/zmk/rgb_underglow.h +++ b/app/include/zmk/rgb_underglow.h @@ -12,3 +12,4 @@ int zmk_rgb_underglow_change_hue(int direction); int zmk_rgb_underglow_change_sat(int direction); int zmk_rgb_underglow_change_brt(int direction); int zmk_rgb_underglow_change_spd(int direction); +int zmk_rgb_underglow_set_hsb(uint16_t hue, uint8_t saturation, uint8_t brightness); \ No newline at end of file diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c index 399123a3..07f24940 100644 --- a/app/src/behaviors/behavior_rgb_underglow.c +++ b/app/src/behaviors/behavior_rgb_underglow.c @@ -21,28 +21,31 @@ static int behavior_rgb_underglow_init(const struct device *dev) { return 0; } static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event) { switch (binding->param1) { - case RGB_TOG: + case RGB_TOG_CMD: return zmk_rgb_underglow_toggle(); - case RGB_HUI: + case RGB_HUI_CMD: return zmk_rgb_underglow_change_hue(1); - case RGB_HUD: + case RGB_HUD_CMD: return zmk_rgb_underglow_change_hue(-1); - case RGB_SAI: + case RGB_SAI_CMD: return zmk_rgb_underglow_change_sat(1); - case RGB_SAD: + case RGB_SAD_CMD: return zmk_rgb_underglow_change_sat(-1); - case RGB_BRI: + case RGB_BRI_CMD: return zmk_rgb_underglow_change_brt(1); - case RGB_BRD: + case RGB_BRD_CMD: return zmk_rgb_underglow_change_brt(-1); - case RGB_SPI: + case RGB_SPI_CMD: return zmk_rgb_underglow_change_spd(1); - case RGB_SPD: + case RGB_SPD_CMD: return zmk_rgb_underglow_change_spd(-1); - case RGB_EFF: + case RGB_EFF_CMD: return zmk_rgb_underglow_cycle_effect(1); - case RGB_EFR: + case RGB_EFR_CMD: return zmk_rgb_underglow_cycle_effect(-1); + case RGB_COLOR_HSB_CMD: + return zmk_rgb_underglow_set_hsb((binding->param2 >> 16) & 0xFFFF, + (binding->param2 >> 8) & 0xFF, binding->param2 & 0xFF); } return -ENOTSUP; diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c index 73a5c5e9..a2c02ed8 100644 --- a/app/src/rgb_underglow.c +++ b/app/src/rgb_underglow.c @@ -346,6 +346,19 @@ int zmk_rgb_underglow_toggle() { return zmk_rgb_underglow_save_state(); } +int zmk_rgb_underglow_set_hsb(uint16_t hue, uint8_t saturation, uint8_t brightness) { + if (hue > 360 || saturation > 100 || brightness > 100) { + return -ENOTSUP; + } + + state.hue = hue; + state.saturation = saturation; + state.brightness = brightness; + state.current_effect = UNDERGLOW_EFFECT_SOLID; + + return 0; +} + int zmk_rgb_underglow_change_hue(int direction) { if (!led_strip) return -ENODEV; From 79b4a0ea6fdda3bd65cadd40106518ac20914cf5 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 15 Dec 2020 11:13:02 +0000 Subject: [PATCH 27/31] Add RGB_COLOR_HSB to lighting documentation --- docs/docs/behaviors/lighting.md | 58 +++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/docs/docs/behaviors/lighting.md b/docs/docs/behaviors/lighting.md index 2d4f532e..2a204e52 100644 --- a/docs/docs/behaviors/lighting.md +++ b/docs/docs/behaviors/lighting.md @@ -21,19 +21,20 @@ This will allow you to reference the actions defined in this header such as `RGB Here is a table describing the action for each define: -| Define | Action | -| --------- | --------------------------------------------------------- | -| `RGB_TOG` | Toggles the RGB feature on and off | -| `RGB_HUI` | Increases the hue of the RGB feature | -| `RGB_HUD` | Decreases the hue of the RGB feature | -| `RGB_SAI` | Increases the saturation of the RGB feature | -| `RGB_SAD` | Decreases the saturation of the RGB feature | -| `RGB_BRI` | Increases the brightness of the RGB feature | -| `RGB_BRD` | Decreases the brightness of the RGB feature | -| `RGB_SPI` | Increases the speed of the RGB feature effect's animation | -| `RGB_SPD` | Decreases the speed of the RGB feature effect's animation | -| `RGB_EFF` | Cycles the RGB feature's effect forwards | -| `RGB_EFR` | Cycles the RGB feature's effect reverse | +| Define | Action | +| --------------- | ---------------------------------------------------------------------------------------------- | +| `RGB_TOG` | Toggles the RGB feature on and off | +| `RGB_HUI` | Increases the hue of the RGB feature | +| `RGB_HUD` | Decreases the hue of the RGB feature | +| `RGB_SAI` | Increases the saturation of the RGB feature | +| `RGB_SAD` | Decreases the saturation of the RGB feature | +| `RGB_BRI` | Increases the brightness of the RGB feature | +| `RGB_BRD` | Decreases the brightness of the RGB feature | +| `RGB_SPI` | Increases the speed of the RGB feature effect's animation | +| `RGB_SPD` | Decreases the speed of the RGB feature effect's animation | +| `RGB_EFF` | Cycles the RGB feature's effect forwards | +| `RGB_EFR` | Cycles the RGB feature's effect reverse | +| `RGB_COLOR_HSB` | Sets a specific [HSB (HSV)](https://en.wikipedia.org/wiki/HSL_and_HSV) value for the underglow | ## RGB Underglow @@ -42,10 +43,31 @@ The "RGB underglow" behavior completes an RGB action given on press. ### Behavior Binding - Reference: `&rgb_ug` -- Parameter: The RGB action define, e.g. `RGB_TOG` or `RGB_BRI` +- Parameter #1: The RGB action define, e.g. `RGB_TOG` or `RGB_BRI` +- Parameter #1: Only applies to `RGB_COLOR_HSB` and is the HSB values of the color to set within parenthesis and separated by a common (see below for an example) -Example: +:::note HSB Values -``` -&rgb_ug RGB_TOG -``` +When specifying HSB values you'll need to use `RGB_COLOR_HSB(h, s, b)` in your keymap file. See below for an example. + +Value Limits: + +- Hue values can _not_ exceed 360 (degrees) +- Saturation values can _not_ exceed 100 (percent) +- Brightness values can _not_ exceed 100 (percent) + +::: + +### Examples + +1. Toggle underglow on/off + + ``` + &rgb_ug RGB_TOG + ``` + +1. Set a specific HSB color (green) + + ``` + &rgb_ug RGB_COLOR_HSB(128,100,100) + ``` From 6345bd54688a20cb054e061db3b3c7102bd0a0d4 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 15 Dec 2020 11:19:52 +0000 Subject: [PATCH 28/31] Remove setting the animation/effect when setting hsv ; some of the effects like glowing will use the hsv color specified --- app/src/rgb_underglow.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c index a2c02ed8..f3bd7a9d 100644 --- a/app/src/rgb_underglow.c +++ b/app/src/rgb_underglow.c @@ -354,7 +354,6 @@ int zmk_rgb_underglow_set_hsb(uint16_t hue, uint8_t saturation, uint8_t brightne state.hue = hue; state.saturation = saturation; state.brightness = brightness; - state.current_effect = UNDERGLOW_EFFECT_SOLID; return 0; } From af563e9dbcad8ca4c06f956c342fae79e3706ff7 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Wed, 30 Dec 2020 21:10:18 +0000 Subject: [PATCH 29/31] Fix parameter number --- docs/docs/behaviors/lighting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/behaviors/lighting.md b/docs/docs/behaviors/lighting.md index 2a204e52..6e6732be 100644 --- a/docs/docs/behaviors/lighting.md +++ b/docs/docs/behaviors/lighting.md @@ -44,7 +44,7 @@ The "RGB underglow" behavior completes an RGB action given on press. - Reference: `&rgb_ug` - Parameter #1: The RGB action define, e.g. `RGB_TOG` or `RGB_BRI` -- Parameter #1: Only applies to `RGB_COLOR_HSB` and is the HSB values of the color to set within parenthesis and separated by a common (see below for an example) +- Parameter #2: Only applies to `RGB_COLOR_HSB` and is the HSB values of the color to set within parenthesis and separated by a common (see below for an example) :::note HSB Values From 002a89765f27fc295cf14af1648348c3bc0032ae Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Fri, 8 Jan 2021 15:32:55 -0600 Subject: [PATCH 30/31] refactor(Kconfig): Set USB default based on hardware capabilities Removes the USB default under every split right half in favor of a default based on hardware capabilities in the main app Kconfig. --- app/Kconfig | 3 +++ app/boards/shields/bfo9000/Kconfig.defconfig | 3 --- app/boards/shields/corne/Kconfig.defconfig | 3 --- app/boards/shields/cradio/Kconfig.defconfig | 3 --- app/boards/shields/helix/Kconfig.defconfig | 3 --- app/boards/shields/iris/Kconfig.defconfig | 3 --- app/boards/shields/jian/Kconfig.defconfig | 3 --- app/boards/shields/jorne/Kconfig.defconfig | 3 --- app/boards/shields/kyria/Kconfig.defconfig | 3 --- app/boards/shields/lily58/Kconfig.defconfig | 3 --- app/boards/shields/microdox/Kconfig.defconfig | 3 --- app/boards/shields/quefrency/Kconfig.defconfig | 3 --- app/boards/shields/sofle/Kconfig.defconfig | 3 --- app/boards/shields/splitreus62/Kconfig.defconfig | 3 --- 14 files changed, 3 insertions(+), 39 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index f4860210..f5d92a88 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -361,6 +361,9 @@ config KERNEL_BIN_NAME config REBOOT default y +config USB + default y if HAS_HW_NRF_USBD + module = ZMK module-str = zmk source "subsys/logging/Kconfig.template.log_config" diff --git a/app/boards/shields/bfo9000/Kconfig.defconfig b/app/boards/shields/bfo9000/Kconfig.defconfig index 1251113f..a8584886 100644 --- a/app/boards/shields/bfo9000/Kconfig.defconfig +++ b/app/boards/shields/bfo9000/Kconfig.defconfig @@ -16,9 +16,6 @@ if SHIELD_BFO9000_RIGHT config ZMK_KEYBOARD_NAME default "BFO9000 Right" -config USB - default y - endif if SHIELD_BFO9000_LEFT || SHIELD_BFO9000_RIGHT diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig index 6cf60b18..ef4817b5 100644 --- a/app/boards/shields/corne/Kconfig.defconfig +++ b/app/boards/shields/corne/Kconfig.defconfig @@ -12,9 +12,6 @@ if SHIELD_CORNE_RIGHT config ZMK_KEYBOARD_NAME default "Corne Right" - -config USB - default y endif diff --git a/app/boards/shields/cradio/Kconfig.defconfig b/app/boards/shields/cradio/Kconfig.defconfig index 25bb4331..5e826bf0 100644 --- a/app/boards/shields/cradio/Kconfig.defconfig +++ b/app/boards/shields/cradio/Kconfig.defconfig @@ -16,9 +16,6 @@ if SHIELD_CRADIO_RIGHT config ZMK_KEYBOARD_NAME default "cradio right" -config USB - default y - endif if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT diff --git a/app/boards/shields/helix/Kconfig.defconfig b/app/boards/shields/helix/Kconfig.defconfig index f58684a8..f0a4f880 100644 --- a/app/boards/shields/helix/Kconfig.defconfig +++ b/app/boards/shields/helix/Kconfig.defconfig @@ -16,9 +16,6 @@ if SHIELD_HELIX_RIGHT config ZMK_KEYBOARD_NAME default "Helix Right" -config USB - default y - endif if SHIELD_HELIX_LEFT || SHIELD_HELIX_RIGHT diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig index a43c0073..57b8c1ee 100644 --- a/app/boards/shields/iris/Kconfig.defconfig +++ b/app/boards/shields/iris/Kconfig.defconfig @@ -16,9 +16,6 @@ if SHIELD_IRIS_RIGHT config ZMK_KEYBOARD_NAME default "Iris Right" -config USB - default y - endif if SHIELD_IRIS_LEFT || SHIELD_IRIS_RIGHT diff --git a/app/boards/shields/jian/Kconfig.defconfig b/app/boards/shields/jian/Kconfig.defconfig index 07023a24..fc1f1995 100644 --- a/app/boards/shields/jian/Kconfig.defconfig +++ b/app/boards/shields/jian/Kconfig.defconfig @@ -14,9 +14,6 @@ if SHIELD_JIAN_RIGHT config ZMK_KEYBOARD_NAME default "Jian Right" - -config USB - default y endif diff --git a/app/boards/shields/jorne/Kconfig.defconfig b/app/boards/shields/jorne/Kconfig.defconfig index 18dcabe1..860cb12f 100644 --- a/app/boards/shields/jorne/Kconfig.defconfig +++ b/app/boards/shields/jorne/Kconfig.defconfig @@ -14,9 +14,6 @@ if SHIELD_JORNE_RIGHT config ZMK_KEYBOARD_NAME default "Jorne Right" - -config USB - default y endif diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index d0c17105..99e47bfe 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -15,9 +15,6 @@ if SHIELD_KYRIA_RIGHT config ZMK_KEYBOARD_NAME default "Kyria Right" -config USB - default y - endif if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig index ebcfa7b7..915cc70e 100644 --- a/app/boards/shields/lily58/Kconfig.defconfig +++ b/app/boards/shields/lily58/Kconfig.defconfig @@ -14,9 +14,6 @@ if SHIELD_LILY58_RIGHT config ZMK_KEYBOARD_NAME default "Lily58 Right" -config USB - default y - endif if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT diff --git a/app/boards/shields/microdox/Kconfig.defconfig b/app/boards/shields/microdox/Kconfig.defconfig index 0afd7491..be39c9f8 100644 --- a/app/boards/shields/microdox/Kconfig.defconfig +++ b/app/boards/shields/microdox/Kconfig.defconfig @@ -17,9 +17,6 @@ if SHIELD_MICRODOX_RIGHT config ZMK_KEYBOARD_NAME default "Microdox Right" -config USB - default y - endif if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_RIGHT diff --git a/app/boards/shields/quefrency/Kconfig.defconfig b/app/boards/shields/quefrency/Kconfig.defconfig index 5a7d964a..de44702f 100644 --- a/app/boards/shields/quefrency/Kconfig.defconfig +++ b/app/boards/shields/quefrency/Kconfig.defconfig @@ -17,9 +17,6 @@ if SHIELD_QUEFRENCY_RIGHT config ZMK_KEYBOARD_NAME default "Quefrency Right" -config USB - default y - endif if SHIELD_QUEFRENCY_LEFT || SHIELD_QUEFRENCY_RIGHT diff --git a/app/boards/shields/sofle/Kconfig.defconfig b/app/boards/shields/sofle/Kconfig.defconfig index 765afea4..6a580bfe 100644 --- a/app/boards/shields/sofle/Kconfig.defconfig +++ b/app/boards/shields/sofle/Kconfig.defconfig @@ -16,9 +16,6 @@ if SHIELD_SOFLE_RIGHT config ZMK_KEYBOARD_NAME default "Sofle Right" -config USB - default y - endif if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT diff --git a/app/boards/shields/splitreus62/Kconfig.defconfig b/app/boards/shields/splitreus62/Kconfig.defconfig index 26c2e937..fdaa3779 100644 --- a/app/boards/shields/splitreus62/Kconfig.defconfig +++ b/app/boards/shields/splitreus62/Kconfig.defconfig @@ -18,9 +18,6 @@ if SHIELD_SPLITREUS62_RIGHT config ZMK_KEYBOARD_NAME default "Splitreus62 Right" -config USB - default y - endif if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT From 0c6686f6e8ccb23465655458a2837081c3eda5e9 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Thu, 7 Jan 2021 12:36:49 -0600 Subject: [PATCH 31/31] docs(split): Remove USB configuration on right half --- docs/docs/development/new-shield.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index ceb81d10..6fac2075 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -111,9 +111,6 @@ if SHIELD_MY_BOARD_RIGHT config ZMK_KEYBOARD_NAME default "My Awesome Keyboard Right" -config USB - default y - endif if SHIELD_MY_BOARD_LEFT || SHIELD_MY_BOARD_RIGHT