From 16e52980c4072b0e227e88307a109fe111907079 Mon Sep 17 00:00:00 2001
From: FateEverywhere <41215461+FateEverywhere@users.noreply.github.com>
Date: Tue, 20 Jul 2021 12:58:39 -0400
Subject: [PATCH] [Keyboard] Hard Light - Add keyboard, basic keymap (#12654)

Co-authored-by: ridingqwerty <george.g.koenig@gmail.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
---
 keyboards/edi/hardlight/mk1/config.h          | 109 +++++++++++++++++
 .../edi/hardlight/mk1/keymaps/.gitignore      |   1 +
 .../hardlight/mk1/keymaps/default/config.h    |  20 +++
 .../hardlight/mk1/keymaps/default/keymap.c    | 115 ++++++++++++++++++
 keyboards/edi/hardlight/mk1/mk1.c             |  18 +++
 keyboards/edi/hardlight/mk1/mk1.h             |  41 +++++++
 keyboards/edi/hardlight/mk1/readme.md         |  19 +++
 keyboards/edi/hardlight/mk1/rules.mk          |  23 ++++
 8 files changed, 346 insertions(+)
 create mode 100644 keyboards/edi/hardlight/mk1/config.h
 create mode 100644 keyboards/edi/hardlight/mk1/keymaps/.gitignore
 create mode 100644 keyboards/edi/hardlight/mk1/keymaps/default/config.h
 create mode 100644 keyboards/edi/hardlight/mk1/keymaps/default/keymap.c
 create mode 100644 keyboards/edi/hardlight/mk1/mk1.c
 create mode 100644 keyboards/edi/hardlight/mk1/mk1.h
 create mode 100644 keyboards/edi/hardlight/mk1/readme.md
 create mode 100644 keyboards/edi/hardlight/mk1/rules.mk

diff --git a/keyboards/edi/hardlight/mk1/config.h b/keyboards/edi/hardlight/mk1/config.h
new file mode 100644
index 0000000000..be136fe9c9
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/config.h
@@ -0,0 +1,109 @@
+/*
+©2021 Everywhere Defense Industries / Fate Everywhere <fate@7storm.org>
+ 
+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 3 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       0xF7E0
+#define PRODUCT_ID      0x2401
+#define DEVICE_VER      0x0000
+#define MANUFACTURER    Everywhere Defense Industries
+#define PRODUCT         Hard Light
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+*/
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, D4, D6, D7, B4 }
+#define MATRIX_COL_PINS { E6, F0, F1, F4, F5, F6, F7, B5 }
+#define UNUSED_PINS { B7, D2, D3, D5 }
+
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+// #define BACKLIGHT_PIN C7
+// #define BACKLIGHT_BREATHING
+// #define BACKLIGHT_LEVELS 3
+
+
+/* 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
+
+/* 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
+
+/*
+ * Enable RGB Underlighting
+ */
+#define RGB_DI_PIN C7
+#define RGBLED_NUM 15
+#define RGBLIGHT_ANIMATIONS
+//#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+//#define RGBLIGHT_EFFECT_KNIGHT
+//#define RGBLIGHT_EFFECT_TWINKLE
+//#define RGBLIGHT_EFFECT_BREATHING
+
+
+/*
+ * Enable Audio Subsystem with two voices
+ */
+// #define AUDIO_PIN C6
+
+
+/* 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
diff --git a/keyboards/edi/hardlight/mk1/keymaps/.gitignore b/keyboards/edi/hardlight/mk1/keymaps/.gitignore
new file mode 100644
index 0000000000..08a0f321a2
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/keymaps/.gitignore
@@ -0,0 +1 @@
+fate
\ No newline at end of file
diff --git a/keyboards/edi/hardlight/mk1/keymaps/default/config.h b/keyboards/edi/hardlight/mk1/keymaps/default/config.h
new file mode 100644
index 0000000000..2db5f3b328
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/keymaps/default/config.h
@@ -0,0 +1,20 @@
+/*
+©2021 Everywhere Defense Industries / Fate Everywhere <fate@7storm.org>
+ 
+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 3 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
+
+// place overrides here
diff --git a/keyboards/edi/hardlight/mk1/keymaps/default/keymap.c b/keyboards/edi/hardlight/mk1/keymaps/default/keymap.c
new file mode 100644
index 0000000000..251b6c8b38
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/keymaps/default/keymap.c
@@ -0,0 +1,115 @@
+/*
+©2021 Everywhere Defense Industries / Fate Everywhere <fate@7storm.org>
+ 
+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 3 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
+
+enum layers {
+    _MAIN,
+    _RAISE,
+    _LOWER,
+    _SET,
+};
+
+// Readability keycodes
+#define LOWER   MO(_LOWER)
+#define RAISE   MO(_RAISE)
+#define SET     MO(_SET)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+
+/* MAIN
+ * .-----------------------------------------------------------------------------------------------------------------------------------------------.
+ * | Tab    | Q      | W      | E      | R      | T      | Y      | U      | I      | O      | P      | Backsp | Delete |   7    |   8    |   9    |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * | Esc    | A      | S      | D      | F      | G      | H      | J      | K      | L      | ;      | '      | Pause  |   4    |   5    |   6    |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * | LShift | Z      | X      | C      | V      | B      | N      | M      | ,      | .      | /      | Up     | Enter  |   1    |   2    |   3    |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * | LCtrl  |  Lock  |   GUI  |   Alt  | Lower  | Space  |  Space | Raise  | PrtScr | RShift | Left   | Down   | Right  |   0    |   .    |  Enter |
+ * '-----------------------------------------------------------------------------------------------------------------------------------------------'
+ */
+
+  [_MAIN] = LAYOUT_ortho_4x16(
+  KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC, KC_DEL,  KC_KP_7, KC_KP_8,   KC_KP_9,
+  KC_ESC,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_PAUS, KC_KP_4, KC_KP_5,   KC_KP_6,
+  KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_UP,   KC_ENT,  KC_KP_1, KC_KP_2,   KC_KP_3,
+  KC_LCTL, KC_LOCK, KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_SPC,  RAISE,   KC_PSCR, KC_RSFT, KC_LEFT, KC_DOWN, KC_RGHT, KC_KP_0, KC_KP_DOT, KC_PENT
+  ),
+
+/* RAISE
+ * .-----------------------------------------------------------------------------------------------------------------------------------------------.
+ * |    `   |  1     |  2     |  3     |  4     |  5     |  6     |  7     |  8     |  9     |  0     |        | Insert |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        | -      | =      | [      | ]      |   \    |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |        |        |        |        |  PgUp  |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |        |        |        |  Vol-  |  PgDn  |  Vol+  |        |        |        |
+ * '-----------------------------------------------------------------------------------------------------------------------------------------------'
+ */
+
+  [_RAISE] = LAYOUT_ortho_4x16(
+  KC_GRV,  KC_1,   KC_2,   KC_3,   KC_4,   KC_5,   KC_6,   KC_7,    KC_8,    KC_9,    KC_0,    _______,   KC_INS,   _______,   _______,   _______,
+  _______,   _______,  _______,  _______,  _______,  _______,  _______,  KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC, KC_BSLS, _______,    _______,   _______,   _______,
+  _______,   _______,  _______,  _______,  _______,  _______,  _______,  _______,   _______,   _______,   _______,   KC_PGUP, _______,  _______,   _______,   _______,
+  _______,   _______,  _______,  _______,  _______,  _______,  _______,  _______,   _______, _______,   KC_VOLD, KC_PGDN, KC_VOLU,  _______,   _______,   _______
+  ),
+
+/* LOWER
+ * .-----------------------------------------------------------------------------------------------------------------------------------------------.
+ * |    ~   |    !   |    @   |    #   |    $   |    %   |    ^   |    &   |    *   |    (   |    )   |        |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |   F1   |   F2   |   F3   |   F4   |   F5   |   F6   |    _   |    +   |    {   |    }   |   |    |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |   F7   |   F8   |   F9   |  F10   |  F11   |  F12   |        |        |        |        |  Home  |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |        |        |        |  Mute  |  End   |  Play  |        |        |        |
+ * '-----------------------------------------------------------------------------------------------------------------------------------------------'
+ */
+
+  [_LOWER] = LAYOUT_ortho_4x16(
+  KC_TILD, KC_EXLM,   KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,  _______,  _______,  _______, _______, 
+  _______,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,  _______,  _______,  _______, _______,
+  _______,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______,   _______,   _______,   _______,   KC_HOME,  _______,   _______, _______, _______, 
+  _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______, _______,   KC_MUTE, KC_END,   KC_MPLY, _______, _______, _______
+  ),
+
+ /* SETTINGS
+ * .-----------------------------------------------------------------------------------------------------------------------------------------------.
+ * |        | CapLok | ScrLok | NumLok |        |        |        | RGB IO | Mode+  | Mode-  | Plain  |        |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |  Hue+  |  Sat+  |  Val+  | RSwirl |        |        |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |  Hue-  |  Sat-  |  Val-  | Larsen |        | Reset  |        |        |        |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+ * |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |
+ * '-----------------------------------------------------------------------------------------------------------------------------------------------'
+ */
+
+  [_SET] = LAYOUT_ortho_4x16(
+  _______,   KC_CAPS,   KC_SLCK,   KC_NLCK,   _______,   _______,   _______,   RGB_TOG,   RGB_MOD,   RGB_RMOD,  RGB_M_P,   _______,   _______,   _______, _______,  _______,
+  _______,   _______,   _______,   _______,   _______,   _______,   _______,   RGB_HUI,   RGB_SAI,   RGB_VAI,   RGB_M_SW,  _______,   _______,   _______, _______,  _______,
+  _______,   _______,   _______,   _______,   _______,   _______,   _______,   RGB_HUD,   RGB_SAD,   RGB_VAD,   RGB_M_K,   _______,   RESET,     _______, _______,  _______, 
+  _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______,   _______, _______,  _______
+  ),
+
+};
+
+layer_state_t layer_state_set_user(layer_state_t state) {
+  return update_tri_layer_state(state, _LOWER, _RAISE, _SET);
+}
\ No newline at end of file
diff --git a/keyboards/edi/hardlight/mk1/mk1.c b/keyboards/edi/hardlight/mk1/mk1.c
new file mode 100644
index 0000000000..5a1e0bbb19
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/mk1.c
@@ -0,0 +1,18 @@
+/*
+©2021 Everywhere Defense Industries / Fate Everywhere <fate@7storm.org>
+ 
+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 3 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 "mk1.h"
diff --git a/keyboards/edi/hardlight/mk1/mk1.h b/keyboards/edi/hardlight/mk1/mk1.h
new file mode 100644
index 0000000000..e8ef9777a4
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/mk1.h
@@ -0,0 +1,41 @@
+/*
+©2021 Everywhere Defense Industries / Fate Everywhere <fate@7storm.org>
+ 
+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 3 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 a shortcut to help you visually see your layout.
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+
+#define LAYOUT_ortho_4x16( \
+    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, K14, K15, \
+    K16, K17, K18, K19, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K30, K31, \
+    K32, K33, K34, K35, K36, K37, K38, K39, K40, K41, K42, K43, K44, K45, K46, K47, \
+    K48, K49, K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K60, K61, K62, K63 \
+) \
+{ \
+    { K00, K02, K04, K06, K08, K10, K12, K14 }, \
+    { K01, K03, K05, K07, K09, K11, K13, K15 }, \
+    { K16, K18, K20, K22, K24, K26, K28, K30 }, \
+    { K17, K19, K21, K23, K25, K27, K29, K31 }, \
+    { K32, K34, K36, K38, K40, K42, K44, K46 }, \
+    { K33, K35, K37, K39, K41, K43, K45, K47 }, \
+    { K48, K50, K52, K54, K56, K58, K60, K62 }, \
+    { K49, K51, K53, K55, K57, K59, K61, K63 } \
+}
diff --git a/keyboards/edi/hardlight/mk1/readme.md b/keyboards/edi/hardlight/mk1/readme.md
new file mode 100644
index 0000000000..177a46b5d0
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/readme.md
@@ -0,0 +1,19 @@
+# Hard Light Mark 1
+
+![Hard Light Mark 1](https://i.imgur.com/X6Katarh.png)
+
+A compact 60% keyboard designed by Fate Everywhere. Born out of the desire for a Planck with a numpad for technical work and a lack of reliance on the Elite-C.
+
+* Keyboard Maintainer: [Fate Everywhere](https://github.com/fateeverywhere)
+* Hardware Supported: Revision P, Revision Q, Mark 1 Hard Light.
+* Hardware Availability: Seven Store (https://store.7storm.org).
+
+Build example for this keyboard (after setting up your build environment):
+
+    make edi/hardlight/mk1:default
+
+Flash example for this keyboard (after setting up your build environment):
+ 
+    make edi/hardlight/mk1:default:flash
+
+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/edi/hardlight/mk1/rules.mk b/keyboards/edi/hardlight/mk1/rules.mk
new file mode 100644
index 0000000000..33595b42e0
--- /dev/null
+++ b/keyboards/edi/hardlight/mk1/rules.mk
@@ -0,0 +1,23 @@
+# 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 = no        # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = yes        # Console for debug
+COMMAND_ENABLE = yes        # 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 = yes       # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+KEY_LOCK_ENABLE = yes
\ No newline at end of file