From ad3169f500e027296adf6961fcd948caa023891d Mon Sep 17 00:00:00 2001
From: yiancar <yiangosyiangou@cytanet.com.cy>
Date: Sat, 26 Jun 2021 05:42:09 +0100
Subject: [PATCH] [Keyboard] Add NK1 (#13212)

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: yiancar <yiancar@gmail.com>
---
 keyboards/nk1/config.h                  | 93 +++++++++++++++++++++++++
 keyboards/nk1/info.json                 | 12 ++++
 keyboards/nk1/keymaps/default/keymap.c  | 21 ++++++
 keyboards/nk1/keymaps/default/readme.md |  1 +
 keyboards/nk1/keymaps/via/keymap.c      | 21 ++++++
 keyboards/nk1/keymaps/via/readme.md     |  1 +
 keyboards/nk1/keymaps/via/rules.mk      |  1 +
 keyboards/nk1/nk1.c                     | 17 +++++
 keyboards/nk1/nk1.h                     | 25 +++++++
 keyboards/nk1/readme.md                 | 32 +++++++++
 keyboards/nk1/rules.mk                  | 24 +++++++
 11 files changed, 248 insertions(+)
 create mode 100644 keyboards/nk1/config.h
 create mode 100755 keyboards/nk1/info.json
 create mode 100644 keyboards/nk1/keymaps/default/keymap.c
 create mode 100644 keyboards/nk1/keymaps/default/readme.md
 create mode 100644 keyboards/nk1/keymaps/via/keymap.c
 create mode 100644 keyboards/nk1/keymaps/via/readme.md
 create mode 100644 keyboards/nk1/keymaps/via/rules.mk
 create mode 100644 keyboards/nk1/nk1.c
 create mode 100644 keyboards/nk1/nk1.h
 create mode 100644 keyboards/nk1/readme.md
 create mode 100644 keyboards/nk1/rules.mk

diff --git a/keyboards/nk1/config.h b/keyboards/nk1/config.h
new file mode 100644
index 0000000000..122df2e6da
--- /dev/null
+++ b/keyboards/nk1/config.h
@@ -0,0 +1,93 @@
+
+/* Copyright 2021 Yiancar
+ *
+ * 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       0x8968
+#define PRODUCT_ID      0x4E4D
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    Yiancar-Designs
+#define PRODUCT         NK1
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Keyboard Matrix Assignments */
+#define DIRECT_PINS { \
+    { D4 } \
+}
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
+//#define MATRIX_HAS_GHOST
+
+/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
+ * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
+ */
+// #define GRAVE_ESC_CTRL_OVERRIDE
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
+
+/*
+ * Magic Key Options
+ *
+ * Magic keys are hotkey commands that allow control over firmware functions of
+ * the keyboard. They are best used in combination with the HID Listen program,
+ * found here: https://www.pjrc.com/teensy/hid_listen.html
+ *
+ * The options below allow the magic key functionality to be changed. This is
+ * useful if your keyboard/keypad is missing keys and you want magic key support.
+ *
+ */
+
+#define RGB_DI_PIN F0
+#ifdef RGB_DI_PIN
+    #define RGBLED_NUM 9
+    #define RGBLIGHT_HUE_STEP 8
+    #define RGBLIGHT_SAT_STEP 8
+    #define RGBLIGHT_VAL_STEP 8
+    #define RGBLIGHT_SLEEP  /* If defined, the RGB lighting will be switched off when the host goes to sleep */
+    #define RGBLIGHT_ANIMATIONS
+#endif
+
+/* There is only 1 Button so limiting VIA to 1 layer */
+#define DYNAMIC_KEYMAP_LAYER_COUNT 1
diff --git a/keyboards/nk1/info.json b/keyboards/nk1/info.json
new file mode 100755
index 0000000000..3bf8d4745a
--- /dev/null
+++ b/keyboards/nk1/info.json
@@ -0,0 +1,12 @@
+{
+    "keyboard_name": "NK1", 
+    "url": "www.yiancar-designs.com",
+    "maintainer": "yiancar", 
+    "width": 1, 
+    "height": 1, 
+    "layouts": {
+        "LAYOUT_ortho_1x1": {
+            "layout": [{"x": 0, "y": 0}]
+        }
+    }
+}
diff --git a/keyboards/nk1/keymaps/default/keymap.c b/keyboards/nk1/keymaps/default/keymap.c
new file mode 100644
index 0000000000..550a0f4873
--- /dev/null
+++ b/keyboards/nk1/keymaps/default/keymap.c
@@ -0,0 +1,21 @@
+/* Copyright 2021 Yiancar
+ *
+ * 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] = {
+[0] = LAYOUT_ortho_1x1( /* Base */
+    KC_ENT)
+};
diff --git a/keyboards/nk1/keymaps/default/readme.md b/keyboards/nk1/keymaps/default/readme.md
new file mode 100644
index 0000000000..6e9c78ee51
--- /dev/null
+++ b/keyboards/nk1/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for NK1
diff --git a/keyboards/nk1/keymaps/via/keymap.c b/keyboards/nk1/keymaps/via/keymap.c
new file mode 100644
index 0000000000..550a0f4873
--- /dev/null
+++ b/keyboards/nk1/keymaps/via/keymap.c
@@ -0,0 +1,21 @@
+/* Copyright 2021 Yiancar
+ *
+ * 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] = {
+[0] = LAYOUT_ortho_1x1( /* Base */
+    KC_ENT)
+};
diff --git a/keyboards/nk1/keymaps/via/readme.md b/keyboards/nk1/keymaps/via/readme.md
new file mode 100644
index 0000000000..10025a5969
--- /dev/null
+++ b/keyboards/nk1/keymaps/via/readme.md
@@ -0,0 +1 @@
+# The default keymap for NK1 with VIA enabled
diff --git a/keyboards/nk1/keymaps/via/rules.mk b/keyboards/nk1/keymaps/via/rules.mk
new file mode 100644
index 0000000000..036bd6d1c3
--- /dev/null
+++ b/keyboards/nk1/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/nk1/nk1.c b/keyboards/nk1/nk1.c
new file mode 100644
index 0000000000..6833478568
--- /dev/null
+++ b/keyboards/nk1/nk1.c
@@ -0,0 +1,17 @@
+/* Copyright 2021 Yiancar
+ *
+ * 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 "nk1.h"
diff --git a/keyboards/nk1/nk1.h b/keyboards/nk1/nk1.h
new file mode 100644
index 0000000000..3962e18516
--- /dev/null
+++ b/keyboards/nk1/nk1.h
@@ -0,0 +1,25 @@
+/* Copyright 2021 Yiancar
+ *
+ * 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_ortho_1x1( \
+    K00 \
+) { \
+    { K00 } \
+}
diff --git a/keyboards/nk1/readme.md b/keyboards/nk1/readme.md
new file mode 100644
index 0000000000..bc668481b5
--- /dev/null
+++ b/keyboards/nk1/readme.md
@@ -0,0 +1,32 @@
+# NK1
+
+A big switch keypad!
+
+* Keyboard Maintainer: [Yiancar](https://yiancar-designs.com/) and on [GitHub](https://github.com/yiancar)
+* Hardware Supported: A BIG keypad with ATmega 32u4
+* Hardware Availability: https://novelkeys.xyz/
+
+## Instructions
+
+### Build
+
+Make example for this keyboard (after setting up your build environment):
+
+    make nk1: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).
+
+### Reset
+
+- Unplug
+- Hold the key
+- Plug In
+- Unplug
+- Release the key
+
+### Flash
+
+- Unplug
+- Hold the key
+- Plug In
+- Flash using QMK Toolbox or dfu-util (`make nk1:<keymap>:flash`)
diff --git a/keyboards/nk1/rules.mk b/keyboards/nk1/rules.mk
new file mode 100644
index 0000000000..8dd72e9a64
--- /dev/null
+++ b/keyboards/nk1/rules.mk
@@ -0,0 +1,24 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+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
+# 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 = yes           # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+
+LAYOUTS = ortho_1x1