Merge branch 'main' of https://github.com/zmkfirmware/zmk into main

This commit is contained in:
tominabox1 2020-08-23 16:46:04 -05:00
commit 83ddc8a638
20 changed files with 265 additions and 15 deletions

View file

@ -3,3 +3,8 @@ config BOARD_ENABLE_DCDC
select SOC_DCDC_NRF52X select SOC_DCDC_NRF52X
default y default y
depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13) depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13)
config BOARD_NRFMICRO_CHARGER
bool "Enable battery charger"
default y
depends on (BOARD_NRFMICRO_13)

View file

@ -30,4 +30,11 @@ config ZMK_USB
config PINMUX config PINMUX
default y default y
if BOARD_NRFMICRO_13
config BOARD_NRFMICRO_CHARGER
default y
endif # BOARD_NRFMICRO_13
endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13

View file

@ -23,9 +23,13 @@ static int pinmux_nrfmicro_init(struct device *port)
gpio_pin_configure(p1, 9, GPIO_OUTPUT); gpio_pin_configure(p1, 9, GPIO_OUTPUT);
gpio_pin_set(p1, 9, 0); gpio_pin_set(p1, 9, 0);
// enable charger (nRFMicro 1.3 only) #if CONFIG_BOARD_NRFMICRO_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT); gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0); gpio_pin_set(p0, 5, 0);
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
#endif
#else #else
// enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1) // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1)
gpio_pin_configure(p1, 9, GPIO_OUTPUT); gpio_pin_configure(p1, 9, GPIO_OUTPUT);

View file

@ -0,0 +1,22 @@
#Copyright (c) 2020 Derek Schmell
#SPDX-License-Identifier: MIT
if SHIELD_SPLITREUS62_LEFT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Left"
endif
if SHIELD_SPLITREUS62_RIGHT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Right"
endif
if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT
endif

View file

@ -0,0 +1,8 @@
# Copyright (c) 2020 Derek Schmell
# SPDX-License-Identifier: MIT
config SHIELD_SPLITREUS62_LEFT
def_bool $(shields_list_contains,splitreus62_left)
config SHIELD_SPLITREUS62_RIGHT
def_bool $(shields_list_contains,splitreus62_right)

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix-transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <6>;
// | SW0 | SW5 | SW10 | SW15 | SW20 | SW25 | SW25 | SW20 | SW15 | SW10 | SW5 | SW1 |
// | SW1 | SW6 | SW11 | SW16 | SW21 | SW26 | SW26 | SW21 | SW16 | SW11 | SW6 | SW2 |
// | SW2 | SW7 | SW12 | SW17 | SW22 | SW27 | SW27 | SW22 | SW17 | SW12 | SW7 | SW3 |
// | SW3 | SW8 | SW13 | SW18 | SW23 | SW28 | SW28 | SW23 | SW18 | SW13 | SW8 | SW4 |
// | SW4 | SW9 | SW14 | SW19 | SW24 | SW29 | SW29 | SW24 | SW19 | SW14 | SW9 | SW5 |
// SW30 | SW30
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,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,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11)
RC(5,5) RC(5,6)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
row-gpios
= <&pro_micro_d 1 GPIO_ACTIVE_HIGH >
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
;
};
};

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
// ------------------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | \ |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHIFT | Z | X | C | V | B | | N | M | , | . | / | SHIFT |
// | LCTL | LGUI | LALT | GRAV | | EQL | DEL | BKSP| | RET | SPC | LBKT | RBKT | LBKT | HOME | END |
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 TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
&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 LCTL &kp LGUI &kp LALT &kp GRAV &kp EQL &kp DEL &kp SPC &kp LBKT &kp RBKT &kp MINUS &kp HOME &kp END
&kp BKSP &kp RET
>;
};
};
};

View file

@ -0,0 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include "splitreus62.dtsi"
&kscan0 {
col-gpios
= <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

View file

@ -0,0 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include "splitreus62.dtsi"
&default_transform {
col-offset = <6>;
};
&kscan0 {
col-gpios
= <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

View file

@ -1,3 +1,5 @@
#include <dt-bindings/zmk/reset.h>
/ { / {
behaviors { behaviors {
reset: behavior_reset { reset: behavior_reset {
@ -5,5 +7,12 @@
label = "RESET"; label = "RESET";
#binding-cells = <0>; #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" compatible: "zmk,behavior-reset"
include: zero_param.yaml 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); LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_reset_config { }; struct behavior_reset_config {
struct behavior_reset_data { }; int type;
};
static int behavior_reset_init(struct device *dev) 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) 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? // TODO: Correct magic code for going into DFU?
// See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107 // See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
sys_reboot(0); sys_reboot(cfg->type);
return 0; 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 = {}; #define RST_INST(n) \
static const struct behavior_reset_config behavior_reset_config_##n = { \
static struct behavior_reset_data behavior_reset_data; .type = DT_INST_PROP(n, type) \
}; \
DEVICE_AND_API_INIT(behavior_reset, DT_INST_LABEL(0), behavior_reset_init, DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, \
&behavior_reset_data, NULL, \
&behavior_reset_config, &behavior_reset_config_##n, \
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&behavior_reset_driver_api); &behavior_reset_driver_api);
DT_INST_FOREACH_STATUS_OKAY(RST_INST)

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

View file

@ -52,6 +52,7 @@ sudo apt install -y \
autoconf \ autoconf \
automake \ automake \
build-essential \ build-essential \
bzip2 \
ccache \ ccache \
device-tree-compiler \ device-tree-compiler \
dfu-util \ dfu-util \
@ -91,6 +92,7 @@ sudo apt install -y \
autoconf \ autoconf \
automake \ automake \
build-essential \ build-essential \
bzip2 \
ccache \ ccache \
device-tree-compiler \ device-tree-compiler \
dfu-util \ dfu-util \
@ -130,6 +132,7 @@ sudo dnf install -y \
wget \ wget \
autoconf \ autoconf \
automake \ automake \
bzip2 \
ccache \ ccache \
dtc \ dtc \
dfu-util \ dfu-util \

View file

@ -12,6 +12,7 @@ module.exports = {
"behavior/layers", "behavior/layers",
"behavior/misc", "behavior/misc",
"behavior/mod-tap", "behavior/mod-tap",
"behavior/reset",
"behavior/lighting", "behavior/lighting",
], ],
Development: [ Development: [

View file

@ -38,7 +38,7 @@ echo ""
echo "Keyboard Shield Selection:" echo "Keyboard Shield Selection:"
prompt="Pick an keyboard:" prompt="Pick an keyboard:"
options=("Kyria" "Lily58" "Corne") options=("Kyria" "Lily58" "Corne" "Splitreus62")
PS3="$prompt " PS3="$prompt "
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
@ -50,6 +50,7 @@ select opt in "${options[@]}" "Quit"; do
1 ) shield_title="Kyria" shield="kyria"; split="y"; break;; 1 ) shield_title="Kyria" shield="kyria"; split="y"; break;;
2 ) shield_title="Lily58" shield="lily58"; split="y"; break;; 2 ) shield_title="Lily58" shield="lily58"; split="y"; break;;
3 ) shield_title="Corne" shield="corne"; split="y"; break;; 3 ) shield_title="Corne" shield="corne"; split="y"; break;;
4 ) shield_title="Splitreus62" shield="splitreus62"; split="y"; break;;
# Add link to docs on adding your own custom shield in your ZMK config! # Add link to docs on adding your own custom shield in your ZMK config!
# $(( ${#options[@]}+1 )) ) echo "Other!"; break;; # $(( ${#options[@]}+1 )) ) echo "Other!"; break;;