From 8c80475fcc568e04f637ae973086b65a31b5254d Mon Sep 17 00:00:00 2001
From: Danny <nooges@users.noreply.github.com>
Date: Tue, 31 Mar 2020 18:21:05 -0400
Subject: [PATCH] Update Quefrency (#8623)

* Add Quefrency Rev. 2 VIA support

* Fix matrix mapping

* Add Rev. 1 VIA support

* Flip encoder pinout

* Drop trailing backslashes

* Remove layer names

* Remove unneeded extern

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Fix bracket alignment

Co-Authored-By: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
---
 .../keebio/quefrency/keymaps/via/keymap.c     | 51 +++++++++++++++++++
 .../keebio/quefrency/keymaps/via/rules.mk     |  3 ++
 keyboards/keebio/quefrency/rev1/config.h      |  2 +-
 keyboards/keebio/quefrency/rev1/rev1.h        | 23 ++++++++-
 keyboards/keebio/quefrency/rev2/config.h      | 12 ++---
 keyboards/keebio/quefrency/rev2/rev2.h        | 36 ++++++-------
 6 files changed, 101 insertions(+), 26 deletions(-)
 create mode 100644 keyboards/keebio/quefrency/keymaps/via/keymap.c
 create mode 100644 keyboards/keebio/quefrency/keymaps/via/rules.mk

diff --git a/keyboards/keebio/quefrency/keymaps/via/keymap.c b/keyboards/keebio/quefrency/keymaps/via/keymap.c
new file mode 100644
index 0000000000..f70a5bab9a
--- /dev/null
+++ b/keyboards/keebio/quefrency/keymaps/via/keymap.c
@@ -0,0 +1,51 @@
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [0] = LAYOUT_all(
+    KC_F1,   KC_F2,   KC_GESC, 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_DEL,  KC_BSPC, KC_HOME,
+    KC_F3,   KC_F4,   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_END,
+    KC_F5,   KC_F6,   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_NUHS, KC_ENT,  KC_PGUP,
+    KC_F7,   KC_F8,   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_F9,   KC_F10,  KC_LCTL, KC_LALT, KC_LGUI, MO(1),   KC_SPC,  KC_SPC,  MO(1),   KC_SPC,  KC_RALT, KC_RCTL, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT
+  ),
+
+  [1] = LAYOUT_all(
+    _______, _______, KC_GESC, 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_BSPC, _______,
+    _______, _______, RGB_TOG, RGB_MOD, _______, KC_UP,   _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  ),
+
+  [2] = LAYOUT_all(
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  ),
+
+  [3] = LAYOUT_all(
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  )
+};
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+    if (index == 0) {
+        if (clockwise) {
+            tap_code(KC_PGDN);
+        } else {
+            tap_code(KC_PGUP);
+        }
+    } else if (index == 1) {
+        if (clockwise) {
+            tap_code(KC_VOLU);
+        } else {
+            tap_code(KC_VOLD);
+        }
+    }
+}
diff --git a/keyboards/keebio/quefrency/keymaps/via/rules.mk b/keyboards/keebio/quefrency/keymaps/via/rules.mk
new file mode 100644
index 0000000000..540fc2ac3f
--- /dev/null
+++ b/keyboards/keebio/quefrency/keymaps/via/rules.mk
@@ -0,0 +1,3 @@
+VIA_ENABLE = yes
+CONSOLE_ENABLE = yes
+LINK_TIME_OPTIMIZATION_ENABLE = yes
diff --git a/keyboards/keebio/quefrency/rev1/config.h b/keyboards/keebio/quefrency/rev1/config.h
index 1e3be6347a..15771f5311 100644
--- a/keyboards/keebio/quefrency/rev1/config.h
+++ b/keyboards/keebio/quefrency/rev1/config.h
@@ -23,7 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define PRODUCT_ID      0x1257
 #define DEVICE_VER      0x0100
 #define MANUFACTURER    Keebio
-#define PRODUCT         Quefrency
+#define PRODUCT         Quefrency Rev. 1
 #define DESCRIPTION     Split 60/65 percent staggered keyboard
 
 /* key matrix size */
diff --git a/keyboards/keebio/quefrency/rev1/rev1.h b/keyboards/keebio/quefrency/rev1/rev1.h
index 137aa41c2f..da62f904cc 100644
--- a/keyboards/keebio/quefrency/rev1/rev1.h
+++ b/keyboards/keebio/quefrency/rev1/rev1.h
@@ -79,7 +79,6 @@
     { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
   }
 
