Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reviung34 shield definition #1935

Merged
merged 16 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/boards/shields/reviung34/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_REVIUNG34

config ZMK_KEYBOARD_NAME
default "REVIUNG34"

endif
5 changes: 5 additions & 0 deletions app/boards/shields/reviung34/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

config SHIELD_REVIUNG34
def_bool $(shields_list_contains,reviung34)
13 changes: 13 additions & 0 deletions app/boards/shields/reviung34/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# REVIUNG34

REVIUNG34 is a 33-34 key unibody split keyboard by [gtips](https://github.com/gtips). An in-stock version can be found at [Little Keyboards](https://www.littlekeyboards.com/products/reviung34-analyst-keyboard-kit).

By default, the 2x1u layout is used. To use to the 1x2u layout, add the following to your keymap:

```
/ {
chosen {
zmk,matrix_transform = &single_2u_transform;
};
};
```
alexkang marked this conversation as resolved.
Show resolved Hide resolved
48 changes: 48 additions & 0 deletions app/boards/shields/reviung34/boards/nice_nano_v2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <dt-bindings/led/led.h>

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
low-power-enable;
};
};
};

&spi3 {
alexkang marked this conversation as resolved.
Show resolved Hide resolved
compatible = "nordic,nrf-spim";
status = "okay";

pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";

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 = <9>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
3 changes: 3 additions & 0 deletions app/boards/shields/reviung34/reviung34.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Uncomment the following lines to enable RGB underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y
77 changes: 77 additions & 0 deletions app/boards/shields/reviung34/reviung34.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/rgb.h>

/ {
chosen {
// 34 keys.
zmk,matrix_transform = &dual_1u_transform;

// 33 keys. Center two thumb keys replaced by a single 2u key. Remember to adjust your
// keymap accordingly!
// zmk,matrix_transform = &single_2u_transform;
};
};

/ {
keymap {
compatible = "zmk,keymap";

base {
label = "Base";
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI
&mt LSHFT Z &mt LCTRL X &mt LALT C &kp V &kp B &kp N &kp M &mt RALT COMMA &mt RCTRL DOT &mt RSHFT SLASH
&kp LGUI &lt 1 BSPC &lt 2 SPACE &mo 3
>;
};

lower {
label = "Lower";
bindings = <
&kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR
&trans &kp TILDE &kp DQT &kp PIPE &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &mo 4 &trans
>;
};

upper {
label = "Upper";
bindings = <
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&trans &kp GRAVE &kp SQT &kp BSLH &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &mo 4 &trans &trans
>;
};

function {
label = "Function";
bindings = <
&kp TAB &trans &kp C_VOL_UP &trans &trans &trans &trans &trans &trans &kp ENTER
&kp ESC &kp C_BRI_DN &kp C_VOL_DN &kp C_BRI_UP &trans &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &kp C_PWR &trans &trans
>;
};

meta {
label = "Meta";
bindings = <
&rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_BRI &rgb_ug RGB_SPI &rgb_ug RGB_EFF &none &none &none &none &none
&rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_BRD &rgb_ug RGB_SPD &rgb_ug RGB_EFR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4
&none &none &rgb_ug RGB_TOG &none &none &none &none &bt BT_CLR &none &none
&none &trans &trans &none
>;
};
};
};
63 changes: 63 additions & 0 deletions app/boards/shields/reviung34/reviung34.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <dt-bindings/zmk/matrix_transform.h>

/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &dual_1u_transform;
};

dual_1u_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <9>;
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(3,5)
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(3,6)
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(3,7)
RC(3,2) RC(3,3) RC(3,4) RC(3,8)
>;
};

single_2u_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <9>;
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(3,5)
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(3,6)
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(3,7)
RC(3,2) RC(3,4) RC(3,8)
>;
};

kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";

col-gpios
= <&pro_micro 4 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
, <&pro_micro 7 GPIO_ACTIVE_HIGH>
, <&pro_micro 8 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 14 GPIO_ACTIVE_HIGH>
, <&pro_micro 16 GPIO_ACTIVE_HIGH>
, <&pro_micro 10 GPIO_ACTIVE_HIGH>
;

row-gpios
= <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
};
9 changes: 9 additions & 0 deletions app/boards/shields/reviung34/reviung34.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
file_format: "1"
id: reviung34
name: REVIUNG34
type: shield
url: https://github.com/gtips/reviung/tree/master/reviung34
requires: [pro_micro]
features:
- keys
- underglow