summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/boards/arm/nrf52840_m2/CMakeLists.txt13
-rw-r--r--app/boards/arm/nrf52840_m2/Kconfig10
-rw-r--r--app/boards/arm/nrf52840_m2/Kconfig.board10
-rw-r--r--app/boards/arm/nrf52840_m2/Kconfig.defconfig30
-rw-r--r--app/boards/arm/nrf52840_m2/board.cmake9
-rw-r--r--app/boards/arm/nrf52840_m2/nrf52840_m2.dts97
-rw-r--r--app/boards/arm/nrf52840_m2/nrf52840_m2.yaml15
-rw-r--r--app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig23
-rw-r--r--app/boards/shields/clueboard_california/clueboard_california.keymap6
-rw-r--r--app/boards/shields/corne/corne.keymap6
-rw-r--r--app/boards/shields/iris/iris.keymap2
-rw-r--r--app/boards/shields/kyria/kyria.keymap6
-rw-r--r--app/boards/shields/lily58/lily58.keymap6
-rw-r--r--app/boards/shields/m60/Kconfig.defconfig11
-rw-r--r--app/boards/shields/m60/Kconfig.shield7
-rw-r--r--app/boards/shields/m60/m60.conf0
-rw-r--r--app/boards/shields/m60/m60.keymap42
-rw-r--r--app/boards/shields/m60/m60.overlay66
-rw-r--r--app/boards/shields/m60/readme.md14
-rw-r--r--app/boards/shields/romac/romac.keymap2
-rw-r--r--app/boards/shields/sofle/sofle.keymap6
-rw-r--r--app/boards/shields/splitreus62/splitreus62.keymap3
-rw-r--r--app/drivers/zephyr/kscan_gpio_direct.c6
-rw-r--r--app/src/kscan_composite.c12
-rw-r--r--docs/docs/dev-setup.md112
-rw-r--r--docs/static/setup.ps110
-rw-r--r--docs/static/setup.sh6
27 files changed, 455 insertions, 75 deletions
diff --git a/app/boards/arm/nrf52840_m2/CMakeLists.txt b/app/boards/arm/nrf52840_m2/CMakeLists.txt
new file mode 100644
index 0000000..84b2ab9
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/CMakeLists.txt
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+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/nrf52840_m2/Kconfig b/app/boards/arm/nrf52840_m2/Kconfig
new file mode 100644
index 0000000..faff492
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/Kconfig
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+config BOARD_ENABLE_DCDC
+ bool "Enable DCDC mode"
+ select SOC_DCDC_NRF52X
+ default y
+ depends on BOARD_NRF52840_M2
diff --git a/app/boards/arm/nrf52840_m2/Kconfig.board b/app/boards/arm/nrf52840_m2/Kconfig.board
new file mode 100644
index 0000000..6ade68c
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/Kconfig.board
@@ -0,0 +1,10 @@
+# Maker Diary nrf52840 M.2 board configuration
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+config BOARD_NRF52840_M2
+ bool "nrf52480_m2"
+ depends on SOC_NRF52840_QIAA
+
diff --git a/app/boards/arm/nrf52840_m2/Kconfig.defconfig b/app/boards/arm/nrf52840_m2/Kconfig.defconfig
new file mode 100644
index 0000000..98fcd08
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/Kconfig.defconfig
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+if BOARD_NRF52840_M2
+
+config BOARD
+ default "nrf52480_m2"
+
+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
+
+endif # BOARD_NRF52840_M2
diff --git a/app/boards/arm/nrf52840_m2/board.cmake b/app/boards/arm/nrf52840_m2/board.cmake
new file mode 100644
index 0000000..55b44e2
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/board.cmake
@@ -0,0 +1,9 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
+
+include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
+include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2.dts b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts
new file mode 100644
index 0000000..fb5b0ff
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ * SPDX-License-Identifier: MIT
+ */
+
+/dts-v1/;
+#include <nordic/nrf52840_qiaa.dtsi>
+
+/ {
+ model = "Makerdiary nRF52840 M.2 module";
+ compatible = "makerdiary,nrf52840_m2";
+
+ chosen {
+ zephyr,code-partition = &code_partition;
+ //zephyr,console = &uart0;
+ //zephyr,bt-mon-uart = &uart0;
+ //zephyr,bt-c2h-uart = &uart0;
+ zephyr,sram = &sram0;
+ zephyr,flash = &flash0;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+ red_led: led_0 {
+ gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+ label = "Red LED";
+ };
+ green_led: led_1 {
+ gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+ label = "Green LED";
+ };
+ blue_led: led_2 {
+ gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+ label = "Blue LED";
+ };
+ };
+
+};
+
+&gpio0 {
+ status = "okay";
+};
+
+&gpio1 {
+ status = "okay";
+};
+
+&uart0 {
+ compatible = "nordic,nrf-uart";
+ status = "okay";
+ current-speed = <115200>;
+ tx-pin = <16>;
+ rx-pin = <15>;
+ rts-pin = <14>;
+ cts-pin = <13>;
+};
+
+&usbd {
+ compatible = "nordic,nrf-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>;
+
+ boot_partition: partition@0 {
+ label = "adafruit_boot";
+ reg = <0x000000000 0x0000C000>;
+ };
+ code_partition: partition@26000 {
+ label = "code_partition";
+ reg = <0x00026000 0x000d2000>;
+ };
+
+ /*
+ * The flash starting at 0x000f8000 and ending at
+ * 0x000fffff is reserved for use by the application.
+ */
+
+ /*
+ * Storage partition will be used by FCB/LittleFS/NVS
+ * if enabled.
+ */
+ storage_partition: partition@f8000 {
+ label = "storage";
+ reg = <0x000f8000 0x00008000>;
+ };
+ };
+};
diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2.yaml b/app/boards/arm/nrf52840_m2/nrf52840_m2.yaml
new file mode 100644
index 0000000..0a999bb
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/nrf52840_m2.yaml
@@ -0,0 +1,15 @@
+identifier: nrf52840_m2
+name: Makerdiary nRF52840 M.2 module
+type: mcu
+arch: arm
+toolchain:
+ - zephyr
+ - gnuarmemb
+ - xtools
+supported:
+ - adc
+ - usb_device
+ - ble
+ - ieee802154
+ - pwm
+ - watchdog
diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig b/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig
new file mode 100644
index 0000000..e74438b
--- /dev/null
+++ b/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+CONFIG_SOC_SERIES_NRF52X=y
+CONFIG_SOC_NRF52840_QIAA=y
+CONFIG_BOARD_NRF52840_M2=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
diff --git a/app/boards/shields/clueboard_california/clueboard_california.keymap b/app/boards/shields/clueboard_california/clueboard_california.keymap
index 7a84b11..44a0b07 100644
--- a/app/boards/shields/clueboard_california/clueboard_california.keymap
+++ b/app/boards/shields/clueboard_california/clueboard_california.keymap
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
diff --git a/app/boards/shields/corne/corne.keymap b/app/boards/shields/corne/corne.keymap
index 5f0f15f..64d4a00 100644
--- a/app/boards/shields/corne/corne.keymap
+++ b/app/boards/shields/corne/corne.keymap
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
diff --git a/app/boards/shields/iris/iris.keymap b/app/boards/shields/iris/iris.keymap
index 6042ad7..8b06b1b 100644
--- a/app/boards/shields/iris/iris.keymap
+++ b/app/boards/shields/iris/iris.keymap
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Pete Johanson, Kurtis Lew
+ * Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
diff --git a/app/boards/shields/kyria/kyria.keymap b/app/boards/shields/kyria/kyria.keymap
index f689ef6..ac0d13f 100644
--- a/app/boards/shields/kyria/kyria.keymap
+++ b/app/boards/shields/kyria/kyria.keymap
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
diff --git a/app/boards/shields/lily58/lily58.keymap b/app/boards/shields/lily58/lily58.keymap
index 61c19f8..997a124 100644
--- a/app/boards/shields/lily58/lily58.keymap
+++ b/app/boards/shields/lily58/lily58.keymap
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
diff --git a/app/boards/shields/m60/Kconfig.defconfig b/app/boards/shields/m60/Kconfig.defconfig
new file mode 100644
index 0000000..e31d5a5
--- /dev/null
+++ b/app/boards/shields/m60/Kconfig.defconfig
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+if SHIELD_M60
+
+config ZMK_KEYBOARD_NAME
+ default "m60"
+
+endif
diff --git a/app/boards/shields/m60/Kconfig.shield b/app/boards/shields/m60/Kconfig.shield
new file mode 100644
index 0000000..47a28e2
--- /dev/null
+++ b/app/boards/shields/m60/Kconfig.shield
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2020 The ZMK Contributors
+# SPDX-License-Identifier: MIT
+#
+
+config SHIELD_M60
+ def_bool $(shields_list_contains,m60)
diff --git a/app/boards/shields/m60/m60.conf b/app/boards/shields/m60/m60.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/boards/shields/m60/m60.conf
diff --git a/app/boards/shields/m60/m60.keymap b/app/boards/shields/m60/m60.keymap
new file mode 100644
index 0000000..cbe356c
--- /dev/null
+++ b/app/boards/shields/m60/m60.keymap
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/keys.h>
+#include <dt-bindings/zmk/bt.h>
+
+/ {
+ keymap0: 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 | [ | ] | \ |
+// | 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 | MO(1) | WIN | CTRL |
+// ------------------------------------------------------------------------------------------
+ bindings = <
+ &kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL &kp BKSP
+ &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 SCLN &kp QUOT &kp RET
+ &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT
+ &kp LCTL &kp LGUI &kp LALT &kp SPC &kp RALT &mo 1 &kp RGUI &kp RCTL
+ >;
+ };
+
+ fn_layer {
+ bindings = <
+&kp GRAV &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bootloader
+&trans &bt BT_CLR &none &none &none &none &none &none &none &none &none &none &none &reset
+&trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LARW &kp DARW &kp UARW &kp RARW &none &none &trans
+&trans &none &none &none &none &none &none &none &none &none &none &trans
+&trans &trans &trans &trans &trans &trans &trans &trans
+ >;
+ };
+ };
+};
diff --git a/app/boards/shields/m60/m60.overlay b/app/boards/shields/m60/m60.overlay
new file mode 100644
index 0000000..babae2d
--- /dev/null
+++ b/app/boards/shields/m60/m60.overlay
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <dt-bindings/zmk/matrix-transform.h>
+
+/ {
+ chosen {
+ zmk,kscan = &kscan0;
+ zmk,matrix_transform = &default_transform;
+ };
+
+ kscan0: kscan {
+ compatible = "zmk,kscan-gpio-matrix";
+ label = "KSCAN";
+
+ diode-direction = "col2row";
+ row-gpios
+ = <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ , <&gpio0 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
+ ;
+ col-gpios
+ = <&gpio0 19 GPIO_ACTIVE_HIGH>
+ , <&gpio0 20 GPIO_ACTIVE_HIGH>
+ , <&gpio0 21 GPIO_ACTIVE_HIGH>
+ , <&gpio0 22 GPIO_ACTIVE_HIGH>
+ , <&gpio0 23 GPIO_ACTIVE_HIGH>
+ , <&gpio0 24 GPIO_ACTIVE_HIGH>
+ , <&gpio0 25 GPIO_ACTIVE_HIGH>
+ , <&gpio0 26 GPIO_ACTIVE_HIGH>
+ ;
+ };
+
+ default_transform: keymap_transform_0 {
+ compatible = "zmk,matrix-transform";
+ columns = <8>;
+ rows = <8>;
+// | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | MX13 | MX14 |
+// | MX15 | MX16 | MX17 | MX18 | MX19 | MX20 | MX21 | MX22 | MX23 | MX24 | MX25 | MX26 | MX27 | MX28 |
+// | MX29 | MX30 | MX31 | MX32 | MX33 | MX34 | MX35 | MX36 | MX37 | MX38 | MX39 | MX40 | MX41 |
+// | MX42 | MX43 | MX44 | MX45 | MX46 | MX47 | MX48 | MX49 | MX50 | MX51 | MX52 | MX53 |
+// | MX54 | MX55 | MX56 | MX57 | MX58 | MX59 | MX60 | MX61 |
+ 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(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5)
+RC(3,3) RC(3,2) RC(3,1) RC(3,0) RC(2,7) RC(2,6) RC(2,5) RC(2,4) RC(2,3) RC(2,2) RC(2,1) RC(2,0) RC(1,7) RC(1,6)
+RC(3,4) RC(3,5) RC(3,6) RC(3,7) 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(5,0)
+RC(6,4) RC(6,3) RC(6,2) RC(6,1) RC(6,0) RC(5,7) RC(5,6) RC(5,5) RC(5,4) RC(5,3) RC(5,2) RC(5,1)
+RC(6,5) RC(6,6) RC(6,7) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4)
+ >;
+ };
+
+ bt_unpair_combo: bt_unpair_combo {
+ compatible = "zmk,bt-unpair-combo";
+ key-positions = <0 53>;
+ };
+
+};
+
diff --git a/app/boards/shields/m60/readme.md b/app/boards/shields/m60/readme.md
new file mode 100644
index 0000000..e801c78
--- /dev/null
+++ b/app/boards/shields/m60/readme.md
@@ -0,0 +1,14 @@
+# [Makerdiary M60](https://wiki.makerdiary.com/m60)
+
+A 60% ANSI keyboard designed and manufactured by Makerdiary.
+http://makerdiary.com
+
+## Features
+
+- Per key RGB LED.
+- Uses makerdiary M.2 nRF52840 module
+- Matrix wiring
+
+## Hardware Notes
+
+https://wiki.makerdiary.com/m60/developer_guide/hardware/
diff --git a/app/boards/shields/romac/romac.keymap b/app/boards/shields/romac/romac.keymap
index 97ea9c5..31e1ce8 100644
--- a/app/boards/shields/romac/romac.keymap
+++ b/app/boards/shields/romac/romac.keymap
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Pete Johanson, Richard Jones
+ * Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
diff --git a/app/boards/shields/sofle/sofle.keymap b/app/boards/shields/sofle/sofle.keymap
index 1cbe742..e2ebc1a 100644
--- a/app/boards/shields/sofle/sofle.keymap
+++ b/app/boards/shields/sofle/sofle.keymap
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2020 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
diff --git a/app/boards/shields/splitreus62/splitreus62.keymap b/app/boards/shields/splitreus62/splitreus62.keymap
index 920e61a..07dd2ad 100644
--- a/app/boards/shields/splitreus62/splitreus62.keymap
+++ b/app/boards/shields/splitreus62/splitreus62.keymap
@@ -1,9 +1,10 @@
/*
- * Copyright (c) 2020 Derek Schmell
+ * Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
+
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
diff --git a/app/drivers/zephyr/kscan_gpio_direct.c b/app/drivers/zephyr/kscan_gpio_direct.c
index d6dab4d..4818c99 100644
--- a/app/drivers/zephyr/kscan_gpio_direct.c
+++ b/app/drivers/zephyr/kscan_gpio_direct.c
@@ -173,7 +173,7 @@ static const struct kscan_driver_api gpio_driver_api = {
#define INST_INPUT_LEN(n) DT_INST_PROP_LEN(n, input_gpios)
#define GPIO_INST_INIT(n) \
- COND_CODE_0(CONFIG_ZMK_KSCAN_DIRECT_POLLING, \
+ COND_CODE_0(IS_ENABLED(CONFIG_ZMK_KSCAN_DIRECT_POLLING), \
(static struct kscan_gpio_irq_callback irq_callbacks_##n[INST_INPUT_LEN(n)];), ()) \
static struct kscan_gpio_data kscan_gpio_data_##n = { \
.inputs = {[INST_INPUT_LEN(n) - 1] = NULL}}; \
@@ -195,7 +195,7 @@ static const struct kscan_driver_api gpio_driver_api = {
return err; \
} \
COND_CODE_0( \
- CONFIG_ZMK_KSCAN_DIRECT_POLLING, \
+ IS_ENABLED(CONFIG_ZMK_KSCAN_DIRECT_POLLING), \
(irq_callbacks_##n[i].work = &data->work; \
irq_callbacks_##n[i].debounce_period = cfg->debounce_period; \
gpio_init_callback(&irq_callbacks_##n[i].callback, \
@@ -208,7 +208,7 @@ static const struct kscan_driver_api gpio_driver_api = {
()) \
} \
data->dev = dev; \
- COND_CODE_1(CONFIG_ZMK_KSCAN_DIRECT_POLLING, \
+ COND_CODE_1(IS_ENABLED(CONFIG_ZMK_KSCAN_DIRECT_POLLING), \
(k_timer_init(&data->poll_timer, kscan_gpio_timer_handler, NULL);), ()) \
if (cfg->debounce_period > 0) { \
k_delayed_work_init(&data->work.delayed, kscan_gpio_work_handler); \
diff --git a/app/src/kscan_composite.c b/app/src/kscan_composite.c
index 0249140..f8e8d60 100644
--- a/app/src/kscan_composite.c
+++ b/app/src/kscan_composite.c
@@ -38,8 +38,7 @@ struct kscan_composite_data {
};
static int kscan_composite_enable_callback(struct device *dev) {
- for (int i = 0; i < sizeof(kscan_composite_children) / sizeof(kscan_composite_children[0]);
- i++) {
+ for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) {
const struct kscan_composite_child_config *cfg = &kscan_composite_children[i];
kscan_enable_callback(device_get_binding(cfg->label));
@@ -48,8 +47,7 @@ static int kscan_composite_enable_callback(struct device *dev) {
}
static int kscan_composite_disable_callback(struct device *dev) {
- for (int i = 0; i < sizeof(kscan_composite_children) / sizeof(kscan_composite_children[0]);
- i++) {
+ for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) {
const struct kscan_composite_child_config *cfg = &kscan_composite_children[i];
kscan_disable_callback(device_get_binding(cfg->label));
@@ -63,8 +61,7 @@ static void kscan_composite_child_callback(struct device *child_dev, u32_t row,
struct device *dev = device_get_binding(DT_INST_LABEL(0));
struct kscan_composite_data *data = dev->driver_data;
- for (int i = 0; i < sizeof(kscan_composite_children) / sizeof(kscan_composite_children[0]);
- i++) {
+ for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) {
const struct kscan_composite_child_config *cfg = &kscan_composite_children[i];
if (device_get_binding(cfg->label) != child_dev) {
@@ -82,8 +79,7 @@ static int kscan_composite_configure(struct device *dev, kscan_callback_t callba
return -EINVAL;
}
- for (int i = 0; i < sizeof(kscan_composite_children) / sizeof(kscan_composite_children[0]);
- i++) {
+ for (int i = 0; i < ARRAY_SIZE(kscan_composite_children); i++) {
const struct kscan_composite_child_config *cfg = &kscan_composite_children[i];
kscan_config(device_get_binding(cfg->label), &kscan_composite_child_callback);
diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md
index 1d7d703..4891f5a 100644
--- a/docs/docs/dev-setup.md
+++ b/docs/docs/dev-setup.md
@@ -12,16 +12,16 @@ groupId="operating-systems"
defaultValue="debian"
values={[
{label: 'Debian/Ubuntu', value: 'debian'},
-{label: 'Raspberry OS', value: 'raspberryos'},
-{label: 'Fedora', value: 'fedora'},
{label: 'Windows', value: 'win'},
{label: 'macOS', value: 'mac'},
+{label: 'Raspberry OS', value: 'raspberryos'},
+{label: 'Fedora', value: 'fedora'},
]
}>{props.children}</Tabs>);
## Prerequisites
-A unix-like environment with the following base packages installed:
+ZMK requires the following base packages to first be installed:
- Git
- Python 3
@@ -34,6 +34,7 @@ A unix-like environment with the following base packages installed:
<OsTabs>
<TabItem value="debian">
+
On Debian and Ubuntu, we'll use `apt` to install our base dependencies:
First, if you haven't updated recently, or if this is a new install,
@@ -74,7 +75,8 @@ or download and install CMake version 3.13.1 or newer manually.
:::
</TabItem>
<TabItem value="raspberryos">
-On Raspberry OS, we'll use apt to install our base dependencies:
+
+On Raspberry OS, we'll use `apt` to install our base dependencies:
First, if you haven't updated recently, or if this is a new install,
you should update to get the latest package information:
@@ -185,14 +187,40 @@ brew install cmake ninja python3 ccache dtc git wget
`west` is the [Zephyr™ meta-tool](https://docs.zephyrproject.org/2.3.0/guides/west/index.html) used to configure and build Zephyr™ applications.
-West can be installed by using the `pip` python package manager.
+West can be installed by using the `pip` python package manager. The [Zephyr™ instructions](https://docs.zephyrproject.org/latest/guides/west/install.html#installing-west) are summarized here:
+
+<Tabs
+defaultValue="linux"
+values={[
+{label: 'Linux', value: 'linux'},
+{label: 'Windows', value: 'win'},
+]}>
+<TabItem value = 'linux'>
```sh
pip3 install --user -U west
```
-:::danger pip user packages
-If you haven't done so yet, you may need to add the Python Pip user package directory to your `PATH` otherwise your computer will not be able to find the `west` command.
+</TabItem>
+<TabItem value = 'win'>
+
+In `cmd.exe` as **Administrator**:
+
+```sh
+pip3 install -U west
+```
+
+:::note
+**For Windows, do not use the `--user` argument** that Linux uses otherwise `west` will be installed in a different location and the below instructions for adding Python `pip` will no longer apply.
+:::
+
+Once `west` is installed, close Command Prompt and open a new session as a **user** for the remainder of the instructions.
+
+</TabItem>
+</Tabs>
+
+:::danger `pip` user packages
+If you haven't done so yet, you may need to add the Python `pip` package directory to your `PATH` otherwise your computer will not be able to find the `west` command.
:::
<Tabs
@@ -213,7 +241,8 @@ source ~/.bashrc
<TabItem value = 'win'>
1. See the [Environment Variables](#environment-variables) section on how to get to the Environment Variables page.
-3. Click "Edit..." and then "New" to add the directory where your west.exe is located. By default this should be something like `C:\Python38\Scripts`.
+2. Under "System variables" select the "Path" variable. Click "Edit..." and then "New" to add the directory where your `west.exe` is located. By default this should be `C:\Python##\Scripts` where ## is your Python version number.
+3. Close Command Prompt and open a new session for the changes to take effect, or run `refreshenv`.
</TabItem>
</Tabs>
@@ -279,7 +308,7 @@ The installation will prompt with several questions about installation location,
#### GNU ARM Embedded
-Since the Zephyr™ SDK is not available for Windows, we recommending following the steps to install the [GNU ARM Embedded](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded).
+Since the Zephyr™ SDK is not available for Windows, we recommending following the [Zephyr documentation](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded) to install a GNU ARM Embedded build. Note the warnings regarding installing the toolchain into a path with spaces, and make sure to follow the steps to add the environment variables which are also summarized with screenshots in the [Environment Variables](#environment-variables) section below.
</TabItem>
<TabItem value="mac">
@@ -308,7 +337,7 @@ The transient instructions must be run to build firmware using the current shell
### Source Code
-Next, you'll need to clone the ZMK source repository if you haven't already:
+Next, you'll need to clone the ZMK source repository if you haven't already. Navigate to the folder you would like to place your `zmk` directory in and run the following command:
```
git clone https://github.com/zmkfirmware/zmk.git
@@ -358,12 +387,17 @@ pip3 install --user -r zephyr/scripts/requirements-base.txt
### Environment Variables
-#### For GNU ARM Embedded on Windows
+<Tabs
+defaultValue="win"
+values={[
+{label: 'Windows', value: 'win'},
+{label: 'Other OS', value: 'other'},
+]}>
+<TabItem value = 'win'>
-On Windows, you will have to set two environment variables for ZMK to build properly: `ZEPHYR_TOOLCHAIN_VARIANT` and `GNUARMEMB_TOOLCHAIN_PATH`.
+#### For GNU ARM Embedded on Windows
-<details>
-<summary> Steps to Update Environment Variables </summary>
+On Windows, only two environment variables need to be set for ZMK to build properly: `ZEPHYR_TOOLCHAIN_VARIANT` and `GNUARMEMB_TOOLCHAIN_PATH`.
1. Open Start Menu and type 'env' to find the 'Edit the system environment variables' option. Open it.
@@ -381,11 +415,15 @@ On Windows, you will have to set two environment variables for ZMK to build prop
![Adding Zephyr toolchain variable](assets/env-var/zephyr_toolchain.png)
-5. Create another variable with variable name 'GNUARMEMB_TOOLCHAIN_PATH' and value set to wherever you installed your toolchain. Click OK to save.
+5. Create another variable with variable name 'GNUARMEMB_TOOLCHAIN_PATH' and value set to wherever you installed your toolchain. **Make sure this path does not contain any spaces.** If it does, rename the folder and update here. Click OK to save.
![Adding GNUARMEMB variable](assets/env-var/gnuarmemb.png)
-</details>
+6. Close Command Prompt and reopen, or run `refreshenv` to apply the changes.
+
+</TabItem>
+
+<TabItem value = 'other'>
#### For Zephyr
@@ -396,48 +434,10 @@ We suggest two main [options](https://docs.zephyrproject.org/2.3.0/guides/env_va
To load the Zephyr environment properly for just one transient shell, run the following from your ZMK checkout directory:
-<OsTabs>
-<TabItem value="debian">
-
-```
-source zephyr/zephyr-env.sh
-```
-
-</TabItem>
-
-<TabItem value="raspberryos">
-
-```
-source zephyr/zephyr-env.sh
-```
-
-</TabItem>
-
-<TabItem value="fedora">
-
```
source zephyr/zephyr-env.sh
```
-</TabItem>
-
-<TabItem value="mac">
-
-```
-source zephyr/zephyr-env.sh
-```
-
-</TabItem>
-
-<TabItem value="win">
-
-```
-source zephyr/zephyr-env.cmd
-```
-
-</TabItem>
-</OsTabs>
-
##### All Shells
To load the environment variables for your shell every time,
@@ -469,3 +469,7 @@ cat ~/.zephyrrc >> ~/.zshrc
</TabItem>
</Tabs>
+
+</TabItem>
+
+</Tabs>
diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1
index 3946e66..dc7b18c 100644
--- a/docs/static/setup.ps1
+++ b/docs/static/setup.ps1
@@ -63,8 +63,8 @@ $repo_path = "https://github.com/zmkfirmware/zmk-config-split-template.git"
$title = "ZMK Config Setup:"
$prompt = "Pick an MCU board"
-$options = "nice!nano", "QMK Proton-C", "BlueMicro840 (v1)"
-$boards = "nice_nano", "proton_c", "bluemicro840_v1"
+$options = "nice!nano", "QMK Proton-C", "BlueMicro840 (v1)", "makerdiary nRF52840 M.2"
+$boards = "nice_nano", "proton_c", "bluemicro840_v1", "nrf52840_m2"
Write-Host "$title"
Write-Host ""
@@ -78,9 +78,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", "RoMac"
-$names = "kyria", "lily58", "corne", "splitreus62", "sofle", "iris", "romac"
-$splits = "y", "y", "y", "y", "y", "y", "n"
+$options = "Kyria", "Lily58", "Corne", "Splitreus62", "Sofle", "Iris", "RoMac", "makerdiary M60"
+$names = "kyria", "lily58", "corne", "splitreus62", "sofle", "iris", "romac", "m60"
+$splits = "y", "y", "y", "y", "y", "y", "n", "n"
$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 5bf3645..9e98964 100644
--- a/docs/static/setup.sh
+++ b/docs/static/setup.sh
@@ -26,7 +26,7 @@ repo_path="https://github.com/zmkfirmware/zmk-config-split-template.git"
title="ZMK Config Setup:"
prompt="Pick an MCU board:"
-options=("nice!nano" "QMK Proton-C" "BlueMicro840 (v1)")
+options=("nice!nano" "QMK Proton-C" "BlueMicro840 (v1)" "makerdiary nRF52840 M.2")
echo "$title"
echo ""
@@ -39,6 +39,7 @@ select opt in "${options[@]}" "Quit"; do
1 ) board="nice_nano"; break;;
2 ) board="proton_c"; break;;
3 ) board="bluemicro840_v1"; break;;
+ 3 ) board="nrf52840_m2"; break;;
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*) echo "Invalid option. Try another one."; continue;;
@@ -50,7 +51,7 @@ echo ""
echo "Keyboard Shield Selection:"
prompt="Pick an keyboard:"
-options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "RoMac")
+options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "RoMac" "makerdiary M60")
PS3="$prompt "
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
@@ -66,6 +67,7 @@ select opt in "${options[@]}" "Quit"; do
5 ) shield_title="Sofle" shield="sofle"; split="y"; break;;
6 ) shield_title="Iris" shield="iris"; split="y"; break;;
7 ) shield_title="RoMac" shield="romac"; split="n"; break;;
+ 7 ) shield_title="M60" shield="m60"; split="n"; break;;
# Add link to docs on adding your own custom shield in your ZMK config!
# $(( ${#options[@]}+1 )) ) echo "Other!"; break;;