Merge branch 'main' into CrossR/Sofle

This commit is contained in:
CrossR 2020-08-21 22:03:52 +01:00
commit 84761fc589
58 changed files with 873 additions and 77 deletions

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -1,5 +1,5 @@
identifier: bluemicro52840_v1
name: BlueMicro52840_V1
identifier: bluemicro840_v1
name: BlueMicro840_V1
type: mcu
arch: arm
toolchain:

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 {};

View File

@ -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 {};

View File

@ -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)

View File

@ -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>;
};
};
};

View File

@ -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

View File

@ -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

View File

@ -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>;
};
};
};

View File

@ -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

View File

@ -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

View File

@ -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>;
};
};
};

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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
>;
};

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y

View File

@ -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;
};
};

View File

@ -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;
};
};

View File

@ -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;
};
};

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y

View File

@ -1,3 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
CONFIG_ZMK_BLE_UNPAIR_COMBO=y

View File

@ -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})

View File

@ -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>;
};
};
};

View File

@ -6,3 +6,8 @@ description: Keyboard Reset Behavior
compatible: "zmk,behavior-reset"
include: zero_param.yaml
properties:
type:
type: int
default: 0

View File

@ -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

View File

@ -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);
#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)

View File

@ -7,10 +7,11 @@
#include <device.h>
#include <init.h>
#include <logging/log.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>
@ -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) */

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View File

@ -1,5 +1,6 @@
---
title: Key Presses
title: Key Press Behaviors
sidebar_label: Key Press
---
## Summary

View File

@ -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.
It is possible to use "toggle layer" to have keys that raise and lower the layers as well.

View File

@ -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
```
```

View File

@ -1,5 +1,6 @@
---
title: Miscellaneous
title: Miscellaneous Behaviors
sidebar_label: Miscellaneous
---
## Summary

View File

@ -1,5 +1,6 @@
---
title: Mod-Tap
title: Mod-Tap Behavior
sidebar_label: Mod-Tap
---
## Summary

View File

@ -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
```

27
docs/docs/bond-reset.md Normal file
View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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: [

View File

@ -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;;