From ea819268f3d08868ca72bd7911de7979c866d8a5 Mon Sep 17 00:00:00 2001
From: BenKesselring <bskesselring@gmail.com>
Date: Fri, 6 Oct 2017 08:20:28 -0600
Subject: [PATCH] Add new 4x12 ortho layout & add credit to XD75 port (#1782)

* add xd75, preliminary RGB'

* fix RGB

* add backlight support (probably)

* updated readme and tweaked keymap

* added xd75 to list in /keyboards

* copyright ALL the things, create blank slate for Colemak Mod-DH Split/Wide keymap

* Add preliminary split Colemak Mod-DH layout

* changing stuff to compile properly

* attribution

* moar attribution

* removed incomplete keymap

* Create Colemak Mod-DH Wide layout for 4x12 ortho.

* Move Adjust key

* Add layou timage to readme

* fix naming

* Fix stupid issue with not understanding how the keymap works

* forgot to switch COLEMAK to COLEMAKDH...

* Remove and link image

* Remove and link image
---
 keyboards/xd75/config.h                       |   2 +-
 keyboards/xd75/keymaps/default/config.h       |   2 +-
 keyboards/xd75/keymaps/default/keymap.c       |   2 +-
 keyboards/xd75/xd75.c                         |   2 +-
 keyboards/xd75/xd75.h                         |   2 +-
 .../ortho_4x12/colemak_mod_dh_wide/config.h   |  37 +++++
 .../ortho_4x12/colemak_mod_dh_wide/keymap.c   | 141 ++++++++++++++++++
 .../ortho_4x12/colemak_mod_dh_wide/readme.md  |   5 +
 8 files changed, 188 insertions(+), 5 deletions(-)
 create mode 100644 layouts/community/ortho_4x12/colemak_mod_dh_wide/config.h
 create mode 100644 layouts/community/ortho_4x12/colemak_mod_dh_wide/keymap.c
 create mode 100644 layouts/community/ortho_4x12/colemak_mod_dh_wide/readme.md

diff --git a/keyboards/xd75/config.h b/keyboards/xd75/config.h
index 608d0aad13..b509dbdec2 100644
--- a/keyboards/xd75/config.h
+++ b/keyboards/xd75/config.h
@@ -1,5 +1,5 @@
 /*
-Copyright 2017 REPLACE_WITH_YOUR_NAME
+Copyright 2017 Benjamin Kesselring
 
 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
diff --git a/keyboards/xd75/keymaps/default/config.h b/keyboards/xd75/keymaps/default/config.h
index f52a97bbc8..015377b5f8 100644
--- a/keyboards/xd75/keymaps/default/config.h
+++ b/keyboards/xd75/keymaps/default/config.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 REPLACE_WITH_YOUR_NAME
+/* Copyright 2017 Benjamin Kesselring
  *
  * 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
diff --git a/keyboards/xd75/keymaps/default/keymap.c b/keyboards/xd75/keymaps/default/keymap.c
index 82ea1f2be8..9867322993 100644
--- a/keyboards/xd75/keymaps/default/keymap.c
+++ b/keyboards/xd75/keymaps/default/keymap.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 REPLACE_WITH_YOUR_NAME
+/* Copyright 2017 Benjamin Kesselring
  *
  * 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
diff --git a/keyboards/xd75/xd75.c b/keyboards/xd75/xd75.c
index 3d635f3c10..9b35b6cfa0 100644
--- a/keyboards/xd75/xd75.c
+++ b/keyboards/xd75/xd75.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 REPLACE_WITH_YOUR_NAME
+/* Copyright 2017 Benjamin Kesselring
  *
  * 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
diff --git a/keyboards/xd75/xd75.h b/keyboards/xd75/xd75.h
index 08592b6650..b2030d4a6e 100644
--- a/keyboards/xd75/xd75.h
+++ b/keyboards/xd75/xd75.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 REPLACE_WITH_YOUR_NAME
+/* Copyright 2017 Benjamin Kesselring
  *
  * 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
diff --git a/layouts/community/ortho_4x12/colemak_mod_dh_wide/config.h b/layouts/community/ortho_4x12/colemak_mod_dh_wide/config.h
new file mode 100644
index 0000000000..3c3d9b8858
--- /dev/null
+++ b/layouts/community/ortho_4x12/colemak_mod_dh_wide/config.h
@@ -0,0 +1,37 @@
+/*
+This is the c configuration file for the keymap
+
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2015 Jack Humbert
+
+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/>.
+*/
+
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+#include QMK_KEYBOARD_CONFIG_H
+
+/* Use I2C or Serial, not both */
+
+#define USE_SERIAL
+// #define USE_I2C
+
+/* Select hand configuration */
+
+#define MASTER_LEFT
+// #define _MASTER_RIGHT
+// #define EE_HANDS
+
+#endif
\ No newline at end of file
diff --git a/layouts/community/ortho_4x12/colemak_mod_dh_wide/keymap.c b/layouts/community/ortho_4x12/colemak_mod_dh_wide/keymap.c
new file mode 100644
index 0000000000..218ff93741
--- /dev/null
+++ b/layouts/community/ortho_4x12/colemak_mod_dh_wide/keymap.c
@@ -0,0 +1,141 @@
+#include QMK_KEYBOARD_H
+#include "action_layer.h"
+#include "eeconfig.h"
+
+extern keymap_config_t keymap_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _COLEMAKDH 0
+#define _LOWER 1
+#define _RAISE 2
+#define _ADJUST 16
+
+enum custom_keycodes {
+  COLEMAKDH = SAFE_RANGE,
+  LOWER,
+  RAISE,
+  ADJUST,
+};
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Colemak
+ * ,-----------------------------------------------------------------------------------.
+ * |   Q  |   W  |   F  |   P  |   B  | Tab  | Bksp |   J  |   L  |   U  |   Y  |   ;  |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * |   A  |   R  |   S  |   T  |   G  | Esc  |  "   |   M  |   N  |   E  |   I  |   O  |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * |   Z  |   X  |   C  |   D  |   V  |Shift |Enter |   K  |   H  |   ,  |   .  |   /  |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Ctrl | Alt  | GUI  |Adjust|Space |Lower |Raise |Space | Left | Down |  Up  |Right |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_COLEMAKDH] = LAYOUT_ortho_4x12( \
+  KC_Q,    KC_W,    KC_F,    KC_P,    KC_B,    KC_TAB,  KC_BSPC, KC_J,    KC_L,    KC_U,    KC_Y,    KC_SCLN, \
+  KC_A,    KC_R,    KC_S,    KC_T,    KC_G,    KC_ESC,  KC_QUOT, KC_M,    KC_N,    KC_E,    KC_I,    KC_O,    \
+  KC_Z,    KC_X,    KC_C,    KC_D,    KC_V,    KC_LSFT, KC_ENT,  KC_K,    KC_H,    KC_COMM, KC_DOT,  KC_SLSH, \
+  ADJUST,  KC_LCTL, KC_LALT, KC_LGUI, KC_SPC,  LOWER,   RAISE,   KC_SPC,  KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT  \
+),
+
+/* Lower
+ * ,-----------------------------------------------------------------------------------.
+ * |   ~  |   !  |   @  |   #  |   $  |   %  |   ^  |   &  |   *  |   (  |   )  | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Del  |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   _  |   +  |     |    \  |  |   |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * |      |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 |ISO ~ |ISO | |      |      |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * |      |      |      |      |      |             |      | Next | Vol- | Vol+ | Play |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_LOWER] = LAYOUT_ortho_4x12( \
+  KC_TILD, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
+  KC_DEL,  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,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
+  _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+),
+
+/* Raise
+ * ,-----------------------------------------------------------------------------------.
+ * |   `  |   1  |   2  |   3  |   4  |   5  |   6  |   7  |   8  |   9  |   0  | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Del  |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   -  |   =  |   [  |   ]  |  \   |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * |      |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 |ISO # |ISO / |      |      |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * |      |      |      |      |      |             |      | Next | Vol- | Vol+ | Play |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_RAISE] = LAYOUT_ortho_4x12( \
+  KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC, \
+  KC_DEL,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC, KC_BSLS, \
+  _______, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_NUHS, KC_NUBS, _______, _______, _______, \
+  _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+),
+
+/* Adjust (Lower + Raise)
+ * ,-----------------------------------------------------------------------------------.
+ * |      | Reset|      |      |      |      |      |      |      |      |      |  Del |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * |      |      |      |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|      |      |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * |      |      |      |      |      |      |      |      |      |      |      |      |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * |      |      |      |      |      |             |      |      |      |      |      |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_ADJUST] =  LAYOUT_ortho_4x12( \
+  _______, RESET,   _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
+  _______, _______, _______, AU_ON,   AU_OFF,  AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, \
+  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
+  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
+)
+
+
+};
+
+void persistent_default_layer_set(uint16_t default_layer) {
+  eeconfig_update_default_layer(default_layer);
+  default_layer_set(default_layer);
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  switch (keycode) {
+    case LOWER:
+      if (record->event.pressed) {
+        layer_on(_LOWER);
+        update_tri_layer(_LOWER, _RAISE, _ADJUST);
+      } else {
+        layer_off(_LOWER);
+        update_tri_layer(_LOWER, _RAISE, _ADJUST);
+      }
+      return false;
+      break;
+    case RAISE:
+      if (record->event.pressed) {
+        layer_on(_RAISE);
+        update_tri_layer(_LOWER, _RAISE, _ADJUST);
+      } else {
+        layer_off(_RAISE);
+        update_tri_layer(_LOWER, _RAISE, _ADJUST);
+      }
+      return false;
+      break;
+    case ADJUST:
+      if (record->event.pressed) {
+        layer_on(_ADJUST);
+      } else {
+        layer_off(_ADJUST);
+      }
+      return false;
+      break;
+  }
+  return true;
+}
diff --git a/layouts/community/ortho_4x12/colemak_mod_dh_wide/readme.md b/layouts/community/ortho_4x12/colemak_mod_dh_wide/readme.md
new file mode 100644
index 0000000000..63193e5869
--- /dev/null
+++ b/layouts/community/ortho_4x12/colemak_mod_dh_wide/readme.md
@@ -0,0 +1,5 @@
+# ortho_4x12
+
+A wide, split layout for use on grid Planck or Let's Split based on the Colemak Mod-DH keyboard layout.
+
+![layout image](https://i.imgur.com/y3O6U1R.png)