From 55d0b1f048528439135874dd91ae009b9a2b4c9d Mon Sep 17 00:00:00 2001
From: bjacques <bjacques@users.noreply.github.com>
Date: Tue, 27 Mar 2018 17:00:52 +0100
Subject: [PATCH] Create new 'tada68/iso-uk' layout tailored for boards with
 the big fat iso enter key (#2612)

---
 keyboards/tada68/keymaps/iso-uk/config.h  |  4 ++
 keyboards/tada68/keymaps/iso-uk/keymap.c  | 49 +++++++++++++++
 keyboards/tada68/keymaps/iso-uk/readme.md | 19 ++++++
 keyboards/tada68/keymaps/iso-uk/rules.mk  | 21 +++++++
 keyboards/tada68/keymaps/iso-uk/tada68.h  | 74 +++++++++++++++++++++++
 5 files changed, 167 insertions(+)
 create mode 100644 keyboards/tada68/keymaps/iso-uk/config.h
 create mode 100644 keyboards/tada68/keymaps/iso-uk/keymap.c
 create mode 100644 keyboards/tada68/keymaps/iso-uk/readme.md
 create mode 100644 keyboards/tada68/keymaps/iso-uk/rules.mk
 create mode 100644 keyboards/tada68/keymaps/iso-uk/tada68.h

diff --git a/keyboards/tada68/keymaps/iso-uk/config.h b/keyboards/tada68/keymaps/iso-uk/config.h
new file mode 100644
index 0000000000..1e1005aeef
--- /dev/null
+++ b/keyboards/tada68/keymaps/iso-uk/config.h
@@ -0,0 +1,4 @@
+#include "../../config.h"
+
+#define BACKLIGHT_BREATHING
+#define BREATHING_PERIOD 6
\ No newline at end of file
diff --git a/keyboards/tada68/keymaps/iso-uk/keymap.c b/keyboards/tada68/keymaps/iso-uk/keymap.c
new file mode 100644
index 0000000000..185e29385a
--- /dev/null
+++ b/keyboards/tada68/keymaps/iso-uk/keymap.c
@@ -0,0 +1,49 @@
+#include "tada68.h"
+
+#define _BL 0
+#define _FL 1
+
+#define _______ KC_TRNS
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  /* Keymap _BL: (Base Layer) Default Layer
+   * ,----------------------------------------------------------------.
+   * |Esc | 1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp |~ ` |
+   * |----------------------------------------------------------------|
+   * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|     |Del |
+   * |-------------------------------------------------------    -----|
+   * |CAPS   |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;| '|  #|Entr|PgUp|
+   * |----------------------------------------------------------------|
+   * |Shift|  \ |  Z|  X|  C|  V|  B|  N|  M|  ,|  .| /|Rshift|Up|PgDn|
+   * |----------------------------------------------------------------|
+   * |Ctrl|Win |Alt |        Space          |Alt| FN|Ctrl|Lef|Dow|Rig |
+   * `----------------------------------------------------------------'
+   */
+[_BL] = KEYMAP_ISO(
+  KC_ESC ,   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_GRV, \
+  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_NUHS,KC_DEL, \
+  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_PGUP,  \
+  KC_LSFT,KC_NUBS,   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_PGDN, \
+  KC_LCTL,KC_LGUI,KC_LALT,                KC_SPC,                        KC_RALT, MO(_FL), KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT),
+
+  /* Keymap _FL1: Function Layer 1
+   * ,----------------------------------------------------------------.
+   * |   | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| Delete| Ins|
+   
+   * |----------------------------------------------------------------|
+   * |     |   | ↑ |   |   |   |   |   |   |   |   |   |   |     |Home|
+   * |-------------------------------------------------------    -----|
+   * |       | ← | ↓ | → |   |   |   |   |   |   |   |  |   |    | End|
+   * |----------------------------------------------------------------|
+   * |     |   |   |   | L+|LED| L-|   | V+|  V-|Mut|  | MsBtn|Up|MsBn|
+   * |----------------------------------------------------------------|
+   * |    |    |    |                       |   |   |    | Lt| Dn| Rt |
+   * `----------------------------------------------------------------'
+   */
+[_FL] = KEYMAP_ISO(
+  _______,  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_DEL, KC_INS,  \
+  _______,_______,  KC_UP,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_HOME, \
+  _______,KC_LEFT,KC_DOWN,KC_RGHT,_______,_______,_______,_______,_______,_______,_______,_______,        _______, KC_END, \
+  _______,_______,_______, _______, BL_DEC,BL_TOGG, BL_INC,_______,KC_VOLU,KC_VOLD,KC_MUTE,_______,KC_BTN1, KC_MS_U,KC_BTN2, \
+  _______,_______,_______,                 _______,                        _______,_______,_______,KC_MS_L, KC_MS_D,KC_MS_R),
+};
diff --git a/keyboards/tada68/keymaps/iso-uk/readme.md b/keyboards/tada68/keymaps/iso-uk/readme.md
new file mode 100644
index 0000000000..03e6769154
--- /dev/null
+++ b/keyboards/tada68/keymaps/iso-uk/readme.md
@@ -0,0 +1,19 @@
+# TADA68 layout for ISO UK
+
+This layout has been tested on a TADA68 purchased from kbdfans in March 2018. The physical key layout includes the "double height" iso Enter key and the "short" Left Shift along side the iso Backslash key. [See this keyboard-layout-editor.com Gist](http://www.keyboard-layout-editor.com/#/gists/acf0f32f7ea0d0ed35c901663ca47919)
+
+The Base Layer and Function layer defined here match the layout defined by the kbdfans keyboard layout tool found at http://123.57.250.164:3000/tada68
+
+## Special mention for the ISO Hash key
+
+When viewing tada68.h in this directory, KEYMAP_ISO does not define a key at location *k2c* (it's missing) even though this is where the ISO Hash key (KC_NUHS) physically appears on your keyboard. For some reason we have to map the KC_NUHS to key location *k1d* which is above the Enter key.
+
+In an attempt to clarify this anomaly, the ascii image comments in keymap.c depicts the physical layout, but the definition in *[_BL] = KEYMAP_ISO* depicts the layout that the firmware operates on.
+
+## Installation
+
+Please see the [tada68 readme](../../readme.md) using the following command
+
+```
+make tada68:iso-uk:bin
+```
\ No newline at end of file
diff --git a/keyboards/tada68/keymaps/iso-uk/rules.mk b/keyboards/tada68/keymaps/iso-uk/rules.mk
new file mode 100644
index 0000000000..4deca710b8
--- /dev/null
+++ b/keyboards/tada68/keymaps/iso-uk/rules.mk
@@ -0,0 +1,21 @@
+# Build Options
+#   change to "no" to disable the options, or define them in the Makefile in 
+#   the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes       # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
+CONSOLE_ENABLE = no         # Console for debug(+400)
+COMMAND_ENABLE = yes        # Commands for debug and configuration
+NKRO_ENABLE = yes           # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = yes       # Enable keyboard backlight functionality
+MIDI_ENABLE = no            # MIDI controls
+AUDIO_ENABLE = no           # Audio output on port C6
+UNICODE_ENABLE = no         # Unicode
+BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE = no        # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+
+ifndef QUANTUM_DIR
+	include ../../../../Makefile
+endif
\ No newline at end of file
diff --git a/keyboards/tada68/keymaps/iso-uk/tada68.h b/keyboards/tada68/keymaps/iso-uk/tada68.h
new file mode 100644
index 0000000000..07bdc77eba
--- /dev/null
+++ b/keyboards/tada68/keymaps/iso-uk/tada68.h
@@ -0,0 +1,74 @@
+#ifndef TADA68_H
+#define TADA68_H
+
+#include "quantum.h"
+
+// readability
+#define XXX KC_NO
+
+/* TADA68 ANSI layout
+   * ,----------------------------------------------------------------.
+   * | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d    | 0e |
+   * |----------------------------------------------------------------|
+   * | 10  | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c|  1d | 1e |
+   * |----------------------------------------------------------------|
+   * | 20    | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2d    | 2e |
+   * |----------------------------------------------------------------|
+   * | 30     | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b|    3c| 3d| 3e |
+   * |----------------------------------------------------------------|
+   * | 40 | 41 | 42 |        45             | 49| 4a|  4b| 4c| 4d| 4e |
+   * `----------------------------------------------------------------'
+ */
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+
+#define KEYMAP_ANSI( \
+    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b,      k2d, k2e, \
+	k30,      k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
+	k40, k41, k42,           k45,                k49, k4a, k4b, k4c, k4d, k4e  \
+) \
+{ \
+	{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
+	{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \
+	{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
+	{k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
+	{k40, k41, k42, XXX, XXX, k45, XXX, XXX, XXX, k49, k4a, k4b, k4c, k4d, k4e}  \
+}
+
+/* TADA68 ISO layout
+   * ,----------------------------------------------------------------.
+   * | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d    | 0e |
+   * |----------------------------------------------------------------|
+   * | 10  | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c|  1d | 1e |
+   * |----------------------------------------------------------------|
+   * | 20    | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2c| 2d| 2e |
+   * |----------------------------------------------------------------|
+   * | 30     | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b|    3c| 3d| 3e |
+   * |----------------------------------------------------------------|
+   * | 40 | 41 | 42 |        45             | 49| 4a|  4b| 4c| 4d| 4e |
+   * `----------------------------------------------------------------'
+ */
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+
+#define KEYMAP_ISO( \
+    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b,      k2d, k2e, \
+	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
+	k40, k41, k42,           k45,                k49, k4a, k4b, k4c, k4d, k4e  \
+) \
+{ \
+	{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
+	{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \
+	{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
+	{k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
+	{k40, k41, k42, XXX, XXX, k45, XXX, XXX, XXX, k49, k4a, k4b, k4c, k4d, k4e}  \
+}
+
+void matrix_init_user(void);
+void matrix_scan_user(void);
+
+#endif
\ No newline at end of file