Overhaul / update tg4x sources
This commit is contained in:
parent
2b9253affb
commit
d1b501f9e8
|
@ -1,6 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(app PRIVATE mdk_pwr_led.c)
|
|
@ -4,6 +4,6 @@
|
|||
if SHIELD_TG4X
|
||||
|
||||
config ZMK_KEYBOARD_NAME
|
||||
default "TG4X"
|
||||
default "tg4x"
|
||||
|
||||
endif
|
||||
|
|
|
@ -4,23 +4,10 @@ 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
|
||||
## Board Revision and Layout Notes
|
||||
|
||||
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.
|
||||
This TG4X implementation is for...
|
||||
|
||||
## 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
|
||||
|
||||
```
|
||||
* rev 2.1 of the board
|
||||
* Split spacebar with 2.25U on the left and 2.75U on the right
|
||||
* 2U right shift
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
status = "okay";
|
||||
mosi-pin = <9>;
|
||||
mosi-pin = <8>;
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
sck-pin = <5>;
|
||||
miso-pin = <7>;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* 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);
|
|
@ -1,7 +0,0 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Enable underglow
|
||||
#CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||
# Use the STRIP config specific to the LEDs you're using
|
||||
#CONFIG_WS2812_STRIP=y
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
= <&pro_micro_d 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 2 (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)>
|
||||
;
|
||||
|
||||
col-gpios
|
||||
= <&pro_micro_d 9 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 6 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>
|
||||
, <&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>
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <13>;
|
||||
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(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,11) 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,11) RC(2, 12)
|
||||
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(3, 12)
|
||||
>;
|
||||
};
|
||||
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
};
|
|
@ -9,34 +9,46 @@
|
|||
#include <dt-bindings/zmk/bt.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
ht: hold_tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "Hold Tap";
|
||||
#binding-cells = <2>;
|
||||
tapping_term_ms = <200>;
|
||||
flavor = "tap-preferred";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&kp ESCAPE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp SQT &kp BSPC
|
||||
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp ENTER &none
|
||||
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH &kp RSHFT &none
|
||||
&kp LCTRL &kp LGUI &kp LALT < 1 SPACE &none &none &none &kp SPACE &kp RALT &kp RGUI &mo 2 &kp RCTL &none
|
||||
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp SEMI &kp BSPC
|
||||
&ht CAPS TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp APOS &kp RET
|
||||
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp RSHFT
|
||||
&kp LCTRL &kp LGUI &kp LALT < 1 SPACE &kp SPACE &kp RALT &kp RGUI &mo 2 &kp RCTRL
|
||||
>;
|
||||
};
|
||||
|
||||
f_layer {
|
||||
function_layer {
|
||||
bindings = <
|
||||
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp DEL
|
||||
&trans &kp HOME &kp PG_UP &trans &trans &trans &trans &kp LBRC &kp RBRC &kp EQUAL &kp BSLH &kp ENTER &none
|
||||
&trans &kp END &kp PG_DN &trans &trans &trans &trans &trans &trans &trans &kp UP &kp RSFT &none
|
||||
&trans &trans &trans &trans &none &none &none &trans &trans &kp LEFT &kp DOWN &kp RIGHT &none
|
||||
&none &kp HOME &kp PG_UP &trans &trans &trans &kp LBKT &kp RBKT &kp EQUAL &kp BSLH &kp FSLH &trans
|
||||
&trans &kp END &kp PG_DN &trans &trans &trans &trans &trans &trans &kp UP &trans
|
||||
&trans &trans &trans &trans &trans &trans &kp LEFT &kp DOWN &kp RIGHT
|
||||
>;
|
||||
};
|
||||
|
||||
o_layer {
|
||||
other_layer {
|
||||
bindings = <
|
||||
&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12
|
||||
&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_VOL_DN &kp C_PP &none
|
||||
&bt BT_CLR &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bootloader &reset &none
|
||||
&trans &trans &trans &trans &none &none &none &trans &trans &trans &trans &trans &none
|
||||
&kp PRINTSCREEN &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12
|
||||
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
||||
&trans &bt BT_CLR &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &bootloader &reset &trans
|
||||
&trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_VOL_DN &kp C_PP
|
||||
>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,4 +4,52 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "tg4x.dtsi"
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
|
||||
diode-direction = "col2row";
|
||||
|
||||
row-gpios
|
||||
= <&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)>
|
||||
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
;
|
||||
|
||||
col-gpios
|
||||
= <&pro_micro_d 1 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
|
||||
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
rows = <8>;
|
||||
columns = <7>;
|
||||
|
||||
map = <
|
||||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5)
|
||||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4)
|
||||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(6,0) RC(6,1) RC(6,2) RC(6,4)
|
||||
RC(3,0) RC(3,1) RC(3,2) RC(3,4) RC(3,5) RC(7,1) RC(7,2) RC(7,3) RC(7,4)
|
||||
>;
|
||||
};
|
||||
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue