Basic setup of dongle's for pockettype and tg4x
This commit is contained in:
parent
ad30ca423a
commit
594db23795
|
@ -10,9 +10,17 @@ Need to have the `zmk-config` directory mounted at `/workspaces/zmk-config` in D
|
|||
|
||||
west build --board nice_nano -d build/tidbit -- -DSHIELD=tidbit -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/pockettype -- -DSHIELD=pockettype -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
west build --board nice_nano -d build/pockettype/default -- -DSHIELD=pockettype -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/tg4x -- -DSHIELD=tg4x -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
west build --board nrf52840_mdk -d build/pockettype/mdk -- -DSHIELD=pockettype_mdk -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/pockettype/peripheral -- -DSHIELD=pockettype_peripheral -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/tg4x/default -- -DSHIELD=tg4x -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nrf52840_mdk -d build/tg4x/mdk -- -DSHIELD=tg4x_mdk -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/tg4x/peripheral -- -DSHIELD=tg4x_peripheral -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
west build --board nice_nano -d build/lily58/left -- -DSHIELD=lily58_left -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(app PRIVATE pwr_led.c)
|
||||
target_sources(app PRIVATE pockettype_pwr_led.c)
|
||||
target_sources(app PRIVATE mdk_pwr_led.c)
|
||||
|
|
|
@ -3,3 +3,24 @@
|
|||
Standard setup for the [PocketType!](https://mechboards.co.uk/shop/kits/pockettype/) mini keyboard.
|
||||
|
||||
The `keymap` directory contains the keyboard layout and were created by [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/). Please note: the zmk keymap is slightly adjusted from the default shown on the main PocketType! pages and QMK.
|
||||
|
||||
## Alternate Builds
|
||||
|
||||
The `pockettype_mdk` shield is setup to use the MakerDiary MDK board as a dongle for the Pockettype!. This will setup the PocketType! as a split ZMK keyboard. The "peripheral half" will be the Pockettype! and the "controller half" will be the MDK.
|
||||
|
||||
## Build Commands
|
||||
|
||||
Below are the three commands that can be used to build ZMK for the Pockettype! as a stand alone board or with a MakerDiary MDK as a dongle.
|
||||
|
||||
``` sh
|
||||
|
||||
# Stand alone build
|
||||
west build --board nice_nano -d build/pockettype/default -- -DSHIELD=pockettype -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
# MDK Dongle build
|
||||
west build --board nrf52840_mdk -d build/pockettype/mdk -- -DSHIELD=pockettype_mdk -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
# Pockettype as a peripheral to the MDK
|
||||
west build --board nice_nano -d build/pockettype/peripheral -- -DSHIELD=pockettype_peripheral -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
```
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
#include <devicetree.h>
|
||||
#include <drivers/gpio.h>
|
||||
|
||||
#define PWR_LED_NODE DT_ALIAS(led1-blue)
|
||||
|
||||
#if DT_NODE_HAS_STATUS(PWR_LED_NODE, okay)
|
||||
#define PWR_LED DT_GPIO_LABEL(PWR_LED_NODE, gpios)
|
||||
#define PWR_LED_PIN DT_GPIO_PIN(PWR_LED_NODE, gpios)
|
||||
#else
|
||||
/* A build error here means your board isn't set up to blink an LED. */
|
||||
#error "Unsupported board: pwr_led devicetree alias is not defined"
|
||||
#define PWR_LED ""
|
||||
#define PIN 0
|
||||
#define FLAGS 0
|
||||
#endif
|
||||
|
||||
static int pwr_led_init(const struct device *_arg) {
|
||||
ARG_UNUSED(_arg);
|
||||
|
||||
const struct device *dev;
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(PWR_LED);
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure(dev, PWR_LED_PIN, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
gpio_pin_set(dev, PIN, (int)true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(pwr_led_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h>
|
||||
|
||||
/ {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
act_led: led_a {
|
||||
gpios = <&pro_micro_a 3 GPIO_ACTIVE_HIGH>;
|
||||
label = "ACT LED";
|
||||
};
|
||||
power_led: led_p {
|
||||
gpios = <&pro_micro_a 2 GPIO_ACTIVE_HIGH>;
|
||||
label = "PWR LED";
|
||||
};
|
||||
};
|
||||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
= <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 3 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
|
||||
row-gpios
|
||||
= <&pro_micro_d 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <12>;
|
||||
rows = <4>;
|
||||
|
||||
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)
|
||||
>;
|
||||
};
|
||||
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
};
|
|
@ -4,65 +4,4 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h>
|
||||
|
||||
/ {
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
act_led: led_a {
|
||||
gpios = <&pro_micro_a 3 GPIO_ACTIVE_HIGH>;
|
||||
label = "ACT LED";
|
||||
};
|
||||
power_led: led_p {
|
||||
gpios = <&pro_micro_a 2 GPIO_ACTIVE_HIGH>;
|
||||
label = "PWR LED";
|
||||
};
|
||||
};
|
||||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
= <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 3 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
|
||||
row-gpios
|
||||
= <&pro_micro_d 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <12>;
|
||||
rows = <4>;
|
||||
|
||||
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)
|
||||
>;
|
||||
};
|
||||
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
};
|
||||
#include "pockettype.dtsi"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
keymap0: keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&bootloader
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
|
||||
label = "KSCAN";
|
||||
|
||||
input-gpios
|
||||
= <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>
|
||||
;
|
||||
|
||||
};
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Pete Johanson
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "pockettype.dtsi"
|
||||
#include "pockettype.keymap"
|
||||
|
||||
&default_transform {
|
||||
col-offset = <0>;
|
||||
};
|
|
@ -0,0 +1,6 @@
|
|||
#
|
||||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(app PRIVATE mdk_pwr_led.c)
|
|
@ -3,3 +3,24 @@
|
|||
Standard setup for the [TG4X](https://github.com/MythosMann/tg4x/) 40% keyboard.
|
||||
|
||||
The `keymap` directory contains the keyboard layout and were created by [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/). Please note: the zmk keymap is slightly adjusted from the default shown on the main TG4X pages and QMK.
|
||||
|
||||
## Alternate Builds
|
||||
|
||||
The `tg4x_mdk` shield is setup to use the MakerDiary MDK board as a dongle for the TG4X. This will setup the TG4X as a split ZMK keyboard. The "peripheral half" will be the TG4X and the "controller half" will be the MDK.
|
||||
|
||||
## Build Commands
|
||||
|
||||
Below are the three commands that can be used to build ZMK for the TG4X as a stand alone board or with a MakerDiary MDK as a dongle.
|
||||
|
||||
``` sh
|
||||
|
||||
# Stand alone build
|
||||
west build --board nice_nano -d build/tg4x/default -- -DSHIELD=tg4x -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
# MDK Dongle build
|
||||
west build --board nrf52840_mdk -d build/tg4x/mdk -- -DSHIELD=tg4x_mdk -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
# TG4X as a peripheral to the MDK
|
||||
west build --board nice_nano -d build/tg4x/peripheral -- -DSHIELD=tg4x_peripheral -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
|
||||
|
||||
```
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
#include <devicetree.h>
|
||||
#include <drivers/gpio.h>
|
||||
|
||||
#define PWR_LED_NODE DT_ALIAS(led1-blue)
|
||||
|
||||
#if DT_NODE_HAS_STATUS(PWR_LED_NODE, okay)
|
||||
#define PWR_LED DT_GPIO_LABEL(PWR_LED_NODE, gpios)
|
||||
#define PWR_LED_PIN DT_GPIO_PIN(PWR_LED_NODE, gpios)
|
||||
#else
|
||||
/* A build error here means your board isn't set up to blink an LED. */
|
||||
#error "Unsupported board: pwr_led devicetree alias is not defined"
|
||||
#define PWR_LED ""
|
||||
#define PIN 0
|
||||
#define FLAGS 0
|
||||
#endif
|
||||
|
||||
static int pwr_led_init(const struct device *_arg) {
|
||||
ARG_UNUSED(_arg);
|
||||
|
||||
const struct device *dev;
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(PWR_LED);
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure(dev, PWR_LED_PIN, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
gpio_pin_set(dev, PIN, (int)true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(pwr_led_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <behaviors.dtsi>
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
keymap0: keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&bootloader
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix-transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-direct";
|
||||
|
||||
label = "KSCAN";
|
||||
|
||||
input-gpios
|
||||
= <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>
|
||||
;
|
||||
|
||||
};
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ZMK_SPLIT=y
|
||||
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Pete Johanson
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "tg4x.dtsi"
|
||||
#include "tg4x.keymap"
|
||||
|
||||
&default_transform {
|
||||
col-offset = <0>;
|
||||
};
|
|
@ -29,14 +29,8 @@
|
|||
|
||||
# Hardware To Do / Notes
|
||||
|
||||
## Pockettype
|
||||
|
||||
- Setup as the 'nice' dongle
|
||||
|
||||
## 40%
|
||||
|
||||
- Setup as the 'naked' dongle
|
||||
- Standard ZMK port with nice!nano
|
||||
- Figure out underglow
|
||||
|
||||
## Tidbit
|
||||
|
|
Loading…
Reference in a new issue