summaryrefslogtreecommitdiff
path: root/keyboards/kbdmania/kmac
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/kbdmania/kmac')
-rw-r--r--keyboards/kbdmania/kmac/config.h54
-rw-r--r--keyboards/kbdmania/kmac/info.json228
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default/keymap.c81
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default/readme.md50
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/keymap.c81
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/readme.md50
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/keymap.c81
-rw-r--r--keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/readme.md50
-rw-r--r--keyboards/kbdmania/kmac/keymaps/via/keymap.c49
-rw-r--r--keyboards/kbdmania/kmac/keymaps/via/rules.mk2
-rw-r--r--keyboards/kbdmania/kmac/kmac.c56
-rw-r--r--keyboards/kbdmania/kmac/matrix.c205
-rw-r--r--keyboards/kbdmania/kmac/readme.md21
-rw-r--r--keyboards/kbdmania/kmac/rules.mk18
14 files changed, 1026 insertions, 0 deletions
diff --git a/keyboards/kbdmania/kmac/config.h b/keyboards/kbdmania/kmac/config.h
new file mode 100644
index 0000000000..dd12560fb6
--- /dev/null
+++ b/keyboards/kbdmania/kmac/config.h
@@ -0,0 +1,54 @@
+/*
+Copyright 2017 Mathias Andersson <wraul@dbox.se>
+
+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
+
+
+/* key matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 17
+
+/*
+ * Keyboard Matrix Assignments
+ * The KMAC uses demultiplexers for the cols, they are only included here as documentation.
+ * See matrix.c for more details.
+ */
+#define MATRIX_ROW_PINS \
+ { D0, D1, D2, D3, D5, B7 }
+#define MATRIX_COL_PINS \
+ { B6, C6, C7, F1, F0, B5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN }
+
+/* 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
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
diff --git a/keyboards/kbdmania/kmac/info.json b/keyboards/kbdmania/kmac/info.json
new file mode 100644
index 0000000000..0ec6f0b2a9
--- /dev/null
+++ b/keyboards/kbdmania/kmac/info.json
@@ -0,0 +1,228 @@
+{
+ "keyboard_name": "KMAC",
+ "manufacturer": "KBDMania",
+ "maintainer": "qmk",
+ "usb": {
+ "vid": "0x4B4D",
+ "pid": "0x4143",
+ "device_version": "1.0.4"
+ },
+ "backlight": {
+ "driver": "custom"
+ },
+ "indicators": {
+ "caps_lock": "B0",
+ "scroll_lock": "E6",
+ "on_state": 0
+ },
+ "processor": "atmega32u4",
+ "bootloader": "atmel-dfu",
+ "community_layouts": ["tkl_ansi"],
+ "layouts": {
+ "LAYOUT_tkl_ansi": {
+ "layout": [
+ {"matrix": [0, 0], "x": 0, "y": 0},
+
+ {"matrix": [0, 2], "x": 2, "y": 0},
+ {"matrix": [0, 3], "x": 3, "y": 0},
+ {"matrix": [0, 4], "x": 4, "y": 0},
+ {"matrix": [0, 5], "x": 5, "y": 0},
+
+ {"matrix": [0, 6], "x": 6.5, "y": 0},
+ {"matrix": [0, 7], "x": 7.5, "y": 0},
+ {"matrix": [0, 8], "x": 8.5, "y": 0},
+ {"matrix": [0, 9], "x": 9.5, "y": 0},
+
+ {"matrix": [0, 10], "x": 11, "y": 0},
+ {"matrix": [0, 11], "x": 12, "y": 0},
+ {"matrix": [0, 12], "x": 13, "y": 0},
+ {"matrix": [0, 13], "x": 14, "y": 0},
+
+ {"matrix": [0, 14], "x": 15.25, "y": 0},
+ {"matrix": [0, 15], "x": 16.25, "y": 0},
+ {"matrix": [0, 16], "x": 17.25, "y": 0},
+
+ {"matrix": [1, 0], "x": 0, "y": 1.5},
+ {"matrix": [1, 1], "x": 1, "y": 1.5},
+ {"matrix": [1, 2], "x": 2, "y": 1.5},
+ {"matrix": [1, 3], "x": 3, "y": 1.5},
+ {"matrix": [1, 4], "x": 4, "y": 1.5},
+ {"matrix": [1, 5], "x": 5, "y": 1.5},
+ {"matrix": [1, 6], "x": 6, "y": 1.5},
+ {"matrix": [1, 7], "x": 7, "y": 1.5},
+ {"matrix": [1, 8], "x": 8, "y": 1.5},
+ {"matrix": [1, 9], "x": 9, "y": 1.5},
+ {"matrix": [1, 10], "x": 10, "y": 1.5},
+ {"matrix": [1, 11], "x": 11, "y": 1.5},
+ {"matrix": [1, 12], "x": 12, "y": 1.5},
+ {"matrix": [1, 13], "x": 13, "y": 1.5, "w": 2},
+
+ {"matrix": [1, 14], "x": 15.25, "y": 1.5},
+ {"matrix": [1, 15], "x": 16.25, "y": 1.5},
+ {"matrix": [1, 16], "x": 17.25, "y": 1.5},
+
+ {"matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5},
+ {"matrix": [2, 1], "x": 1.5, "y": 2.5},
+ {"matrix": [2, 2], "x": 2.5, "y": 2.5},
+ {"matrix": [2, 3], "x": 3.5, "y": 2.5},
+ {"matrix": [2, 4], "x": 4.5, "y": 2.5},
+ {"matrix": [2, 5], "x": 5.5, "y": 2.5},
+ {"matrix": [2, 6], "x": 6.5, "y": 2.5},
+ {"matrix": [2, 7], "x": 7.5, "y": 2.5},
+ {"matrix": [2, 8], "x": 8.5, "y": 2.5},
+ {"matrix": [2, 9], "x": 9.5, "y": 2.5},
+ {"matrix": [2, 10], "x": 10.5, "y": 2.5},
+ {"matrix": [2, 11], "x": 11.5, "y": 2.5},
+ {"matrix": [2, 12], "x": 12.5, "y": 2.5},
+ {"matrix": [2, 13], "x": 13.5, "y": 2.5, "w": 1.5},
+
+ {"matrix": [2, 14], "x": 15.25, "y": 2.5},
+ {"matrix": [2, 15], "x": 16.25, "y": 2.5},
+ {"matrix": [2, 16], "x": 17.25, "y": 2.5},
+
+ {"matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75},
+ {"matrix": [3, 1], "x": 1.75, "y": 3.5},
+ {"matrix": [3, 2], "x": 2.75, "y": 3.5},
+ {"matrix": [3, 3], "x": 3.75, "y": 3.5},
+ {"matrix": [3, 4], "x": 4.75, "y": 3.5},
+ {"matrix": [3, 5], "x": 5.75, "y": 3.5},
+ {"matrix": [3, 6], "x": 6.75, "y": 3.5},
+ {"matrix": [3, 7], "x": 7.75, "y": 3.5},
+ {"matrix": [3, 8], "x": 8.75, "y": 3.5},
+ {"matrix": [3, 9], "x": 9.75, "y": 3.5},
+ {"matrix": [3, 10], "x": 10.75, "y": 3.5},
+ {"matrix": [3, 11], "x": 11.75, "y": 3.5},
+ {"matrix": [3, 13], "x": 12.75, "y": 3.5, "w": 2.25},
+
+ {"matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25},
+ {"matrix": [4, 1], "x": 2.25, "y": 4.5},
+ {"matrix": [4, 2], "x": 3.25, "y": 4.5},
+ {"matrix": [4, 3], "x": 4.25, "y": 4.5},
+ {"matrix": [4, 4], "x": 5.25, "y": 4.5},
+ {"matrix": [4, 5], "x": 6.25, "y": 4.5},
+ {"matrix": [4, 6], "x": 7.25, "y": 4.5},
+ {"matrix": [4, 7], "x": 8.25, "y": 4.5},
+ {"matrix": [4, 8], "x": 9.25, "y": 4.5},
+ {"matrix": [4, 9], "x": 10.25, "y": 4.5},
+ {"matrix": [4, 10], "x": 11.25, "y": 4.5},
+ {"matrix": [4, 13], "x": 12.25, "y": 4.5, "w": 2.75},
+
+ {"matrix": [4, 15], "x": 16.25, "y": 4.5},
+
+ {"matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 1], "x": 1.25, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 2], "x": 2.5, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 5], "x": 3.75, "y": 5.5, "w": 6.25},
+ {"matrix": [5, 8], "x": 10, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 10], "x": 11.25, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 12], "x": 12.5, "y": 5.5, "w": 1.25},
+ {"matrix": [5, 13], "x": 13.75, "y": 5.5, "w": 1.25},
+
+ {"matrix": [5, 14], "x": 15.25, "y": 5.5},
+ {"matrix": [5, 15], "x": 16.25, "y": 5.5},
+ {"matrix": [5, 16], "x": 17.25, "y": 5.5}
+ ]
+ },
+ "LAYOUT_tkl_ansi_wkl": {
+ "layout": [
+ {"matrix": [0, 0], "x": 0, "y": 0},
+
+ {"matrix": [0, 2], "x": 2, "y": 0},
+ {"matrix": [0, 3], "x": 3, "y": 0},
+ {"matrix": [0, 4], "x": 4, "y": 0},
+ {"matrix": [0, 5], "x": 5, "y": 0},
+
+ {"matrix": [0, 6], "x": 6.5, "y": 0},
+ {"matrix": [0, 7], "x": 7.5, "y": 0},
+ {"matrix": [0, 8], "x": 8.5, "y": 0},
+ {"matrix": [0, 9], "x": 9.5, "y": 0},
+
+ {"matrix": [0, 10], "x": 11, "y": 0},
+ {"matrix": [0, 11], "x": 12, "y": 0},
+ {"matrix": [0, 12], "x": 13, "y": 0},
+ {"matrix": [0, 13], "x": 14, "y": 0},
+
+ {"matrix": [0, 14], "x": 15.25, "y": 0},
+ {"matrix": [0, 15], "x": 16.25, "y": 0},
+ {"matrix": [0, 16], "x": 17.25, "y": 0},
+
+ {"matrix": [1, 0], "x": 0, "y": 1.5},
+ {"matrix": [1, 1], "x": 1, "y": 1.5},
+ {"matrix": [1, 2], "x": 2, "y": 1.5},
+ {"matrix": [1, 3], "x": 3, "y": 1.5},
+ {"matrix": [1, 4], "x": 4, "y": 1.5},
+ {"matrix": [1, 5], "x": 5, "y": 1.5},
+ {"matrix": [1, 6], "x": 6, "y": 1.5},
+ {"matrix": [1, 7], "x": 7, "y": 1.5},
+ {"matrix": [1, 8], "x": 8, "y": 1.5},
+ {"matrix": [1, 9], "x": 9, "y": 1.5},
+ {"matrix": [1, 10], "x": 10, "y": 1.5},
+ {"matrix": [1, 11], "x": 11, "y": 1.5},
+ {"matrix": [1, 12], "x": 12, "y": 1.5},
+ {"matrix": [1, 13], "x": 13, "y": 1.5, "w": 2},
+
+ {"matrix": [1, 14], "x": 15.25, "y": 1.5},
+ {"matrix": [1, 15], "x": 16.25, "y": 1.5},
+ {"matrix": [1, 16], "x": 17.25, "y": 1.5},
+
+ {"matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5},
+ {"matrix": [2, 1], "x": 1.5, "y": 2.5},
+ {"matrix": [2, 2], "x": 2.5, "y": 2.5},
+ {"matrix": [2, 3], "x": 3.5, "y": 2.5},
+ {"matrix": [2, 4], "x": 4.5, "y": 2.5},
+ {"matrix": [2, 5], "x": 5.5, "y": 2.5},
+ {"matrix": [2, 6], "x": 6.5, "y": 2.5},
+ {"matrix": [2, 7], "x": 7.5, "y": 2.5},
+ {"matrix": [2, 8], "x": 8.5, "y": 2.5},
+ {"matrix": [2, 9], "x": 9.5, "y": 2.5},
+ {"matrix": [2, 10], "x": 10.5, "y": 2.5},
+ {"matrix": [2, 11], "x": 11.5, "y": 2.5},
+ {"matrix": [2, 12], "x": 12.5, "y": 2.5},
+ {"matrix": [2, 13], "x": 13.5, "y": 2.5, "w": 1.5},
+
+ {"matrix": [2, 14], "x": 15.25, "y": 2.5},
+ {"matrix": [2, 15], "x": 16.25, "y": 2.5},
+ {"matrix": [2, 16], "x": 17.25, "y": 2.5},
+
+ {"matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75},
+ {"matrix": [3, 1], "x": 1.75, "y": 3.5},
+ {"matrix": [3, 2], "x": 2.75, "y": 3.5},
+ {"matrix": [3, 3], "x": 3.75, "y": 3.5},
+ {"matrix": [3, 4], "x": 4.75, "y": 3.5},
+ {"matrix": [3, 5], "x": 5.75, "y": 3.5},
+ {"matrix": [3, 6], "x": 6.75, "y": 3.5},
+ {"matrix": [3, 7], "x": 7.75, "y": 3.5},
+ {"matrix": [3, 8], "x": 8.75, "y": 3.5},
+ {"matrix": [3, 9], "x": 9.75, "y": 3.5},
+ {"matrix": [3, 10], "x": 10.75, "y": 3.5},
+ {"matrix": [3, 11], "x": 11.75, "y": 3.5},
+ {"matrix": [3, 13], "x": 12.75, "y": 3.5, "w": 2.25},
+
+ {"matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25},
+ {"matrix": [4, 1], "x": 2.25, "y": 4.5},
+ {"matrix": [4, 2], "x": 3.25, "y": 4.5},
+ {"matrix": [4, 3], "x": 4.25, "y": 4.5},
+ {"matrix": [4, 4], "x": 5.25, "y": 4.5},
+ {"matrix": [4, 5], "x": 6.25, "y": 4.5},
+ {"matrix": [4, 6], "x": 7.25, "y": 4.5},
+ {"matrix": [4, 7], "x": 8.25, "y": 4.5},
+ {"matrix": [4, 8], "x": 9.25, "y": 4.5},
+ {"matrix": [4, 9], "x": 10.25, "y": 4.5},
+ {"matrix": [4, 10], "x": 11.25, "y": 4.5},
+ {"matrix": [4, 13], "x": 12.25, "y": 4.5, "w": 2.75},
+
+ {"matrix": [4, 15], "x": 16.25, "y": 4.5},
+
+ {"matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.5},
+ {"matrix": [5, 2], "x": 2.5, "y": 5.5, "w": 1.5},
+ {"matrix": [5, 5], "x": 4, "y": 5.5, "w": 7},
+ {"matrix": [5, 8], "x": 11, "y": 5.5, "w": 1.5},
+ {"matrix": [5, 13], "x": 13.5, "y": 5.5, "w": 1.5},
+
+ {"matrix": [5, 14], "x": 15.25, "y": 5.5},
+ {"matrix": [5, 15], "x": 16.25, "y": 5.5},
+ {"matrix": [5, 16], "x": 17.25, "y": 5.5}
+ ]
+ }
+ }
+}
diff --git a/keyboards/kbdmania/kmac/keymaps/default/keymap.c b/keyboards/kbdmania/kmac/keymaps/default/keymap.c
new file mode 100644
index 0000000000..f3e4385052
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default/keymap.c
@@ -0,0 +1,81 @@
+/* Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+ *
+ * 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
+
+enum layer_names {
+ _QW,
+ _FN,
+};
+
+// Defines the keycodes used by our macros in process_record_user
+enum custom_keycodes {
+ MCR_01 = SAFE_RANGE,
+ MCR_02,
+ MCR_03,
+ MCR_04,
+ MCR_05,
+ MCR_06,
+ MCR_07,
+ MCR_08,
+ MCR_09,
+ MCR_10,
+ MCR_11,
+};
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_QW] = LAYOUT_tkl_ansi(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_BRK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+ [_FN] = LAYOUT_tkl_ansi(
+ BL_STEP, MCR_01, MCR_02, MCR_03, MCR_03, MCR_04, MCR_05, MCR_06, MCR_07, MCR_08, MCR_09, MCR_10, MCR_11, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+};
+// clang-format on
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case MCR_01:
+ if (record->event.pressed) {
+ SEND_STRING("The");
+ }
+ break;
+ case MCR_02:
+ if (record->event.pressed) {
+ SEND_STRING("Custom");
+ }
+ break;
+ case MCR_03:
+ if (record->event.pressed) {
+ SEND_STRING("Keyboard");
+ }
+ break;
+ case MCR_04:
+ if (record->event.pressed) {
+ SEND_STRING(SS_LCTL("c") SS_TAP(X_RIGHT) SS_LCTL("v"));
+ }
+ break;
+ }
+ return true;
+};
diff --git a/keyboards/kbdmania/kmac/keymaps/default/readme.md b/keyboards/kbdmania/kmac/keymaps/default/readme.md
new file mode 100644
index 0000000000..a608403753
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default/readme.md
@@ -0,0 +1,50 @@
+# Keymap for the winkey version of KMAC
+
+This is the default keymap for the winkey version of the PCB. It implements the same features as the official default KMAC firmware.
+
+## Layers
+
+The keymap have two layers. To access the functions on the second layer, hold down `Fn` and press the corresponding key.
+
+### Layer 1: Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|Fn |Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+### Layer 2: Function Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Led| |M1 |M2 |M3 |M4 | |M5 |M6 |M7 |M8 | |M9 |M10|M11|M12| | | | |
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+## Macros
+
+These are mostly useless and serve more like examples I guess.
+
+| Macro | Action |
+|:-----:| -------------------------------------- |
+| 1 | Types `The` |
+| 2 | Types `Custom` |
+| 3 | Types `Keyboard` |
+| 4 | Inputs `<Ctrl+c>` `<Right>` `<Ctrl+v>` |
diff --git a/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/keymap.c b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/keymap.c
new file mode 100644
index 0000000000..f3e4385052
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/keymap.c
@@ -0,0 +1,81 @@
+/* Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+ *
+ * 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
+
+enum layer_names {
+ _QW,
+ _FN,
+};
+
+// Defines the keycodes used by our macros in process_record_user
+enum custom_keycodes {
+ MCR_01 = SAFE_RANGE,
+ MCR_02,
+ MCR_03,
+ MCR_04,
+ MCR_05,
+ MCR_06,
+ MCR_07,
+ MCR_08,
+ MCR_09,
+ MCR_10,
+ MCR_11,
+};
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_QW] = LAYOUT_tkl_ansi(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_BRK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+ [_FN] = LAYOUT_tkl_ansi(
+ BL_STEP, MCR_01, MCR_02, MCR_03, MCR_03, MCR_04, MCR_05, MCR_06, MCR_07, MCR_08, MCR_09, MCR_10, MCR_11, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+};
+// clang-format on
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case MCR_01:
+ if (record->event.pressed) {
+ SEND_STRING("The");
+ }
+ break;
+ case MCR_02:
+ if (record->event.pressed) {
+ SEND_STRING("Custom");
+ }
+ break;
+ case MCR_03:
+ if (record->event.pressed) {
+ SEND_STRING("Keyboard");
+ }
+ break;
+ case MCR_04:
+ if (record->event.pressed) {
+ SEND_STRING(SS_LCTL("c") SS_TAP(X_RIGHT) SS_LCTL("v"));
+ }
+ break;
+ }
+ return true;
+};
diff --git a/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/readme.md b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/readme.md
new file mode 100644
index 0000000000..a608403753
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi/readme.md
@@ -0,0 +1,50 @@
+# Keymap for the winkey version of KMAC
+
+This is the default keymap for the winkey version of the PCB. It implements the same features as the official default KMAC firmware.
+
+## Layers
+
+The keymap have two layers. To access the functions on the second layer, hold down `Fn` and press the corresponding key.
+
+### Layer 1: Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|Fn |Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+### Layer 2: Function Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Led| |M1 |M2 |M3 |M4 | |M5 |M6 |M7 |M8 | |M9 |M10|M11|M12| | | | |
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+## Macros
+
+These are mostly useless and serve more like examples I guess.
+
+| Macro | Action |
+|:-----:| -------------------------------------- |
+| 1 | Types `The` |
+| 2 | Types `Custom` |
+| 3 | Types `Keyboard` |
+| 4 | Inputs `<Ctrl+c>` `<Right>` `<Ctrl+v>` |
diff --git a/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/keymap.c b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/keymap.c
new file mode 100644
index 0000000000..8c018383b1
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/keymap.c
@@ -0,0 +1,81 @@
+/* Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+ *
+ * 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
+
+enum layer_names {
+ _QW,
+ _FN,
+};
+
+// Defines the keycodes used by our macros in process_record_user
+enum custom_keycodes {
+ MCR_01 = SAFE_RANGE,
+ MCR_02,
+ MCR_03,
+ MCR_04,
+ MCR_05,
+ MCR_06,
+ MCR_07,
+ MCR_08,
+ MCR_09,
+ MCR_10,
+ MCR_11,
+};
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_QW] = LAYOUT_tkl_ansi_wkl(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_BRK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LALT, KC_SPC, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+ [_FN] = LAYOUT_tkl_ansi_wkl(
+ BL_STEP, MCR_01, MCR_02, MCR_03, MCR_03, MCR_04, MCR_05, MCR_06, MCR_07, MCR_08, MCR_09, MCR_10, MCR_11, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______),
+};
+// clang-format on
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case MCR_01:
+ if (record->event.pressed) {
+ SEND_STRING("The");
+ }
+ break;
+ case MCR_02:
+ if (record->event.pressed) {
+ SEND_STRING("Custom");
+ }
+ break;
+ case MCR_03:
+ if (record->event.pressed) {
+ SEND_STRING("Keyboard");
+ }
+ break;
+ case MCR_04:
+ if (record->event.pressed) {
+ SEND_STRING(SS_LCTL("c") SS_TAP(X_RIGHT) SS_LCTL("v"));
+ }
+ break;
+ }
+ return true;
+};
diff --git a/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/readme.md b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/readme.md
new file mode 100644
index 0000000000..a66ed10902
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/default_tkl_ansi_wkl/readme.md
@@ -0,0 +1,50 @@
+# Keymap for the winkeyless version of KMAC
+
+This is the default keymap for the winkeyless version of the PCB. It implements the same features as the official default KMAC firmware.
+
+## Layers
+
+The keymap have two layers. To access the functions on the second layer, hold down `Fn` and press the corresponding key.
+
+### Layer 1: Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl | |Alt | Space |Fn | |Ctl | |Lef|Dow|Rig|
+ `----' `-----------------------------------------' `----' `-----------'
+
+### Layer 2: Function Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Led| |M1 |M2 |M3 |M4 | |M5 |M6 |M7 |M8 | |M9 |M10|M11|M12| | | | |
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `----' `-----------------------------------------' `----' `-----------'
+
+## Macros
+
+These are mostly useless and serve more like examples I guess.
+
+| Macro | Action |
+|:-----:| -------------------------------------- |
+| 1 | Types `The` |
+| 2 | Types `Custom` |
+| 3 | Types `Keyboard` |
+| 4 | Inputs `<Ctrl+c>` `<Right>` `<Ctrl+v>` |
diff --git a/keyboards/kbdmania/kmac/keymaps/via/keymap.c b/keyboards/kbdmania/kmac/keymaps/via/keymap.c
new file mode 100644
index 0000000000..507840e462
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/via/keymap.c
@@ -0,0 +1,49 @@
+/* Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+ *
+ * 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
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_tkl_ansi(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_BRK,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+ [1] = LAYOUT_tkl_ansi(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+ [2] = LAYOUT_tkl_ansi(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+ [3] = LAYOUT_tkl_ansi(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+};
+// clang-format on
diff --git a/keyboards/kbdmania/kmac/keymaps/via/rules.mk b/keyboards/kbdmania/kmac/keymaps/via/rules.mk
new file mode 100644
index 0000000000..36b7ba9cbc
--- /dev/null
+++ b/keyboards/kbdmania/kmac/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
diff --git a/keyboards/kbdmania/kmac/kmac.c b/keyboards/kbdmania/kmac/kmac.c
new file mode 100644
index 0000000000..29f7091084
--- /dev/null
+++ b/keyboards/kbdmania/kmac/kmac.c
@@ -0,0 +1,56 @@
+/* Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+ *
+ * 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 "quantum.h"
+
+#define F_ROW_MASK 0b01
+#define WASD_MASK 0b10
+
+void backlight_init_ports(void) {
+ setPinOutput(B1);
+ setPinOutput(B2);
+ setPinOutput(B3);
+ setPinOutput(B4);
+ setPinOutput(D7);
+}
+
+/* Backlight pin configuration
+ * F-row: High PB1
+ * W: Low PB4
+ * A: Low PB2
+ * S: Low PB3
+ * D: Low PD7
+ */
+void backlight_set(uint8_t level) {
+ // F-row
+ if (level & F_ROW_MASK) {
+ writePinHigh(B1);
+ } else {
+ writePinLow(B1);
+ }
+
+ // WASD
+ if (level & WASD_MASK) {
+ writePinLow(B2);
+ writePinLow(B3);
+ writePinLow(B4);
+ writePinLow(D7);
+ } else {
+ writePinHigh(B2);
+ writePinHigh(B3);
+ writePinHigh(B4);
+ writePinHigh(D7);
+ }
+}
diff --git a/keyboards/kbdmania/kmac/matrix.c b/keyboards/kbdmania/kmac/matrix.c
new file mode 100644
index 0000000000..6569867032
--- /dev/null
+++ b/keyboards/kbdmania/kmac/matrix.c
@@ -0,0 +1,205 @@
+/*
+Copyright 2017-2019 Mathias Andersson <wraul@dbox.se>
+
+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 <stdint.h>
+#include <stdbool.h>
+#include "wait.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "debounce.h"
+#include "quantum.h"
+
+#if (MATRIX_COLS <= 8)
+# define print_matrix_header() print("\nr/c 01234567\n")
+# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
+# define ROW_SHIFTER ((uint8_t)1)
+#elif (MATRIX_COLS <= 16)
+# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
+# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
+# define ROW_SHIFTER ((uint16_t)1)
+#elif (MATRIX_COLS <= 32)
+# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
+# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
+# define ROW_SHIFTER ((uint32_t)1)
+#endif
+
+static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
+static matrix_row_t matrix[MATRIX_ROWS]; // debounced values
+
+__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
+
+__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
+
+__attribute__((weak)) void matrix_init_user(void) {}
+
+__attribute__((weak)) void matrix_scan_user(void) {}
+
+inline uint8_t matrix_rows(void) { return MATRIX_ROWS; }
+
+inline uint8_t matrix_cols(void) { return MATRIX_COLS; }
+
+inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); }
+
+inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
+
+void matrix_print(void) {
+ print_matrix_header();
+
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ print_hex8(row);
+ print(": ");
+ print_matrix_row(row);
+ print("\n");
+ }
+}
+
+/* Columns 0 - 15
+ * These columns uses two 74HC237D 3 to 8 bit demultiplexers.
+ * col / pin: PB6 PC6 PC7 PF1 PF0
+ * 0: 0 1 0 0 0
+ * 1: 0 1 0 0 1
+ * 2: 0 1 0 1 0
+ * 3: 0 1 0 1 1
+ * 4: 0 1 1 0 0
+ * 5: 0 1 1 0 1
+ * 6: 0 1 1 1 0
+ * 7: 0 1 1 1 1
+ * 8: 1 0 0 0 0
+ * 9: 1 0 0 0 1
+ * 10: 1 0 0 1 0
+ * 11: 1 0 0 1 1
+ * 12: 1 0 1 0 0
+ * 13: 1 0 1 0 1
+ * 14: 1 0 1 1 0
+ * 15: 1 0 1 1 1
+ *
+ * col: 16
+ * pin: PB5
+ */
+static void unselect_cols(void) {
+ for (uint8_t x = 0; x < 6; x++) {
+ setPinOutput(col_pins[x]);
+ writePinLow(col_pins[x]);
+ }
+}
+
+static void select_col(uint8_t col) {
+ if (col < 16) {
+ uint8_t c = col + 8;
+
+ writePin(B6, c & 0b10000);
+ writePin(C6, c & 0b01000);
+ writePin(C7, c & 0b00100);
+ writePin(F1, c & 0b00010);
+ writePin(F0, c & 0b00001);
+ } else {
+ writePinHigh(B5);
+ }
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4 5
+ * pin: D0 D1 D2 D3 D5 B7
+ *
+ * Caps lock uses its own pin E2
+ */
+static void init_pins(void) {
+ unselect_cols();
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ setPinInputHigh(row_pins[x]);
+ }
+
+ setPinInputHigh(E2);
+}
+
+static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
+ bool matrix_changed = false;
+
+ // Select col and wait for col selecton to stabilize
+ select_col(current_col);
+ wait_us(30);
+
+ // For each row...
+ for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[row_index];
+
+ // Check row pin state
+ // Use the otherwise unused row: 3, col: 0 for caps lock
+ if (row_index == 3 && current_col == 0) {
+ if (readPin(E2) == 0) {
+ // Pin LO, set col bit
+ current_matrix[row_index] |= (ROW_SHIFTER << current_col);
+ } else {
+ // Pin HI, clear col bit
+ current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
+ }
+ } else {
+ if (readPin(row_pins[row_index]) == 0) {
+ // Pin HI, clear col bit
+ current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
+ } else {
+ // Pin LO, set col bit
+ current_matrix[row_index] |= (ROW_SHIFTER << current_col);
+ }
+ }
+
+ // Determine if the matrix changed state
+ if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) {
+ matrix_changed = true;
+ }
+ }
+
+ // Unselect cols
+ unselect_cols();
+
+ return matrix_changed;
+}
+
+void matrix_init(void) {
+ // initialize key pins
+ init_pins();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ raw_matrix[i] = 0;
+ matrix[i] = 0;
+ }
+
+ debounce_init(MATRIX_ROWS);
+
+ matrix_init_kb();
+}
+
+uint8_t matrix_scan(void) {
+ bool changed = false;
+
+ for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+ changed |= read_rows_on_col(raw_matrix, current_col);
+ }
+
+ debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
+
+ matrix_scan_kb();
+
+ return (uint8_t)changed;
+}
diff --git a/keyboards/kbdmania/kmac/readme.md b/keyboards/kbdmania/kmac/readme.md
new file mode 100644
index 0000000000..c9f7746292
--- /dev/null
+++ b/keyboards/kbdmania/kmac/readme.md
@@ -0,0 +1,21 @@
+# KMAC
+
+A Korean custom keyboard designed by Byungho Kim and the KBDMania community.
+
+Keyboard Maintainer: [Mathias Andersson](https://github.com/wraul)
+Hardware Supported: KMAC & KMAC 2
+Hardware Availability: [KBDMania](http://www.kbdmania.net/xe/news/5232321)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make kbdmania/kmac: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).
+
+## Bootloader
+
+The PCB is hardwired to run the bootloader if the key at the `Caps Lock` position is held down when connecting the keyboard.
+
+## PCB versions
+
+The KMAC are available with two different PCB layouts, a winkey version and a winkeyless version. A default keymap are provided for each versions of the PCB.
diff --git a/keyboards/kbdmania/kmac/rules.mk b/keyboards/kbdmania/kmac/rules.mk
new file mode 100644
index 0000000000..d9aa87a7dc
--- /dev/null
+++ b/keyboards/kbdmania/kmac/rules.mk
@@ -0,0 +1,18 @@
+# Processor frequency
+F_CPU = 8000000
+
+# 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
+CUSTOM_MATRIX = yes # Custom matrix file
+NKRO_ENABLE = yes # Enable N-Key Rollover
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+AUDIO_ENABLE = no # Audio output
+
+# Project specific files
+SRC += matrix.c