-
 #define LAYOUT_65_with_macro( \
   LA9, LA8, LA1, LA2, LA3, LA4, LA5, LA6, LA7, RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8, RA9, \
   LB9, LB8, LB1, LB2, LB3, LB4, LB5, LB6,      RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
@@ -101,3 +100,25 @@
     { RE1, RE2, RE9, RE4, RE5, RE6, RE7, RE8 }, \
     { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RA9, RB9 } \
   }
+
+#define LAYOUT_all( \
+  LA9, LA8, LA1, LA2, LA3, LA4, LA5, LA6, LA7, RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8, RA9, \
+  LB9, LB8, LB1, LB2, LB3, LB4, LB5, LB6,      RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
+  LC9, LC8, LC1, LC2, LC3, LC4, LC5, LC6,      RC1, RC2, RC3, RC4, RC5, RC6, RC7x,RC8, RC9, \
+  LD9, LD8, LD1, LD2x,LD3, LD4, LD5, LD6, LD7, RD1, RD2, RD3, RD4,      RD6, RD7, RD8, RD9, \
+  LE9, LE8, LE1, LE2, LE3,      LE5, LE6x,LE7, RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  ) \
+  { \
+    { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8 }, \
+    { LB1, LB2, LB3, LB4, LB5, LB6, LB9, LB8 }, \
+    { LC1, LC2, LC3, LC4, LC5, LC6, LC9, LC8 }, \
+    { LD1, LD9, LD3, LD4, LD5, LD6, LD7, LD8 }, \
+    { LE1, LE2, LE3, LA9, LE5, LE9, LE7, LE8 }, \
+    { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+    { RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8 }, \
+    { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8 }, \
+    { RC1, RC2, RC3, RC4, RC5, RC6, RC9, RC8 }, \
+    { RD1, RD2, RD3, RD4, RD9, RD6, RD7, RD8 }, \
+    { RE1, RE2, RE9, RE4, RE5, RE6, RE7, RE8 }, \
+    { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RA9, RB9 } \
+  }
diff --git a/keyboards/keebio/quefrency/rev2/config.h b/keyboards/keebio/quefrency/rev2/config.h
index 4463eb7396..d18b7be1ff 100644
--- a/keyboards/keebio/quefrency/rev2/config.h
+++ b/keyboards/keebio/quefrency/rev2/config.h
@@ -20,10 +20,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 /* USB Device descriptor parameter */
 #define VENDOR_ID       0xCB10
-#define PRODUCT_ID      0x1257
+#define PRODUCT_ID      0x2257
 #define DEVICE_VER      0x0200
 #define MANUFACTURER    Keebio
-#define PRODUCT         Quefrency
+#define PRODUCT         Quefrency Rev. 2
 #define DESCRIPTION     Split 60/65 percent staggered keyboard
 
 /* key matrix size */
@@ -38,10 +38,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define MATRIX_ROW_PINS_RIGHT { B3, B2, B6, B4, D7 }
 #define MATRIX_COL_PINS_RIGHT { F1, F0, F4, F5, F6, D5, C7, D3, B7 }
 #define SPLIT_HAND_PIN F7
-#define ENCODERS_PAD_A { F6 }
-#define ENCODERS_PAD_B { F5 }
-#define ENCODERS_PAD_A_RIGHT { D4 }
-#define ENCODERS_PAD_B_RIGHT { D6 }
+#define ENCODERS_PAD_A { F5 }
+#define ENCODERS_PAD_B { F6 }
+#define ENCODERS_PAD_A_RIGHT { D6 }
+#define ENCODERS_PAD_B_RIGHT { D4 }
 
 /* Set 0 if debouncing isn't needed */
 #define DEBOUNCE 5
diff --git a/keyboards/keebio/quefrency/rev2/rev2.h b/keyboards/keebio/quefrency/rev2/rev2.h
index 6d3db55842..b9c2ef6b44 100644
--- a/keyboards/keebio/quefrency/rev2/rev2.h
+++ b/keyboards/keebio/quefrency/rev2/rev2.h
@@ -16,7 +16,7 @@
   LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, \
   LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6,      RC8, \
   LD3,      LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, \
-  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8 \
+  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8 \
   ) \
   { \
     { KC_NO, KC_NO, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -28,7 +28,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, KC_NO }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, KC_NO, RC8, KC_NO }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, KC_NO }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, KC_NO } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, KC_NO } \
   }
 
 #define LAYOUT LAYOUT_60    // For backwards compatibility with Rev. 1
