From 54dabffd0d371595a8142ee4da4f5d888a310cda Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Wed, 9 Jun 2021 06:10:20 +0000 Subject: [PATCH 01/10] feat(behaviors): Add caps word (`&caps_word`). * Add new `&caps_word` behavior that acts like caps lock, but releases automatically when any "break" keycode is pressed. --- app/CMakeLists.txt | 1 + app/dts/behaviors.dtsi | 1 + app/dts/behaviors/caps_word.dtsi | 19 ++ .../behaviors/zmk,behavior-caps-word.yaml | 15 ++ app/src/behaviors/behavior_caps_word.c | 186 ++++++++++++++++++ app/tests/caps-word/behavior_keymap.dtsi | 17 ++ .../events.patterns | 4 + .../keycode_events.snapshot | 17 ++ .../native_posix.keymap | 21 ++ .../events.patterns | 4 + .../keycode_events.snapshot | 14 ++ .../native_posix.keymap | 21 ++ .../events.patterns | 3 + .../keycode_events.snapshot | 13 ++ .../native_posix.keymap | 17 ++ .../events.patterns | 3 + .../keycode_events.snapshot | 9 + .../native_posix.keymap | 17 ++ docs/docs/behaviors/caps-word.md | 74 +++++++ docs/sidebars.js | 1 + 20 files changed, 457 insertions(+) create mode 100644 app/dts/behaviors/caps_word.dtsi create mode 100644 app/dts/bindings/behaviors/zmk,behavior-caps-word.yaml create mode 100644 app/src/behaviors/behavior_caps_word.c create mode 100644 app/tests/caps-word/behavior_keymap.dtsi create mode 100644 app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns create mode 100644 app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot create mode 100644 app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap create mode 100644 app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns create mode 100644 app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot create mode 100644 app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap create mode 100644 app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns create mode 100644 app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot create mode 100644 app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap create mode 100644 app/tests/caps-word/deactivate-by-second-press/events.patterns create mode 100644 app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot create mode 100644 app/tests/caps-word/deactivate-by-second-press/native_posix.keymap create mode 100644 docs/docs/behaviors/caps-word.md diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 9c7befec..970c6c20 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -47,6 +47,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) target_sources(app PRIVATE src/behaviors/behavior_reset.c) target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c) target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c) + target_sources(app PRIVATE src/behaviors/behavior_caps_word.c) target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c) target_sources(app PRIVATE src/behaviors/behavior_mod_morph.c) target_sources(app PRIVATE src/behaviors/behavior_outputs.c) diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 4333ceea..5b5f72b4 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -14,3 +14,4 @@ #include #include #include +#include diff --git a/app/dts/behaviors/caps_word.dtsi b/app/dts/behaviors/caps_word.dtsi new file mode 100644 index 00000000..57d5cab7 --- /dev/null +++ b/app/dts/behaviors/caps_word.dtsi @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + behaviors { + /omit-if-no-ref/ caps_word: behavior_caps_word { + compatible = "zmk,behavior-caps-word"; + label = "CAPS_WORD"; + #binding-cells = <0>; + continue-list = ; + }; + }; +}; + diff --git a/app/dts/bindings/behaviors/zmk,behavior-caps-word.yaml b/app/dts/bindings/behaviors/zmk,behavior-caps-word.yaml new file mode 100644 index 00000000..cc1dda01 --- /dev/null +++ b/app/dts/bindings/behaviors/zmk,behavior-caps-word.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +description: Caps word behavior + +compatible: "zmk,behavior-caps-word" + +include: zero_param.yaml + +properties: + continue-list: + type: array + required: true + mods: + type: int diff --git a/app/src/behaviors/behavior_caps_word.c b/app/src/behaviors/behavior_caps_word.c new file mode 100644 index 00000000..45e3d9d9 --- /dev/null +++ b/app/src/behaviors/behavior_caps_word.c @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define DT_DRV_COMPAT zmk_behavior_caps_word + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +struct caps_word_continue_item { + uint16_t page; + uint32_t id; + uint8_t implicit_modifiers; +}; + +struct behavior_caps_word_config { + zmk_mod_flags_t mods; + uint8_t index; + uint8_t continuations_count; + struct caps_word_continue_item continuations[]; +}; + +struct behavior_caps_word_data { + bool active; +}; + +static void activate_caps_word(const struct device *dev) { + struct behavior_caps_word_data *data = dev->data; + + data->active = true; +} + +static void deactivate_caps_word(const struct device *dev) { + struct behavior_caps_word_data *data = dev->data; + + data->active = false; +} + +static int on_caps_word_binding_pressed(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + const struct device *dev = device_get_binding(binding->behavior_dev); + struct behavior_caps_word_data *data = dev->data; + + if (data->active) { + deactivate_caps_word(dev); + } else { + activate_caps_word(dev); + } + + return ZMK_BEHAVIOR_OPAQUE; +} + +static int on_caps_word_binding_released(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + return ZMK_BEHAVIOR_OPAQUE; +} + +static const struct behavior_driver_api behavior_caps_word_driver_api = { + .binding_pressed = on_caps_word_binding_pressed, + .binding_released = on_caps_word_binding_released, +}; + +static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh); + +ZMK_LISTENER(behavior_caps_word, caps_word_keycode_state_changed_listener); +ZMK_SUBSCRIPTION(behavior_caps_word, zmk_keycode_state_changed); + +static const struct device *devs[DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT)]; + +static bool caps_word_is_caps_includelist(const struct behavior_caps_word_config *config, + uint16_t usage_page, uint8_t usage_id, + uint8_t implicit_modifiers) { + for (int i = 0; i < config->continuations_count; i++) { + const struct caps_word_continue_item *continuation = &config->continuations[i]; + LOG_DBG("Comparing with 0x%02X - 0x%02X (with implicit mods: 0x%02X)", continuation->page, + continuation->id, continuation->implicit_modifiers); + + if (continuation->page == usage_page && continuation->id == usage_id && + continuation->implicit_modifiers == implicit_modifiers) { + LOG_DBG("Continuing capsword, found included usage: 0x%02X - 0x%02X", usage_page, + usage_id); + return true; + } + } + + return false; +} + +static bool caps_word_is_alpha(uint8_t usage_id) { + return (usage_id >= HID_USAGE_KEY_KEYBOARD_A && usage_id <= HID_USAGE_KEY_KEYBOARD_Z); +} + +static bool caps_word_is_numeric(uint8_t usage_id) { + return (usage_id >= HID_USAGE_KEY_KEYBOARD_1_AND_EXCLAMATION && + usage_id <= HID_USAGE_KEY_KEYBOARD_0_AND_RIGHT_PARENTHESIS); +} + +static void caps_word_enhance_usage(const struct behavior_caps_word_config *config, + struct zmk_keycode_state_changed *ev) { + if (ev->usage_page != HID_USAGE_KEY || !caps_word_is_alpha(ev->keycode)) { + return; + } + + LOG_DBG("Enhancing usage 0x%02X with modifiers: 0x%02X", ev->keycode, config->mods); + ev->implicit_modifiers |= config->mods; +} + +static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh) { + struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh); + if (ev == NULL || !ev->state) { + return ZMK_EV_EVENT_BUBBLE; + } + + for (int i = 0; i < DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT); i++) { + const struct device *dev = devs[i]; + if (dev == NULL) { + continue; + } + + struct behavior_caps_word_data *data = dev->data; + if (!data->active) { + continue; + } + + const struct behavior_caps_word_config *config = dev->config; + + caps_word_enhance_usage(config, ev); + + if (!caps_word_is_alpha(ev->keycode) && !caps_word_is_numeric(ev->keycode) && + !caps_word_is_caps_includelist(config, ev->usage_page, ev->keycode, + ev->implicit_modifiers)) { + LOG_DBG("Deactivating caps_word for 0x%02X - 0x%02X", ev->usage_page, ev->keycode); + deactivate_caps_word(dev); + } + } + + return ZMK_EV_EVENT_BUBBLE; +} + +static int behavior_caps_word_init(const struct device *dev) { + const struct behavior_caps_word_config *config = dev->config; + devs[config->index] = dev; + return 0; +} + +#define CAPS_WORD_LABEL(i, _n) DT_INST_LABEL(i) + +#define PARSE_BREAK(i) \ + {.page = (HID_USAGE_PAGE(i) & 0xFF), \ + .id = HID_USAGE_ID(i), \ + .implicit_modifiers = SELECT_MODS(i)}, + +#define BREAK_ITEM(i, n) PARSE_BREAK(DT_INST_PROP_BY_IDX(n, continue_list, i)) + +#define KP_INST(n) \ + static struct behavior_caps_word_data behavior_caps_word_data_##n = {.active = false}; \ + static struct behavior_caps_word_config behavior_caps_word_config_##n = { \ + .index = n, \ + .mods = DT_INST_PROP_OR(n, mods, MOD_LSFT), \ + .continuations = {UTIL_LISTIFY(DT_INST_PROP_LEN(n, continue_list), BREAK_ITEM, n)}, \ + .continuations_count = DT_INST_PROP_LEN(n, continue_list), \ + }; \ + DEVICE_DT_INST_DEFINE(n, behavior_caps_word_init, device_pm_control_nop, \ + &behavior_caps_word_data_##n, &behavior_caps_word_config_##n, \ + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_caps_word_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(KP_INST) + +#endif diff --git a/app/tests/caps-word/behavior_keymap.dtsi b/app/tests/caps-word/behavior_keymap.dtsi new file mode 100644 index 00000000..04653bec --- /dev/null +++ b/app/tests/caps-word/behavior_keymap.dtsi @@ -0,0 +1,17 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + label = "Default keymap"; + + default_layer { + bindings = < + &caps_word &kp A + &kp N6 &kp MINUS + >; + }; + }; +}; diff --git a/app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns new file mode 100644 index 00000000..dd4d3d3f --- /dev/null +++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_implicit_modifiers_//p +s/.*caps_word_enhance_usage/enhance_usage/p +s/.*caps_word_is_caps_includelist/caps_includelist/p \ No newline at end of file diff --git a/app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot new file mode 100644 index 00000000..fe705ba4 --- /dev/null +++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/keycode_events.snapshot @@ -0,0 +1,17 @@ +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +caps_includelist: Comparing with 0x07 - 0x2d (with implicit mods: 0x02) +caps_includelist: Comparing with 0x07 - 0x2d (with implicit mods: 0x00) +caps_includelist: Continuing capsword, found included usage: 0x07 - 0x2d +pressed: usage_page 0x07 keycode 0x2d implicit_mods 0x00 explicit_mods 0x00 +press: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x2d implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 diff --git a/app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap new file mode 100644 index 00000000..68c3249f --- /dev/null +++ b/app/tests/caps-word/continue-with-non-alpha-continue-list-item/native_posix.keymap @@ -0,0 +1,21 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&caps_word { + continue-list = ; +}; + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_PRESS(1,1,10) + ZMK_MOCK_RELEASE(1,1,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; \ No newline at end of file diff --git a/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns new file mode 100644 index 00000000..dd4d3d3f --- /dev/null +++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_implicit_modifiers_//p +s/.*caps_word_enhance_usage/enhance_usage/p +s/.*caps_word_is_caps_includelist/caps_includelist/p \ No newline at end of file diff --git a/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot new file mode 100644 index 00000000..23ddbe1b --- /dev/null +++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/keycode_events.snapshot @@ -0,0 +1,14 @@ +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +pressed: usage_page 0x07 keycode 0x23 implicit_mods 0x00 explicit_mods 0x00 +press: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x23 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 diff --git a/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap new file mode 100644 index 00000000..40a4d4a9 --- /dev/null +++ b/app/tests/caps-word/continue-with-non-modified-numeric-usage-id/native_posix.keymap @@ -0,0 +1,21 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&caps_word { + continue-list = ; +}; + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; \ No newline at end of file diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns new file mode 100644 index 00000000..fa75ab0c --- /dev/null +++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/events.patterns @@ -0,0 +1,3 @@ +s/.*hid_listener_keycode_//p +s/.*hid_implicit_modifiers_//p +s/.*caps_word_enhance_usage/enhance_usage/p \ No newline at end of file diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot new file mode 100644 index 00000000..eb24c4bb --- /dev/null +++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/keycode_events.snapshot @@ -0,0 +1,13 @@ +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +pressed: usage_page 0x07 keycode 0x2d implicit_mods 0x00 explicit_mods 0x00 +press: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x2d implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +press: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 diff --git a/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap new file mode 100644 index 00000000..4219e354 --- /dev/null +++ b/app/tests/caps-word/deactivate-by-non-alpha-non-continuation/native_posix.keymap @@ -0,0 +1,17 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_PRESS(1,1,10) + ZMK_MOCK_RELEASE(1,1,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; \ No newline at end of file diff --git a/app/tests/caps-word/deactivate-by-second-press/events.patterns b/app/tests/caps-word/deactivate-by-second-press/events.patterns new file mode 100644 index 00000000..fa75ab0c --- /dev/null +++ b/app/tests/caps-word/deactivate-by-second-press/events.patterns @@ -0,0 +1,3 @@ +s/.*hid_listener_keycode_//p +s/.*hid_implicit_modifiers_//p +s/.*caps_word_enhance_usage/enhance_usage/p \ No newline at end of file diff --git a/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot b/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot new file mode 100644 index 00000000..5181f75b --- /dev/null +++ b/app/tests/caps-word/deactivate-by-second-press/keycode_events.snapshot @@ -0,0 +1,9 @@ +enhance_usage: Enhancing usage 0x04 with modifiers: 0x02 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x02 explicit_mods 0x00 +press: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +press: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +release: Modifiers set to 0x00 diff --git a/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap b/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap new file mode 100644 index 00000000..05f13fed --- /dev/null +++ b/app/tests/caps-word/deactivate-by-second-press/native_posix.keymap @@ -0,0 +1,17 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; \ No newline at end of file diff --git a/docs/docs/behaviors/caps-word.md b/docs/docs/behaviors/caps-word.md new file mode 100644 index 00000000..ee493741 --- /dev/null +++ b/docs/docs/behaviors/caps-word.md @@ -0,0 +1,74 @@ +--- +title: Caps Word Behavior +sidebar_label: Caps Word +--- + +## Summary + +The caps word behavior behaves similar to a caps lock, but will automatically deactivate when one of the configured "break keycodes" is pressed, or if the caps word key is pressed again. For smaller keyboards, using [mod-taps](/docs/behaviors/mod-tap), this can help avoid repeated alternating holds when typing words in all caps. + +The modifiers are applied only to to the alphabetic (`A` to `Z`) keycodes, to avoid automatically appliying them to numeric values, etc. + +### Behavior Binding + +- Reference: `&caps_word` + +Example: + +``` +&caps_word +``` + +### Configuration + +#### Continue List + +By default, the caps word will remain active when any alphanumeric character or the underscore (`UNDERSCORE`) characters are pressed. Any other keycode sent, +will turn off caps word. If you would like to override this, you can set a new array of keys in the `continue-list` property in your keymap: + +``` +&caps_word { + continue-list = ; +}; + +/ { + keymap { + ... + }; +}; +``` + +#### Applied Modifier(s) + +In addition, if you would like _multiple_ modifiers, instead of just `MOD_LSFT`, you can override the `mods` property: + +``` +&caps_word { + mods = ; +}; + +/ { + keymap { + ... + }; +}; +``` + +### Multiple Caps Breaks + +If you want to use multiple caps breaks with different codes to break the caps, you can add additional caps words instances to use in your keymap: + +``` +/ { + prog_caps: behavior_prog_caps_word { + compatible = "zmk,behavior-caps-word"; + label = "PROG_CAPS"; + #binding-cells = <0>; + continue-list = ; + }; + + keymap { + ... + }; +}; +``` diff --git a/docs/sidebars.js b/docs/sidebars.js index 04389695..38256219 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -27,6 +27,7 @@ module.exports = { "behaviors/mod-morph", "behaviors/sticky-key", "behaviors/sticky-layer", + "behaviors/caps-word", "behaviors/reset", "behaviors/bluetooth", "behaviors/outputs", From 0b4432161338368dc4ead0aae85332521c896c3e Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Sun, 28 Nov 2021 22:58:17 -0600 Subject: [PATCH 02/10] fix(shields): Fix typo on Quefrency .zmk.yml --- app/boards/shields/quefrency/quefrency.zmk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/boards/shields/quefrency/quefrency.zmk.yml b/app/boards/shields/quefrency/quefrency.zmk.yml index f741a702..e70ae68e 100644 --- a/app/boards/shields/quefrency/quefrency.zmk.yml +++ b/app/boards/shields/quefrency/quefrency.zmk.yml @@ -8,5 +8,5 @@ features: - keys - encoder siblings: - - quenfrency_left - - quenfrency_right + - quefrency_left + - quefrency_right From b9a35c6ae7e86de637a96bd9f76b362915f309a0 Mon Sep 17 00:00:00 2001 From: Cem Aksoylar Date: Sun, 28 Nov 2021 21:49:59 -0800 Subject: [PATCH 03/10] fix(keymaps): Locate shared conf and overlay for split boards. --- app/cmake/zmk_config.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/cmake/zmk_config.cmake b/app/cmake/zmk_config.cmake index dec31104..c8aa1a00 100644 --- a/app/cmake/zmk_config.cmake +++ b/app/cmake/zmk_config.cmake @@ -105,8 +105,10 @@ if (ZMK_CONFIG) endif() # TODO: Board revisions? + list(APPEND overlay_candidates "${ZMK_CONFIG}/${BOARD_DIR_NAME}.overlay") list(APPEND overlay_candidates "${ZMK_CONFIG}/${BOARD}.overlay") list(APPEND overlay_candidates "${ZMK_CONFIG}/default.overlay") + list(APPEND config_candidates "${ZMK_CONFIG}/${BOARD_DIR_NAME}.conf") list(APPEND config_candidates "${ZMK_CONFIG}/${BOARD}.conf") list(APPEND config_candidates "${ZMK_CONFIG}/default.conf") From 66f90dae3a46095330ef057c413baffbb56ce2fa Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 30 Nov 2021 04:39:46 +1100 Subject: [PATCH 04/10] feat(shield) Add Chalice support (#1022) * add chalice * add split bs transform * Update app/boards/shields/chalice/chalice.zmk.yml Co-authored-by: Nick Winans Co-authored-by: Nick Winans --- app/boards/shields/chalice/Kconfig.defconfig | 9 +++ app/boards/shields/chalice/Kconfig.shield | 5 ++ .../shields/chalice/boards/nice_nano.overlay | 28 +++++++ .../chalice/boards/nice_nano_v2.overlay | 28 +++++++ app/boards/shields/chalice/chalice.conf | 3 + app/boards/shields/chalice/chalice.keymap | 39 ++++++++++ app/boards/shields/chalice/chalice.overlay | 73 +++++++++++++++++++ app/boards/shields/chalice/chalice.zmk.yml | 9 +++ 8 files changed, 194 insertions(+) create mode 100644 app/boards/shields/chalice/Kconfig.defconfig create mode 100644 app/boards/shields/chalice/Kconfig.shield create mode 100644 app/boards/shields/chalice/boards/nice_nano.overlay create mode 100644 app/boards/shields/chalice/boards/nice_nano_v2.overlay create mode 100644 app/boards/shields/chalice/chalice.conf create mode 100644 app/boards/shields/chalice/chalice.keymap create mode 100644 app/boards/shields/chalice/chalice.overlay create mode 100644 app/boards/shields/chalice/chalice.zmk.yml diff --git a/app/boards/shields/chalice/Kconfig.defconfig b/app/boards/shields/chalice/Kconfig.defconfig new file mode 100644 index 00000000..9987a79a --- /dev/null +++ b/app/boards/shields/chalice/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_CHALICE + +config ZMK_KEYBOARD_NAME + default "Chalice" + +endif diff --git a/app/boards/shields/chalice/Kconfig.shield b/app/boards/shields/chalice/Kconfig.shield new file mode 100644 index 00000000..bd03bf76 --- /dev/null +++ b/app/boards/shields/chalice/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_CHALICE + def_bool $(shields_list_contains,chalice) diff --git a/app/boards/shields/chalice/boards/nice_nano.overlay b/app/boards/shields/chalice/boards/nice_nano.overlay new file mode 100644 index 00000000..21e28515 --- /dev/null +++ b/app/boards/shields/chalice/boards/nice_nano.overlay @@ -0,0 +1,28 @@ +&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 = <14>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/chalice/boards/nice_nano_v2.overlay b/app/boards/shields/chalice/boards/nice_nano_v2.overlay new file mode 100644 index 00000000..21e28515 --- /dev/null +++ b/app/boards/shields/chalice/boards/nice_nano_v2.overlay @@ -0,0 +1,28 @@ +&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 = <14>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/chalice/chalice.conf b/app/boards/shields/chalice/chalice.conf new file mode 100644 index 00000000..da642256 --- /dev/null +++ b/app/boards/shields/chalice/chalice.conf @@ -0,0 +1,3 @@ +# Uncomment the following lines to enable RGB underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/app/boards/shields/chalice/chalice.keymap b/app/boards/shields/chalice/chalice.keymap new file mode 100644 index 00000000..cba93d03 --- /dev/null +++ b/app/boards/shields/chalice/chalice.keymap @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + + bindings = < + &kp ESC &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 EQUAL &kp BSPC + &kp INSERT &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH + &kp DELETE &kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp ENTER + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH &kp RSHFT &kp UP + &kp LCTRL &kp LALT &kp SPACE &mo 1 &kp SPACE &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT + >; + }; + + function_layer { + + bindings = < + &bootloader &out OUT_TOG &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 &bt BT_CLR &rgb_ug RGB_TOG &rgb_ug RGB_HUD &rgb_ug RGB_HUI &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &trans &bt BT_SEL 0 &rgb_ug RGB_EFF &rgb_ug RGB_SAD &rgb_ug RGB_SAI &trans &trans &trans &trans &trans &trans &trans &trans &trans + &bt BT_SEL 1 &rgb_ug RGB_EFR &rgb_ug RGB_BRD &rgb_ug RGB_BRI &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp PG_UP + &bt BT_SEL 2 &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_DN &kp END + >; + }; + }; +}; diff --git a/app/boards/shields/chalice/chalice.overlay b/app/boards/shields/chalice/chalice.overlay new file mode 100644 index 00000000..34cbd34e --- /dev/null +++ b/app/boards/shields/chalice/chalice.overlay @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 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 = <7>; + rows = <10>; + + map = < + RC(0,0) RC(1,0) RC(0,1) RC(1,1) RC(0,2) RC(1,2) RC(0,3) RC(1,3) RC(0,4) RC(1,4) RC(0,5) RC(1,5) RC(0,6) RC(1,6) RC(4,6) + RC(2,0) RC(3,0) RC(2,1) RC(3,1) RC(2,2) RC(3,2) RC(2,3) RC(3,3) RC(2,4) RC(3,4) RC(2,5) RC(3,5) RC(2,6) RC(3,6) RC(5,6) + RC(4,0) RC(5,0) RC(4,1) RC(5,1) RC(4,2) RC(5,2) RC(4,3) RC(5,3) RC(4,4) RC(5,4) RC(4,5) RC(5,5) RC(6,6) RC(7,6) + RC(6,0) RC(7,0) RC(6,1) RC(7,1) RC(6,2) RC(7,2) RC(6,3) RC(7,3) RC(6,4) RC(7,4) RC(6,5) RC(7,5) RC(8,6) RC(9,6) + RC(8,0) RC(9,1) RC(8,2) RC(9,2) RC(8,3) RC(9,3) RC(8,4) RC(9,4) RC(8,5) RC(9,5) + >; + }; + + splitbs_transform: keymap_transform_1 { + compatible = "zmk,matrix-transform"; + columns = <7>; + rows = <10>; + + map = < + RC(0,0) RC(1,0) RC(0,1) RC(1,1) RC(0,2) RC(1,2) RC(0,3) RC(1,3) RC(0,4) RC(1,4) RC(0,5) RC(1,5) RC(0,6) RC(1,6) RC(4,6) RC(8,1) + RC(2,0) RC(3,0) RC(2,1) RC(3,1) RC(2,2) RC(3,2) RC(2,3) RC(3,3) RC(2,4) RC(3,4) RC(2,5) RC(3,5) RC(2,6) RC(3,6) RC(5,6) + RC(4,0) RC(5,0) RC(4,1) RC(5,1) RC(4,2) RC(5,2) RC(4,3) RC(5,3) RC(4,4) RC(5,4) RC(4,5) RC(5,5) RC(6,6) RC(7,6) + RC(6,0) RC(7,0) RC(6,1) RC(7,1) RC(6,2) RC(7,2) RC(6,3) RC(7,3) RC(6,4) RC(7,4) RC(6,5) RC(7,5) RC(8,6) RC(9,6) + RC(8,0) RC(9,1) RC(8,2) RC(9,2) RC(8,3) RC(9,3) RC(8,4) RC(9,4) RC(8,5) RC(9,5) + >; + }; + + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + col-gpios + = <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 0 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +}; diff --git a/app/boards/shields/chalice/chalice.zmk.yml b/app/boards/shields/chalice/chalice.zmk.yml new file mode 100644 index 00000000..a284dbe5 --- /dev/null +++ b/app/boards/shields/chalice/chalice.zmk.yml @@ -0,0 +1,9 @@ +file_format: "1" +id: chalice +name: Chalice +type: shield +url: https://customkbd.com/products/chalice-pre-order +requires: [pro_micro] +features: + - keys + - underglow From 99c5a8ee6fbda71686130a207e9a7719146be013 Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Tue, 23 Nov 2021 14:23:40 +0000 Subject: [PATCH 05/10] feat(boards): Add BT60 Boards --- app/boards/arm/bt60/CMakeLists.txt | 8 + app/boards/arm/bt60/Kconfig | 7 + app/boards/arm/bt60/Kconfig.board | 12 ++ app/boards/arm/bt60/Kconfig.defconfig | 34 +++++ app/boards/arm/bt60/board.cmake | 5 + app/boards/arm/bt60/bt60.dtsi | 128 ++++++++++++++++ app/boards/arm/bt60/bt60_v1.dts | 113 ++++++++++++++ app/boards/arm/bt60/bt60_v1.keymap | 180 +++++++++++++++++++++++ app/boards/arm/bt60/bt60_v1.yaml | 15 ++ app/boards/arm/bt60/bt60_v1.zmk.yml | 12 ++ app/boards/arm/bt60/bt60_v1_defconfig | 24 +++ app/boards/arm/bt60/bt60_v1_hs.dts | 61 ++++++++ app/boards/arm/bt60/bt60_v1_hs.keymap | 37 +++++ app/boards/arm/bt60/bt60_v1_hs.yaml | 15 ++ app/boards/arm/bt60/bt60_v1_hs.zmk.yml | 12 ++ app/boards/arm/bt60/bt60_v1_hs_defconfig | 24 +++ 16 files changed, 687 insertions(+) create mode 100644 app/boards/arm/bt60/CMakeLists.txt create mode 100644 app/boards/arm/bt60/Kconfig create mode 100644 app/boards/arm/bt60/Kconfig.board create mode 100644 app/boards/arm/bt60/Kconfig.defconfig create mode 100644 app/boards/arm/bt60/board.cmake create mode 100644 app/boards/arm/bt60/bt60.dtsi create mode 100644 app/boards/arm/bt60/bt60_v1.dts create mode 100644 app/boards/arm/bt60/bt60_v1.keymap create mode 100644 app/boards/arm/bt60/bt60_v1.yaml create mode 100644 app/boards/arm/bt60/bt60_v1.zmk.yml create mode 100644 app/boards/arm/bt60/bt60_v1_defconfig create mode 100644 app/boards/arm/bt60/bt60_v1_hs.dts create mode 100644 app/boards/arm/bt60/bt60_v1_hs.keymap create mode 100644 app/boards/arm/bt60/bt60_v1_hs.yaml create mode 100644 app/boards/arm/bt60/bt60_v1_hs.zmk.yml create mode 100644 app/boards/arm/bt60/bt60_v1_hs_defconfig diff --git a/app/boards/arm/bt60/CMakeLists.txt b/app/boards/arm/bt60/CMakeLists.txt new file mode 100644 index 00000000..00952c30 --- /dev/null +++ b/app/boards/arm/bt60/CMakeLists.txt @@ -0,0 +1,8 @@ +set_property(GLOBAL APPEND PROPERTY extra_post_build_commands + COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py + -c + -b 0x26000 + -f 0xADA52840 + -o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 + ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin +) diff --git a/app/boards/arm/bt60/Kconfig b/app/boards/arm/bt60/Kconfig new file mode 100644 index 00000000..359e237d --- /dev/null +++ b/app/boards/arm/bt60/Kconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on (BOARD_BT60_V1_HS || BOARD_BT60_V1) diff --git a/app/boards/arm/bt60/Kconfig.board b/app/boards/arm/bt60/Kconfig.board new file mode 100644 index 00000000..0f0a9c6e --- /dev/null +++ b/app/boards/arm/bt60/Kconfig.board @@ -0,0 +1,12 @@ +# BT60 board configuration + +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT + +config BOARD_BT60_V1 + bool "bt60" + depends on SOC_NRF52840_QIAA + +config BOARD_BT60_V1_HS + bool "bt60 hotswap" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/bt60/Kconfig.defconfig b/app/boards/arm/bt60/Kconfig.defconfig new file mode 100644 index 00000000..7e7ab124 --- /dev/null +++ b/app/boards/arm/bt60/Kconfig.defconfig @@ -0,0 +1,34 @@ +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT + +if BOARD_BT60_V1_HS || BOARD_BT60_V1 + +config BOARD + default "bt60" + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +config ZMK_BATTERY_VOLTAGE_DIVIDER + default y + +config ZMK_KEYBOARD_NAME + default "BT60" + +endif # BOARD_BT60 diff --git a/app/boards/arm/bt60/board.cmake b/app/boards/arm/bt60/board.cmake new file mode 100644 index 00000000..fa847d50 --- /dev/null +++ b/app/boards/arm/bt60/board.cmake @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/app/boards/arm/bt60/bt60.dtsi b/app/boards/arm/bt60/bt60.dtsi new file mode 100644 index 00000000..48e4128b --- /dev/null +++ b/app/boards/arm/bt60/bt60.dtsi @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2021 Polarity Works +* +* SPDX-License-Identifier: MIT +*/ + +/dts-v1/; +#include +#include + +/ { + model = "BT60"; + compatible = "bt60"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder>; + }; + + + +left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "okay"; + }; + + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 2>; + output-ohms = <2000000>; + full-ohms = <(2000000 + 806000)>; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <17>; + scl-pin = <20>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + tx-pin = <6>; + rx-pin = <8>; +}; + +&usbd { + status = "okay"; +}; + + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "softdevice"; + reg = <0x00000000 0x00026000>; + }; + code_partition: partition@26000 { + label = "code_partition"; + reg = <0x00026000 0x000c6000>; + }; + + /* + * The flash starting at 0x000ec000 and ending at + * 0x000f3fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@ec000 { + label = "storage"; + reg = <0x000ec000 0x00008000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; +}; diff --git a/app/boards/arm/bt60/bt60_v1.dts b/app/boards/arm/bt60/bt60_v1.dts new file mode 100644 index 00000000..83da2c07 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1.dts @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2021 Polarity Works +* +* SPDX-License-Identifier: MIT +*/ + +/dts-v1/; +#include "bt60.dtsi" + + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &ansi_transform; + }; + + ansi_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(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,6) RC(1,7) 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,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) + RC(3,0) 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,13) + RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14) + >; + }; + + hhkb_transform: keymap_transform_1 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(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,6) RC(1,7) 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,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) + RC(3,0) 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,14) + RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) + >; + }; + + iso_transform: keymap_transform_2 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(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,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) + 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(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(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) + >; + }; + + all_1u_transform: keymap_transform_3 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(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,6) RC(1,7) 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,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) + RC(3,0) 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,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14) + >; + }; + + split_transform: keymap_transform_4 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(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,6) RC(1,7) 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,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,13) + RC(3,0) 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,14) + RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) + >; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + col-gpios + = <&gpio1 13 GPIO_ACTIVE_HIGH> + , <&gpio1 10 GPIO_ACTIVE_HIGH> + , <&gpio1 11 GPIO_ACTIVE_HIGH> + , <&gpio1 15 GPIO_ACTIVE_HIGH> + , <&gpio0 3 GPIO_ACTIVE_HIGH> + , <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio0 28 GPIO_ACTIVE_HIGH> + , <&gpio0 29 GPIO_ACTIVE_HIGH> + , <&gpio0 30 GPIO_ACTIVE_HIGH> + , <&gpio0 31 GPIO_ACTIVE_HIGH> + , <&gpio0 5 GPIO_ACTIVE_HIGH> + , <&gpio0 7 GPIO_ACTIVE_HIGH> + , <&gpio1 9 GPIO_ACTIVE_HIGH> + , <&gpio0 12 GPIO_ACTIVE_HIGH> + , <&gpio0 23 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +}; diff --git a/app/boards/arm/bt60/bt60_v1.keymap b/app/boards/arm/bt60/bt60_v1.keymap new file mode 100644 index 00000000..0985a605 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1.keymap @@ -0,0 +1,180 @@ +#include +#include +#include + +#define ANSI true +//#define HHKB true +//#define ISO true +//#define ALL_1U true +//#define SPLIT_BKSP_RSHFT true + + + +/ { + chosen { + #ifdef ANSI + zmk,matrix_transform = &ansi_transform; + #elif defined(HHKB) + zmk,matrix_transform = &hhkb_transform; + #elif defined(ISO) + zmk,matrix_transform = &iso_transform; + #elif defined(ALL_1U) + zmk,matrix_transform = &all_1u_transform; + #else + zmk,matrix_transform = &split_transform; + #endif + }; + + + keymap { + compatible = "zmk,keymap"; + #ifdef ANSI + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | | | + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | + // | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | CTRL | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &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 RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp K_CMENU &kp RCTRL &bt BT_CLR + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + // ------------------------------------------------------------------------------------------ + // |GRAVE| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | + // | TAB | Q | UP | E | R | T | Y | U | INS | O |PSCRN|SLCK |PSEBRK| RESET | + // | CAPS |LEFT |DOWN |RIGHT| F | G | H | J | K | L |HOME |PGUP | BOOTLOADER | + // | PREV |VOLUP |VOLDN|MUTE | V | B | N | M | , | END | PGDN | NEXT | + // | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | BT_CLR | + // ------------------------------------------------------------------------------------------ + 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 DEL + &trans &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &reset + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader + &kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &kp END &kp PG_DN &kp C_NEXT + &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &bt BT_CLR &trans + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + #elif defined(HHKB) + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | BSPC | + // | CTRL | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | 1 | + // | CAPS | ALT | WIN | SPACE | WIN | ALT | CTRL | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSLH &kp GRAVE + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &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 RET + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &mo 1 + &kp LCTRL &kp LALT &kp LGUI &kp SPACE &kp RGUI &kp RALT &kp RCTRL + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + bindings = < + &trans &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 INS &kp DEL + &kp CLCK &bt BT_PRV &bt BT_NXT &bt BT_CLR &trans &trans &trans &trans &trans &trans &trans &kp UP &trans &reset + &trans &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &trans &kp LEFT &kp RIGHT &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp DOWN &trans &trans + &trans &trans &trans &bootloader &trans &trans &trans + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + #elif defined(ISO) + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | | + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | # | ENTER | + // | SHIFT | | | Z | X | C | V | B | N | M | , | . | / | SHIFT | + // | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | CTRL | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp NON_US_HASH &kp RET + &kp LSHFT &kp NON_US_BSLH &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp K_CMENU &kp RCTRL + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + 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 DEL + &reset &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &trans &bootloader + &kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &trans &kp END &kp PG_DN &kp C_NEXT + &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &bt BT_CLR + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + #elif defined(ALL_1U) + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" | + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHFT | UP | 1 | + // | CTL | WIN | ALT | SPACE | ALT | CTRL | LEFT | DOWN | RIGHT | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &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 RSHFT &kp UP &mo 1 + &kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + 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 F1 + &trans &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &reset + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader + &kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &trans &trans &kp END &kp PG_DN &kp C_NEXT + &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &bt BT_CLR + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + #else + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |BKSP| DEL | + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | 1 | + // | CTL | WIN | ALT | SPACE | ALT | 1 | CTRL | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &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 LBKT &kp RBKT &kp BSLH + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &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 RSHFT &mo 1 + &kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &kp RGUI &kp C_MENU &kp RCTRL + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + 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 DEL &trans + &trans &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &reset + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader + &kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &kp END &kp PG_DN &kp C_NEXT &trans + &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &bt BT_CLR + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + #endif + }; +}; diff --git a/app/boards/arm/bt60/bt60_v1.yaml b/app/boards/arm/bt60/bt60_v1.yaml new file mode 100644 index 00000000..41fd7e40 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1.yaml @@ -0,0 +1,15 @@ +identifier: bt60_v1 +name: BT60 V1 Soldered +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/bt60/bt60_v1.zmk.yml b/app/boards/arm/bt60/bt60_v1.zmk.yml new file mode 100644 index 00000000..9909f191 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1.zmk.yml @@ -0,0 +1,12 @@ +file_format: "1" +id: bt60_v1 +name: BT60 V1 Soldered +type: board +arch: arm +features: + - keys + - encoder +outputs: + - usb + - ble +url: https://polarityworks.com diff --git a/app/boards/arm/bt60/bt60_v1_defconfig b/app/boards/arm/bt60/bt60_v1_defconfig new file mode 100644 index 00000000..0f13395b --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_defconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BT60_V1=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +# encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y diff --git a/app/boards/arm/bt60/bt60_v1_hs.dts b/app/boards/arm/bt60/bt60_v1_hs.dts new file mode 100644 index 00000000..0e686fd9 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_hs.dts @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2021 Polarity Works +* +* SPDX-License-Identifier: MIT +*/ + +/dts-v1/; +#include "bt60.dtsi" + + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <15>; + rows = <5>; + 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(0,10) RC(0,11) RC(0,12) RC(0,13) RC(2,13) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(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,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) + 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(4,0) RC(4,1) RC(4,2) RC(4,5) RC(4,8) RC(4,9) RC(4,10) RC(4,11) + >; + }; + + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + col-gpios + = <&gpio1 11 GPIO_ACTIVE_HIGH> + , <&gpio1 10 GPIO_ACTIVE_HIGH> + , <&gpio1 13 GPIO_ACTIVE_HIGH> + , <&gpio1 15 GPIO_ACTIVE_HIGH> + , <&gpio0 3 GPIO_ACTIVE_HIGH> + , <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio0 28 GPIO_ACTIVE_HIGH> + , <&gpio0 29 GPIO_ACTIVE_HIGH> + , <&gpio0 30 GPIO_ACTIVE_HIGH> + , <&gpio0 31 GPIO_ACTIVE_HIGH> + , <&gpio0 5 GPIO_ACTIVE_HIGH> + , <&gpio0 7 GPIO_ACTIVE_HIGH> + , <&gpio1 9 GPIO_ACTIVE_HIGH> + , <&gpio0 12 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 23 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +}; diff --git a/app/boards/arm/bt60/bt60_v1_hs.keymap b/app/boards/arm/bt60/bt60_v1_hs.keymap new file mode 100644 index 00000000..6e62e1bb --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_hs.keymap @@ -0,0 +1,37 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + // ------------------------------------------------------------------------------------------ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP | DEL + // | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | | | + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | + // | CTL | WIN | ALT | SPACE | ALT | 1 | MENU | CTRL | + // ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &bt BT_CLR + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH + &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &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 RSHFT + &kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp K_CMENU &kp RCTRL + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + raise { + 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 DEL &trans + &trans &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &reset + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader + &kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &trans &trans &trans &trans &trans &kp END &kp PG_DN &kp C_NEXT + &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &bt BT_CLR + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + }; +}; diff --git a/app/boards/arm/bt60/bt60_v1_hs.yaml b/app/boards/arm/bt60/bt60_v1_hs.yaml new file mode 100644 index 00000000..5a73753b --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_hs.yaml @@ -0,0 +1,15 @@ +identifier: bt60_v1_hs +name: BT60 V1 Hotswap +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/bt60/bt60_v1_hs.zmk.yml b/app/boards/arm/bt60/bt60_v1_hs.zmk.yml new file mode 100644 index 00000000..bc9acea4 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_hs.zmk.yml @@ -0,0 +1,12 @@ +file_format: "1" +id: bt60_v1_hs +name: BT60 V1 Hotswap +type: board +arch: arm +features: + - keys + - encoder +outputs: + - usb + - ble +url: https://polarityworks.com diff --git a/app/boards/arm/bt60/bt60_v1_hs_defconfig b/app/boards/arm/bt60/bt60_v1_hs_defconfig new file mode 100644 index 00000000..27a22490 --- /dev/null +++ b/app/boards/arm/bt60/bt60_v1_hs_defconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BT60_V1_HS=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +# encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y From b8774103798fb24b07b8987ccb89ef9b2cb892d4 Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Sun, 28 Nov 2021 22:31:10 +0000 Subject: [PATCH 06/10] fix(boards): BT60 Formatting tweaks --- app/boards/arm/bt60/bt60.dtsi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/boards/arm/bt60/bt60.dtsi b/app/boards/arm/bt60/bt60.dtsi index 48e4128b..d5109e76 100644 --- a/app/boards/arm/bt60/bt60.dtsi +++ b/app/boards/arm/bt60/bt60.dtsi @@ -10,7 +10,7 @@ / { model = "BT60"; - compatible = "bt60"; + compatible = "polarityworks,bt60"; chosen { zephyr,code-partition = &code_partition; @@ -21,20 +21,20 @@ }; sensors { - compatible = "zmk,keymap-sensors"; - sensors = <&left_encoder>; + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder>; }; -left_encoder: encoder_left { - compatible = "alps,ec11"; - label = "LEFT_ENCODER"; - a-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; - b-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; - resolution = <4>; - status = "okay"; - }; + left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "okay"; + }; leds { From c4ad3bc5dcfdf01f86b7538b42b7546487a694b0 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 1 Dec 2021 16:50:50 -0500 Subject: [PATCH 07/10] fix(docs): Make the modifier function examples clearer. * Ensure the list of available modifier functions is clearly shown as macros, not as basic defines. --- docs/docs/codes/modifiers.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/codes/modifiers.mdx b/docs/docs/codes/modifiers.mdx index c573a670..483e34af 100644 --- a/docs/docs/codes/modifiers.mdx +++ b/docs/docs/codes/modifiers.mdx @@ -41,6 +41,6 @@ These functions take the form: `XX(code)` - Some basic codes already include a modifier function in their definition: - `DOLLAR` = `LS(NUMBER_4)` - There are left- and right-handed versions of each modifier (also see table above): - - `LS`, `LC`, `LA`, `LG`, `RS`, `RC`, `RA`, `RG` + - `LS(x)`, `LC(x)`, `LA(x)`, `LG(x)`, `RS(x)`, `RC(x)`, `RA(x)`, `RG(x)` - Modified keys can safely be rolled-over. Modifier functions are released when another key is pressed. - Press `&kp LS(A)`, then press `&kp B`, release `&kp LS(A)` and release `&kp B` results in **Ab**. Only the A is capitalized. From 6ef1e7034ffaed14378e6194152269ed9ed5bdd1 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Mon, 29 Nov 2021 19:34:40 +0000 Subject: [PATCH 08/10] fix(hid): Implicit mods on non-key page events * Properly send the KEY usage page report for modifier changes when there are state changes to other usages pages that include implicit modifiers. --- app/src/hid.c | 25 +++++++++++++++++-------- app/src/hid_listener.c | 41 +++++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/app/src/hid.c b/app/src/hid.c index b524b09f..d6c63e1d 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -26,14 +26,17 @@ static zmk_mod_flags_t explicit_modifiers = 0; LOG_DBG("Modifiers set to 0x%02X", keyboard_report.body.modifiers); \ } +#define GET_MODIFIERS (keyboard_report.body.modifiers) + zmk_mod_flags_t zmk_hid_get_explicit_mods() { return explicit_modifiers; } int zmk_hid_register_mod(zmk_mod_t modifier) { explicit_modifier_counts[modifier]++; LOG_DBG("Modifier %d count %d", modifier, explicit_modifier_counts[modifier]); WRITE_BIT(explicit_modifiers, modifier, true); + zmk_mod_flags_t current = GET_MODIFIERS; SET_MODIFIERS(explicit_modifiers); - return 0; + return current == GET_MODIFIERS ? 0 : 1; } int zmk_hid_unregister_mod(zmk_mod_t modifier) { @@ -47,26 +50,30 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) { LOG_DBG("Modifier %d released", modifier); WRITE_BIT(explicit_modifiers, modifier, false); } + zmk_mod_flags_t current = GET_MODIFIERS; SET_MODIFIERS(explicit_modifiers); - return 0; + return current == GET_MODIFIERS ? 0 : 1; } int zmk_hid_register_mods(zmk_mod_flags_t modifiers) { + int ret = 0; for (zmk_mod_t i = 0; i < 8; i++) { if (modifiers & (1 << i)) { - zmk_hid_register_mod(i); + ret += zmk_hid_register_mod(i); } } - return 0; + return ret; } int zmk_hid_unregister_mods(zmk_mod_flags_t modifiers) { + int ret = 0; for (zmk_mod_t i = 0; i < 8; i++) { if (modifiers & (1 << i)) { - zmk_hid_unregister_mod(i); + ret += zmk_hid_unregister_mod(i); } } - return 0; + + return ret; } #if IS_ENABLED(CONFIG_ZMK_HID_REPORT_TYPE_NKRO) @@ -130,13 +137,15 @@ static inline int deselect_keyboard_usage(zmk_key_t usage) { } int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers) { + zmk_mod_flags_t current = GET_MODIFIERS; SET_MODIFIERS(explicit_modifiers | implicit_modifiers); - return 0; + return current == GET_MODIFIERS ? 0 : 1; } int zmk_hid_implicit_modifiers_release() { + zmk_mod_flags_t current = GET_MODIFIERS; SET_MODIFIERS(explicit_modifiers); - return 0; + return current == GET_MODIFIERS ? 0 : 1; } int zmk_hid_keyboard_press(zmk_key_t code) { diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index d582c169..c0a82c34 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -17,56 +17,77 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include static int hid_listener_keycode_pressed(const struct zmk_keycode_state_changed *ev) { - int err; + int err, explicit_mods_changed, implicit_mods_changed; + LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X", ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers); switch (ev->usage_page) { case HID_USAGE_KEY: err = zmk_hid_keyboard_press(ev->keycode); - if (err) { + if (err < 0) { LOG_ERR("Unable to press keycode"); return err; } break; case HID_USAGE_CONSUMER: err = zmk_hid_consumer_press(ev->keycode); - if (err) { + if (err < 0) { LOG_ERR("Unable to press keycode"); return err; } break; } - zmk_hid_register_mods(ev->explicit_modifiers); - zmk_hid_implicit_modifiers_press(ev->implicit_modifiers); + explicit_mods_changed = zmk_hid_register_mods(ev->explicit_modifiers); + implicit_mods_changed = zmk_hid_implicit_modifiers_press(ev->implicit_modifiers); + if (ev->usage_page != HID_USAGE_KEY && + (explicit_mods_changed > 0 || implicit_mods_changed > 0)) { + err = zmk_endpoints_send_report(HID_USAGE_KEY); + if (err < 0) { + LOG_ERR("Failed to send key report for changed mofifiers for consumer page event (%d)", + err); + } + } + return zmk_endpoints_send_report(ev->usage_page); } static int hid_listener_keycode_released(const struct zmk_keycode_state_changed *ev) { - int err; + int err, explicit_mods_changed, implicit_mods_changed; + LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X", ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers); switch (ev->usage_page) { case HID_USAGE_KEY: err = zmk_hid_keyboard_release(ev->keycode); - if (err) { + if (err < 0) { LOG_ERR("Unable to release keycode"); return err; } break; case HID_USAGE_CONSUMER: err = zmk_hid_consumer_release(ev->keycode); - if (err) { + if (err < 0) { LOG_ERR("Unable to release keycode"); return err; } } - zmk_hid_unregister_mods(ev->explicit_modifiers); + + explicit_mods_changed = zmk_hid_unregister_mods(ev->explicit_modifiers); // There is a minor issue with this code. // If LC(A) is pressed, then LS(B), then LC(A) is released, the shift for B will be released // prematurely. This causes if LS(B) to repeat like Bbbbbbbb when pressed for a long time. // Solving this would require keeping track of which key's implicit modifiers are currently // active and only releasing modifiers at that time. - zmk_hid_implicit_modifiers_release(); + implicit_mods_changed = zmk_hid_implicit_modifiers_release(); + ; + if (ev->usage_page != HID_USAGE_KEY && + (explicit_mods_changed > 0 || implicit_mods_changed > 0)) { + err = zmk_endpoints_send_report(HID_USAGE_KEY); + if (err < 0) { + LOG_ERR("Failed to send key report for changed mofifiers for consumer page event (%d)", + err); + } + } return zmk_endpoints_send_report(ev->usage_page); } From 9148ffd05d409639a7d4088bc78bc73008316a7f Mon Sep 17 00:00:00 2001 From: toddmok <91770979+toddmok@users.noreply.github.com> Date: Thu, 2 Dec 2021 12:51:27 -0600 Subject: [PATCH 09/10] feat(shields) Add Redox Shield Support (#1002) * Add redox shield support * typo * Pull request fixes * requested changes add underglow, add copyright, remove display * remove because of no display * comment fix * bt clear --- app/boards/shields/redox/Kconfig.defconfig | 18 ++++ app/boards/shields/redox/Kconfig.shield | 7 ++ .../shields/redox/boards/nice_nano.overlay | 34 ++++++++ app/boards/shields/redox/redox.conf | 3 + app/boards/shields/redox/redox.dtsi | 48 +++++++++++ app/boards/shields/redox/redox.keymap | 82 +++++++++++++++++++ app/boards/shields/redox/redox.zmk.yml | 12 +++ app/boards/shields/redox/redox_left.overlay | 19 +++++ app/boards/shields/redox/redox_right.overlay | 23 ++++++ 9 files changed, 246 insertions(+) create mode 100644 app/boards/shields/redox/Kconfig.defconfig create mode 100644 app/boards/shields/redox/Kconfig.shield create mode 100644 app/boards/shields/redox/boards/nice_nano.overlay create mode 100644 app/boards/shields/redox/redox.conf create mode 100644 app/boards/shields/redox/redox.dtsi create mode 100644 app/boards/shields/redox/redox.keymap create mode 100644 app/boards/shields/redox/redox.zmk.yml create mode 100644 app/boards/shields/redox/redox_left.overlay create mode 100644 app/boards/shields/redox/redox_right.overlay diff --git a/app/boards/shields/redox/Kconfig.defconfig b/app/boards/shields/redox/Kconfig.defconfig new file mode 100644 index 00000000..06554def --- /dev/null +++ b/app/boards/shields/redox/Kconfig.defconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT +if SHIELD_REDOX_LEFT + +config ZMK_KEYBOARD_NAME + default "Redox" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +endif + +if SHIELD_REDOX_LEFT || SHIELD_REDOX_RIGHT + +config ZMK_SPLIT + default y + +endif \ No newline at end of file diff --git a/app/boards/shields/redox/Kconfig.shield b/app/boards/shields/redox/Kconfig.shield new file mode 100644 index 00000000..2df91c11 --- /dev/null +++ b/app/boards/shields/redox/Kconfig.shield @@ -0,0 +1,7 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT +config SHIELD_REDOX_LEFT + def_bool $(shields_list_contains,redox_left) + +config SHIELD_REDOX_RIGHT + def_bool $(shields_list_contains,redox_right) diff --git a/app/boards/shields/redox/boards/nice_nano.overlay b/app/boards/shields/redox/boards/nice_nano.overlay new file mode 100644 index 00000000..b81ba195 --- /dev/null +++ b/app/boards/shields/redox/boards/nice_nano.overlay @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 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 = <5>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/redox/redox.conf b/app/boards/shields/redox/redox.conf new file mode 100644 index 00000000..a1837ef9 --- /dev/null +++ b/app/boards/shields/redox/redox.conf @@ -0,0 +1,3 @@ +# Uncomment the following lines to enable the Redox RGB Underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/app/boards/shields/redox/redox.dtsi b/app/boards/shields/redox/redox.dtsi new file mode 100644 index 00000000..4825a39f --- /dev/null +++ b/app/boards/shields/redox/redox.dtsi @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 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 | SW13 | | SW13 | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | +// | SW14 | SW15 | SW16 | SW17 | SW18 | SW19 | SW20 | | SW20 | SW19 | SW18 | SW17 | SW16 | SW15 | SW14 | +// | SW21 | SW22 | SW23 | SW24 | SW25 | SW26 | SW27 | SW28 | | SW28 | SW27 | SW26 | SW25 | SW24 | SW23 | SW22 | SW21 | +// | SW29 | SW30 | SW31 | SW32 | SW33 | SW34 | SW35 | | SW35 | SW34 | SW33 | SW32 | SW31 | SW30 | SW29 | + 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(0,6) RC(0,7) 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(1,6) RC(1,7) 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(2,6) RC(3,6) RC(3,7) RC(2,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 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + +}; diff --git a/app/boards/shields/redox/redox.keymap b/app/boards/shields/redox/redox.keymap new file mode 100644 index 00000000..aed22c42 --- /dev/null +++ b/app/boards/shields/redox/redox.keymap @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap" ; + + default_layer { +// -------------------------------------------------------------------------------------------------------------------------------- +// | ESC | 1 | 2 | 3 | 4 | 5 | --- | 6 | 7 | 8 | 9 | 0 | BKSP | +// | TAB | Q | W | E | R | T | ( | --- | ) | Y | U | I | O | P | - | +// | CTRL | A | S | D | F | G | [ | --- | ] | H | J | K | L | ; | ' | +// | SHIFT | Z | X | C | V | B | PG_UP | PG_DOWN | --- | HOME | END | N | M | , | . | / | SHFT(RET) | +// | CRTL | ALT | GUI | LOWER | GUI | LOWER | SPACE | --- | DEL | SPACE | RAISE | LEFT | DOWN | UP | RIGHT | + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp LPAR &kp RPAR &kp Y &kp U &kp I &kp O &kp P &kp MINUS + &kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp LBKT &kp RBKT &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 PG_UP &kp PG_DN &kp HOME &kp END &kp N &kp M &kp COMMA &kp DOT &kp FSLH &mt RSHFT RET + &kp LCTRL &kp LALT &kp LGUI &mo 3 &kp LGUI &mo 1 &kp SPACE &kp DEL &kp SPACE &mo 2 &kp LEFT &kp DOWN &kp UP &kp RIGHT + >; + + }; + + lower_layer { +// -------------------------------------------------------------------------------------------------------------------------- +// | ESC | 1 | 2 | 3 | 4 | 5 | --- | 6 | 7 | 8 | 9 | 0 | DEL | +// | ESC | 1 | 2 | 3 | 4 | 5 | ( | --- | ) | 6 | 7 | 8 | 9 | 0 | DEL | +// | CTRL | - | = | [ | ] | \ | [ | --- | ] | * | 4 | 5 | 6 | + | - | +// | SHIFT | ESC | GUI | COPY | PASTE | | PG_UP | PG_DOWN | --- | HOME | END | \ | 1 | 2 | 3 | RET | RET | +// | CRTL | ALT | GUI | LOWER | GUI | LOWER | SPACE | --- | DEL | 0 | RAISE | LEFT | DOWN | UP | RIGHT | + bindings = < + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &trans &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL + &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &trans &trans &kp KP_MULTIPLY &kp N4 &kp N5 &kp N6 &kp KP_PLUS &kp KP_MINUS + &trans &kp ESC &kp LGUI &kp LG(C) &kp LG(V) &kp GRAVE &trans &trans &trans &trans &kp KP_DIVIDE &kp N1 &kp N2 &kp N3 &kp RET &kp RET + &trans &trans &trans &trans &trans &trans &trans &trans &kp N0 &mo 3 &trans &trans &trans &trans + >; + }; + + raise_layer { +// ---------------------------------------------------------------------------------------------------------------------------- +// | ESC | 1 | 2 | 3 | 4 | 5 | --- | 6 | 7 | 8 | 9 | 0 | DEL | +// | ESC | ! | @ | # | $ | % | ( | --- | ) | ^ | & | * | ( | ) | DEL | +// | CTRL | _ | + | { | } | "|" | [ | --- | ] | HOME | PGUP | PRSC | UP | ` | ~ | +// | SHIFT | ESC | GUI | ( | ) | | PG_UP | PG_DOWN | --- | HOME | END | END | PGDN | LEFT | DOWN | RIGHT | RET | +// | CRTL | ALT | GUI | LOWER | GUI | LOWER | SPACE | --- | DEL | SPACE | RAISE | LEFT | DOWN | UP | RIGHT | + bindings = < + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &kp ESC &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &trans &trans &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &kp DEL + &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &trans &trans &kp HOME &kp PG_UP &kp PSCRN &kp UP &kp GRAVE &kp TILDE + &trans &kp ESC &kp LGUI &kp LPAR &kp RPAR &kp TILDE &trans &trans &trans &trans &kp END &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp RET + &trans &trans &trans &mo 3 &trans &mo 3 &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + + adjust_layer { +// ----------------------------------------------------------------------------------------- +// | F1 | F2 | F3 | F4 | F5 | F6 | --- | F7 | F8 | F9 | F10 | F11 | F12 | +// | TAB | | | | | | BOOTL | --- | ) | BT1 | BT2 | BT3 | BT4 | BT5 | OUTPUT TGL | +// | CTRL | MUTE | Vol Dn | Vol Up | Play/Pause | | RESET | --- | ] | F1 | F2 | F3 | F4 | F5 | F6 | +// | SHIFT | PSCRN | PSCRN | CAPS | | | PG_UP | PG_DOWN | --- | HOME | END | F7 | F8 | F9 | F10 | F11 | F12 | +// | CRTL | ALT | GUI | LOWER | GUI | LOWER | SPACE | --- | DEL | SPACE | RAISE | LEFT | DOWN | UP | RIGHT | + bindings = < + &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 &none &none &none &none &none &bootloader &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &out OUT_TOG + &trans &kp K_MUTE &kp C_VOL_DN &kp C_VOL_UP &kp C_PLAY_PAUSE &none &reset &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 + &trans &kp PSCRN &kp PSCRN &kp CLCK &none &none &trans &trans &trans &trans &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 &trans + >; + }; + }; +}; diff --git a/app/boards/shields/redox/redox.zmk.yml b/app/boards/shields/redox/redox.zmk.yml new file mode 100644 index 00000000..fd22971d --- /dev/null +++ b/app/boards/shields/redox/redox.zmk.yml @@ -0,0 +1,12 @@ +file_format: "1" +id: redox +name: Redox +type: shield +url: https://github.com/mattdibi/redox-keyboard +requires: [pro_micro] +features: + - keys + - underglow +siblings: + - redox_left + - redox_right diff --git a/app/boards/shields/redox/redox_left.overlay b/app/boards/shields/redox/redox_left.overlay new file mode 100644 index 00000000..322dca79 --- /dev/null +++ b/app/boards/shields/redox/redox_left.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "redox.dtsi" + +&kscan0 { + col-gpios + = <&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> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/app/boards/shields/redox/redox_right.overlay b/app/boards/shields/redox/redox_right.overlay new file mode 100644 index 00000000..f2dcfed0 --- /dev/null +++ b/app/boards/shields/redox/redox_right.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "redox.dtsi" + +&default_transform { + col-offset = <7>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 10 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + ; +}; From a8c7cf4f19ad80eb8e6148f872d3a9584b25befc Mon Sep 17 00:00:00 2001 From: Kyle McCreery Date: Thu, 2 Dec 2021 18:21:35 -0500 Subject: [PATCH 10/10] feat(boards): Add S40NC board definition (#1021) * initial commit * initial commit * Encode, OLED, and RGB Nice Nano support added as well as refining default keymap. * tweaking keymap * Prepared murphpad for PR. Includes adding support for second encoder, OLED, and underglow RGB * Enabled OLED by default. * Initial commit with settings updated to match schematic. * Removing test directories. * removed naked60 config files * Fixed dogbone definitions to be full working for murphpad. * Preparing S40NC for PR * Removed the murphpad test files that were not supposed to be a part of this PR. * Changing licensing to be from The ZMK Contributors. * Changed the licensing in the keymap file to be from The ZMK Contributors * Update s40nc.keymap --- app/boards/arm/s40nc/CMakeLists.txt | 8 ++ app/boards/arm/s40nc/Kconfig.board | 6 ++ app/boards/arm/s40nc/Kconfig.defconfig | 31 ++++++ app/boards/arm/s40nc/README.md | 9 ++ app/boards/arm/s40nc/board.cmake | 7 ++ app/boards/arm/s40nc/s40nc.dts | 139 +++++++++++++++++++++++++ app/boards/arm/s40nc/s40nc.keymap | 58 +++++++++++ app/boards/arm/s40nc/s40nc.yaml | 14 +++ app/boards/arm/s40nc/s40nc.zmk.yml | 11 ++ app/boards/arm/s40nc/s40nc_defconfig | 21 ++++ 10 files changed, 304 insertions(+) create mode 100644 app/boards/arm/s40nc/CMakeLists.txt create mode 100644 app/boards/arm/s40nc/Kconfig.board create mode 100644 app/boards/arm/s40nc/Kconfig.defconfig create mode 100644 app/boards/arm/s40nc/README.md create mode 100644 app/boards/arm/s40nc/board.cmake create mode 100644 app/boards/arm/s40nc/s40nc.dts create mode 100644 app/boards/arm/s40nc/s40nc.keymap create mode 100644 app/boards/arm/s40nc/s40nc.yaml create mode 100644 app/boards/arm/s40nc/s40nc.zmk.yml create mode 100644 app/boards/arm/s40nc/s40nc_defconfig diff --git a/app/boards/arm/s40nc/CMakeLists.txt b/app/boards/arm/s40nc/CMakeLists.txt new file mode 100644 index 00000000..f833ff2e --- /dev/null +++ b/app/boards/arm/s40nc/CMakeLists.txt @@ -0,0 +1,8 @@ +set_property(GLOBAL APPEND PROPERTY extra_post_build_commands + COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py + -c + -b 0x1000 + -f 0xADA52840 + -o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 + ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin +) diff --git a/app/boards/arm/s40nc/Kconfig.board b/app/boards/arm/s40nc/Kconfig.board new file mode 100644 index 00000000..673e3b24 --- /dev/null +++ b/app/boards/arm/s40nc/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_S40NC + bool "S40NC" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/s40nc/Kconfig.defconfig b/app/boards/arm/s40nc/Kconfig.defconfig new file mode 100644 index 00000000..0f407151 --- /dev/null +++ b/app/boards/arm/s40nc/Kconfig.defconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if BOARD_S40NC + +config ZMK_KEYBOARD_NAME + default "S40NC" + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +config ZMK_BATTERY_VOLTAGE_DIVIDER + default y + +endif # BOARD_S40NC diff --git a/app/boards/arm/s40nc/README.md b/app/boards/arm/s40nc/README.md new file mode 100644 index 00000000..32db57e9 --- /dev/null +++ b/app/boards/arm/s40nc/README.md @@ -0,0 +1,9 @@ +# S40NC +![S40NC](https://i.imgur.com/fk8587n.jpg) + +Shorty40NoCordy (S40NC) is a limited run 40% bluetooth keyboard originally made and sold by MechWild. + +## Building S40NC ZMK firmware +``` +west build -p -b s40nc +``` diff --git a/app/boards/arm/s40nc/board.cmake b/app/boards/arm/s40nc/board.cmake new file mode 100644 index 00000000..c50b2d9d --- /dev/null +++ b/app/boards/arm/s40nc/board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +set(OPENOCD_NRF5_SUBFAMILY nrf52) +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) diff --git a/app/boards/arm/s40nc/s40nc.dts b/app/boards/arm/s40nc/s40nc.dts new file mode 100644 index 00000000..58e0c2de --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.dts @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include + +/ { + model = "S40NC"; + compatible = "s40nc"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <12>; + 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(0,10) RC(0,11) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,11) + RC(2,0) 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(3,0) RC(3,1) RC(3,2) RC(3,4) RC(3,6) RC(3,8) RC(3,9) RC(3,10) RC(3,11) + >; + }; + + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&gpio1 2 GPIO_ACTIVE_HIGH> + , <&gpio1 1 GPIO_ACTIVE_HIGH> + , <&gpio1 3 GPIO_ACTIVE_HIGH> + , <&gpio1 0 GPIO_ACTIVE_HIGH> + , <&gpio0 22 GPIO_ACTIVE_HIGH> + , <&gpio1 15 GPIO_ACTIVE_HIGH> + , <&gpio0 3 GPIO_ACTIVE_HIGH> + , <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio0 28 GPIO_ACTIVE_HIGH> + , <&gpio0 29 GPIO_ACTIVE_HIGH> + , <&gpio0 30 GPIO_ACTIVE_HIGH> + , <&gpio0 31 GPIO_ACTIVE_HIGH> + ; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 2>; + output-ohms = <2000000>; + full-ohms = <(2000000 + 820000)>; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&usbd { + status = "okay"; +}; + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "mbr"; + reg = <0x00000000 0x00001000>; + }; + + code_partition: partition@1000 { + label = "code_partition"; + reg = <0x00001000 0x000d3000>; + }; + + /* + * The flash starting at 0x000d4000 and ending at + * 0x000f3fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@d4000 { + label = "storage"; + reg = <0x000d4000 0x00020000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; +}; diff --git a/app/boards/arm/s40nc/s40nc.keymap b/app/boards/arm/s40nc/s40nc.keymap new file mode 100644 index 00000000..d7f349d9 --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.keymap @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +#define DEFAULT 0 +#define LOWER 1 +#define RAISE 2 +#define CONTROL 3 + +/ { + 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 + &mo LOWER &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp ENTER + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp FSLH &kp UP &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT < LOWER SPACE < CONTROL SPACE < RAISE SPACE &kp LEFT &kp DOWN &kp RIGHT + >; + }; + + lower_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 DEL + &kp PSCRN &kp MINUS &kp EQUAL &trans &trans &trans &trans &kp LBKT &kp RBKT &kp SEMI &kp APOS + &trans &trans &trans &trans &trans &trans &trans &kp COMMA &kp DOT &kp PG_UP &kp BSLH + &trans &trans &trans &kp TAB &kp TAB &kp TAB &kp HOME &kp PG_DN &kp END + >; + }; + + raise_layer { + bindings = < + &kp TILDE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &trans + &kp PSCRN &kp UNDER &kp PLUS &trans &trans &trans &trans &kp LBRC &kp RBRC &kp COLON &kp DQT + &trans &trans &trans &trans &trans &trans &trans &kp LT &kp GT &kp PG_UP &kp PIPE + &trans &trans &trans &kp TAB &kp TAB &kp TAB &kp HOME &kp PG_DN &kp END + >; + }; + + control_layer { + bindings = < + &bt BT_CLR &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp C_PP + &bt BT_SEL 0 &kp F11 &kp F12 &trans &trans &trans &trans &trans &trans &trans &kp K_LOCK + &bt BT_SEL 1 &out OUT_USB &kp CAPS &kp KP_NUM &kp SLCK &trans &trans &kp COMMA &kp DOT &kp K_VOL_UP &kp K_MUTE + &bt BT_SEL 2 &out OUT_BLE &kp PAUSE_BREAK &reset &trans &bootloader &kp C_BRI_DN &kp K_VOL_DN &kp C_BRI_UP + >; + }; + }; +}; + diff --git a/app/boards/arm/s40nc/s40nc.yaml b/app/boards/arm/s40nc/s40nc.yaml new file mode 100644 index 00000000..1fb23ee3 --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.yaml @@ -0,0 +1,14 @@ +identifier: s40nc +name: S40NC +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/s40nc/s40nc.zmk.yml b/app/boards/arm/s40nc/s40nc.zmk.yml new file mode 100644 index 00000000..57b30eca --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.zmk.yml @@ -0,0 +1,11 @@ +file_format: "1" +id: s40nc +name: S40NC +type: board +arch: arm +features: + - keys +outputs: + - usb + - ble +url: https://mechwild.com diff --git a/app/boards/arm/s40nc/s40nc_defconfig b/app/boards/arm/s40nc/s40nc_defconfig new file mode 100644 index 00000000..e9bbfc17 --- /dev/null +++ b/app/boards/arm/s40nc/s40nc_defconfig @@ -0,0 +1,21 @@ +# Copyright (c) 2021 The ZMK Contributors +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_S40NC=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y