diff --git a/app/boards/shields/reviung5/boards/nice_nano_v2.overlay b/app/boards/shields/reviung5/boards/nice_nano_v2.overlay new file mode 100644 index 00000000..540e345a --- /dev/null +++ b/app/boards/shields/reviung5/boards/nice_nano_v2.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#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"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <4>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/reviung5/reviung5.conf b/app/boards/shields/reviung5/reviung5.conf index a8b4a868..d5d38739 100644 --- a/app/boards/shields/reviung5/reviung5.conf +++ b/app/boards/shields/reviung5/reviung5.conf @@ -1,3 +1,7 @@ -# Encoder support. Uncomment to enable. +# Uncomment the following two lines to add support for encoders # CONFIG_EC11=y # CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment the following two lines to enable RGB underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/app/boards/shields/reviung5/reviung5.keymap b/app/boards/shields/reviung5/reviung5.keymap index 31c89cbc..33701677 100644 --- a/app/boards/shields/reviung5/reviung5.keymap +++ b/app/boards/shields/reviung5/reviung5.keymap @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 The ZMK Contributors + * Copyright (c) 2024 The ZMK Contributors * * SPDX-License-Identifier: MIT */ @@ -8,20 +8,31 @@ #include #include #include +#include #define BASE 0 #define BLE 1 +#define RGB 2 / { + + behaviors { + rgb_encoder: rgb_encoder { + compatible = "zmk,behavior-sensor-rotate"; + #sensor-binding-cells = <0>; + bindings = <&rgb_ug RGB_BRI>, <&rgb_ug RGB_BRD>; + }; + }; + keymap { compatible = "zmk,keymap"; base_layer { display-name = "BASE"; bindings = < - // ╭─────────────┬──────────────┬──────────────────┬─────────────┬─────────────╮ - &mo BLE &kp C_PREVIOUS &kp C_PLAY_PAUSE &kp C_NEXT &kp C_MUTE - // ╰─────────────┴──────────────┴──────────────────┴─────────────┴─────────────╯ + // ╭─────────┬────────────────┬──────────────────┬────────────┬────────────────╮ + &mo BLE &kp C_PREVIOUS &kp C_PLAY_PAUSE &kp C_NEXT < RGB C_MUTE + // ╰─────────┴────────────────┴──────────────────┴────────────┴────────────────╯ >; sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; }; @@ -29,10 +40,20 @@ ble_layer { display-name = "BLE"; bindings = < - // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ - &trans &out OUT_TOG &bt BT_PRV &bt BT_NXT &bt BT_CLR - // ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ + // ╭────────┬──────────────┬────────────┬────────────┬────────────╮ + &trans &out OUT_TOG &bt BT_PRV &bt BT_NXT &bt BT_CLR + // ╰────────┴──────────────┴────────────┴────────────┴────────────╯ >; }; + + rgb_layer { + display-name = "RGB"; + bindings = < + // ╭──────────────────┬─────────────────┬─────────────────┬──────────────────────────────────┬────────╮ + &rgb_ug RGB_TOG &rgb_ug RGB_EFR &rgb_ug RGB_EFF &rgb_ug RGB_COLOR_HSB(307,89,98) &trans + // ╰──────────────────┴─────────────────┴─────────────────┴──────────────────────────────────┴────────╯ + >; + sensor-bindings = <&rgb_encoder>; + }; }; -}; +}; \ No newline at end of file diff --git a/app/boards/shields/reviung5/reviung5.zmk.yml b/app/boards/shields/reviung5/reviung5.zmk.yml index 9be3811f..bf332f23 100644 --- a/app/boards/shields/reviung5/reviung5.zmk.yml +++ b/app/boards/shields/reviung5/reviung5.zmk.yml @@ -7,3 +7,4 @@ requires: [pro_micro] features: - keys - encoder + - underglow