@@ -38,7 +38,7 @@
   LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
   LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6,      RC8, RC9, \
   LD3,      LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, RD9, \
-  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8, RE9 \
   ) \
   { \
     { KC_NO, KC_NO, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -50,7 +50,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9 }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, KC_NO, RC8, RC9 }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, RD9 }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, RE9 } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, RE9 } \
   }
 
 #define LAYOUT_60_with_macro( \
@@ -58,7 +58,7 @@
   LB1, LB2, LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, \
   LC1, LC2, LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6,      RC8, \
   LD1, LD2, LD3,      LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, \
-  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8 \
+  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8 \
   ) \
   { \
     { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -70,7 +70,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, KC_NO }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, KC_NO, RC8, KC_NO }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, KC_NO }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, KC_NO } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, KC_NO } \
   }
 
 #define LAYOUT_65_with_macro( \
@@ -78,7 +78,7 @@
   LB1, LB2, LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
   LC1, LC2, LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6,      RC8, RC9, \
   LD1, LD2, LD3,      LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, RD9, \
-  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8, RE9 \
   ) \
   { \
     { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -90,7 +90,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9 }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, KC_NO, RC8, RC9 }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, RD9 }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, RE9 } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, RE9 } \
   }
 
 #define LAYOUT_60_iso( \
@@ -98,7 +98,7 @@
   LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7,      \
   LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, \
   LD3, LD4, LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, \
-  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8 \
+  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8 \
   ) \
   { \
     { KC_NO, KC_NO, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -110,7 +110,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, KC_NO, KC_NO }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, KC_NO }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, KC_NO }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, KC_NO } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, KC_NO } \
   }
 
 #define LAYOUT_65_iso( \
@@ -118,7 +118,7 @@
   LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7,      RB9, \
   LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9, \
   LD3, LD4, LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, RD9, \
-  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8, RE9 \
   ) \
   { \
     { KC_NO, KC_NO, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -130,7 +130,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, KC_NO, RB9 }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9 }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, RD9 }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, RE9 } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, RE9 } \
   }
 
 #define LAYOUT_60_iso_with_macro( \
@@ -138,7 +138,7 @@
   LB1, LB2, LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7,      \
   LC1, LC2, LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, \
   LD1, LD2, LD3, LD4, LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, \
-  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8 \
+  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8 \
   ) \
   { \
     { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -150,7 +150,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, KC_NO, KC_NO }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, KC_NO }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, KC_NO }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, KC_NO } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, KC_NO } \
   }
 
 #define LAYOUT_65_iso_with_macro( \
@@ -158,7 +158,7 @@
   LB1, LB2, LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7,      RB9, \
   LC1, LC2, LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9, \
   LD1, LD2, LD3, LD4, LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, RD9, \
-  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  LE1, LE2, LE3, LE4, LE5, LE6,      LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8, RE9 \
   ) \
   { \
     { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -170,7 +170,7 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, KC_NO, RB9 }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9 }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, RD9 }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, RE9 } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, RE9 } \
   }
 
 #define LAYOUT_all( \
@@ -178,7 +178,7 @@
   LB1, LB2, LB3, LB4, LB5, LB6, LB7, LB8,           RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
   LC1, LC2, LC3, LC4, LC5, LC6, LC7, LC8,           RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9, \
   LD1, LD2, LD3, LD4, LD5, LD6, LD7, LD8, LD9,      RD1, RD2, RD3, RD4, RD5,      RD7, RD8, RD9, \
-  LE1, LE2, LE3, LE4, LE5, LE6, LE7, LE8,           RE1, RE2,      RE4, RE5, RE6, RE7, RE8, RE9 \
+  LE1, LE2, LE3, LE4, LE5, LE6, LE7, LE8,           RE1, RE2, RE3, RE4, RE5,      RE7, RE8, RE9 \
   ) \
   { \
     { LA1, LA2, LA3, LA4, LA5, LA6, LA7, LA8, LA9 }, \
@@ -190,5 +190,5 @@
     { RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9 }, \
     { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9 }, \
     { RD1, RD2, RD3, RD4, RD5, KC_NO, RD7, RD8, RD9 }, \
-    { RE1, RE2, KC_NO, RE4, RE5, RE6, RE7, RE8, RE9 } \
+    { RE1, RE2, RE3, RE4, RE5, KC_NO, RE7, RE8, RE9 } \
   }