diff options
89 files changed, 1682 insertions, 148 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5eb7971..5086bf8 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] + 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 @@ -34,11 +36,11 @@ jobs: tools/ zephyr/ bootloader/ - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} + key: 2-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + 2-${{ runner.os }}-build-${{ env.cache-name }}- + 2-${{ runner.os }}-build- + 2-${{ runner.os }}- - name: West Init uses: "docker://zmkfirmware/zephyr-west-action-arm:latest" id: west-init diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d0d343b..9fce3b6 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) @@ -38,10 +38,13 @@ target_sources(app PRIVATE src/behaviors/behavior_key_press.c) target_sources(app PRIVATE src/behaviors/behavior_reset.c) target_sources(app PRIVATE src/behaviors/behavior_mod_tap.c) target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c) +target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c) target_sources(app PRIVATE src/behaviors/behavior_transparent.c) +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 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 be5a1e4..877fce4 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -40,7 +40,7 @@ menuconfig ZMK_BLE select BT_PERIPHERAL select BT_GATT_DIS select BT_GATT_BAS - # select SETTINGS + select SETTINGS # select BT_SETTINGS if ZMK_BLE @@ -124,6 +124,9 @@ config ZMK_USB config BT_MAX_CONN default 5 +config BT_GAP_AUTO_UPDATE_CONN_PARAMS + default n + endif endchoice @@ -190,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/bluemicro840/CMakeLists.txt b/app/boards/arm/bluemicro840/CMakeLists.txt new file mode 100644 index 0000000..00952c3 --- /dev/null +++ b/app/boards/arm/bluemicro840/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/bluemicro840/Kconfig b/app/boards/arm/bluemicro840/Kconfig new file mode 100644 index 0000000..0e6743d --- /dev/null +++ b/app/boards/arm/bluemicro840/Kconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_BLUEMICRO840_V1 + diff --git a/app/boards/arm/bluemicro840/Kconfig.board b/app/boards/arm/bluemicro840/Kconfig.board new file mode 100644 index 0000000..bc271af --- /dev/null +++ b/app/boards/arm/bluemicro840/Kconfig.board @@ -0,0 +1,8 @@ +# BlueMicro840 board configuration + +# Copyright (c) 2020 Pete Johanson, Derek Schmell +# SPDX-License-Identifier: MIT + +config BOARD_BLUEMICRO840_V1 + bool "BlueMicro840_V1" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/bluemicro840/Kconfig.defconfig b/app/boards/arm/bluemicro840/Kconfig.defconfig new file mode 100644 index 0000000..566b5a4 --- /dev/null +++ b/app/boards/arm/bluemicro840/Kconfig.defconfig @@ -0,0 +1,30 @@ +# BlueMicro840 board configuration + +# Copyright (c) 2020 Pete Johanson, Derek Schmell +# SPDX-License-Identifier: MIT + +if BOARD_BLUEMICRO840_V1 + +config BOARD + default "bluemicro840_v1" + +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_BLUEMICRO840_V1 diff --git a/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi b/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi new file mode 100644 index 0000000..940d891 --- /dev/null +++ b/app/boards/arm/bluemicro840/arduino_pro_micro_pins.dtsi @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 Derek Schmell + * + * 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 D2 */ + , <1 0 &gpio0 6 0> /* D1 D3*/ + , <2 0 &gpio0 15 0> /* D2 D1*/ + , <3 0 &gpio0 17 0> /* D3 D0*/ + , <4 0 &gpio0 20 0> /* D4/A6 D4*/ + , <5 0 &gpio0 13 0> /* D5 C6*/ + , <6 0 &gpio0 24 0> /* D6/A7 D7*/ + , <7 0 &gpio0 9 0> /* D7 E6*/ + , <8 0 &gpio0 10 0> /* D8/A8 B4*/ + , <9 0 &gpio1 6 0> /* D9/A9 B5*/ + , <10 0 &gpio1 11 0> /* D10/A10 B6*/ + , <16 0 &gpio0 28 0> /* D16 B2*/ + , <14 0 &gpio0 3 0> /* D14 B3*/ + , <15 0 &gpio1 13 0> /* D15 B1*/ + ; + }; + + 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 F7*/ + , <1 0 &gpio0 29 0> /* A1 F6*/ + , <2 0 &gpio0 26 0> /* A2 F5*/ + , <3 0 &gpio0 30 0> /* A3 F4*/ + , <6 0 &gpio0 20 0> /* D4/A6 D4*/ + , <7 0 &gpio0 24 0> /* D6/A7 D7*/ + , <8 0 &gpio0 10 0> /* D8/A8 B4*/ + , <9 0 &gpio1 6 0> /* D9/A9 B5*/ + , <10 0 &gpio1 13 0> /* D10/A10 B6*/ + ; + }; +}; + +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/bluemicro840/bluemicro840_v1.dts b/app/boards/arm/bluemicro840/bluemicro840_v1.dts new file mode 100644 index 0000000..c693662 --- /dev/null +++ b/app/boards/arm/bluemicro840/bluemicro840_v1.dts @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2020 Pete Johanson, Derek Schmell + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include <nordic/nrf52840_qiaa.dtsi> +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "BlueMicro840_V1"; + compatible = "bluemicro840,v1"; + + 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"; + blue_led: led_0 { + gpios = <&gpio0 42 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/bluemicro840/bluemicro840_v1.yaml b/app/boards/arm/bluemicro840/bluemicro840_v1.yaml new file mode 100644 index 0000000..9e1dd54 --- /dev/null +++ b/app/boards/arm/bluemicro840/bluemicro840_v1.yaml @@ -0,0 +1,15 @@ +identifier: bluemicro840_v1 +name: BlueMicro840_V1 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/bluemicro840/bluemicro840_v1_defconfig b/app/boards/arm/bluemicro840/bluemicro840_v1_defconfig new file mode 100644 index 0000000..96f03ca --- /dev/null +++ b/app/boards/arm/bluemicro840/bluemicro840_v1_defconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BLUEMICRO840_V1=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
\ No newline at end of file diff --git a/app/boards/arm/bluemicro840/board.cmake b/app/boards/arm/bluemicro840/board.cmake new file mode 100644 index 0000000..fa847d5 --- /dev/null +++ b/app/boards/arm/bluemicro840/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/nice_nano/Kconfig b/app/boards/arm/nice_nano/Kconfig new file mode 100644 index 0000000..fb5537a --- /dev/null +++ b/app/boards/arm/nice_nano/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_NICE_NANO diff --git a/app/boards/arm/nice_nano/Kconfig.board b/app/boards/arm/nice_nano/Kconfig.board index 60ee58b..4fd394f 100644 --- a/app/boards/arm/nice_nano/Kconfig.board +++ b/app/boards/arm/nice_nano/Kconfig.board @@ -6,3 +6,4 @@ config BOARD_NICE_NANO bool "nice!nano" depends on SOC_NRF52840_QIAA + diff --git a/app/boards/arm/nice_nano/Kconfig.defconfig b/app/boards/arm/nice_nano/Kconfig.defconfig index 2431813..0961ddd 100644 --- a/app/boards/arm/nice_nano/Kconfig.defconfig +++ b/app/boards/arm/nice_nano/Kconfig.defconfig @@ -1,5 +1,3 @@ -# Electronut Labs Papyr board configuration - # Copyright (c) 2020 Pete Johanson # SPDX-License-Identifier: MIT diff --git a/app/boards/arm/nice_nano/nice_nano.dts b/app/boards/arm/nice_nano/nice_nano.dts index 7c676e3..2e9556b 100644 --- a/app/boards/arm/nice_nano/nice_nano.dts +++ b/app/boards/arm/nice_nano/nice_nano.dts @@ -24,7 +24,7 @@ leds { compatible = "gpio-leds"; blue_led: led_0 { - gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; label = "Blue LED"; }; }; @@ -39,13 +39,6 @@ status = "okay"; }; -&uart0 { - compatible = "nordic,nrf-uart"; - current-speed = <115200>; - tx-pin = <6>; - rx-pin = <8>; -}; - &i2c0 { compatible = "nordic,nrf-twi"; sda-pin = <17>; diff --git a/app/boards/arm/nrfmicro/CMakeLists.txt b/app/boards/arm/nrfmicro/CMakeLists.txt new file mode 100644 index 0000000..cd4843a --- /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 0000000..17a3347 --- /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 0000000..177373a --- /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 0000000..2212277 --- /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 0000000..6cde2b4 --- /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 0000000..9bad7f4 --- /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 0000000..fa847d5 --- /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 0000000..dc07ac8 --- /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 <nordic/nrf52840_qiaa.dtsi> +#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 0000000..4608130 --- /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 0000000..c1ac836 --- /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 0000000..5bf493f --- /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 <nordic/nrf52840_qiaa.dtsi> +#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 0000000..74461f0 --- /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 0000000..b35cb79 --- /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 0000000..dc07ac8 --- /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 <nordic/nrf52840_qiaa.dtsi> +#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 0000000..a7415e4 --- /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 0000000..cac1164 --- /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 0000000..c02ca92 --- /dev/null +++ b/app/boards/arm/nrfmicro/pinmux.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Okke Formsma, joric + * + * SPDX-License-Identifier: MIT + */ + +#include <kernel.h> +#include <device.h> +#include <init.h> +#include <drivers/gpio.h> +#include <sys/sys_io.h> +#include <devicetree.h> + +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.conf b/app/boards/shields/corne/corne.conf index c8e3c00..b79385b 100644 --- a/app/boards/shields/corne/corne.conf +++ b/app/boards/shields/corne/corne.conf @@ -1,5 +1,6 @@ -# Uncomment the following line to enable the Corne RGB Underglow +# Uncomment the following lines to enable the Corne RGB Underglow # ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y # Uncomment the following line to enable the Corne OLED Display # CONFIG_ZMK_DISPLAY=y diff --git a/app/boards/shields/corne/corne.dtsi b/app/boards/shields/corne/corne.dtsi index 70d6495..af14bae 100644 --- a/app/boards/shields/corne/corne.dtsi +++ b/app/boards/shields/corne/corne.dtsi @@ -21,9 +21,9 @@ // | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | // | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | 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,12) -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,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,12) +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,10) RC(1,11) +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(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) >; }; @@ -58,13 +58,17 @@ 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 }; + bt_unpair_combo: bt_unpair_combo { + compatible = "zmk,bt-unpair-combo"; + }; + // TODO: per-key RGB node(s)? }; &pro_micro_i2c { status = "okay"; - ssd1306@3c { + oled: ssd1306@3c { compatible = "solomon,ssd1306fb"; reg = <0x3c>; label = "DISPLAY"; @@ -73,7 +77,10 @@ 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 segment-offset = <0>; page-offset = <0>; display-offset = <0>; - multiplex-ratio = <63>; + multiplex-ratio = <31>; + segment-remap; + com-invdir; + com-sequential; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/corne/corne.keymap b/app/boards/shields/corne/corne.keymap index 2f7f38b..c0bbb4a 100644 --- a/app/boards/shields/corne/corne.keymap +++ b/app/boards/shields/corne/corne.keymap @@ -2,21 +2,49 @@ #include <dt-bindings/zmk/keys.h> / { - keymap { - compatible = "zmk,keymap"; + keymap { + compatible = "zmk,keymap"; - default_layer { -// --------------------------------------------------------------------------------------------------------------------------------- -// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | -// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | -// | SHIFT | Z | X | C | V | B | | N | M | , | . | / | CTRL | -// | GUI | DEL | RET | | TAB | BSPC | R-ALT | - bindings = < - &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH - &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT - &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL - &kp LGUI &kp DEL &kp RET &kp TAB &kp BKSP &kp RALT - >; - }; - }; + default_layer { +// ----------------------------------------------------------------------------------------- +// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP | +// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' | +// | SHFT | Z | X | C | V | B | | N | M | , | . | / | SHFT | +// | GUI | LWR | SPC | | ENT | RSE | ALT | + bindings = < + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BKSP + &kp LCTL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT + &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 LGUI &mo 1 &kp SPC &kp RET &mo 2 &kp RALT + >; + }; + lower_layer { +// ----------------------------------------------------------------------------------------- +// | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP | +// | 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 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 + >; + }; + + raise_layer { +// ----------------------------------------------------------------------------------------- +// | ESC | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP | +// | CTRL | | | | | | | - | = | { | } | "|" | ` | +// | SHFT | | | | | | | _ | + | [ | ] | \ | ~ | // TODO: Fix this row when &mkp is committed +// | 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 &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 e51dee4..1e028a7 100644 --- a/app/boards/shields/corne/corne_left.conf +++ b/app/boards/shields/corne/corne_left.conf @@ -1,2 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
\ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/corne/corne_left.overlay b/app/boards/shields/corne/corne_left.overlay index 399bddd..f12c417 100644 --- a/app/boards/shields/corne/corne_left.overlay +++ b/app/boards/shields/corne/corne_left.overlay @@ -16,3 +16,7 @@ , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> ; }; + +&bt_unpair_combo { + key-positions = <0 38>; +}; diff --git a/app/boards/shields/corne/corne_right.conf b/app/boards/shields/corne/corne_right.conf index a835adc..990cf7c 100644 --- a/app/boards/shields/corne/corne_right.conf +++ b/app/boards/shields/corne/corne_right.conf @@ -1,2 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
\ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/corne/corne_right.overlay b/app/boards/shields/corne/corne_right.overlay index 652d5ed..9d97d85 100644 --- a/app/boards/shields/corne/corne_right.overlay +++ b/app/boards/shields/corne/corne_right.overlay @@ -21,3 +21,6 @@ ; }; +&bt_unpair_combo { + key-positions = <11 39>; +}; 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 0000000..d7f724f --- /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 0000000..c5f2a94 --- /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 0000000..c5f2a94 --- /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.conf b/app/boards/shields/kyria/kyria.conf index fa98d1c..7a0b5b6 100644 --- a/app/boards/shields/kyria/kyria.conf +++ b/app/boards/shields/kyria/kyria.conf @@ -5,5 +5,6 @@ # Uncomment the following line to enable the Kyria OLED Display # CONFIG_ZMK_DISPLAY=y -# Uncomment the following line to enable RGB underglow +# Uncomment the following lines to enable RGB underglow # CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/kyria/kyria.dtsi b/app/boards/shields/kyria/kyria.dtsi index bbead84..a13f7f0 100644 --- a/app/boards/shields/kyria/kyria.dtsi +++ b/app/boards/shields/kyria/kyria.dtsi @@ -81,6 +81,10 @@ 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) sensors = <&left_encoder &right_encoder>; }; + bt_unpair_combo: bt_unpair_combo { + compatible = "zmk,bt-unpair-combo"; + }; + // TODO: RGB node(s) }; diff --git a/app/boards/shields/kyria/kyria_left.overlay b/app/boards/shields/kyria/kyria_left.overlay index c8b5be2..441c1a6 100644 --- a/app/boards/shields/kyria/kyria_left.overlay +++ b/app/boards/shields/kyria/kyria_left.overlay @@ -22,3 +22,7 @@ &left_encoder { status = "okay"; }; + +&bt_unpair_combo { + key-positions = <0 44>; +};
\ 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 a835adc..990cf7c 100644 --- a/app/boards/shields/kyria/kyria_right.conf +++ b/app/boards/shields/kyria/kyria_right.conf @@ -1,2 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
\ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/kyria/kyria_right.overlay b/app/boards/shields/kyria/kyria_right.overlay index 8163c95..8ee0fcb 100644 --- a/app/boards/shields/kyria/kyria_right.overlay +++ b/app/boards/shields/kyria/kyria_right.overlay @@ -27,3 +27,7 @@ &right_encoder { status = "okay"; }; + +&bt_unpair_combo { + key-positions = <11 45>; +};
\ No newline at end of file diff --git a/app/boards/shields/lily58/lily58.dtsi b/app/boards/shields/lily58/lily58.dtsi index 8655d8c..24f6805 100644 --- a/app/boards/shields/lily58/lily58.dtsi +++ b/app/boards/shields/lily58/lily58.dtsi @@ -44,12 +44,16 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) ; }; + + bt_unpair_combo: bt_unpair_combo { + compatible = "zmk,bt-unpair-combo"; + }; }; &pro_micro_i2c { status = "okay"; - ssd1306@3c { + oled: ssd1306@3c { compatible = "solomon,ssd1306fb"; reg = <0x3c>; label = "DISPLAY"; diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf index e51dee4..1e028a7 100644 --- a/app/boards/shields/lily58/lily58_left.conf +++ b/app/boards/shields/lily58/lily58_left.conf @@ -1,2 +1,2 @@ CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
\ No newline at end of file +CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/lily58/lily58_left.overlay b/app/boards/shields/lily58/lily58_left.overlay index c8e2213..c6f630f 100644 --- a/app/boards/shields/lily58/lily58_left.overlay +++ b/app/boards/shields/lily58/lily58_left.overlay @@ -17,3 +17,6 @@ ; }; +&bt_unpair_combo { + key-positions = <0 42>; +}; diff --git a/app/boards/shields/lily58/lily58_right.overlay b/app/boards/shields/lily58/lily58_right.overlay index 748be14..84f0b06 100644 --- a/app/boards/shields/lily58/lily58_right.overlay +++ b/app/boards/shields/lily58/lily58_right.overlay @@ -21,3 +21,6 @@ ; }; +&bt_unpair_combo { + key-positions = <11 43>; +}; diff --git a/app/cmake/zmk_config.cmake b/app/cmake/zmk_config.cmake index 518c3c3..017dd11 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/drivers/zephyr/kscan_gpio_matrix.c b/app/drivers/zephyr/kscan_gpio_matrix.c index baaca30..b19c492 100644 --- a/app/drivers/zephyr/kscan_gpio_matrix.c +++ b/app/drivers/zephyr/kscan_gpio_matrix.c @@ -205,7 +205,13 @@ static int kscan_gpio_config_interrupts(struct device **devices, } \ data->callback = callback; \ return 0; \ - } \ + }; \ + static int kscan_gpio_enable_##n(struct device *dev) \ + { \ + int err = kscan_gpio_enable_interrupts_##n(dev); \ + if (err) { return err; } \ + return kscan_gpio_read_##n(dev); \ + }; \ static int kscan_gpio_init_##n(struct device *dev) \ { \ struct kscan_gpio_data_##n *data = dev->driver_data; \ @@ -258,7 +264,7 @@ static int kscan_gpio_config_interrupts(struct device **devices, } \ static const struct kscan_driver_api gpio_driver_api_##n = { \ .config = kscan_gpio_configure_##n, \ - .enable_callback = kscan_gpio_enable_interrupts_##n, \ + .enable_callback = kscan_gpio_enable_##n, \ .disable_callback = kscan_gpio_disable_interrupts_##n, \ }; \ static const struct kscan_gpio_config_##n kscan_gpio_config_##n = { \ diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 04e42b6..4cfb7a0 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -1,7 +1,9 @@ #include <behaviors/key_press.dtsi> #include <behaviors/transparent.dtsi> +#include <behaviors/none.dtsi> #include <behaviors/mod_tap.dtsi> #include <behaviors/momentary_layer.dtsi> +#include <behaviors/toggle_layer.dtsi> #include <behaviors/reset.dtsi> #include <behaviors/sensor_rotate_key_press.dtsi> #include <behaviors/rgb_underglow.dtsi>
\ No newline at end of file diff --git a/app/dts/behaviors/none.dtsi b/app/dts/behaviors/none.dtsi new file mode 100644 index 0000000..e84ed49 --- /dev/null +++ b/app/dts/behaviors/none.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +/ { + behaviors { + none: behavior_none { + compatible = "zmk,behavior-none"; + label = "NONE"; + #binding-cells = <0>; + }; + }; +}; diff --git a/app/dts/behaviors/reset.dtsi b/app/dts/behaviors/reset.dtsi index 4e3b444..fc4fa14 100644 --- a/app/dts/behaviors/reset.dtsi +++ b/app/dts/behaviors/reset.dtsi @@ -1,3 +1,5 @@ +#include <dt-bindings/zmk/reset.h> + / { 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 = <RST_UF2>; + #binding-cells = <0>; + }; }; }; diff --git a/app/dts/behaviors/toggle_layer.dtsi b/app/dts/behaviors/toggle_layer.dtsi new file mode 100644 index 0000000..86a050d --- /dev/null +++ b/app/dts/behaviors/toggle_layer.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Cody McGinnis <brainwart@gmail.com> + * + * SPDX-License-Identifier: MIT + */ + + / { + behaviors { + tog: behavior_toggle_layer { + compatible = "zmk,behavior-toggle-layer"; + label = "TOGGLE_LAYER"; + #binding-cells = <1>; + }; + }; +}; diff --git a/app/dts/bindings/behaviors/zmk,behavior-none.yaml b/app/dts/bindings/behaviors/zmk,behavior-none.yaml new file mode 100644 index 0000000..9c66c94 --- /dev/null +++ b/app/dts/bindings/behaviors/zmk,behavior-none.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2020, Pete Johanson +# SPDX-License-Identifier: MIT + +description: None Binding Behavior + +compatible: "zmk,behavior-none" + +include: zero_param.yaml diff --git a/app/dts/bindings/behaviors/zmk,behavior-reset.yaml b/app/dts/bindings/behaviors/zmk,behavior-reset.yaml index c8e5e6f..061b15e 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/dts/bindings/behaviors/zmk,behavior-toggle-layer.yaml b/app/dts/bindings/behaviors/zmk,behavior-toggle-layer.yaml new file mode 100644 index 0000000..065949f --- /dev/null +++ b/app/dts/bindings/behaviors/zmk,behavior-toggle-layer.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2020, Cody McGinnis <brainwart@gmail.com> +# SPDX-License-Identifier: MIT + +description: Toggle Layer + +compatible: "zmk,behavior-toggle-layer" + +include: one_param.yaml diff --git a/app/dts/bindings/zmk,bt-unpair-combo.yaml b/app/dts/bindings/zmk,bt-unpair-combo.yaml new file mode 100644 index 0000000..d781347 --- /dev/null +++ b/app/dts/bindings/zmk,bt-unpair-combo.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2020, Pete Johanson +# SPDX-License-Identifier: MIT + +description: | + Defines a set of key positions that will unpair all BT devices if held on startup. + +compatible: "zmk,bt-unpair-combo" + +properties: + key-positions: + type: array + required: true diff --git a/app/include/dt-bindings/zmk/reset.h b/app/include/dt-bindings/zmk/reset.h new file mode 100644 index 0000000..b513649 --- /dev/null +++ b/app/include/dt-bindings/zmk/reset.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * + * 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/include/zmk/ble.h b/app/include/zmk/ble.h index a77237d..e760ed7 100644 --- a/app/include/zmk/ble.h +++ b/app/include/zmk/ble.h @@ -3,5 +3,5 @@ #include <zmk/keys.h> -int zmk_ble_init(); +int zmk_ble_unpair_all(); bool zmk_ble_handle_key_user(struct zmk_key_event *key_event); diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 4a6bb37..c1f6393 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -1,6 +1,8 @@ #pragma once +bool zmk_keymap_layer_active(u8_t layer); int zmk_keymap_layer_activate(u8_t layer); int zmk_keymap_layer_deactivate(u8_t layer); +int zmk_keymap_layer_toggle(u8_t layer); int zmk_keymap_position_state_changed(u32_t position, bool pressed); diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c new file mode 100644 index 0000000..7e77e54 --- /dev/null +++ b/app/src/behaviors/behavior_none.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * + * SPDX-License-Identifier: MIT + */ + +#define DT_DRV_COMPAT zmk_behavior_none + +#include <device.h> +#include <power/reboot.h> +#include <drivers/behavior.h> +#include <logging/log.h> + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +struct behavior_none_config { }; +struct behavior_none_data { }; + +static int behavior_none_init(struct device *dev) +{ + return 0; +}; + +static int on_keymap_binding_pressed(struct device *dev, u32_t position, u32_t _param1, u32_t _param2) +{ + return 1; +} + +static int on_keymap_binding_released(struct device *dev, u32_t position, u32_t _param1, u32_t _param2) +{ + return 1; +} + +static const struct behavior_driver_api behavior_none_driver_api = { + .binding_pressed = on_keymap_binding_pressed, + .binding_released = on_keymap_binding_released, +}; + + +static const struct behavior_none_config behavior_none_config = {}; + +static struct behavior_none_data behavior_none_data; + +DEVICE_AND_API_INIT(behavior_none, DT_INST_LABEL(0), behavior_none_init, + &behavior_none_data, + &behavior_none_config, + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &behavior_none_driver_api);
\ No newline at end of file diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index 44cbc21..30a96ea 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/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c new file mode 100644 index 0000000..13f4a29 --- /dev/null +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Cody McGinnis <brainwart@gmail.com> + * + * SPDX-License-Identifier: MIT + */ + +#define DT_DRV_COMPAT zmk_behavior_toggle_layer + +#include <device.h> +#include <drivers/behavior.h> +#include <logging/log.h> + +#include <zmk/keymap.h> + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +struct behavior_tog_config { }; +struct behavior_tog_data { }; + +static int behavior_tog_init(struct device *dev) +{ + return 0; +}; + + +static int tog_keymap_binding_pressed(struct device *dev, u32_t position, u32_t layer, u32_t _) +{ + return zmk_keymap_layer_toggle(layer); +} + +static int tog_keymap_binding_released(struct device *dev, u32_t position, u32_t layer, u32_t _) +{ + return 0; +} + +static const struct behavior_driver_api behavior_tog_driver_api = { + .binding_pressed = tog_keymap_binding_pressed, + .binding_released = tog_keymap_binding_released, +}; + +static const struct behavior_tog_config behavior_tog_config = {}; + +static struct behavior_tog_data behavior_tog_data; + +DEVICE_AND_API_INIT(behavior_tog, DT_INST_LABEL(0), behavior_tog_init, + &behavior_tog_data, + &behavior_tog_config, + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &behavior_tog_driver_api); diff --git a/app/src/ble.c b/app/src/ble.c index 488491c..0e96d16 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -1,3 +1,8 @@ +/* + * Copyright (c) 2020 Peter Johanson + * + * SPDX-License-Identifier: MIT + */ #include <device.h> #include <init.h> @@ -23,6 +28,16 @@ static struct bt_conn *auth_passkey_entry_conn; static u8_t passkey_entries[6] = {0, 0, 0, 0, 0, 0}; static u8_t passkey_digit = 0; +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#define ZMK_ADV_PARAMS BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ + BT_LE_ADV_OPT_USE_NAME | \ + BT_LE_ADV_OPT_ONE_TIME, \ + BT_GAP_ADV_FAST_INT_MIN_2, \ + BT_GAP_ADV_FAST_INT_MAX_2, NULL) +#else +#define ZMK_ADV_PARAMS BT_LE_ADV_CONN_NAME +#endif + static void connected(struct bt_conn *conn, u8_t err) { char addr[BT_ADDR_LE_STR_LEN]; @@ -76,29 +91,10 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, } } -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) -static bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param) { - static struct bt_conn_info info; - - bt_conn_get_info(conn, &info); - - /* This captures a param change from central half of a split board connection - to stop default params from getting set over the top of our preferred ones */ - if (info.role == BT_CONN_ROLE_MASTER && (param->interval_min != 6 || param->latency != 30)) { - return false; - } - - return true; -} -#endif - static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, .security_changed = security_changed, -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) - .le_param_req = le_param_req, -#endif }; static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) @@ -173,7 +169,7 @@ static void zmk_ble_ready(int err) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, zmk_ble_ad, ARRAY_SIZE(zmk_ble_ad), NULL, 0); + err = bt_le_adv_start(ZMK_ADV_PARAMS, zmk_ble_ad, ARRAY_SIZE(zmk_ble_ad), NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); @@ -204,6 +200,12 @@ static int zmk_ble_init(struct device *_arg) return 0; } +int zmk_ble_unpair_all() +{ + LOG_DBG(""); + return bt_unpair(BT_ID_DEFAULT, NULL); +}; + bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) { zmk_key key = key_event->key; diff --git a/app/src/ble_unpair_combo.c b/app/src/ble_unpair_combo.c new file mode 100644 index 0000000..82fa834 --- /dev/null +++ b/app/src/ble_unpair_combo.c @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2020 Peter Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include <device.h> +#include <init.h> + +#define DT_DRV_COMPAT zmk_bt_unpair_combo + +#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) + +#include <logging/log.h> +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include <zmk/ble.h> +#include <zmk/event-manager.h> +#include <zmk/events/position-state-changed.h> + + +static u8_t combo_state; + +const u32_t key_positions[] = DT_INST_PROP(0, key_positions); +#define KP_LEN DT_INST_PROP_LEN(0, key_positions) + +int index_for_key_position(u32_t kp) +{ + for (int i = 0; i < KP_LEN; i++) { + if (key_positions[i] == kp) { + return i; + } + } + + return -1; +} + +int unpair_combo_listener(const struct zmk_event_header *eh) +{ + if (is_position_state_changed(eh)) { + const struct position_state_changed *psc = cast_position_state_changed(eh); + + int kp_index = index_for_key_position(psc->position); + if (kp_index < 0) { + return 0; + } + + WRITE_BIT(combo_state, kp_index, psc->state); + } + + return 0; +}; + +void unpair_combo_work_handler(struct k_work *work) +{ + for (int i = 0; i < KP_LEN; i++) { + if (!(combo_state & BIT(i))) { + LOG_DBG("Key position %d not held, skipping unpair combo", key_positions[i]); + return; + } + } + + zmk_ble_unpair_all(); +}; + +struct k_delayed_work unpair_combo_work; + +int zmk_ble_unpair_combo_init(struct device *_unused) +{ + k_delayed_work_init(&unpair_combo_work, unpair_combo_work_handler); + k_delayed_work_submit(&unpair_combo_work, K_SECONDS(2)); + + return 0; +}; + +ZMK_LISTENER(zmk_ble_unpair_combo, unpair_combo_listener); +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/app/src/keymap.c b/app/src/keymap.c index ff494f7..ee6e370 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -76,6 +76,11 @@ static struct zmk_behavior_binding zmk_sensor_keymap[ZMK_KEYMAP_LAYERS_LEN][ZMK_ WRITE_BIT(zmk_keymap_layer_state, layer, state); \ return 0; +bool zmk_keymap_layer_active(u8_t layer) +{ + return (zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer)); +}; + int zmk_keymap_layer_activate(u8_t layer) { SET_LAYER_STATE(layer, true); @@ -86,6 +91,16 @@ int zmk_keymap_layer_deactivate(u8_t layer) SET_LAYER_STATE(layer, false); }; +int zmk_keymap_layer_toggle(u8_t layer) +{ + if (zmk_keymap_layer_active(layer)) + { + return zmk_keymap_layer_deactivate(layer); + } + + return zmk_keymap_layer_activate(layer); +}; + bool is_active_position(u32_t position, u8_t layer) { return (zmk_keymap_layer_state & BIT(layer)) == BIT(layer) diff --git a/app/src/usb_hid.c b/app/src/usb_hid.c index 4c6dd4b..784fc25 100644 --- a/app/src/usb_hid.c +++ b/app/src/usb_hid.c @@ -11,18 +11,42 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -static enum usb_dc_status_code usb_status; +static enum usb_dc_status_code usb_status = USB_DC_UNKNOWN; static struct device *hid_dev; +static K_SEM_DEFINE(hid_sem, 1, 1); + +static void in_ready_cb(void) +{ + k_sem_give(&hid_sem); +} + +static const struct hid_ops ops = +{ + .int_in_ready = in_ready_cb, +}; + int zmk_usb_hid_send_report(const u8_t *report, size_t len) { - if (usb_status == USB_DC_SUSPEND) - { + switch(usb_status) { + case USB_DC_SUSPEND: return usb_wakeup_request(); + case USB_DC_ERROR: + case USB_DC_RESET: + case USB_DC_DISCONNECTED: + case USB_DC_UNKNOWN: + return -ENODEV; + default: + k_sem_take(&hid_sem, K_MSEC(30)); + int err = hid_int_ep_write(hid_dev, report, len, NULL); + + if (err) { + k_sem_give(&hid_sem); + } + + return err; } - - return hid_int_ep_write(hid_dev, report, len, NULL); } void usb_hid_status_cb(enum usb_dc_status_code status, const u8_t *params) @@ -43,7 +67,7 @@ static int zmk_usb_hid_init(struct device *_arg) usb_hid_register_device(hid_dev, zmk_hid_report_desc, sizeof(zmk_hid_report_desc), - NULL); + &ops); usb_hid_init(hid_dev); diff --git a/app/west.yml b/app/west.yml index 3784d97..cba53ab 100644 --- a/app/west.yml +++ b/app/west.yml @@ -21,6 +21,18 @@ manifest: - hal_microchip - hal_nxp - hal_openisa + - hal_silabs + - hal_xtensa + - hal_st + - hal_ti + - loramac-node + - mcuboot + - mcumgr + - net-tools + - segger + - openthread + - edtt + - trusted-firmware-m - name: uf2 remote: microsoft path: tools/uf2 diff --git a/docs/blog/2020-08-12-zmk-sotf-1.md b/docs/blog/2020-08-12-zmk-sotf-1.md index 2b69535..8a3ca7c 100644 --- a/docs/blog/2020-08-12-zmk-sotf-1.md +++ b/docs/blog/2020-08-12-zmk-sotf-1.md @@ -28,10 +28,10 @@ There's been lots of various activity in ZMK land! Despite the flurry of activity, there are still some serious bugs and show stoppers that potential ZMK users should be aware of: - [Bluetooth Related](https://github.com/zmkfirmware/zmk/issues/58) - There are several key bugs and fixes needed, including one complete show stopper: - - Fully working split wireless is not working. In particular, both split halves can properly pair, but once they do so, pairing with the _central_ host will not work. Workaround: You can currently have both halves pair, and use USB on the central side (Left side right now for Kyria, Corne, Lily58) and receive HID events over USB. + - <del>Fully working split wireless is not working. In particular, both split halves can properly pair, but once they do so, pairing with the _central_ host will not work. Workaround: You can currently have both halves pair, and use USB on the central side (Left side right now for Kyria, Corne, Lily58) and receive HID events over USB.</del> - Fixed in <a href="https://github.com/zmkfirmware/zmk/commit/8b61beb2bbc62f754db670ad77266f84edde041d">8b61beb</a>. - BT bond information is not currently stored to the devices, so after powering off or restarting your device, users need to re-pair - USB - There is one important USB related bug which is a showstopper: - - The Zephyr USB stack does not have a built in queue for endpoint data being written. As a result, HID events sent by ZMK are sometimes [dropped, or lost](https://github.com/zmkfirmware/zmk/issues/84). + - <del>The Zephyr USB stack does not have a built in queue for endpoint data being written. As a result, HID events sent by ZMK are sometimes <a href="https://github.com/zmkfirmware/zmk/issues/84">dropped, or lost</a>.</del> - Fixed by <a href="https://github.com/careyk007">careyk007</a> in <a href="https://github.com/zmkfirmware/zmk/pull/93">#93</a>. ## Next Steps diff --git a/docs/docs/assets/bond-clearing/corne.jpg b/docs/docs/assets/bond-clearing/corne.jpg Binary files differnew file mode 100644 index 0000000..1e070a2 --- /dev/null +++ b/docs/docs/assets/bond-clearing/corne.jpg diff --git a/docs/docs/assets/bond-clearing/kyria.jpg b/docs/docs/assets/bond-clearing/kyria.jpg Binary files differnew file mode 100644 index 0000000..9fa22a0 --- /dev/null +++ b/docs/docs/assets/bond-clearing/kyria.jpg diff --git a/docs/docs/behavior/key-press.md b/docs/docs/behavior/key-press.md index 08296bb..2edce1d 100644 --- a/docs/docs/behavior/key-press.md +++ b/docs/docs/behavior/key-press.md @@ -1,10 +1,11 @@ --- -title: Key Presses +title: Key Press Behaviors +sidebar_label: Key Press --- ## Summary -The most basic of behaiors, is the ability to send certain keycode presses and releases in response to activating +The most basic of behaviors, is the ability to send certain keycode presses and releases in response to activating a certain key. For reference on keycode values, see the [USB HID Usage Tables](https://www.usb.org/document-library/hid-usage-tables-12). diff --git a/docs/docs/behavior/layers.md b/docs/docs/behavior/layers.md index 2388caf..da7f07f 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 @@ -39,3 +40,55 @@ Example: ``` &mo LOWER ``` + +## Toggle Layer + +The "toggle layer" behavior allows you to enable a layer until the layer is manually disabled. + +### Behavior Binding + +- Reference: `&tog` +- Parameter: The layer number to enable/disable, e.g. `1` + +Example: + +``` +&tog LOWER +``` + +"Toggle layer" for a : + +``` +#define DEFAULT 0 +#define NAVI 1 + +#define NONE 0 + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &tog NAVI &kp KDIV &kp KMLT &kp KMIN + &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp KPLS + &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp KPLS + &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp RET + &kp NUM_0 &kp NUM_0 &kp DOT &kp RET + >; + }; + + nav_layer { + bindings = < + &tog NAVI &kp KDIV &kp KMLT &kp KMIN + &kp HOME &kp UARW &kp PGUP &kp KPLS + &kp LARW &none &kp RARW &kp KPLS + &kp END &kp DARW &kp PGDN &kp RET + &kp INS &kp INS &kp DEL &kp RET + >; + }; + }; +}; +``` + +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 432960e..2d4f532 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 new file mode 100644 index 0000000..446ba33 --- /dev/null +++ b/docs/docs/behavior/misc.md @@ -0,0 +1,42 @@ +--- +title: Miscellaneous Behaviors +sidebar_label: Miscellaneous +--- + +## Summary + +There are a few miscellaneous behaviors that are helpful when working with layers in keymaps, +in particular, with handling what happens in higher layers, and if events are passed to +the next layer or not + +## Transparent + +The transparent behavior simply ignores key position presses/releases, so they will be +passed down to the next active layer in the stack. + +### Behavior Binding + +- Reference: `&trans` +- Parameters: None + +Example: + +``` +&trans +``` + +## None + +The none behavior simply swallows and stops key position presses/releases, so they will **not** +be passed down to the next active layer in the stack. + +### Behavior Binding + +- Reference: `&none` +- Parameters: None + +Example: + +``` +&none +``` diff --git a/docs/docs/behavior/mod-tap.md b/docs/docs/behavior/mod-tap.md new file mode 100644 index 0000000..08e9b65 --- /dev/null +++ b/docs/docs/behavior/mod-tap.md @@ -0,0 +1,30 @@ +--- +title: Mod-Tap Behavior +sidebar_label: Mod-Tap +--- + +## Summary + +The Mod-Tap behavior allows varying the effect of pressing and releasing a key position depending +on whether it is used with other simultaneous key presses at the same time. + +If pressed and released independently, the Mod-Tap behavior will send the press and release events +for the configure keycode. If pressed and held while another key is pressed and released, then +the configured modifiers will be applied to that _other_ key press, and no press will be generated +on the release of the Mod-Tap key. + +## Mod-Tap + +The Mod-Tap behavior either acts as a held modifier, or as a tapped keycode. + +### Behavior Binding + +- Reference: `&mt` +- Parameter #1: The modifiers to be used when activating as a modifier, e.g. `MOD_LSFT` +- Parameter #2: The keycode to sent when used as a tap, e.g. `A`, `B`. + +Example: + +``` +&mt MOD_LSFT A +``` diff --git a/docs/docs/behavior/reset.md b/docs/docs/behavior/reset.md new file mode 100644 index 0000000..8cf122b --- /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 0000000..1d3732b --- /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 + + + +## Corne + +
\ No newline at end of file diff --git a/docs/docs/dev-guide-new-shield.md b/docs/docs/dev-guide-new-shield.md index 1119806..8556623 100644 --- a/docs/docs/dev-guide-new-shield.md +++ b/docs/docs/dev-guide-new-shield.md @@ -81,9 +81,9 @@ this might look something like: ; row-gpios - = <&pro_micro_a 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&pro_micro_a 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&pro_micro_a 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + = <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> ; }; }; @@ -147,51 +147,38 @@ Some important things to note: ## Default Keymap -Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields/<shield_name>/keymap/keymap.overlay` file. The keymap is configured as an additional devicetree overlay that includes the following: +Each keyboard should provide an OOTB default keymap to be used when building the firmware, which can be overridden and customized by user configs. For "shield keyboards", this should be placed in the `app/boards/shields/<shield_name>/<shield_name>.keymap` file. The keymap is configured as an additional devicetree overlay that includes the following: -- A node with `compatible="zmk,layers"` where each child node is a layer with a `bindings` array that binds each key position to a given behavior (e.g. key press, momentarily layer, etc). -- A node with `compatible="zmk,keymap"` that references the layers with a `layers` phandle-array property. -- A chosen node named `zmk,keymap` that references the defined keymap. +- A node with `compatible="zmk,keymap"` where each child node is a layer with a `bindings` array that binds each key position to a given behavior (e.g. key press, momentarily layer, etc). -Here is an example simple keymap for the nice60, with only one layer: +Here is an example simple keymap for the Kyria, with only one layer: ``` #include <behaviors.dtsi> #include <dt-bindings/zmk/keys.h> / { - chosen { - zmk,keymap = &keymap0; - }; - - keymap0: keymap { + keymap { compatible = "zmk,keymap"; - label ="Default nice!60 Keymap"; - layers = <&default>; - }; - layers { - compatible = "zmk,layers"; - - default: layer_0 { - label = "DEFAULT"; -// ------------------------------------------------------------------------------------------ -// | 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 | WIN | MENU | CTL | -// ------------------------------------------------------------------------------------------ + default_layer { +// --------------------------------------------------------------------------------------------------------------------------------- +// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ | +// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' | +// | SHIFT | Z | X | C | V | B | L SHIFT | L SHIFT | | L SHIFT | L SHIFT | N | M | , | . | / | CTRL | +// | GUI | DEL | RET | SPACE | ESC | | RET | SPACE | TAB | BSPC | R-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 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 &kp RGUI &kp GUI &kp RCTL + &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RCTL + &kp LGUI &kp DEL &kp RET &kp SPC &kp ESC &kp RET &kp SPC &kp TAB &kp BKSP &kp RALT >; + + sensor-bindings = <&inc_dec_cp M_VOLU M_VOLD &inc_dec_kp PGUP PGDN>; }; }; }; + ``` :::note diff --git a/docs/docs/dev-setup.md b/docs/docs/dev-setup.md index 5cceb73..6e893b3 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, <TabItem value="raspberryos"> 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). </TabItem> <TabItem value="mac"> -#### 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 + +::: </TabItem> </OsTabs> @@ -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/feature/underglow.md b/docs/docs/feature/underglow.md index 780845a..c6517ce 100644 --- a/docs/docs/feature/underglow.md +++ b/docs/docs/feature/underglow.md @@ -21,10 +21,12 @@ Here you can see the RGB underglow feature in action using WS2812 LEDs. ## Enabling RGB Underglow -To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your user config directory as such: +To enable RGB underglow on your board or shield, simply enable the `ZMK_RGB_UNDERGLOW` and `X_STRIP` configuration values in the `.conf` file of your user config directory as such: ``` CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y ``` If your board or shield does not have RGB underglow configured, refer to [Adding RGB Underglow to a Board](#adding-rgb-underglow-to-a-board). @@ -114,8 +116,10 @@ Once you have your `led_strip` properly defined you need to add it to the root d }; ``` -Finally you need to enable the `ZMK_RGB_UNDERGLOW` configuration value in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): +Finally you need to enable the `ZMK_RGB_UNDERGLOW` and `X_STRIP` configuration values in the `.conf` file of your board (or set a default in the `Kconfig.defconfig`): ``` CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y ``` diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 951cee0..9e6a956 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 1bd0358..51313fc 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", @@ -10,6 +10,9 @@ module.exports = { Behaviors: [ "behavior/key-press", "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 e75b529..4dc740a 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") +options=("nice!nano" "QMK Proton-C" "BlueMicro840 (v1)") echo "$title" echo "" @@ -23,6 +23,7 @@ select opt in "${options[@]}" "Quit"; do 1 ) board="nice_nano"; break;; 2 ) board="proton_c"; break;; + 3 ) board="bluemicro840_v1"; break;; $(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit;; *) echo "Invalid option. Try another one.";continue;; |