diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98ca44d9..5086bf8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: name: Build Test strategy: matrix: - board: [proton_c, nice_nano, bluemicro52840_v1] + board: [proton_c, nice_nano, bluemicro840_v1, nrfmicro_13] shield: - corne_left - corne_right @@ -25,6 +25,8 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Cache west modules + timeout-minutes: 2 + continue-on-error: true uses: actions/cache@v2 env: cache-name: cache-zephyr-modules diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 054f84a7..9fce3b64 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,4 +1,3 @@ -# Find Zephyr. This also loads Zephyr's build system. cmake_minimum_required(VERSION 3.13.1) set(CONFIG_APPLICATION_DEFINED_SYSCALL true) @@ -15,6 +14,7 @@ list(APPEND SYSCALL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/drivers/zephyr) include(cmake/zmk_config.cmake) +# Find Zephyr. This also loads Zephyr's build system. find_package(Zephyr REQUIRED HINTS ../zephyr) project(zmk) @@ -44,7 +44,7 @@ target_sources(app PRIVATE src/behaviors/behavior_none.c) target_sources(app PRIVATE src/behaviors/behavior_sensor_rotate_key_press.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) -target_sources_ifdef(CONFIG_ZMK_BLE_UNPAIR_COMBO app PRIVATE src/ble_unpair_combo.c) +target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble_unpair_combo.c) target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split_listener.c) target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split/bluetooth/service.c) target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL app PRIVATE src/split/bluetooth/central.c) diff --git a/app/Kconfig b/app/Kconfig index 416c9852..877fce43 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -41,16 +41,10 @@ menuconfig ZMK_BLE select BT_GATT_DIS select BT_GATT_BAS select SETTINGS - select BT_SETTINGS + # select BT_SETTINGS if ZMK_BLE -config ZMK_BLE_UNPAIR_COMBO - bool "Enable BT unpair combo" - help - Adds a magic key combo that can be held on startup to remove all paired devices - default n - config ZMK_BLE_INIT_PRIORITY int "Init Priority" default 50 @@ -199,6 +193,10 @@ source "subsys/logging/Kconfig.template.log_config" rsource "boards/Kconfig" rsource "boards/shields/*/Kconfig.defconfig" +rsource "boards/shields/*/Kconfig.shield" + +osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.defconfig" +osource "$(ZMK_CONFIG)/boards/shields/*/Kconfig.shield" source "Kconfig.zephyr" diff --git a/app/boards/arm/bluemicro52840_v1/CMakeLists.txt b/app/boards/arm/bluemicro840/CMakeLists.txt similarity index 100% rename from app/boards/arm/bluemicro52840_v1/CMakeLists.txt rename to app/boards/arm/bluemicro840/CMakeLists.txt diff --git a/app/boards/arm/bluemicro52840_v1/Kconfig b/app/boards/arm/bluemicro840/Kconfig similarity index 76% rename from app/boards/arm/bluemicro52840_v1/Kconfig rename to app/boards/arm/bluemicro840/Kconfig index 67751a0f..0e6743d3 100644 --- a/app/boards/arm/bluemicro52840_v1/Kconfig +++ b/app/boards/arm/bluemicro840/Kconfig @@ -4,5 +4,5 @@ config BOARD_ENABLE_DCDC bool "Enable DCDC mode" select SOC_DCDC_NRF52X default y - depends on BOARD_BLUEMICRO52840_V1 + depends on BOARD_BLUEMICRO840_V1 diff --git a/app/boards/arm/bluemicro52840_v1/Kconfig.board b/app/boards/arm/bluemicro840/Kconfig.board similarity index 53% rename from app/boards/arm/bluemicro52840_v1/Kconfig.board rename to app/boards/arm/bluemicro840/Kconfig.board index dea05550..bc271af3 100644 --- a/app/boards/arm/bluemicro52840_v1/Kconfig.board +++ b/app/boards/arm/bluemicro840/Kconfig.board @@ -1,8 +1,8 @@ -# BlueMicro52840_V1 board configuration +# BlueMicro840 board configuration # Copyright (c) 2020 Pete Johanson, Derek Schmell # SPDX-License-Identifier: MIT -config BOARD_BLUEMICRO52840_V1 - bool "BlueMicro52840_V1" +config BOARD_BLUEMICRO840_V1 + bool "BlueMicro840_V1" depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/bluemicro52840_v1/Kconfig.defconfig b/app/boards/arm/bluemicro840/Kconfig.defconfig similarity index 67% rename from app/boards/arm/bluemicro52840_v1/Kconfig.defconfig rename to app/boards/arm/bluemicro840/Kconfig.defconfig index 90a5ed9a..566b5a42 100644 --- a/app/boards/arm/bluemicro52840_v1/Kconfig.defconfig +++ b/app/boards/arm/bluemicro840/Kconfig.defconfig @@ -1,12 +1,12 @@ -# BlueMicro52840 board configuration +# BlueMicro840 board configuration # Copyright (c) 2020 Pete Johanson, Derek Schmell # SPDX-License-Identifier: MIT -if BOARD_BLUEMICRO52840_V1 +if BOARD_BLUEMICRO840_V1 config BOARD - default "bluemicro52840_v1" + default "bluemicro840_v1" if USB @@ -27,4 +27,4 @@ config ZMK_BLE config ZMK_USB default y -endif # BOARD_BLUEMICRO52840_V1 +endif # BOARD_BLUEMICRO840_V1 diff --git a/app/boards/arm/bluemicro52840_v1/arduino_pro_micro_pins.dtsi b/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi similarity index 100% rename from app/boards/arm/bluemicro52840_v1/arduino_pro_micro_pins.dtsi rename to app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi diff --git a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.dts b/app/boards/arm/bluemicro840/bluemicro840_v1.dts similarity index 96% rename from app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.dts rename to app/boards/arm/bluemicro840/bluemicro840_v1.dts index f8abc667..c693662a 100644 --- a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.dts +++ b/app/boards/arm/bluemicro840/bluemicro840_v1.dts @@ -9,8 +9,8 @@ #include "arduino_pro_micro_pins.dtsi" / { - model = "BlueMicro52840_V1"; - compatible = "bluemicro52840,v1"; + model = "BlueMicro840_V1"; + compatible = "bluemicro840,v1"; chosen { zephyr,code-partition = &code_partition; diff --git a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.yaml b/app/boards/arm/bluemicro840/bluemicro840_v1.yaml similarity index 72% rename from app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.yaml rename to app/boards/arm/bluemicro840/bluemicro840_v1.yaml index fca969d3..9e1dd54c 100644 --- a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1.yaml +++ b/app/boards/arm/bluemicro840/bluemicro840_v1.yaml @@ -1,5 +1,5 @@ -identifier: bluemicro52840_v1 -name: BlueMicro52840_V1 +identifier: bluemicro840_v1 +name: BlueMicro840_V1 type: mcu arch: arm toolchain: diff --git a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1_defconfig b/app/boards/arm/bluemicro840/bluemicro840_v1_defconfig similarity index 84% rename from app/boards/arm/bluemicro52840_v1/bluemicro52840_v1_defconfig rename to app/boards/arm/bluemicro840/bluemicro840_v1_defconfig index f87e69d7..96f03ca4 100644 --- a/app/boards/arm/bluemicro52840_v1/bluemicro52840_v1_defconfig +++ b/app/boards/arm/bluemicro840/bluemicro840_v1_defconfig @@ -2,7 +2,7 @@ CONFIG_SOC_SERIES_NRF52X=y CONFIG_SOC_NRF52840_QIAA=y -CONFIG_BOARD_BLUEMICRO52840_V1=y +CONFIG_BOARD_BLUEMICRO840_V1=y # Enable MPU CONFIG_ARM_MPU=y diff --git a/app/boards/arm/bluemicro52840_v1/board.cmake b/app/boards/arm/bluemicro840/board.cmake similarity index 100% rename from app/boards/arm/bluemicro52840_v1/board.cmake rename to app/boards/arm/bluemicro840/board.cmake diff --git a/app/boards/arm/nrfmicro/CMakeLists.txt b/app/boards/arm/nrfmicro/CMakeLists.txt new file mode 100644 index 00000000..cd4843af --- /dev/null +++ b/app/boards/arm/nrfmicro/CMakeLists.txt @@ -0,0 +1,14 @@ +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 +) + +if(CONFIG_PINMUX) +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) +endif() \ No newline at end of file diff --git a/app/boards/arm/nrfmicro/Kconfig b/app/boards/arm/nrfmicro/Kconfig new file mode 100644 index 00000000..17a3347e --- /dev/null +++ b/app/boards/arm/nrfmicro/Kconfig @@ -0,0 +1,5 @@ +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13) diff --git a/app/boards/arm/nrfmicro/Kconfig.board b/app/boards/arm/nrfmicro/Kconfig.board new file mode 100644 index 00000000..177373ab --- /dev/null +++ b/app/boards/arm/nrfmicro/Kconfig.board @@ -0,0 +1,16 @@ +# nrfmicro board configuration + +# Copyright (c) 2020 Okke Formsma, joric +# SPDX-License-Identifier: MIT + +config BOARD_NRFMICRO_11 + bool "nrfmicro_11" + depends on SOC_NRF52840_QIAA + +config BOARD_NRFMICRO_11_FLIPPED + bool "nrfmicro_11_flipped" + depends on SOC_NRF52840_QIAA + +config BOARD_NRFMICRO_13 + bool "nrfmicro_13" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/nrfmicro/Kconfig.defconfig b/app/boards/arm/nrfmicro/Kconfig.defconfig new file mode 100644 index 00000000..22122772 --- /dev/null +++ b/app/boards/arm/nrfmicro/Kconfig.defconfig @@ -0,0 +1,33 @@ +# Electronut Labs Papyr board configuration + +# Copyright (c) 2020 Okke Formsma, joric +# SPDX-License-Identifier: MIT + +if BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 + +config BOARD + default "nrfmicro" + +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 PINMUX + default y + +endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi new file mode 100644 index 00000000..6cde2b49 --- /dev/null +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins.dtsi @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + + +/ { + pro_micro_d: connector_d { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 8 0> /* D0 */ + , <1 0 &gpio0 6 0> /* D1 */ + , <2 0 &gpio0 15 0> /* D2 */ + , <3 0 &gpio0 17 0> /* D3 */ + , <4 0 &gpio0 20 0> /* D4/A6 */ + , <5 0 &gpio0 13 0> /* D5 */ + , <6 0 &gpio0 24 0> /* D6/A7 */ + , <7 0 &gpio0 9 0> /* D7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 11 0> /* D10/A10 */ + , <16 0 &gpio0 28 0> /* D16 */ + , <14 0 &gpio0 3 0> /* D14 */ + , <15 0 &gpio1 13 0> /* D15 */ + ; + }; + + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 2 0> /* A0 */ + , <1 0 &gpio0 29 0> /* A1 */ + , <2 0 &gpio0 31 0> /* A2 */ + , <3 0 &gpio0 30 0> /* A3 */ + , <6 0 &gpio0 20 0> /* D4/A6 */ + , <7 0 &gpio0 24 0> /* D6/A7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 11 0> /* D10/A10 */ + ; + }; +}; + + +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi new file mode 100644 index 00000000..9bad7f4a --- /dev/null +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_flipped.dtsi @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +/ { + pro_micro_d: connector_d { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 8 0> /* D0 */ + , <1 0 &gpio0 6 0> /* D1 */ + , <2 0 &gpio0 30 0> /* D2 */ + , <3 0 &gpio0 31 0> /* D3 */ + , <4 0 &gpio0 29 0> /* D4/A6 */ + , <5 0 &gpio0 2 0> /* D5 */ + , <6 0 &gpio1 13 0> /* D6/A7 */ + , <7 0 &gpio0 3 0> /* D7 */ + , <8 0 &gpio0 28 0> /* D8/A8 */ + , <9 0 &gpio1 11 0> /* D9/A9 */ + , <10 0 &gpio1 6 0> /* D10/A10 */ + , <16 0 &gpio0 10 0> /* D16 */ + , <14 0 &gpio0 9 0> /* D14 */ + , <15 0 &gpio0 24 0> /* D15 */ + ; + }; + + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 13 0> /* A0 */ + , <1 0 &gpio0 20 0> /* A1 */ + , <2 0 &gpio0 17 0> /* A2 */ + , <3 0 &gpio0 15 0> /* A3 */ + , <6 0 &gpio0 29 0> /* D4/A6 */ + , <7 0 &gpio1 13 0> /* D6/A7 */ + , <8 0 &gpio0 28 0> /* D8/A8 */ + , <9 0 &gpio1 11 0> /* D9/A9 */ + , <10 0 &gpio1 6 0> /* D10/A10 */ + ; + }; +}; + +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/board.cmake b/app/boards/arm/nrfmicro/board.cmake new file mode 100644 index 00000000..fa847d50 --- /dev/null +++ b/app/boards/arm/nrfmicro/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/nrfmicro/nrfmicro_11.dts b/app/boards/arm/nrfmicro/nrfmicro_11.dts new file mode 100644 index 00000000..dc07ac89 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11.dts @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "nrfmicro"; + compatible = "joric,nrfmicro"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <15>; + scl-pin = <17>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + status = "okay"; + current-speed = <115200>; + tx-pin = <39>; + rx-pin = <34>; + rts-pin = <33>; + cts-pin = <12>; +}; + +&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/nrfmicro/nrfmicro_11.yaml b/app/boards/arm/nrfmicro/nrfmicro_11.yaml new file mode 100644 index 00000000..4608130d --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11.yaml @@ -0,0 +1,15 @@ +identifier: nrfmicro_11 +name: nrfmicro_11 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/nrfmicro/nrfmicro_11_defconfig b/app/boards/arm/nrfmicro/nrfmicro_11_defconfig new file mode 100644 index 00000000..c1ac8364 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11_defconfig @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_NRFMICRO_11=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 +CONFIG_CLOCK_CONTROL_NRF=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts new file mode 100644 index 00000000..5bf493f0 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins_flipped.dtsi" + +/ { + model = "nrfmicro"; + compatible = "joric,nrfmicro"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <30>; + scl-pin = <31>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + status = "okay"; + current-speed = <115200>; + tx-pin = <39>; + rx-pin = <34>; + rts-pin = <33>; + cts-pin = <12>; +}; + +&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/nrfmicro/nrfmicro_11_flipped.yaml b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.yaml new file mode 100644 index 00000000..74461f09 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.yaml @@ -0,0 +1,15 @@ +identifier: nrfmicro_11_flipped +name: nrfmicro_11_flipped +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/nrfmicro/nrfmicro_11_flipped_defconfig b/app/boards/arm/nrfmicro/nrfmicro_11_flipped_defconfig new file mode 100644 index 00000000..b35cb791 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_11_flipped_defconfig @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_NRFMICRO_11_FLIPPED=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 +CONFIG_CLOCK_CONTROL_NRF=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/app/boards/arm/nrfmicro/nrfmicro_13.dts b/app/boards/arm/nrfmicro/nrfmicro_13.dts new file mode 100644 index 00000000..dc07ac89 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13.dts @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "nrfmicro"; + compatible = "joric,nrfmicro"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <15>; + scl-pin = <17>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + status = "okay"; + current-speed = <115200>; + tx-pin = <39>; + rx-pin = <34>; + rts-pin = <33>; + cts-pin = <12>; +}; + +&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/nrfmicro/nrfmicro_13.yaml b/app/boards/arm/nrfmicro/nrfmicro_13.yaml new file mode 100644 index 00000000..a7415e44 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13.yaml @@ -0,0 +1,15 @@ +identifier: nrfmicro_13 +name: nrfmicro_13 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_defconfig b/app/boards/arm/nrfmicro/nrfmicro_13_defconfig new file mode 100644 index 00000000..cac11642 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13_defconfig @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_NRFMICRO_13=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 +CONFIG_CLOCK_CONTROL_NRF=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/app/boards/arm/nrfmicro/pinmux.c b/app/boards/arm/nrfmicro/pinmux.c new file mode 100644 index 00000000..c02ca922 --- /dev/null +++ b/app/boards/arm/nrfmicro/pinmux.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include +#include + +static int pinmux_nrfmicro_init(struct device *port) +{ + ARG_UNUSED(port); + + struct device *p1 = device_get_binding("GPIO_1"); + +#if CONFIG_BOARD_NRFMICRO_13 + struct device *p0 = device_get_binding("GPIO_0"); + // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) + gpio_pin_configure(p1, 9, GPIO_OUTPUT); + gpio_pin_set(p1, 9, 0); + + // enable charger (nRFMicro 1.3 only) + gpio_pin_configure(p0, 5, GPIO_OUTPUT); + gpio_pin_set(p0, 5, 0); +#else + // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) + gpio_pin_configure(p1, 9, GPIO_OUTPUT); + gpio_pin_set(p1, 9, 1); +#endif + return 0; +} + +SYS_INIT(pinmux_nrfmicro_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/app/boards/shields/corne/corne.keymap b/app/boards/shields/corne/corne.keymap index a88d0368..c0bbb4ab 100644 --- a/app/boards/shields/corne/corne.keymap +++ b/app/boards/shields/corne/corne.keymap @@ -21,12 +21,12 @@ lower_layer { // ----------------------------------------------------------------------------------------- // | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP | -// | CTRL | | | | | | | RGT | UP | DWN | LFT | | | +// | CTRL | | | | | | | LFT | DWN | UP | RGT | | | // | SHFT | | | | | | | | | | | | | // | GUI | | SPC | | ENT | | ALT | 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 BKSP - &kp LCTL &trans &trans &trans &trans &trans &kp RARW &kp UARW &kp DARW &kp LARW &trans &trans + &kp LCTL &trans &trans &trans &trans &trans &kp LARW &kp DARW &kp UARW &kp RARW &trans &trans &kp LSFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp LGUI &trans &kp SPC &kp RET &trans &kp RALT >; @@ -40,8 +40,8 @@ // | GUI | | SPC | | ENT | | ALT | bindings = < &kp ESC &kp BANG &kp ATSN &kp HASH &kp CURU &kp PRCT &kp CRRT &kp AMPS &kp KMLT &kp LPRN &kp RPRN &kp BKSP - &kp LCTL &trans &trans &trans &trans &trans &kp MINUS &kp EQL &kp LBKT &kp RBKT &kp PIPE &trans - &kp LSFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &kp LCTL &trans &trans &trans &trans &trans &kp MINUS &kp EQL &kp LBKT &kp RBKT &kp PIPE &kp GRAV + &kp LSFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp BSLH &kp TILD &kp LGUI &trans &kp SPC &kp RET &trans &kp RALT >; }; diff --git a/app/boards/shields/corne/corne_left.conf b/app/boards/shields/corne/corne_left.conf index 338fa59c..1e028a78 100644 --- a/app/boards/shields/corne/corne_left.conf +++ b/app/boards/shields/corne/corne_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/corne/corne_right.conf b/app/boards/shields/corne/corne_right.conf index be344c41..990cf7c0 100644 --- a/app/boards/shields/corne/corne_right.conf +++ b/app/boards/shields/corne/corne_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/kyria/boards/nrfmicro_11.overlay b/app/boards/shields/kyria/boards/nrfmicro_11.overlay new file mode 100644 index 00000000..d7f724f6 --- /dev/null +++ b/app/boards/shields/kyria/boards/nrfmicro_11.overlay @@ -0,0 +1,29 @@ +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + mosi-pin = <6>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; + diff --git a/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay b/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay new file mode 100644 index 00000000..c5f2a940 --- /dev/null +++ b/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay @@ -0,0 +1,28 @@ +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + mosi-pin = <6>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/kyria/boards/nrfmicro_13.overlay b/app/boards/shields/kyria/boards/nrfmicro_13.overlay new file mode 100644 index 00000000..c5f2a940 --- /dev/null +++ b/app/boards/shields/kyria/boards/nrfmicro_13.overlay @@ -0,0 +1,28 @@ +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + mosi-pin = <6>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/kyria/kyria_left.conf b/app/boards/shields/kyria/kyria_left.conf index 338fa59c..e51dee44 100644 --- a/app/boards/shields/kyria/kyria_left.conf +++ b/app/boards/shields/kyria/kyria_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file diff --git a/app/boards/shields/kyria/kyria_right.conf b/app/boards/shields/kyria/kyria_right.conf index be344c41..990cf7c0 100644 --- a/app/boards/shields/kyria/kyria_right.conf +++ b/app/boards/shields/kyria/kyria_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf index 338fa59c..1e028a78 100644 --- a/app/boards/shields/lily58/lily58_left.conf +++ b/app/boards/shields/lily58/lily58_left.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y \ No newline at end of file diff --git a/app/boards/shields/lily58/lily58_right.conf b/app/boards/shields/lily58/lily58_right.conf index cf16779e..990cf7c0 100644 --- a/app/boards/shields/lily58/lily58_right.conf +++ b/app/boards/shields/lily58/lily58_right.conf @@ -1,3 +1,2 @@ CONFIG_ZMK_SPLIT=y CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y -CONFIG_ZMK_BLE_UNPAIR_COMBO=y diff --git a/app/cmake/zmk_config.cmake b/app/cmake/zmk_config.cmake index 518c3c3d..017dd111 100644 --- a/app/cmake/zmk_config.cmake +++ b/app/cmake/zmk_config.cmake @@ -44,6 +44,7 @@ endif() set(CACHED_ZMK_CONFIG ${ZMK_CONFIG} CACHE STRING "Selected user ZMK config") if (ZMK_CONFIG) + set(ENV{ZMK_CONFIG} "${ZMK_CONFIG}") if(EXISTS ${ZMK_CONFIG}/boards) message(STATUS "Adding ZMK config directory as board root: ${ZMK_CONFIG}") list(APPEND BOARD_ROOT ${ZMK_CONFIG}) diff --git a/app/dts/behaviors/reset.dtsi b/app/dts/behaviors/reset.dtsi index 4e3b4446..fc4fa149 100644 --- a/app/dts/behaviors/reset.dtsi +++ b/app/dts/behaviors/reset.dtsi @@ -1,3 +1,5 @@ +#include + / { behaviors { reset: behavior_reset { @@ -5,5 +7,12 @@ label = "RESET"; #binding-cells = <0>; }; + + bootloader: behavior_reset_dfu { + compatible = "zmk,behavior-reset"; + label = "BOOTLOADER_RESET"; + type = ; + #binding-cells = <0>; + }; }; }; diff --git a/app/dts/bindings/behaviors/zmk,behavior-reset.yaml b/app/dts/bindings/behaviors/zmk,behavior-reset.yaml index c8e5e6fb..061b15e3 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-reset.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-reset.yaml @@ -6,3 +6,8 @@ description: Keyboard Reset Behavior compatible: "zmk,behavior-reset" include: zero_param.yaml + +properties: + type: + type: int + default: 0 diff --git a/app/include/dt-bindings/zmk/reset.h b/app/include/dt-bindings/zmk/reset.h new file mode 100644 index 00000000..b5136492 --- /dev/null +++ b/app/include/dt-bindings/zmk/reset.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2020 Peter Johanson + * + * SPDX-License-Identifier: MIT + */ + +#define RST_WARM 0x00 +#define RST_COLD 0x01 + +// AdaFruit nrf52 Bootloader Specific. See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107 + +#define RST_UF2 0x57 \ No newline at end of file diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index 44cbc219..30a96ea8 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -13,8 +13,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -struct behavior_reset_config { }; -struct behavior_reset_data { }; +struct behavior_reset_config { + int type; +}; static int behavior_reset_init(struct device *dev) { @@ -23,9 +24,11 @@ static int behavior_reset_init(struct device *dev) static int on_keymap_binding_pressed(struct device *dev, u32_t position, u32_t _param1, u32_t _param2) { + const struct behavior_reset_config *cfg = dev->config_info; + // TODO: Correct magic code for going into DFU? // See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107 - sys_reboot(0); + sys_reboot(cfg->type); return 0; } @@ -34,12 +37,14 @@ static const struct behavior_driver_api behavior_reset_driver_api = { }; -static const struct behavior_reset_config behavior_reset_config = {}; - -static struct behavior_reset_data behavior_reset_data; - -DEVICE_AND_API_INIT(behavior_reset, DT_INST_LABEL(0), behavior_reset_init, - &behavior_reset_data, - &behavior_reset_config, - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &behavior_reset_driver_api); \ No newline at end of file +#define RST_INST(n) \ + static const struct behavior_reset_config behavior_reset_config_##n = { \ + .type = DT_INST_PROP(n, type) \ + }; \ + DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, \ + NULL, \ + &behavior_reset_config_##n, \ + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_reset_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(RST_INST) \ No newline at end of file diff --git a/app/src/ble_unpair_combo.c b/app/src/ble_unpair_combo.c index a33a8e22..82fa8342 100644 --- a/app/src/ble_unpair_combo.c +++ b/app/src/ble_unpair_combo.c @@ -7,10 +7,11 @@ #include #include -#include - #define DT_DRV_COMPAT zmk_bt_unpair_combo +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include @@ -78,3 +79,5 @@ ZMK_SUBSCRIPTION(zmk_ble_unpair_combo, position_state_changed); SYS_INIT(zmk_ble_unpair_combo_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/docs/docs/assets/bond-clearing/corne.jpg b/docs/docs/assets/bond-clearing/corne.jpg new file mode 100644 index 00000000..1e070a2c Binary files /dev/null and b/docs/docs/assets/bond-clearing/corne.jpg differ diff --git a/docs/docs/assets/bond-clearing/kyria.jpg b/docs/docs/assets/bond-clearing/kyria.jpg new file mode 100644 index 00000000..9fa22a07 Binary files /dev/null and b/docs/docs/assets/bond-clearing/kyria.jpg differ diff --git a/docs/docs/behavior/key-press.md b/docs/docs/behavior/key-press.md index 1ae7e316..2edce1d3 100644 --- a/docs/docs/behavior/key-press.md +++ b/docs/docs/behavior/key-press.md @@ -1,5 +1,6 @@ --- -title: Key Presses +title: Key Press Behaviors +sidebar_label: Key Press --- ## Summary diff --git a/docs/docs/behavior/layers.md b/docs/docs/behavior/layers.md index 3e520cab..da7f07f5 100644 --- a/docs/docs/behavior/layers.md +++ b/docs/docs/behavior/layers.md @@ -1,5 +1,6 @@ --- -title: Layers +title: Layer Behaviors +sidebar_label: Layers --- ## Summary @@ -56,12 +57,13 @@ Example: ``` "Toggle layer" for a : + ``` #define DEFAULT 0 #define NAVI 1 #define NONE 0 - + / { keymap { compatible = "zmk,keymap"; @@ -89,4 +91,4 @@ Example: }; ``` -It is possible to use "toggle layer" to have keys that raise and lower the layers as well. \ No newline at end of file +It is possible to use "toggle layer" to have keys that raise and lower the layers as well. diff --git a/docs/docs/behavior/lighting.md b/docs/docs/behavior/lighting.md index 432960e3..2d4f532e 100644 --- a/docs/docs/behavior/lighting.md +++ b/docs/docs/behavior/lighting.md @@ -1,15 +1,16 @@ --- -title: Lighting +title: Lighting Behavior +sidebar_label: Lighting --- ## Summary -Lighting is often used for either aesthetics or for the practical purposes of lighting up keys in the dark. +Lighting is often used for either aesthetics or for the practical purposes of lighting up keys in the dark. Currently ZMK supports RGB underglow, which can be changed and configured using its behavior. ## RGB Action Defines -RGB actions defines are provided through the [`dt-bindings/zmk/rgb.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/rgb.h) header, +RGB actions defines are provided through the [`dt-bindings/zmk/rgb.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/rgb.h) header, which is added at the top of the keymap file: ``` @@ -21,7 +22,7 @@ This will allow you to reference the actions defined in this header such as `RGB Here is a table describing the action for each define: | Define | Action | -|-----------|-----------------------------------------------------------| +| --------- | --------------------------------------------------------- | | `RGB_TOG` | Toggles the RGB feature on and off | | `RGB_HUI` | Increases the hue of the RGB feature | | `RGB_HUD` | Decreases the hue of the RGB feature | @@ -47,4 +48,4 @@ Example: ``` &rgb_ug RGB_TOG -``` \ No newline at end of file +``` diff --git a/docs/docs/behavior/misc.md b/docs/docs/behavior/misc.md index 799c91c8..446ba33c 100644 --- a/docs/docs/behavior/misc.md +++ b/docs/docs/behavior/misc.md @@ -1,5 +1,6 @@ --- -title: Miscellaneous +title: Miscellaneous Behaviors +sidebar_label: Miscellaneous --- ## Summary diff --git a/docs/docs/behavior/mod-tap.md b/docs/docs/behavior/mod-tap.md index cae667e3..08e9b65b 100644 --- a/docs/docs/behavior/mod-tap.md +++ b/docs/docs/behavior/mod-tap.md @@ -1,5 +1,6 @@ --- -title: Mod-Tap +title: Mod-Tap Behavior +sidebar_label: Mod-Tap --- ## Summary diff --git a/docs/docs/behavior/reset.md b/docs/docs/behavior/reset.md new file mode 100644 index 00000000..8cf122b4 --- /dev/null +++ b/docs/docs/behavior/reset.md @@ -0,0 +1,43 @@ +--- +title: Reset Behaviors +sidebar_label: Reset +--- + +## Summary + +There are two available behaviors that can be used to trigger a reset of the keyboard. +The first is a soft reset, that will simply reset and re-run the currently flashed +firmware; the second when triggered will reset into the bootloader, allowing you to +flash a new firmware to the keyboard. + +## Reset + +The basic reset behavior will reset the keyboard and re-run the firmware flashed +to the device + +### Behavior Binding + +- Reference: `&reset` +- Parameters: None + +Example: + +``` +&reset +``` + +## Bootloader Reset + +The bootloader reset behavior will reset the keyboard and put it into bootloader mode, allowing +you to flash a new firmware. + +### Behavior Binding + +- Reference: `&bootloader` +- Parameters: None + +Example: + +``` +&bootloader +``` diff --git a/docs/docs/bond-reset.md b/docs/docs/bond-reset.md new file mode 100644 index 00000000..1d3732b1 --- /dev/null +++ b/docs/docs/bond-reset.md @@ -0,0 +1,27 @@ +--- +id: bond-reset +title: Reset BLE Connections +sidebar_label: BLE Reset +--- + +Known as a 'bond reset', a special key combination, that is not related to the user defined key map, which +clears all wireless connection configurations. The keys must be held for 3 to 5 seconds after the device is +reset. + +:::warning +Currently, ZMK only supports a single BLE host. If you remove the keyboard from the host's bluetooth devices +list, you will need to clear the bonds. +::: + +### Split Keyboards + +Split keyboards will need to be cleared on both halves. For best results try to reset them at the same time. + + +## Kyria + +![Kyria bond-reset combo](assets/bond-clearing/kyria.jpg) + +## Corne + +![Corne bond-reset combo](assets/bond-clearing/corne.jpg) \ No newline at end of file diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md index 5cceb73f..6e893b3f 100644 --- a/docs/docs/dev-setup.md +++ b/docs/docs/dev-setup.md @@ -180,7 +180,7 @@ brew install cmake ninja python3 ccache dtc git wget ### West Build Command -`west` is the [Zephyr™ meta-tool](https://docs.zephyrproject.org/latest/guides/west/index.html) used to configure and build Zephyr™ applications. +`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. @@ -223,7 +223,7 @@ The installation will prompt with several questions about installation location, Because Raspberry OS (Raspbian) runs on the same architecture (but different ABI) as the keyboard MCUs, -the operating system's installed [cross compilers](https://docs.zephyrproject.org/latest/getting_started/toolchain_other_x_compilers.html) can be used to target the different ABI. +the operating system's installed [cross compilers](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_other_x_compilers.html) can be used to target the different ABI. First, the cross compiler should be installed: @@ -259,23 +259,20 @@ 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/latest/getting_started/toolchain_3rd_party_x_compilers.html#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). -#### Zephyr™ ARM SDK +#### GNU ARM Embedded -To build firmwares for the ARM architecture (all supported MCUs/keyboards at this point), you'll need to install the Zephyr™ ARM SDK to your system: +Since the Zephyr™ SDK is not available for macOS, 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). -``` -export ZSDK_VERSION=0.11.2 -wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" && \ - sh "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ - rm "zephyr-toolchain-arm-\${ZSDK_VERSION}-setup.run" -``` +:::warning Security Controls Workaround -The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. +Please be sure to read the [additional setup instructions](https://docs.zephyrproject.org/2.3.0/getting_started/installation_mac.html#mac-gatekeeper) needed to address security controls found in macOS 10.15 Catalina and newer + +::: @@ -342,7 +339,7 @@ pip3 install --user -r zephyr/scripts/requirements-base.txt ### Environment Variables By default, the Zephyr™ SDK will create a file named `~/.zephyrrc` with the correct environment variables to build ZMK. -We suggest two main [options](https://docs.zephyrproject.org/latest/guides/env_vars.html?highlight=zephyrrc) for how to load those settings. +We suggest two main [options](https://docs.zephyrproject.org/2.3.0/guides/env_vars.html?highlight=zephyrrc) for how to load those settings. #### Per Shell @@ -442,7 +439,7 @@ an onboard MCU, or one that uses a MCU board addon. ### Keyboard (Shield) + MCU Board -ZMK treats keyboards that take a MCU addon board as [shields](https://docs.zephyrproject.org/latest/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/latest/guides/porting/board_porting.html) +ZMK treats keyboards that take a MCU addon board as [shields](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) Given the following: @@ -458,7 +455,7 @@ west build -b proton_c -- -DSHIELD=kyria_left -DKEYMAP=default ### Keyboard With Onboard MCU -Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/latest/guides/porting/board_porting.html) as far as Zephyr™ is concerned. +Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) as far as Zephyr™ is concerned. Given the following: diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 951cee04..9e6a956f 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -17,6 +17,8 @@ That being said, there are currently only a few specific [boards](/docs/faq#what ## Boards - [nice!nano](https://docs.nicekeyboards.com/#/nice!nano/) (`nice_nano`) +- [nrfMicro](https://github.com/joric/nrfmicro) (`nrfmicro_13`, `nrfmicro_11`, `nrfmicro_11_flipped`) +- [BlueMicro840](https://store.jpconstantineau.com/#/group/bluemicro) (`bluemicro840_v1`) - [QMK Proton-C](https://qmk.fm/proton-c/) (`proton_c`) ## Keyboard Shields diff --git a/docs/sidebars.js b/docs/sidebars.js index be02a657..51313fc5 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -1,6 +1,6 @@ module.exports = { someSidebar: { - "Getting Started": ["intro", "hardware", "faq", "user-setup"], + "Getting Started": ["intro", "hardware", "faq", "user-setup", "bond-reset"], Features: [ "feature/keymaps", "feature/displays", @@ -12,6 +12,7 @@ module.exports = { "behavior/layers", "behavior/misc", "behavior/mod-tap", + "behavior/reset", "behavior/lighting", ], Development: [ diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 55c96ff9..bb61df60 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -11,7 +11,7 @@ title="ZMK Config Setup:" # TODO: Check for user.name and user.email git configs being set prompt="Pick an MCU board:" -options=("nice!nano" "QMK Proton-C" "BlueMicro52840 (v1)") +options=("nice!nano" "QMK Proton-C" "BlueMicro840 (v1)") echo "$title" echo "" @@ -23,7 +23,7 @@ select opt in "${options[@]}" "Quit"; do 1 ) board="nice_nano"; break;; 2 ) board="proton_c"; break;; - 3 ) board="bluemicro52840_v1"; break;; + 3 ) board="bluemicro840_v1"; break;; $(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit;; *) echo "Invalid option. Try another one.";continue;;