From 22e9a0bd01b5e788b4595e590b4a8a7cc59082e4 Mon Sep 17 00:00:00 2001
From: rainkeebs <44819800+rainkeebs@users.noreply.github.com>
Date: Mon, 17 May 2021 15:53:45 -0700
Subject: [PATCH] Added Yasui keyboard (#12726)

* initial

* fix

* Update config.h

* Update config.h

* Update rules.mk

* Delete info.json

* fuix

* PR work

* replace keymap with layout

Co-authored-by: rainsff <44819800+rainsff@users.noreply.github.com>
---
 keyboards/yasui/config.h                 | 56 ++++++++++++++++++++++++
 keyboards/yasui/info.json                | 12 +++++
 keyboards/yasui/keymaps/default/keymap.c | 43 ++++++++++++++++++
 keyboards/yasui/keymaps/via/keymap.c     | 43 ++++++++++++++++++
 keyboards/yasui/keymaps/via/rules.mk     |  1 +
 keyboards/yasui/readme.md                | 22 ++++++++++
 keyboards/yasui/rules.mk                 | 20 +++++++++
 keyboards/yasui/yasui.c                  | 16 +++++++
 keyboards/yasui/yasui.h                  | 30 +++++++++++++
 9 files changed, 243 insertions(+)
 create mode 100644 keyboards/yasui/config.h
 create mode 100644 keyboards/yasui/info.json
 create mode 100644 keyboards/yasui/keymaps/default/keymap.c
 create mode 100644 keyboards/yasui/keymaps/via/keymap.c
 create mode 100644 keyboards/yasui/keymaps/via/rules.mk
 create mode 100644 keyboards/yasui/readme.md
 create mode 100644 keyboards/yasui/rules.mk
 create mode 100644 keyboards/yasui/yasui.c
 create mode 100644 keyboards/yasui/yasui.h

diff --git a/keyboards/yasui/config.h b/keyboards/yasui/config.h
new file mode 100644
index 0000000000..7d41a9e7f9
--- /dev/null
+++ b/keyboards/yasui/config.h
@@ -0,0 +1,56 @@
+/* Copyright 2021 Regan Palmer
+ *
+ * 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       0x726B // rk - "rainkeebs"
+#define PRODUCT_ID      0x7973 // ys - "yasui"
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    rainkeebs
+#define PRODUCT         yasui
+
+/* key matrix size */
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 10
+
+/* key matrix pins */
+#define MATRIX_ROW_PINS { D4, C6, B5, E6 }
+#define MATRIX_COL_PINS { D7, B4, B6, B2, B3, B1, F7, F6, F5, F4 }
+#define UNUSED_PINS
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+#define RGB_DI_PIN D1
+
+#ifdef RGB_DI_PIN
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 10
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
+#endif
diff --git a/keyboards/yasui/info.json b/keyboards/yasui/info.json
new file mode 100644
index 0000000000..496c190b46
--- /dev/null
+++ b/keyboards/yasui/info.json
@@ -0,0 +1,12 @@
+{
+    "keyboard_name": "Yasui",
+    "url": "https://www.rainkeebs.mx/product/yasui-keyboard-kit",
+    "maintainer": "rainkeebs",
+    "width": 10,
+    "height": 4,
+    "layouts": {
+        "LAYOUT": {
+            "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}]
+        }
+    }
+}
diff --git a/keyboards/yasui/keymaps/default/keymap.c b/keyboards/yasui/keymaps/default/keymap.c
new file mode 100644
index 0000000000..3f90b06c41
--- /dev/null
+++ b/keyboards/yasui/keymaps/default/keymap.c
@@ -0,0 +1,43 @@
+/* Copyright 2021 Regan Palmer
+ *
+ * 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
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+	LAYOUT(
+		KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
+		KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
+		KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_BSPC,
+		KC_LCTL, KC_LALT, MO(1), KC_LSFT, KC_MPLY, KC_SPC, KC_SPC, MO(2), KC_RALT, KC_RCTL),
+
+	LAYOUT(
+		KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
+		KC_ESC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_MINS, KC_EQL, KC_QUOT, KC_SCLN, KC_TRNS,
+		KC_TAB, KC_DEL, KC_PSCR, KC_LBRC, KC_RBRC, KC_BSLS, KC_SLSH, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+	LAYOUT(
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+	LAYOUT(
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
+};
diff --git a/keyboards/yasui/keymaps/via/keymap.c b/keyboards/yasui/keymaps/via/keymap.c
new file mode 100644
index 0000000000..3f90b06c41
--- /dev/null
+++ b/keyboards/yasui/keymaps/via/keymap.c
@@ -0,0 +1,43 @@
+/* Copyright 2021 Regan Palmer
+ *
+ * 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
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+	LAYOUT(
+		KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
+		KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
+		KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_BSPC,
+		KC_LCTL, KC_LALT, MO(1), KC_LSFT, KC_MPLY, KC_SPC, KC_SPC, MO(2), KC_RALT, KC_RCTL),
+
+	LAYOUT(
+		KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
+		KC_ESC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_MINS, KC_EQL, KC_QUOT, KC_SCLN, KC_TRNS,
+		KC_TAB, KC_DEL, KC_PSCR, KC_LBRC, KC_RBRC, KC_BSLS, KC_SLSH, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+	LAYOUT(
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+	LAYOUT(
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+		KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
+};
diff --git a/keyboards/yasui/keymaps/via/rules.mk b/keyboards/yasui/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/yasui/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/yasui/readme.md b/keyboards/yasui/readme.md
new file mode 100644
index 0000000000..dfc20bbe6b
--- /dev/null
+++ b/keyboards/yasui/readme.md
@@ -0,0 +1,22 @@
+# Yasui
+
+![Yasui](https://i.imgur.com/TRFOEkw.png)
+
+A 10u ortho kit.
+
+* Keyboard Maintainer: Rain
+* Hardware Supported: Yasui PCB v2
+* Hardware Availability: [rainkeebs](https://www.rainkeebs.mx/product/yasui-keyboard-kit)
+
+
+Make example for this keyboard (after setting up your build environment):
+
+    qmk compile -kb yasui -kb default
+    
+To reset the keyboard, hold the top left key while plugging in, or hit the reset button near the USB port
+
+Install example for this keyboard:
+
+    qmk flash -kb yasui -km default
+
+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/yasui/rules.mk b/keyboards/yasui/rules.mk
new file mode 100644
index 0000000000..b8adede3eb
--- /dev/null
+++ b/keyboards/yasui/rules.mk
@@ -0,0 +1,20 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader
+BOOTLOADER = caterina
+
+# Build Options
+#   comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = yes   # Mouse keys
+EXTRAKEY_ENABLE = yes   # Audio control and System control
+CONSOLE_ENABLE = no     # Console for debug
+COMMAND_ENABLE = no     # Commands for debug and configuration
+SLEEP_LED_ENABLE = no   # Breathing sleep LED during USB suspend
+NKRO_ENABLE = yes       # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = no   # Enable keyboard backlight functionality
+AUDIO_ENABLE = no
+RGBLIGHT_ENABLE = yes
+
diff --git a/keyboards/yasui/yasui.c b/keyboards/yasui/yasui.c
new file mode 100644
index 0000000000..a87f7482a0
--- /dev/null
+++ b/keyboards/yasui/yasui.c
@@ -0,0 +1,16 @@
+/* Copyright 2021 Regan Palmer
+ *
+ * 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 "yasui.h"
diff --git a/keyboards/yasui/yasui.h b/keyboards/yasui/yasui.h
new file mode 100644
index 0000000000..387b9a5ac8
--- /dev/null
+++ b/keyboards/yasui/yasui.h
@@ -0,0 +1,30 @@
+/* Copyright 2021 Regan Palmer
+ *
+ * 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"
+
+#define LAYOUT( \
+	K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, \
+	K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, \
+	K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, \
+	K300, K301, K302, K303, K304, K305, K306, K307, K308, K309  \
+) { \
+	{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009 }, \
+	{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109 }, \
+	{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209 }, \
+	{ K300,  K301,  K302,  K303,  K304,  K305,  K306,  K307,  K308,  K309 }  \
+}