From 7fe9ecd87f086fe6fcf253559e751fab575faa5c Mon Sep 17 00:00:00 2001 From: Khalid Aj Date: Wed, 18 Oct 2023 05:43:50 +0700 Subject: [PATCH] feat(shields): Add Reviung53 shield. * Initial Reviung53 shield --------- Co-authored-by: Cem Aksoylar --- .../shields/reviung53/Kconfig.defconfig | 9 ++ app/boards/shields/reviung53/Kconfig.shield | 5 + .../reviung53/boards/nice_nano.overlay | 47 ++++++++ .../reviung53/boards/nice_nano_v2.overlay | 47 ++++++++ app/boards/shields/reviung53/reviung53.conf | 3 + app/boards/shields/reviung53/reviung53.keymap | 109 ++++++++++++++++++ .../shields/reviung53/reviung53.overlay | 56 +++++++++ .../shields/reviung53/reviung53.zmk.yml | 9 ++ 8 files changed, 285 insertions(+) create mode 100644 app/boards/shields/reviung53/Kconfig.defconfig create mode 100644 app/boards/shields/reviung53/Kconfig.shield create mode 100644 app/boards/shields/reviung53/boards/nice_nano.overlay create mode 100644 app/boards/shields/reviung53/boards/nice_nano_v2.overlay create mode 100644 app/boards/shields/reviung53/reviung53.conf create mode 100644 app/boards/shields/reviung53/reviung53.keymap create mode 100644 app/boards/shields/reviung53/reviung53.overlay create mode 100644 app/boards/shields/reviung53/reviung53.zmk.yml diff --git a/app/boards/shields/reviung53/Kconfig.defconfig b/app/boards/shields/reviung53/Kconfig.defconfig new file mode 100644 index 00000000000..efac69b7f40 --- /dev/null +++ b/app/boards/shields/reviung53/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2023 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_REVIUNG53 + +config ZMK_KEYBOARD_NAME + default "Reviung53" + +endif diff --git a/app/boards/shields/reviung53/Kconfig.shield b/app/boards/shields/reviung53/Kconfig.shield new file mode 100644 index 00000000000..0b0613e2331 --- /dev/null +++ b/app/boards/shields/reviung53/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2023 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_REVIUNG53 + def_bool $(shields_list_contains,reviung53) diff --git a/app/boards/shields/reviung53/boards/nice_nano.overlay b/app/boards/shields/reviung53/boards/nice_nano.overlay new file mode 100644 index 00000000000..4df91903c68 --- /dev/null +++ b/app/boards/shields/reviung53/boards/nice_nano.overlay @@ -0,0 +1,47 @@ +#include + +&pinctrl { + spi3_default: spi3_default { + group1 { + psels = ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = ; + 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 = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/reviung53/boards/nice_nano_v2.overlay b/app/boards/shields/reviung53/boards/nice_nano_v2.overlay new file mode 100644 index 00000000000..4df91903c68 --- /dev/null +++ b/app/boards/shields/reviung53/boards/nice_nano_v2.overlay @@ -0,0 +1,47 @@ +#include + +&pinctrl { + spi3_default: spi3_default { + group1 { + psels = ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = ; + 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 = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/reviung53/reviung53.conf b/app/boards/shields/reviung53/reviung53.conf new file mode 100644 index 00000000000..289f070ba3f --- /dev/null +++ b/app/boards/shields/reviung53/reviung53.conf @@ -0,0 +1,3 @@ +# Uncomment the following lines to enable RGB underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/reviung53/reviung53.keymap b/app/boards/shields/reviung53/reviung53.keymap new file mode 100644 index 00000000000..d00ca6b975b --- /dev/null +++ b/app/boards/shields/reviung53/reviung53.keymap @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2023 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +/ { + 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 < 1 SPACE < 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 + >; + }; + }; +}; \ No newline at end of file diff --git a/app/boards/shields/reviung53/reviung53.overlay b/app/boards/shields/reviung53/reviung53.overlay new file mode 100644 index 00000000000..213b3b81c72 --- /dev/null +++ b/app/boards/shields/reviung53/reviung53.overlay @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + 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)> + ; + + }; +}; diff --git a/app/boards/shields/reviung53/reviung53.zmk.yml b/app/boards/shields/reviung53/reviung53.zmk.yml new file mode 100644 index 00000000000..e670755c774 --- /dev/null +++ b/app/boards/shields/reviung53/reviung53.zmk.yml @@ -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