From d46d3043957b75369923cb0202c632fa1d8f0311 Mon Sep 17 00:00:00 2001
From: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Date: Tue, 11 Dec 2018 15:58:10 -0800
Subject: [PATCH] Preonic Configurator update (#4598)

* Preonic: refactor layout macros

Unify layout macro names across AVR and ARM.

- all layouts and matrices have moved/duplicated to their appropriate revisions
  - preonic.h now includes the appropriate header file from the selected revision
  - revision header files only contain layouts appropriate for that revision
    - Previously, all layouts were available in source for all revisions.
- removed KEYMAP layout macro alias (was unused)
- macros LAYOUT_preonic_1x2uC and LAYOUT_preonic_grid for AVR and ARM revisions
  - LAYOUT_preonic_grid has alias LAYOUT_ortho_5x12 for all revisions
- deleted LAYOUT_ortho_4x12 alias (not appropriate for this keyboard)
- ARM-based revisions have 1x2uR, 1x2uL and 2x2u matrices

* Preonic: updated revision headers to #pragma once

* Preonic: update Configurator files

Updated the Configurator files to reflect the previous changes in this branch.

- Preonic revs. 1 and 2 will use keyboards/preonic/info.json
- Preonic rev. 3 will use keyboards/preonic/rev3/info.json
  - This file will override keyboards/preonic/info.json when preonic/rev3 is selected in the Configurator.
---
 keyboards/preonic/info.json      |   4 +-
 keyboards/preonic/preonic.h      | 163 ++-------------
 keyboards/preonic/rev1/rev1.h    |  39 +++-
 keyboards/preonic/rev2/rev2.h    |  36 ++++
 keyboards/preonic/rev3/info.json | 330 +++++++++++++++++++++++++++++++
 keyboards/preonic/rev3/rev3.h    | 106 +++++++++-
 6 files changed, 530 insertions(+), 148 deletions(-)
 create mode 100644 keyboards/preonic/rev3/info.json

diff --git a/keyboards/preonic/info.json b/keyboards/preonic/info.json
index 3e5670cfaf..cb0798b545 100644
--- a/keyboards/preonic/info.json
+++ b/keyboards/preonic/info.json
@@ -6,7 +6,7 @@
   "width": 12,
   "height": 5,
   "layouts": {
-    "KEYMAP": {
+    "LAYOUT_preonic_1x2uC": {
       "key_count": 59,
       "layout": [ 
         { "w": 1, "x": 0, "y": 0 }, 
@@ -69,7 +69,7 @@
         { "w": 1, "x": 10, "y": 4 }, 
         { "w": 1, "x": 11, "y": 4 } ]
     },
-    "LAYOUT_preonic_grid": {
+    "LAYOUT_ortho_5x12": {
       "key_count": 60,
       "layout": [ 
         { "w": 1, "x": 0, "y": 0 }, 
diff --git a/keyboards/preonic/preonic.h b/keyboards/preonic/preonic.h
index 8d7b577a97..e2aa1545c1 100644
--- a/keyboards/preonic/preonic.h
+++ b/keyboards/preonic/preonic.h
@@ -1,149 +1,26 @@
-#ifndef PREONIC_H
-#define PREONIC_H
+#pragma once
 
 #include "quantum.h"
 
-#ifdef __AVR__
-
-#define LAYOUT_preonic_1x2uC( \
-	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-	k40, k41, k42, k43, k44,    k45,   k47, k48, k49, k4a, k4b \
-) \
-{ \
-	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
-	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
-	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
-	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
-	{ k40, k41, k42, k43, k44, k45, k45, k47, k48, k49, k4a, k4b } \
-}
-
-#define LAYOUT_preonic_grid( \
-	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-	k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
-) \
-{ \
-	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
-	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
-	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
-	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
-	{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b } \
-}
-
-#define KEYMAP LAYOUT_preonic_1x2uC
-#define LAYOUT_ortho_5x12 LAYOUT_preonic_grid
-
-#else
-
-#define LAYOUT_preonic_1x2uC( \
-    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-    k40, k41, k42, k43, k44,    k45,   k47, k48, k49, k4a, k4b \
-) \
-{ \
-    { k00, k01, k02, k03, k04, k05 }, \
-    { k10, k11, k12, k13, k14, k15 }, \
-    { k20, k21, k22, k23, k24, k25 }, \
-    { k30, k31, k32, k33, k34, k35 }, \
-    { k06, k07, k08, k09, k0a, k0b }, \
-    { k16, k17, k18, k19, k1a, k1b }, \
-    { k26, k27, k28, k29, k2a, k2b }, \
-    { k36, k37, k38, k39, k3a, k3b }, \
-    { k40, k41, k42, k49, k4a, k4b }, \
-    { k46, k47, k48, k43, k44, k45 } \
-}
-
-#define LAYOUT_preonic_1x2uR( \
-    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-    k40, k41, k42, k43, k44, k45,   k47,    k48, k49, k4a, k4b \
-) \
-{ \
-    { k00, k01, k02, k03, k04, k05 }, \
-    { k10, k11, k12, k13, k14, k15 }, \
-    { k20, k21, k22, k23, k24, k25 }, \
-    { k30, k31, k32, k33, k34, k35 }, \
-    { k06, k07, k08, k09, k0a, k0b }, \
-    { k16, k17, k18, k19, k1a, k1b }, \
-    { k26, k27, k28, k29, k2a, k2b }, \
-    { k36, k37, k38, k39, k3a, k3b }, \
-    { k40, k41, k42, k49, k4a, k4b }, \
-    { k46, k47, k48, k43, k44, k45 } \
-}
-#define LAYOUT_preonic_1x2uL( \
-    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-    k40, k41, k42, k43,   k44,    k46, k47, k48, k49, k4a, k4b \
-) \
-{ \
-    { k00, k01, k02, k03, k04, k05 }, \
-    { k10, k11, k12, k13, k14, k15 }, \
-    { k20, k21, k22, k23, k24, k25 }, \
-    { k30, k31, k32, k33, k34, k35 }, \
-    { k06, k07, k08, k09, k0a, k0b }, \
-    { k16, k17, k18, k19, k1a, k1b }, \
-    { k26, k27, k28, k29, k2a, k2b }, \
-    { k36, k37, k38, k39, k3a, k3b }, \
-    { k40, k41, k42, k49, k4a, k4b }, \
-    { k46, k47, k48, k43, k44, k45 } \
-}
-
-#define LAYOUT_preonic_2x2u( \
-    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-    k40, k41, k42, k43,   k44,      k46,    k48, k49, k4a, k4b \
-) \
-{ \
-    { k00, k01, k02, k03, k04, k05 }, \
-    { k10, k11, k12, k13, k14, k15 }, \
-    { k20, k21, k22, k23, k24, k25 }, \
-    { k30, k31, k32, k33, k34, k35 }, \
-    { k06, k07, k08, k09, k0a, k0b }, \
-    { k16, k17, k18, k19, k1a, k1b }, \
-    { k26, k27, k28, k29, k2a, k2b }, \
-    { k36, k37, k38, k39, k3a, k3b }, \
-    { k40, k41, k42, k49, k4a, k4b }, \
-    { k46, k47, k48, k43, k44, k45 } \
-}
-
-#define LAYOUT_preonic_grid( \
-    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
-    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
-    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
-    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
-    k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
-) \
-{ \
-    { k00, k01, k02, k03, k04, k05 }, \
-    { k10, k11, k12, k13, k14, k15 }, \
-    { k20, k21, k22, k23, k24, k25 }, \
-    { k30, k31, k32, k33, k34, k35 }, \
-    { k06, k07, k08, k09, k0a, k0b }, \
-    { k16, k17, k18, k19, k1a, k1b }, \
-    { k26, k27, k28, k29, k2a, k2b }, \
-    { k36, k37, k38, k39, k3a, k3b }, \
-    { k40, k41, k42, k49, k4a, k4b }, \
-    { k46, k47, k48, k43, k44, k45 } \
-}
-
-#define KEYMAP LAYOUT_preonic_grid
-#define LAYOUT_ortho_4x12 LAYOUT_preonic_grid
-#define KC_LAYOUT_ortho_4x12 KC_KEYMAP
-
-
+/**************************************************
+** Include headers specific to keyboard revision **
+***************************************************/
+#ifdef KEYBOARD_preonic_rev1
+  #include "rev1.h"
 #endif
 
