From 58f8c97d3cd37a0da335bed84fc457aa85b17bfe Mon Sep 17 00:00:00 2001 From: Ladislav Benc Date: Wed, 21 Dec 2022 03:49:17 +0100 Subject: [PATCH] feat(shields): Add a Reviung5 shield Co-authored-by: Pete Johanson --- app/boards/shields/reviung5/Kconfig.defconfig | 9 ++++ app/boards/shields/reviung5/Kconfig.shield | 4 ++ app/boards/shields/reviung5/reviung5.conf | 3 ++ app/boards/shields/reviung5/reviung5.keymap | 38 +++++++++++++ app/boards/shields/reviung5/reviung5.overlay | 54 +++++++++++++++++++ app/boards/shields/reviung5/reviung5.zmk.yml | 9 ++++ 6 files changed, 117 insertions(+) create mode 100644 app/boards/shields/reviung5/Kconfig.defconfig create mode 100644 app/boards/shields/reviung5/Kconfig.shield create mode 100644 app/boards/shields/reviung5/reviung5.conf create mode 100644 app/boards/shields/reviung5/reviung5.keymap create mode 100644 app/boards/shields/reviung5/reviung5.overlay create mode 100644 app/boards/shields/reviung5/reviung5.zmk.yml diff --git a/app/boards/shields/reviung5/Kconfig.defconfig b/app/boards/shields/reviung5/Kconfig.defconfig new file mode 100644 index 00000000..9477db39 --- /dev/null +++ b/app/boards/shields/reviung5/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_REVIUNG5 + +config ZMK_KEYBOARD_NAME + default "Reviung5" + +endif \ No newline at end of file diff --git a/app/boards/shields/reviung5/Kconfig.shield b/app/boards/shields/reviung5/Kconfig.shield new file mode 100644 index 00000000..2ecf47b2 --- /dev/null +++ b/app/boards/shields/reviung5/Kconfig.shield @@ -0,0 +1,4 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT +config SHIELD_REVIUNG5 + def_bool $(shields_list_contains,reviung5) \ No newline at end of file diff --git a/app/boards/shields/reviung5/reviung5.conf b/app/boards/shields/reviung5/reviung5.conf new file mode 100644 index 00000000..a8b4a868 --- /dev/null +++ b/app/boards/shields/reviung5/reviung5.conf @@ -0,0 +1,3 @@ +# Encoder support. Uncomment to enable. +# CONFIG_EC11=y +# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y diff --git a/app/boards/shields/reviung5/reviung5.keymap b/app/boards/shields/reviung5/reviung5.keymap new file mode 100644 index 00000000..93669479 --- /dev/null +++ b/app/boards/shields/reviung5/reviung5.keymap @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +#define BASE 0 +#define BLE 1 + +/ { + keymap { + compatible = "zmk,keymap"; + + base_layer { + label = "BASE"; + bindings = < + // ╭─────────────┬──────────────┬──────────────────┬─────────────┬─────────────╮ + &mo BLE &kp C_PREVIOUS &kp C_PLAY_PAUSE &kp C_NEXT &kp C_MUTE + // ╰─────────────┴──────────────┴──────────────────┴─────────────┴─────────────╯ + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + + ble_layer { + label = "BLE"; + bindings = < + // ╭─────────────┬─────────────┬─────────────┬─────────────┬─────────────╮ + &trans &out OUT_TOG &bt BT_PRV &bt BT_NXT &bt BT_CLR + // ╰─────────────┴─────────────┴─────────────┴─────────────┴─────────────╯ + >; + }; + }; +}; diff --git a/app/boards/shields/reviung5/reviung5.overlay b/app/boards/shields/reviung5/reviung5.overlay new file mode 100644 index 00000000..24b0f582 --- /dev/null +++ b/app/boards/shields/reviung5/reviung5.overlay @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 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 = <5>; + rows = <1>; + + map = ; + }; + + 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> + ; + + row-gpios + = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; + + encoder: encoder { + compatible = "alps,ec11"; + label = "encoder"; + a-gpios = <&pro_micro 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "okay"; + }; + + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&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 new file mode 100644 index 00000000..9be3811f --- /dev/null +++ b/app/boards/shields/reviung5/reviung5.zmk.yml @@ -0,0 +1,9 @@ +file_format: "1" +id: reviung5 +name: REVIUNG5 +type: shield +url: https://github.com/gtips/reviung/tree/master/reviung5 +requires: [pro_micro] +features: + - keys + - encoder