From ba599270189242a728a230e7879b9c189a22053f Mon Sep 17 00:00:00 2001
From: Daniel Osipishin <88534270+subrezon@users.noreply.github.com>
Date: Thu, 12 May 2022 00:39:08 +0200
Subject: [PATCH] [Keyboard] Add subrezon/la_nc keyboard (#16833)

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Daniel Osipishin <daniel.osipishin@retarus.de>
---
 keyboards/subrezon/info.json                  |  4 ++
 keyboards/subrezon/la_nc/config.h             | 33 ++++++++++
 keyboards/subrezon/la_nc/info.json            | 52 +++++++++++++++
 .../subrezon/la_nc/keymaps/default/keymap.c   | 63 +++++++++++++++++++
 .../subrezon/la_nc/keymaps/default/rules.mk   |  3 +
 keyboards/subrezon/la_nc/la_nc.c              | 45 +++++++++++++
 keyboards/subrezon/la_nc/la_nc.h              |  6 ++
 keyboards/subrezon/la_nc/readme.md            | 27 ++++++++
 keyboards/subrezon/la_nc/rules.mk             | 18 ++++++
 9 files changed, 251 insertions(+)
 create mode 100644 keyboards/subrezon/info.json
 create mode 100644 keyboards/subrezon/la_nc/config.h
 create mode 100644 keyboards/subrezon/la_nc/info.json
 create mode 100644 keyboards/subrezon/la_nc/keymaps/default/keymap.c
 create mode 100644 keyboards/subrezon/la_nc/keymaps/default/rules.mk
 create mode 100644 keyboards/subrezon/la_nc/la_nc.c
 create mode 100644 keyboards/subrezon/la_nc/la_nc.h
 create mode 100644 keyboards/subrezon/la_nc/readme.md
 create mode 100644 keyboards/subrezon/la_nc/rules.mk

diff --git a/keyboards/subrezon/info.json b/keyboards/subrezon/info.json
new file mode 100644
index 0000000000..faad074acb
--- /dev/null
+++ b/keyboards/subrezon/info.json
@@ -0,0 +1,4 @@
+{
+    "manufacturer": "subrezon",
+    "maintainer": "subrezon"
+}
\ No newline at end of file
diff --git a/keyboards/subrezon/la_nc/config.h b/keyboards/subrezon/la_nc/config.h
new file mode 100644
index 0000000000..6d5aad031a
--- /dev/null
+++ b/keyboards/subrezon/la_nc/config.h
@@ -0,0 +1,33 @@
+// Copyright 2022 Daniel Osipishin (@subrezon)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "config_common.h"
+
+// USB device parameters
+#define VENDOR_ID       0xFEED
+#define PRODUCT_ID      0x1A7C
+#define DEVICE_VER      0x0100
+
+// key matrix
+#define MATRIX_ROWS 6
+#define MATRIX_ROW_PINS {D3, F4, D2, B2, B5, B6}
+
+#define MATRIX_COLS 10
+#define MATRIX_COL_PINS {B3, B1, F7, F6, F5, D4, C6, D7, E6, B4}
+
+#define UNUSED_PINS
+#define DIODE_DIRECTION COL2ROW
+#define DEBOUNCE 5
+
+// Bootmagic Lite
+#define BOOTMAGIC_LITE_ROW 0
+#define BOOTMAGIC_LITE_COLUMN 0
+
+// uncomment to reduce firmware size
+//#define NO_DEBUG
+//#define NO_PRINT
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
diff --git a/keyboards/subrezon/la_nc/info.json b/keyboards/subrezon/la_nc/info.json
new file mode 100644
index 0000000000..d668d94b4b
--- /dev/null
+++ b/keyboards/subrezon/la_nc/info.json
@@ -0,0 +1,52 @@
+{
+    "keyboard_name": "la_nc",
+    "url": "https://github.com/subrezon/la_nc",
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                { "label": "Q",     "matrix": [0, 0], "x":  0, "y": 0},
+                { "label": "W",     "matrix": [0, 1], "x":  1, "y": 0},
+                { "label": "E",     "matrix": [0, 2], "x":  2, "y": 0},
+                { "label": "R",     "matrix": [0, 3], "x":  3, "y": 0},
+                { "label": "T",     "matrix": [0, 4], "x":  4, "y": 0},
+                { "label": "Y",     "matrix": [0, 5], "x":  7, "y": 0},
+                { "label": "U",     "matrix": [0, 6], "x":  8, "y": 0},
+                { "label": "I",     "matrix": [0, 7], "x":  9, "y": 0},
+                { "label": "O",     "matrix": [0, 8], "x": 10, "y": 0},
+                { "label": "P",     "matrix": [0, 9], "x": 11, "y": 0},
+                { "label": "A",     "matrix": [1, 0], "x":  0, "y": 1},
+                { "label": "S",     "matrix": [1, 1], "x":  1, "y": 1},
+                { "label": "D",     "matrix": [1, 2], "x":  2, "y": 1},
+                { "label": "F",     "matrix": [1, 3], "x":  3, "y": 1},
+                { "label": "G",     "matrix": [1, 4], "x":  4, "y": 1},
+                { "label": "H",     "matrix": [2, 5], "x":  7, "y": 1},
+                { "label": "J",     "matrix": [2, 6], "x":  8, "y": 1},
+                { "label": "K",     "matrix": [2, 7], "x":  9, "y": 1},
+                { "label": "L",     "matrix": [2, 8], "x": 10, "y": 1},
+                { "label": ";",     "matrix": [2, 9], "x": 11, "y": 1},
+                { "label": "Z",     "matrix": [3, 0], "x":  0, "y": 2},
+                { "label": "X",     "matrix": [3, 1], "x":  1, "y": 2},
+                { "label": "C",     "matrix": [3, 2], "x":  2, "y": 2},
+                { "label": "V",     "matrix": [3, 3], "x":  3, "y": 2},
+                { "label": "B",     "matrix": [3, 4], "x":  4, "y": 2},
+                { "label": "N",     "matrix": [4, 5], "x":  7, "y": 2},
+                { "label": "M",     "matrix": [4, 6], "x":  8, "y": 2},
+                { "label": ",",     "matrix": [4, 7], "x":  9, "y": 2},
+                { "label": ".",     "matrix": [4, 8], "x": 10, "y": 2},
+                { "label": "/",     "matrix": [4, 9], "x": 11, "y": 2},
+                { "label": "Tab",   "matrix": [5, 0], "x":  0, "y": 3},
+                { "label": "Alt",   "matrix": [5, 1], "x":  1, "y": 3},
+                { "label": "Ctrl",  "matrix": [5, 2], "x":  2, "y": 3},
+                { "label": "Raise", "matrix": [5, 3], "x":  3, "y": 3},
+                { "label": "",      "matrix": [5, 4], "x":  4, "y": 3},
+                { "label": "Esc",   "matrix": [3, 5], "x":  5, "y": 3},
+                { "label": "GUI",   "matrix": [4, 4], "x":  6, "y": 3},
+                { "label": "Bksp",  "matrix": [5, 5], "x":  7, "y": 3},
+                { "label": "Shift", "matrix": [5, 6], "x":  8, "y": 3},
+                { "label": "Lower", "matrix": [5, 7], "x":  9, "y": 3},
+                { "label": "Delete","matrix": [5, 8], "x": 10, "y": 3},
+                { "label": "Enter", "matrix": [5, 9], "x": 11, "y": 3}
+            ]
+        }
+    }
+}
\ No newline at end of file
diff --git a/keyboards/subrezon/la_nc/keymaps/default/keymap.c b/keyboards/subrezon/la_nc/keymaps/default/keymap.c
new file mode 100644
index 0000000000..430a99c510
--- /dev/null
+++ b/keyboards/subrezon/la_nc/keymaps/default/keymap.c
@@ -0,0 +1,63 @@
+// Copyright 2022 Daniel Osipishin (@subrezon)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+enum layer_id {
+    _QWE = 0,
+    _NUM,
+    _SYM,
+    _OPT
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+    [_QWE] = 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_SCLN,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+           KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,                      KC_N,    KC_M,  KC_DOT, KC_COMM, KC_SLSH,
+    //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+         KC_TAB, KC_LALT, KC_LCTL,MO(_NUM),  KC_SPC,  KC_ESC, KC_LGUI, KC_BSPC, KC_LSFT,MO(_SYM),  KC_DEL,  KC_ENT
+    //'--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
+    ),
+
+    [_NUM] = LAYOUT(
+    //.--------+--------+--------+--------+--------.                 .--------+--------+--------+--------+--------.
+        KC_LBRC,    KC_7,    KC_8,    KC_9, KC_RBRC,                    KC_F12,   KC_F7,   KC_F8,   KC_F9, KC_BSLS,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+        KC_MINS,    KC_4,    KC_5,    KC_6,    KC_0,                    KC_F11,   KC_F4,   KC_F5,   KC_F6, KC_CAPS,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+         KC_GRV,    KC_1,    KC_2,    KC_3,  KC_EQL,                    KC_F10,   KC_F1,   KC_F2,   KC_F3, KC_QUOT,
+    //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+         KC_TAB, KC_LALT, KC_LCTL, _______,  KC_SPC,  KC_ESC, KC_LGUI, KC_BSPC, KC_LSFT,MO(_OPT),  KC_DEL,  KC_ENT
+    //'--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
+    ),
+
+    [_SYM] = LAYOUT(
+    //.--------+--------+--------+--------+--------.                 .--------+--------+--------+--------+--------.
+        KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR,                   KC_MPRV, KC_PGUP,   KC_UP, KC_PGDN, KC_PIPE,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+        KC_UNDS,  KC_DLR, KC_PERC, KC_CIRC, KC_RPRN,                   KC_MPLY, KC_LEFT, KC_DOWN, KC_RGHT, KC_LSFT,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+        KC_TILD, KC_EXLM,   KC_AT, KC_HASH, KC_PLUS,                   KC_MNXT, KC_HOME,  KC_INS,  KC_END, KC_DQUO,
+    //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+         KC_TAB, KC_LALT, KC_LCTL,MO(_OPT),  KC_SPC,  KC_ESC, KC_LGUI, KC_BSPC, KC_LSFT, _______,  KC_DEL,  KC_ENT
+    //'--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
+    ),
+
+    [_OPT] = LAYOUT(
+    //.--------+--------+--------+--------+--------.                 .--------+--------+--------+--------+--------.
+        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                   XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                   XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+    //|--------+--------+--------+--------+--------|                 |--------+--------+--------+--------+--------|
+        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                   XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+    //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+        XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX
+    //'--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
+    ),
+
+};
diff --git a/keyboards/subrezon/la_nc/keymaps/default/rules.mk b/keyboards/subrezon/la_nc/keymaps/default/rules.mk
new file mode 100644
index 0000000000..b7c57d87b9
--- /dev/null
+++ b/keyboards/subrezon/la_nc/keymaps/default/rules.mk
@@ -0,0 +1,3 @@
+OLED_ENABLE = yes
+OLED_DRIVER = SSD1306
+LTO_ENABLE = yes
diff --git a/keyboards/subrezon/la_nc/la_nc.c b/keyboards/subrezon/la_nc/la_nc.c
new file mode 100644
index 0000000000..44f1f5afc1
--- /dev/null
+++ b/keyboards/subrezon/la_nc/la_nc.c
@@ -0,0 +1,45 @@
+// Copyright 2022 Daniel Osipishin (@subrezon)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "la_nc.h"
+
+#ifdef OLED_ENABLE
+
+enum layer_id {
+    _QWE = 0,
+    _NUM,
+    _SYM,
+    _OPT
+};
+
+bool oled_task_kb(void) {
+    if (!oled_task_user()) {
+        return false;
+    }
+       oled_write_P(PSTR("Layer:\n"), false);
+
+       switch (get_highest_layer(layer_state)) {
+              case _QWE :
+                     oled_write_P(PSTR("QWERTY\n"), false);
+                     break;
+
+              case _NUM :
+                     oled_write_P(PSTR("Numbers\n"), false);
+                     break;
+
+              case _SYM :
+                     oled_write_P(PSTR("Symbols\n"), false);
+                     break;
+
+              case _OPT :
+                     oled_write_P(PSTR("Options\n"), false);
+                     break;
+
+              default :
+                     oled_write_P(PSTR("Undefined\n"), false);
+       }
+
+       return false;
+};
+
+#endif
diff --git a/keyboards/subrezon/la_nc/la_nc.h b/keyboards/subrezon/la_nc/la_nc.h
new file mode 100644
index 0000000000..039fc487da
--- /dev/null
+++ b/keyboards/subrezon/la_nc/la_nc.h
@@ -0,0 +1,6 @@
+// Copyright 2022 Daniel Osipishin (@subrezon)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "quantum.h"
\ No newline at end of file
diff --git a/keyboards/subrezon/la_nc/readme.md b/keyboards/subrezon/la_nc/readme.md
new file mode 100644
index 0000000000..26a7b4d79a
--- /dev/null
+++ b/keyboards/subrezon/la_nc/readme.md
@@ -0,0 +1,27 @@
+# subrezon/la_nc
+
+![subrezon/la_nc](https://i.imgur.com/xYDcTtsh.jpg)
+
+Loosely based on the Planck keyboard, la_nc aims to deliver a lightly split, ortho typing experience in a similar footprint, as well as an easy build process.
+
+* Keyboard Maintainer: [Daniel Osipishin](https://github.com/subrezon)
+* Hardware Supported: la_nc PCB, with an atmega32u4-based ProMicro compatible controller board
+* Hardware Availability: https://github.com/subrezon/la_nc
+
+Make example for this keyboard (after setting up your build environment):
+
+    make subrezon/la_nc:default
+
+Flashing example for this keyboard:
+
+    make subrezon/la_nc: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).
+
+## Bootloader
+
+Enter the bootloader in 3 ways:
+
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/keyboards/subrezon/la_nc/rules.mk b/keyboards/subrezon/la_nc/rules.mk
new file mode 100644
index 0000000000..a74aa4dbc1
--- /dev/null
+++ b/keyboards/subrezon/la_nc/rules.mk
@@ -0,0 +1,18 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
+
+# Build options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
+MOUSEKEY_ENABLE = yes       # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = no         # Console for debug
+COMMAND_ENABLE = yes        # Commands for debug and configuration
+NKRO_ENABLE = yes           # Enable N-Key Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+AUDIO_ENABLE = no           # Audio output