+#ifdef KEYBOARD_preonic_rev2
+  #include "rev2.h"
 #endif
+
+#ifdef KEYBOARD_preonic_rev3
+  #include "rev3.h"
+#endif
+
+
+/**************************************************
+** Layout macros aliases common to all revisions **
+
+        Name of Alias      Matrix Name:
+        -----------------  ------------------- ****/
+#define LAYOUT_ortho_5x12  LAYOUT_preonic_grid
diff --git a/keyboards/preonic/rev1/rev1.h b/keyboards/preonic/rev1/rev1.h
index 6705b72591..6ca4afd3e2 100644
--- a/keyboards/preonic/rev1/rev1.h
+++ b/keyboards/preonic/rev1/rev1.h
@@ -13,4 +13,41 @@
  * 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 "preonic.h"
\ No newline at end of file
+
+#pragma once
+
+#include "preonic.h"
+
+#ifdef __AVR__ // Preonic revs. 1 & 2
+
+  #define LAYOUT_preonic_1x2uC( \
+	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	k40, k41, k42, k43, k44,    k45,   k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
+	{ k40, k41, k42, k43, k44, k45, k45, k47, k48, k49, k4a, k4b } \
+  }
+
+  #define LAYOUT_preonic_grid( \
+	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
+	{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b } \
+  }
+
+#endif
diff --git a/keyboards/preonic/rev2/rev2.h b/keyboards/preonic/rev2/rev2.h
index 5117214598..6ca4afd3e2 100644
--- a/keyboards/preonic/rev2/rev2.h
+++ b/keyboards/preonic/rev2/rev2.h
@@ -14,4 +14,40 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#pragma once
+
 #include "preonic.h"
