From 22dd68520b4f55ed7c953a67cfb904f85cc88982 Mon Sep 17 00:00:00 2001
From: John Mueller <softplus@users.noreply.github.com>
Date: Sat, 11 Sep 2021 16:33:48 +0200
Subject: [PATCH] [Keyboard] Add 3keyecosystem and 2key2 keyboard (#14023)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
---
 keyboards/3keyecosystem/2key2/2key2.c         | 35 +++++++++++
 keyboards/3keyecosystem/2key2/2key2.h         | 33 +++++++++++
 keyboards/3keyecosystem/2key2/config.h        | 59 +++++++++++++++++++
 keyboards/3keyecosystem/2key2/info.json       | 13 ++++
 .../2key2/keymaps/default/keymap.c            | 40 +++++++++++++
 .../3keyecosystem/2key2/keymaps/via/keymap.c  | 40 +++++++++++++
 .../3keyecosystem/2key2/keymaps/via/rules.mk  |  1 +
 keyboards/3keyecosystem/2key2/readme.md       | 24 ++++++++
 keyboards/3keyecosystem/2key2/rules.mk        | 23 ++++++++
 9 files changed, 268 insertions(+)
 create mode 100644 keyboards/3keyecosystem/2key2/2key2.c
 create mode 100644 keyboards/3keyecosystem/2key2/2key2.h
 create mode 100644 keyboards/3keyecosystem/2key2/config.h
 create mode 100644 keyboards/3keyecosystem/2key2/info.json
 create mode 100644 keyboards/3keyecosystem/2key2/keymaps/default/keymap.c
 create mode 100644 keyboards/3keyecosystem/2key2/keymaps/via/keymap.c
 create mode 100644 keyboards/3keyecosystem/2key2/keymaps/via/rules.mk
 create mode 100644 keyboards/3keyecosystem/2key2/readme.md
 create mode 100644 keyboards/3keyecosystem/2key2/rules.mk

diff --git a/keyboards/3keyecosystem/2key2/2key2.c b/keyboards/3keyecosystem/2key2/2key2.c
new file mode 100644
index 00000000000..17e87b412ea
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/2key2.c
@@ -0,0 +1,35 @@
+/*
+Copyright 2021 John Mueller
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "2key2.h"
+
+// RGB Matrix configuration
+// based on https://docs.qmk.fm/#/feature_rgb_matrix?id=common-configuration
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = { {
+  // Key Matrix to LED Index
+  {   0, 1 }
+}, {
+  // LED Index to Physical Position
+  // Using range { 0..224, 0..64 }
+  { 0,  32 }, { 224,  32 }
+}, {
+  // LED Index to Flag
+  // https://docs.qmk.fm/#/feature_rgb_matrix?id=flags
+  LED_FLAG_ALL, LED_FLAG_ALL
+} };
+#endif
diff --git a/keyboards/3keyecosystem/2key2/2key2.h b/keyboards/3keyecosystem/2key2/2key2.h
new file mode 100644
index 00000000000..05af99101a4
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/2key2.h
@@ -0,0 +1,33 @@
+/*
+Copyright 2021 John Mueller
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#pragma once
+
+#include "quantum.h"
+
+/* This is a shortcut to help you visually see your layout.
+ *
+ * The first section contains all of the arguments representing the physical
+ * layout of the board and position of the keys.
+ *
+ * The second converts the arguments into a two-dimensional array which
+ * represents the switch matrix.
+ */
+#define LAYOUT( \
+    k00, k01 \
+) { \
+    { k00, k01 }  \
+}
diff --git a/keyboards/3keyecosystem/2key2/config.h b/keyboards/3keyecosystem/2key2/config.h
new file mode 100644
index 00000000000..958a665edc7
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/config.h
@@ -0,0 +1,59 @@
+/*
+Copyright 2021 John Mueller
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID    0x1209
+#define PRODUCT_ID   0x3304
+#define DEVICE_VER   0x0001
+#define MANUFACTURER 3-Key-Ecosystem
+#define PRODUCT      2key2
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 2
+
+/* Keyboard Matrix Assignments */
+#define MATRIX_ROW_PINS { F6 }
+#define MATRIX_COL_PINS { F4, D7 }
+#define UNUSED_PINS
+
+// LED on kbmount base board is on B7
+#define LED_CAPS_LOCK_PIN B7 // onboard LED for testing
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* RGB matrix key backlighting */
+#define RGB_DI_PIN B2
+#define DRIVER_LED_TOTAL 2
+#define RGB_MATRIX_KEYPRESSES
+#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_REACTIVE
+#define RGB_MATRIX_STARTUP_HUE 90
+#define RGB_MATRIX_STARTUP_SPD 20
+#define RGB_MATRIX_STARTUP_VAL 128
+#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+#define RGB_DISABLE_WHEN_USB_SUSPENDED true
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+/* disable these deprecated features by default */
+#define NO_ACTION_MACRO
+#define NO_ACTION_FUNCTION
diff --git a/keyboards/3keyecosystem/2key2/info.json b/keyboards/3keyecosystem/2key2/info.json
new file mode 100644
index 00000000000..49caf91b5a3
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/info.json
@@ -0,0 +1,13 @@
+{
+    "keyboard_name": "3-Key-Ecosystem 2key2: 2x1 macro-keyboard",
+    "url": "https://github.com/softplus/3keyecosystem/tree/main/2key2",
+    "maintainer": "softplus",
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                {"label": "k00", "x": 0, "y": 0},
+                {"label": "k01", "x": 1, "y": 0}
+            ]
+        }
+    }
+}
diff --git a/keyboards/3keyecosystem/2key2/keymaps/default/keymap.c b/keyboards/3keyecosystem/2key2/keymaps/default/keymap.c
new file mode 100644
index 00000000000..5c1671fb932
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/keymaps/default/keymap.c
@@ -0,0 +1,40 @@
+/* Copyright 2021 John Mueller
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include QMK_KEYBOARD_H
+
+// Defines names for use in layer keycodes and the keymap
+enum layer_names {
+    _BASE
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Base */
+    [_BASE] = LAYOUT(
+        KC_A,    KC_B
+    ),
+
+    [1] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    ),
+
+    [2] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    ),
+
+    [3] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    )
+};
diff --git a/keyboards/3keyecosystem/2key2/keymaps/via/keymap.c b/keyboards/3keyecosystem/2key2/keymaps/via/keymap.c
new file mode 100644
index 00000000000..7400a9c622e
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/keymaps/via/keymap.c
@@ -0,0 +1,40 @@
+/* Copyright 2021 John Mueller
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include QMK_KEYBOARD_H
+
+// Defines names for use in layer keycodes and the keymap
+enum layer_names {
+    _BASE
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    /* Base */
+    [_BASE] = LAYOUT(
+        KC_A,    KC_B
+    ),
+
+    [1] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    ),
+
+    [2] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    ),
+
+    [3] = LAYOUT(
+        KC_TRNS, KC_TRNS
+    )
+  };
diff --git a/keyboards/3keyecosystem/2key2/keymaps/via/rules.mk b/keyboards/3keyecosystem/2key2/keymaps/via/rules.mk
new file mode 100644
index 00000000000..1e5b99807cb
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/3keyecosystem/2key2/readme.md b/keyboards/3keyecosystem/2key2/readme.md
new file mode 100644
index 00000000000..3befa292ff4
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/readme.md
@@ -0,0 +1,24 @@
+# 3-Key-Ecosystem - 2key2
+
+![keyboard](https://i.imgur.com/IJ1Zyc7.jpeg)
+
+This is a 2x1 macro keyboard with WS2812B key lighting.
+It's designed for a modular keyboard mount using an ATmega32U4.
+
+* Keyboard Maintainer: [softplus](https://github.com/softplus)
+* Hardware Supported: [3keyecosystem-2key2](https://github.com/softplus/3keyecosystem/tree/main/2key2)
+* Hardware Availability: Open-Source files at above link
+
+Make example for this keyboard (after setting up your build environment):
+
+    make 3keyecosystem/2key2:default
+
+Flashing example for this keyboard:
+
+    make 3keyecosystem/2key2:default:flash
+
+## Bootloader
+
+To Enter the bootloader, click reset button on the main board.
+
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/3keyecosystem/2key2/rules.mk b/keyboards/3keyecosystem/2key2/rules.mk
new file mode 100644
index 00000000000..872ace3b35e
--- /dev/null
+++ b/keyboards/3keyecosystem/2key2/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no        # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = no         # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = no            # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+RGB_MATRIX_ENABLE = yes		# Enable RGB matrix
+RGB_MATRIX_DRIVER = WS2812	# Select WS2812 driver for RGB matrix
+AUDIO_ENABLE = no           # Audio output