Skip to content

Commit

Permalink
feat(shields): Add Reviung53 shield.
Browse files Browse the repository at this point in the history
* Initial Reviung53 shield

---------

Co-authored-by: Cem Aksoylar <[email protected]>
  • Loading branch information
kh411d and caksoylar authored Oct 17, 2023
1 parent 3b1d043 commit 7fe9ecd
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/boards/shields/reviung53/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_REVIUNG53

config ZMK_KEYBOARD_NAME
default "Reviung53"

endif
5 changes: 5 additions & 0 deletions app/boards/shields/reviung53/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_REVIUNG53
def_bool $(shields_list_contains,reviung53)
47 changes: 47 additions & 0 deletions app/boards/shields/reviung53/boards/nice_nano.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#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 {
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 = <10>;
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;
};
};
47 changes: 47 additions & 0 deletions app/boards/shields/reviung53/boards/nice_nano_v2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#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 {
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 = <10>;
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/reviung53/reviung53.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
109 changes: 109 additions & 0 deletions app/boards/shields/reviung53/reviung53.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

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

/ {
conditional_layers {
compatible = "zmk,conditional-layers";
tri_layer {
if-layers = <1 2>;
then-layer = <3>;
};
};

keymap {
compatible = "zmk,keymap";

default_layer {
// ----------------------------------------------------------------------------------------
// | | | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | DEL |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | BKSP |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | RET |
// | SHFT | Z | X | C | V | B | N | M | , | . | SHFT(/) |
// | CTRL | GUI | ALT | LOWER(SPACE) | RAISE(SPACE)| ALT | GUI | CTRL(\) |
// |
bindings = <
&kp ESC &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp DEL
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp RET
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &mt RSHFT FSLH
&kp LCTRL &kp LCMD &kp LALT &lt 1 SPACE &lt 2 SPACE &kp RALT &kp RCMD &mt RCTRL BSLH
>;
};

lower_layer {
// --------------------------------------------------------------------------------------------
// | | | | F9 | F10 | F11 | F12 | INS | PAU | SCR | PSCR | |
// | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | |
// | NAV | | | | | | | _ | + | { | } | " |
// | | | | | | | | | | | ? |
// | | | | | | | | | |
// |
bindings = <
&trans &kp F9 &kp F10 &kp F11 &kp F12 &kp INS &kp PAUSE_BREAK &kp SLCK &kp PSCRN &trans
&kp TILDE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp LPAR &kp RPAR &trans
&mo 4 &none &none &none &none &none &none &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp DQT
&trans &none &none &none &none &none &none &none &none &none &kp QMARK
&trans &trans &trans &trans &trans &trans &trans &kp PIPE
>;
};

raise_layer {
// --------------------------------------------------------------------------------------
// | | | | F9 | F10 | F11 | F12 | MUTE | VOL+ | VOL- | PLAY | |
// | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
// | NAV | | | | | | | - | = | [ | ] | ' |
// | | | | | | | | + | < | > | : |
// | | | | | | | | | |
// |
bindings = <
&trans &kp F9 &kp F10 &kp F11 &kp F12 &kp C_MUTE &kp C_VOL_UP &kp C_VOL_DN &kp C_PLAY &trans
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans
&mo 4 &none &none &none &none &none &none &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp SQT
&trans &none &none &none &none &none &none &kp PLUS &kp LT &kp GT &kp COLON
&trans &trans &trans &trans &trans &trans &trans &kp PIPE
>;
};

adjust_layer {
// ------------------------------------------------------------------------------------------------------------------------
// | | | BT CLR | BT1 | BT2 | BT3 | BT4 | BT5 | | | | BT CLR |
// | RGB BRI+ | RGB SAT+ | RGB HUE+ | RGB ANI+ | | RGB TOG | | | | | | |
// | RGB BRI- | RGB SAT- | RGB HUE- | RGB ANI- | | | | | | | | |
// | | | | | | | BOOT | | | | |
// | | | | | | | | |
// |
bindings = <
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &none &none &bt BT_CLR
&rgb_ug RGB_BRI &rgb_ug RGB_SAI &rgb_ug RGB_HUI &rgb_ug RGB_EFF &none &rgb_ug RGB_TOG &none &none &none &none &none &none
&rgb_ug RGB_BRD &rgb_ug RGB_SAD &rgb_ug RGB_HUD &rgb_ug RGB_EFR &none &none &none &none &none &none &none &none
&trans &none &none &none &none &none &bootloader &none &none &none &none
&trans &trans &trans &trans &trans &none &none &none
>;
};

nav_layer {
// ------------------------------------------------------------------------------------------------------------------------
// | | | ESC | | | | | | | | | DEL |
// | TAB | | UP | | | | | | | | | BSPC |
// | NAV | LEFT | DOWN | RIGHT | | | LEFT | DOWN | UP | RIGHT | | ENTER |
// | SHIFT | | | | | | HOME | END | PGUP | PGDN | SHIFT |
// | CTRL | GUI | ALT | SPACE | SPACE | ALT | GUI | CTRL |
// |
bindings = <
&kp ESC &none &none &none &none &none &none &none &none &kp DEL
&kp TAB &none &kp UP &none &none &none &none &none &none &none &none &kp BSPC
&trans &kp LEFT &kp DOWN &kp RIGHT &none &none &kp LEFT &kp DOWN &kp UP &kp RIGHT &none &kp RET
&kp LSHFT &none &none &none &none &none &kp HOME &kp END &kp PG_UP &kp PG_DN &kp RSHFT
&kp LCTRL &kp LCMD &kp LALT &kp SPACE &kp SPACE &kp LALT &kp RCMD &kp RCTRL
>;
};
};
};
56 changes: 56 additions & 0 deletions app/boards/shields/reviung53/reviung53.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* 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 = <8>;
rows = <7>;

map = <
RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(4,0) RC(4,1) RC(4,2) RC(4,3)
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(4,4) RC(4,5) RC(4,6) RC(4,7)
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(5,0) RC(5,1) RC(5,2) RC(5,3)
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(5,4) RC(5,5) RC(5,6)
RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) RC(6,6) RC(6,7)
>;
};

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

col-gpios
= <&pro_micro 21 GPIO_ACTIVE_HIGH>
, <&pro_micro 20 GPIO_ACTIVE_HIGH>
, <&pro_micro 19 GPIO_ACTIVE_HIGH>
, <&pro_micro 18 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 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

};
};
9 changes: 9 additions & 0 deletions app/boards/shields/reviung53/reviung53.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
file_format: "1"
id: reviung53
name: REVIUNG53
type: shield
url: https://github.com/gtips/reviung/tree/master/reviung53
requires: [pro_micro]
features:
- keys
- underglow

0 comments on commit 7fe9ecd

Please sign in to comment.