+
+#ifdef __AVR__ // Preonic revs. 1 & 2
+
+  #define LAYOUT_preonic_1x2uC( \
+	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	k40, k41, k42, k43, k44,    k45,   k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
+	{ k40, k41, k42, k43, k44, k45, k45, k47, k48, k49, k4a, k4b } \
+  }
+
+  #define LAYOUT_preonic_grid( \
+	k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+	{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+	{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+	{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b }, \
+	{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b } \
+  }
+
+#endif
diff --git a/keyboards/preonic/rev3/info.json b/keyboards/preonic/rev3/info.json
new file mode 100644
index 0000000000..50ae8e5fb1
--- /dev/null
+++ b/keyboards/preonic/rev3/info.json
@@ -0,0 +1,330 @@
+{
+  "keyboard_name": "Preonic rev. 3",
+  "keyboard_folder": "preonic/rev3",
+  "url": "https://olkb.com/preonic",
+  "maintainer": "jackhumbert",
+  "width": 12,
+  "height": 5,
+  "layouts": {
+    "LAYOUT_preonic_1x2uC": {
+      "key_count": 59,
+      "layout": [
+        {"label":"k00", "x":0, "y":0},
+        {"label":"k01", "x":1, "y":0},
+        {"label":"k02", "x":2, "y":0},
+        {"label":"k03", "x":3, "y":0},
+        {"label":"k04", "x":4, "y":0},
+        {"label":"k05", "x":5, "y":0},
+        {"label":"k06", "x":6, "y":0},
+        {"label":"k07", "x":7, "y":0},
+        {"label":"k08", "x":8, "y":0},
+        {"label":"k09", "x":9, "y":0},
+        {"label":"k0a", "x":10, "y":0},
+        {"label":"k0b", "x":11, "y":0},
+        {"label":"k10", "x":0, "y":1},
+        {"label":"k11", "x":1, "y":1},
+        {"label":"k12", "x":2, "y":1},
+        {"label":"k13", "x":3, "y":1},
+        {"label":"k14", "x":4, "y":1},
+        {"label":"k15", "x":5, "y":1},
+        {"label":"k16", "x":6, "y":1},
+        {"label":"k17", "x":7, "y":1},
+        {"label":"k18", "x":8, "y":1},
+        {"label":"k19", "x":9, "y":1},
+        {"label":"k1a", "x":10, "y":1},
+        {"label":"k1b", "x":11, "y":1},
+        {"label":"k20", "x":0, "y":2},
+        {"label":"k21", "x":1, "y":2},
+        {"label":"k22", "x":2, "y":2},
+        {"label":"k23", "x":3, "y":2},
+        {"label":"k24", "x":4, "y":2},
+        {"label":"k25", "x":5, "y":2},
+        {"label":"k26", "x":6, "y":2},
+        {"label":"k27", "x":7, "y":2},
+        {"label":"k28", "x":8, "y":2},
+        {"label":"k29", "x":9, "y":2},
+        {"label":"k2a", "x":10, "y":2},
+        {"label":"k2b", "x":11, "y":2},
+        {"label":"k30", "x":0, "y":3},
+        {"label":"k31", "x":1, "y":3},
+        {"label":"k32", "x":2, "y":3},
+        {"label":"k33", "x":3, "y":3},
+        {"label":"k34", "x":4, "y":3},
+        {"label":"k35", "x":5, "y":3},
+        {"label":"k36", "x":6, "y":3},
+        {"label":"k37", "x":7, "y":3},
+        {"label":"k38", "x":8, "y":3},
+        {"label":"k39", "x":9, "y":3},
+        {"label":"k3a", "x":10, "y":3},
+        {"label":"k3b", "x":11, "y":3},
+        {"label":"k40", "x":0, "y":4},
+        {"label":"k41", "x":1, "y":4},
+        {"label":"k42", "x":2, "y":4},
+        {"label":"k43", "x":3, "y":4},
+        {"label":"k44", "x":4, "y":4},
+        {"label":"k45", "x":5, "y":4, "w":2},
+        {"label":"k47", "x":7, "y":4},
+        {"label":"k48", "x":8, "y":4},
+        {"label":"k49", "x":9, "y":4},
+        {"label":"k4a", "x":10, "y":4},
+        {"label":"k4b", "x":11, "y":4}
+      ]
+    },
+    "LAYOUT_preonic_1x2uR": {
+      "key_count": 59,
+      "layout": [
+        {"label":"k00", "x":0, "y":0},
+        {"label":"k01", "x":1, "y":0},
+        {"label":"k02", "x":2, "y":0},
+        {"label":"k03", "x":3, "y":0},
+        {"label":"k04", "x":4, "y":0},
+        {"label":"k05", "x":5, "y":0},
+        {"label":"k06", "x":6, "y":0},
+        {"label":"k07", "x":7, "y":0},
+        {"label":"k08", "x":8, "y":0},
+        {"label":"k09", "x":9, "y":0},
+        {"label":"k0a", "x":10, "y":0},
+        {"label":"k0b", "x":11, "y":0},
+        {"label":"k10", "x":0, "y":1},
+        {"label":"k11", "x":1, "y":1},
+        {"label":"k12", "x":2, "y":1},
+        {"label":"k13", "x":3, "y":1},
+        {"label":"k14", "x":4, "y":1},
+        {"label":"k15", "x":5, "y":1},
+        {"label":"k16", "x":6, "y":1},
+        {"label":"k17", "x":7, "y":1},
+        {"label":"k18", "x":8, "y":1},
+        {"label":"k19", "x":9, "y":1},
+        {"label":"k1a", "x":10, "y":1},
+        {"label":"k1b", "x":11, "y":1},
+        {"label":"k20", "x":0, "y":2},
+        {"label":"k21", "x":1, "y":2},
+        {"label":"k22", "x":2, "y":2},
+        {"label":"k23", "x":3, "y":2},
+        {"label":"k24", "x":4, "y":2},
+        {"label":"k25", "x":5, "y":2},
+        {"label":"k26", "x":6, "y":2},
+        {"label":"k27", "x":7, "y":2},
+        {"label":"k28", "x":8, "y":2},
+        {"label":"k29", "x":9, "y":2},
+        {"label":"k2a", "x":10, "y":2},
+        {"label":"k2b", "x":11, "y":2},
+        {"label":"k30", "x":0, "y":3},
+        {"label":"k31", "x":1, "y":3},
+        {"label":"k32", "x":2, "y":3},
+        {"label":"k33", "x":3, "y":3},
+        {"label":"k34", "x":4, "y":3},
+        {"label":"k35", "x":5, "y":3},
+        {"label":"k36", "x":6, "y":3},
+        {"label":"k37", "x":7, "y":3},
+        {"label":"k38", "x":8, "y":3},
+        {"label":"k39", "x":9, "y":3},
+        {"label":"k3a", "x":10, "y":3},
+        {"label":"k3b", "x":11, "y":3},
+        {"label":"k40", "x":0, "y":4},
+        {"label":"k41", "x":1, "y":4},
+        {"label":"k42", "x":2, "y":4},
+        {"label":"k43", "x":3, "y":4},
+        {"label":"k44", "x":4, "y":4},
+        {"label":"k45", "x":5, "y":4},
+        {"label":"k47", "x":6, "y":4, "w":2},
+        {"label":"k48", "x":8, "y":4},
+        {"label":"k49", "x":9, "y":4},
+        {"label":"k4a", "x":10, "y":4},
+        {"label":"k4b", "x":11, "y":4}
+      ]
+    },
+    "LAYOUT_preonic_1x2uL": {
+      "key_count": 59,
+      "layout": [
+        {"label":"k00", "x":0, "y":0},
+        {"label":"k01", "x":1, "y":0},
+        {"label":"k02", "x":2, "y":0},
+        {"label":"k03", "x":3, "y":0},
+        {"label":"k04", "x":4, "y":0},
+        {"label":"k05", "x":5, "y":0},
+        {"label":"k06", "x":6, "y":0},
+        {"label":"k07", "x":7, "y":0},
+        {"label":"k08", "x":8, "y":0},
+        {"label":"k09", "x":9, "y":0},
+        {"label":"k0a", "x":10, "y":0},
+        {"label":"k0b", "x":11, "y":0},
+        {"label":"k10", "x":0, "y":1},
+        {"label":"k11", "x":1, "y":1},
+        {"label":"k12", "x":2, "y":1},
+        {"label":"k13", "x":3, "y":1},
+        {"label":"k14", "x":4, "y":1},
+        {"label":"k15", "x":5, "y":1},
+        {"label":"k16", "x":6, "y":1},
+        {"label":"k17", "x":7, "y":1},
+        {"label":"k18", "x":8, "y":1},
+        {"label":"k19", "x":9, "y":1},
+        {"label":"k1a", "x":10, "y":1},
+        {"label":"k1b", "x":11, "y":1},
+        {"label":"k20", "x":0, "y":2},
+        {"label":"k21", "x":1, "y":2},
+        {"label":"k22", "x":2, "y":2},
+        {"label":"k23", "x":3, "y":2},
+        {"label":"k24", "x":4, "y":2},
+        {"label":"k25", "x":5, "y":2},
+        {"label":"k26", "x":6, "y":2},
+        {"label":"k27", "x":7, "y":2},
+        {"label":"k28", "x":8, "y":2},
+        {"label":"k29", "x":9, "y":2},
+        {"label":"k2a", "x":10, "y":2},
+        {"label":"k2b", "x":11, "y":2},
+        {"label":"k30", "x":0, "y":3},
+        {"label":"k31", "x":1, "y":3},
+        {"label":"k32", "x":2, "y":3},
+        {"label":"k33", "x":3, "y":3},
+        {"label":"k34", "x":4, "y":3},
+        {"label":"k35", "x":5, "y":3},
+        {"label":"k36", "x":6, "y":3},
+        {"label":"k37", "x":7, "y":3},
+        {"label":"k38", "x":8, "y":3},
+        {"label":"k39", "x":9, "y":3},
+        {"label":"k3a", "x":10, "y":3},
+        {"label":"k3b", "x":11, "y":3},
+        {"label":"k40", "x":0, "y":4},
+        {"label":"k41", "x":1, "y":4},
+        {"label":"k42", "x":2, "y":4},
+        {"label":"k43", "x":3, "y":4},
+        {"label":"k44", "x":4, "y":4, "w":2},
+        {"label":"k46", "x":6, "y":4},
+        {"label":"k47", "x":7, "y":4},
+        {"label":"k48", "x":8, "y":4},
+        {"label":"k49", "x":9, "y":4},
+        {"label":"k4a", "x":10, "y":4},
+        {"label":"k4b", "x":11, "y":4}
+      ]
+    },
+    "LAYOUT_preonic_2x2u": {
+      "key_count": 58,
+      "layout": [
+        {"label":"k00", "x":0, "y":0},
+        {"label":"k01", "x":1, "y":0},
+        {"label":"k02", "x":2, "y":0},
+        {"label":"k03", "x":3, "y":0},
+        {"label":"k04", "x":4, "y":0},
+        {"label":"k05", "x":5, "y":0},
+        {"label":"k06", "x":6, "y":0},
+        {"label":"k07", "x":7, "y":0},
+        {"label":"k08", "x":8, "y":0},
+        {"label":"k09", "x":9, "y":0},
+        {"label":"k0a", "x":10, "y":0},
+        {"label":"k0b", "x":11, "y":0},
+        {"label":"k10", "x":0, "y":1},
+        {"label":"k11", "x":1, "y":1},
+        {"label":"k12", "x":2, "y":1},
+        {"label":"k13", "x":3, "y":1},
+        {"label":"k14", "x":4, "y":1},
+        {"label":"k15", "x":5, "y":1},
+        {"label":"k16", "x":6, "y":1},
+        {"label":"k17", "x":7, "y":1},
+        {"label":"k18", "x":8, "y":1},
+        {"label":"k19", "x":9, "y":1},
+        {"label":"k1a", "x":10, "y":1},
+        {"label":"k1b", "x":11, "y":1},
+        {"label":"k20", "x":0, "y":2},
+        {"label":"k21", "x":1, "y":2},
+        {"label":"k22", "x":2, "y":2},
+        {"label":"k23", "x":3, "y":2},
+        {"label":"k24", "x":4, "y":2},
+        {"label":"k25", "x":5, "y":2},
+        {"label":"k26", "x":6, "y":2},
+        {"label":"k27", "x":7, "y":2},
+        {"label":"k28", "x":8, "y":2},
+        {"label":"k29", "x":9, "y":2},
+        {"label":"k2a", "x":10, "y":2},
+        {"label":"k2b", "x":11, "y":2},
+        {"label":"k30", "x":0, "y":3},
+        {"label":"k31", "x":1, "y":3},
+        {"label":"k32", "x":2, "y":3},
+        {"label":"k33", "x":3, "y":3},
+        {"label":"k34", "x":4, "y":3},
+        {"label":"k35", "x":5, "y":3},
+        {"label":"k36", "x":6, "y":3},
+        {"label":"k37", "x":7, "y":3},
+        {"label":"k38", "x":8, "y":3},
+        {"label":"k39", "x":9, "y":3},
+        {"label":"k3a", "x":10, "y":3},
+        {"label":"k3b", "x":11, "y":3},
+        {"label":"k40", "x":0, "y":4},
+        {"label":"k41", "x":1, "y":4},
+        {"label":"k42", "x":2, "y":4},
+        {"label":"k43", "x":3, "y":4},
+        {"label":"k44", "x":4, "y":4, "w":2},
+        {"label":"k46", "x":6, "y":4, "w":2},
+        {"label":"k48", "x":8, "y":4},
+        {"label":"k49", "x":9, "y":4},
+        {"label":"k4a", "x":10, "y":4},
+        {"label":"k4b", "x":11, "y":4}
+      ]
+    },
+    "LAYOUT_ortho_5x12": {
+      "layout": [
+      "key_count": 60,
+        {"label":"k00", "x":0, "y":0},
+        {"label":"k01", "x":1, "y":0},
+        {"label":"k02", "x":2, "y":0},
+        {"label":"k03", "x":3, "y":0},
+        {"label":"k04", "x":4, "y":0},
+        {"label":"k05", "x":5, "y":0},
+        {"label":"k06", "x":6, "y":0},
+        {"label":"k07", "x":7, "y":0},
+        {"label":"k08", "x":8, "y":0},
+        {"label":"k09", "x":9, "y":0},
+        {"label":"k0a", "x":10, "y":0},
+        {"label":"k0b", "x":11, "y":0},
+        {"label":"k10", "x":0, "y":1},
+        {"label":"k11", "x":1, "y":1},
+        {"label":"k12", "x":2, "y":1},
+        {"label":"k13", "x":3, "y":1},
+        {"label":"k14", "x":4, "y":1},
+        {"label":"k15", "x":5, "y":1},
+        {"label":"k16", "x":6, "y":1},
+        {"label":"k17", "x":7, "y":1},
+        {"label":"k18", "x":8, "y":1},
+        {"label":"k19", "x":9, "y":1},
+        {"label":"k1a", "x":10, "y":1},
+        {"label":"k1b", "x":11, "y":1},
+        {"label":"k20", "x":0, "y":2},
+        {"label":"k21", "x":1, "y":2},
+        {"label":"k22", "x":2, "y":2},
+        {"label":"k23", "x":3, "y":2},
+        {"label":"k24", "x":4, "y":2},
+        {"label":"k25", "x":5, "y":2},
+        {"label":"k26", "x":6, "y":2},
+        {"label":"k27", "x":7, "y":2},
+        {"label":"k28", "x":8, "y":2},
+        {"label":"k29", "x":9, "y":2},
+        {"label":"k2a", "x":10, "y":2},
+        {"label":"k2b", "x":11, "y":2},
+        {"label":"k30", "x":0, "y":3},
+        {"label":"k31", "x":1, "y":3},
+        {"label":"k32", "x":2, "y":3},
+        {"label":"k33", "x":3, "y":3},
+        {"label":"k34", "x":4, "y":3},
+        {"label":"k35", "x":5, "y":3},
+        {"label":"k36", "x":6, "y":3},
+        {"label":"k37", "x":7, "y":3},
+        {"label":"k38", "x":8, "y":3},
+        {"label":"k39", "x":9, "y":3},
+        {"label":"k3a", "x":10, "y":3},
+        {"label":"k3b", "x":11, "y":3},
+        {"label":"k40", "x":0, "y":4},
+        {"label":"k41", "x":1, "y":4},
+        {"label":"k42", "x":2, "y":4},
+        {"label":"k43", "x":3, "y":4},
+        {"label":"k44", "x":4, "y":4},
+        {"label":"k45", "x":5, "y":4},
+        {"label":"k46", "x":6, "y":4},
+        {"label":"k47", "x":7, "y":4},
+        {"label":"k48", "x":8, "y":4},
+        {"label":"k49", "x":9, "y":4},
+        {"label":"k4a", "x":10, "y":4},
+        {"label":"k4b", "x":11, "y":4}
+      ]
+    }
+  }
+}
diff --git a/keyboards/preonic/rev3/rev3.h b/keyboards/preonic/rev3/rev3.h
index 7c274ae270..af97239fd1 100644
--- a/keyboards/preonic/rev3/rev3.h
+++ b/keyboards/preonic/rev3/rev3.h
@@ -13,9 +13,111 @@
  * 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 REV3_H
-#define REV3_H
+
+#pragma once
 
 #include "preonic.h"
 
+#ifndef __AVR__ // Preonic rev. 3 and later
+
+	#define LAYOUT_preonic_1x2uC( \
+	  k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	  k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	  k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	  k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	  k40, k41, k42, k43, k44,    k45,   k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	  { k00, k01, k02, k03, k04, k05 }, \
+	  { k10, k11, k12, k13, k14, k15 }, \
+	  { k20, k21, k22, k23, k24, k25 }, \
+	  { k30, k31, k32, k33, k34, k35 }, \
+	  { k06, k07, k08, k09, k0a, k0b }, \
+	  { k16, k17, k18, k19, k1a, k1b }, \
+	  { k26, k27, k28, k29, k2a, k2b }, \
+	  { k36, k37, k38, k39, k3a, k3b }, \
+	  { k40, k41, k42, k49, k4a, k4b }, \
+	  { k45, k47, k48, k43, k44, k45 } \
+  }
+
+  #define LAYOUT_preonic_1x2uR( \
+	  k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	  k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	  k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	  k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	  k40, k41, k42, k43, k44, k45,   k47,    k48, k49, k4a, k4b \
+  ) \
+  { \
+	  { k00, k01, k02, k03, k04, k05 }, \
+	  { k10, k11, k12, k13, k14, k15 }, \
+	  { k20, k21, k22, k23, k24, k25 }, \
+	  { k30, k31, k32, k33, k34, k35 }, \
+	  { k06, k07, k08, k09, k0a, k0b }, \
+	  { k16, k17, k18, k19, k1a, k1b }, \
+	  { k26, k27, k28, k29, k2a, k2b }, \
+	  { k36, k37, k38, k39, k3a, k3b }, \
+	  { k40, k41, k42, k49, k4a, k4b }, \
+	  { k47, k47, k48, k43, k44, k45 } \
+  }
+
+  #define LAYOUT_preonic_1x2uL( \
+	  k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	  k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	  k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	  k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	  k40, k41, k42, k43,   k44,    k46, k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	  { k00, k01, k02, k03, k04, k05 }, \
+	  { k10, k11, k12, k13, k14, k15 }, \
+	  { k20, k21, k22, k23, k24, k25 }, \
+	  { k30, k31, k32, k33, k34, k35 }, \
+	  { k06, k07, k08, k09, k0a, k0b }, \
+	  { k16, k17, k18, k19, k1a, k1b }, \
+	  { k26, k27, k28, k29, k2a, k2b }, \
+	  { k36, k37, k38, k39, k3a, k3b }, \
+	  { k40, k41, k42, k49, k4a, k4b }, \
+	  { k46, k47, k48, k43, k44, k44 } \
+  }
+
+  #define LAYOUT_preonic_2x2u( \
+	  k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	  k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	  k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	  k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	  k40, k41, k42, k43,   k44,      k46,    k48, k49, k4a, k4b \
+  ) \
+  { \
+	  { k00, k01, k02, k03, k04, k05 }, \
+	  { k10, k11, k12, k13, k14, k15 }, \
+	  { k20, k21, k22, k23, k24, k25 }, \
+	  { k30, k31, k32, k33, k34, k35 }, \
+	  { k06, k07, k08, k09, k0a, k0b }, \
+	  { k16, k17, k18, k19, k1a, k1b }, \
+	  { k26, k27, k28, k29, k2a, k2b }, \
+	  { k36, k37, k38, k39, k3a, k3b }, \
+	  { k40, k41, k42, k49, k4a, k4b }, \
+	  { k46, k46, k48, k43, k44, k44 } \
+  }
+
+  #define LAYOUT_preonic_grid( \
+	  k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+	  k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+	  k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+	  k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
+	  k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
+  ) \
+  { \
+	  { k00, k01, k02, k03, k04, k05 }, \
+	  { k10, k11, k12, k13, k14, k15 }, \
+	  { k20, k21, k22, k23, k24, k25 }, \
+	  { k30, k31, k32, k33, k34, k35 }, \
+	  { k06, k07, k08, k09, k0a, k0b }, \
+	  { k16, k17, k18, k19, k1a, k1b }, \
+	  { k26, k27, k28, k29, k2a, k2b }, \
+	  { k36, k37, k38, k39, k3a, k3b }, \
+	  { k40, k41, k42, k49, k4a, k4b }, \
+	  { k46, k47, k48, k43, k44, k45 } \
+  }
+
 #endif