From ef5c6ea096033423c9b9e141c1fc94dcc41d84fa Mon Sep 17 00:00:00 2001
From: Drashna Jaelre <drashna@live.com>
Date: Sat, 18 Sep 2021 20:10:32 -0700
Subject: [Keyboard] Use old custom matrix for Drop Planck+Preonic (#14488)

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Jack Humbert <jack.humb@gmail.com>
---
 keyboards/planck/planck.h              |  43 ++++--
 keyboards/planck/rev6_drop/chconf.h    |  29 ++++
 keyboards/planck/rev6_drop/config.h    | 128 ++++++++++++++++
 keyboards/planck/rev6_drop/halconf.h   |  22 +++
 keyboards/planck/rev6_drop/info.json   | 262 +++++++++++++++++++++++++++++++++
 keyboards/planck/rev6_drop/matrix.c    | 166 +++++++++++++++++++++
 keyboards/planck/rev6_drop/mcuconf.h   |  39 +++++
 keyboards/planck/rev6_drop/readme.md   |  13 ++
 keyboards/planck/rev6_drop/rev6_drop.c |  44 ++++++
 keyboards/planck/rev6_drop/rev6_drop.h | 108 ++++++++++++++
 keyboards/planck/rev6_drop/rules.mk    |  33 +++++
 11 files changed, 873 insertions(+), 14 deletions(-)
 create mode 100644 keyboards/planck/rev6_drop/chconf.h
 create mode 100644 keyboards/planck/rev6_drop/config.h
 create mode 100644 keyboards/planck/rev6_drop/halconf.h
 create mode 100644 keyboards/planck/rev6_drop/info.json
 create mode 100644 keyboards/planck/rev6_drop/matrix.c
 create mode 100644 keyboards/planck/rev6_drop/mcuconf.h
 create mode 100644 keyboards/planck/rev6_drop/readme.md
 create mode 100644 keyboards/planck/rev6_drop/rev6_drop.c
 create mode 100644 keyboards/planck/rev6_drop/rev6_drop.h
 create mode 100644 keyboards/planck/rev6_drop/rules.mk

(limited to 'keyboards/planck')

diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h
index 31e3ec9158..4b04dfec51 100644
--- a/keyboards/planck/planck.h
+++ b/keyboards/planck/planck.h
@@ -1,26 +1,41 @@
-#ifndef PLANCK_H
-#define PLANCK_H
+/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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
 
 #include "quantum.h"
 
 #if defined(KEYBOARD_planck_ez)
-  #include "ez.h"
+#    include "ez.h"
 #elif defined(KEYBOARD_planck_light)
-  #include "light.h"
+#    include "light.h"
 #elif defined(KEYBOARD_planck_thk)
-  #include "thk.h"
+#    include "thk.h"
 #elif defined(KEYBOARD_planck_rev1)
-  #include "rev1.h"
+#    include "rev1.h"
 #elif defined(KEYBOARD_planck_rev2)
-  #include "rev2.h"
+#    include "rev2.h"
 #elif defined(KEYBOARD_planck_rev3)
-  #include "rev3.h"
+#    include "rev3.h"
 #elif defined(KEYBOARD_planck_rev4)
-  #include "rev4.h"
+#    include "rev4.h"
 #elif defined(KEYBOARD_planck_rev5)
-  #include "rev5.h"
+#    include "rev5.h"
 #elif defined(KEYBOARD_planck_rev6)
-  #include "rev6.h"
-#endif // Planck revisions
-
-#endif
+#    include "rev6.h"
+#elif defined(KEYBOARD_planck_rev6_drop)
+#    include "rev6_drop.h"
+#endif  // Planck revisions
diff --git a/keyboards/planck/rev6_drop/chconf.h b/keyboards/planck/rev6_drop/chconf.h
new file mode 100644
index 0000000000..e1243f23ec
--- /dev/null
+++ b/keyboards/planck/rev6_drop/chconf.h
@@ -0,0 +1,29 @@
+/* Copyright 2020 QMK
+ *
+ * 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/>.
+ */
+
+/*
+ * This file was auto-generated by:
+ *    `qmk chibios-confmigrate -i keyboards/planck/rev6/chconf.h -r platforms/chibios/QMK_PROTON_C/configs/chconf.h`
+ */
+
+#pragma once
+
+#define CH_CFG_ST_RESOLUTION 16
+
+#define CH_CFG_ST_FREQUENCY 10000
+
+#include_next <chconf.h>
+
diff --git a/keyboards/planck/rev6_drop/config.h b/keyboards/planck/rev6_drop/config.h
new file mode 100644
index 0000000000..c1baa34b72
--- /dev/null
+++ b/keyboards/planck/rev6_drop/config.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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
+
+/* USB Device descriptor parameter */
+#define PRODUCT_ID 0xA4F9
+#define DEVICE_VER 0x0006
+#undef MANUFACTURER
+#define MANUFACTURER Drop
+
+#undef MATRIX_ROWS
+#undef MATRIX_COLS
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 6
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+ */
+/* Note: These are not used for arm boards. They're here purely as documentation. */
+#undef MATRIX_ROW_PINS
+#undef MATRIX_COL_PINS
+
+#define MATRIX_ROW_PINS \
+    { A10, A9, A8, B15, C13, C14, C15, A2 }
+#define MATRIX_COL_PINS \
+    { B11, B10, B2, B1, A7, B0 }
+
+#define UNUSED_PINS
+
+#define ENCODERS_PAD_A \
+    { B12 }
+#define ENCODERS_PAD_B \
+    { B13 }
+
+#define DIP_SWITCH_PINS \
+    { B14, A15, A0, B9 }
+
+#define MUSIC_MAP
+#undef AUDIO_VOICES
+#undef AUDIO_PIN
+#define AUDIO_PIN A5
+#define AUDIO_PIN_ALT A4
+#define AUDIO_PIN_ALT_AS_NEGATIVE
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+// #define DEBOUNCE 6
+
+/* 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
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
+
+/*
+ * 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
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+
+/*
+ * WS2812 Underglow Matrix options
+ */
+#define RGB_DI_PIN A1
+#define RGBLED_NUM 9
+#define DRIVER_LED_TOTAL RGBLED_NUM
+
+#define WS2812_PWM_DRIVER PWMD2
+#define WS2812_PWM_CHANNEL 2
+#define WS2812_PWM_PAL_MODE 1
+#define WS2812_DMA_STREAM STM32_DMA1_STREAM2
+#define WS2812_DMA_CHANNEL 2
+
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
diff --git a/keyboards/planck/rev6_drop/halconf.h b/keyboards/planck/rev6_drop/halconf.h
new file mode 100644
index 0000000000..48b76d2f44
--- /dev/null
+++ b/keyboards/planck/rev6_drop/halconf.h
@@ -0,0 +1,22 @@
+/* Copyright 2020 QMK
+ *
+ *  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 3 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 <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#define HAL_USE_PWM TRUE
+#define HAL_USE_GPT TRUE
+#define HAL_USE_DAC TRUE
+
+#include_next <halconf.h>
diff --git a/keyboards/planck/rev6_drop/info.json b/keyboards/planck/rev6_drop/info.json
new file mode 100644
index 0000000000..114a971294
--- /dev/null
+++ b/keyboards/planck/rev6_drop/info.json
@@ -0,0 +1,262 @@
+{
+  "keyboard_name": "Planck rev 6",
+  "url": "https://olkb.com/planck",
+  "maintainer": "jackhumbert",
+  "layouts": {
+    "LAYOUT_ortho_4x12": {
+      "layout": [
+        { "x": 0, "y": 0 },
+        { "x": 1, "y": 0 },
+        { "x": 2, "y": 0 },
+        { "x": 3, "y": 0 },
+        { "x": 4, "y": 0 },
+        { "x": 5, "y": 0 },
+        { "x": 6, "y": 0 },
+        { "x": 7, "y": 0 },
+        { "x": 8, "y": 0 },
+        { "x": 9, "y": 0 },
+        { "x": 10, "y": 0 },
+        { "x": 11, "y": 0 },
+        { "x": 0, "y": 1 },
+        { "x": 1, "y": 1 },
+        { "x": 2, "y": 1 },
+        { "x": 3, "y": 1 },
+        { "x": 4, "y": 1 },
+        { "x": 5, "y": 1 },
+        { "x": 6, "y": 1 },
+        { "x": 7, "y": 1 },
+        { "x": 8, "y": 1 },
+        { "x": 9, "y": 1 },
+        { "x": 10, "y": 1 },
+        { "x": 11, "y": 1 },
+        { "x": 0, "y": 2 },
+        { "x": 1, "y": 2 },
+        { "x": 2, "y": 2 },
+        { "x": 3, "y": 2 },
+        { "x": 4, "y": 2 },
+        { "x": 5, "y": 2 },
+        { "x": 6, "y": 2 },
+        { "x": 7, "y": 2 },
+        { "x": 8, "y": 2 },
+        { "x": 9, "y": 2 },
+        { "x": 10, "y": 2 },
+        { "x": 11, "y": 2 },
+        { "x": 0, "y": 3 },
+        { "x": 1, "y": 3 },
+        { "x": 2, "y": 3 },
+        { "x": 3, "y": 3 },
+        { "x": 4, "y": 3 },
+        { "x": 5, "y": 3 },
+        { "x": 6, "y": 3 },
+        { "x": 7, "y": 3 },
+        { "x": 8, "y": 3 },
+        { "x": 9, "y": 3 },
+        { "x": 10, "y": 3 },
+        { "x": 11, "y": 3 }
+      ]
+    },
+    "LAYOUT_planck_1x2uC": {
+      "layout": [
+        { "x": 0, "y": 0 },
+        { "x": 1, "y": 0 },
+        { "x": 2, "y": 0 },
+        { "x": 3, "y": 0 },
+        { "x": 4, "y": 0 },
+        { "x": 5, "y": 0 },
+        { "x": 6, "y": 0 },
+        { "x": 7, "y": 0 },
+        { "x": 8, "y": 0 },
+        { "x": 9, "y": 0 },
+        { "x": 10, "y": 0 },
+        { "x": 11, "y": 0 },
+        { "x": 0, "y": 1 },
+        { "x": 1, "y": 1 },
+        { "x": 2, "y": 1 },
+        { "x": 3, "y": 1 },
+        { "x": 4, "y": 1 },
+        { "x": 5, "y": 1 },
+        { "x": 6, "y": 1 },
+        { "x": 7, "y": 1 },
+        { "x": 8, "y": 1 },
+        { "x": 9, "y": 1 },
+        { "x": 10, "y": 1 },
+        { "x": 11, "y": 1 },
+        { "x": 0, "y": 2 },
+        { "x": 1, "y": 2 },
+        { "x": 2, "y": 2 },
+        { "x": 3, "y": 2 },
+        { "x": 4, "y": 2 },
+        { "x": 5, "y": 2 },
+        { "x": 6, "y": 2 },
+        { "x": 7, "y": 2 },
+        { "x": 8, "y": 2 },
+        { "x": 9, "y": 2 },
+        { "x": 10, "y": 2 },
+        { "x": 11, "y": 2 },
+        { "x": 0, "y": 3 },
+        { "x": 1, "y": 3 },
+        { "x": 2, "y": 3 },
+        { "x": 3, "y": 3 },
+        { "x": 4, "y": 3 },
+        { "x": 5, "y": 3, "w": 2 },
+        { "x": 7, "y": 3 },
+        { "x": 8, "y": 3 },
+        { "x": 9, "y": 3 },
+        { "x": 10, "y": 3 },
+        { "x": 11, "y": 3 }
+      ]
+    },
+    "LAYOUT_planck_1x2uL": {
+      "layout": [
+        { "x": 0, "y": 0 },
+        { "x": 1, "y": 0 },
+        { "x": 2, "y": 0 },
+        { "x": 3, "y": 0 },
+        { "x": 4, "y": 0 },
+        { "x": 5, "y": 0 },
+        { "x": 6, "y": 0 },
+        { "x": 7, "y": 0 },
+        { "x": 8, "y": 0 },
+        { "x": 9, "y": 0 },
+        { "x": 10, "y": 0 },
+        { "x": 11, "y": 0 },
+        { "x": 0, "y": 1 },
+        { "x": 1, "y": 1 },
+        { "x": 2, "y": 1 },
+        { "x": 3, "y": 1 },
+        { "x": 4, "y": 1 },
+        { "x": 5, "y": 1 },
+        { "x": 6, "y": 1 },
+        { "x": 7, "y": 1 },
+        { "x": 8, "y": 1 },
+        { "x": 9, "y": 1 },
+        { "x": 10, "y": 1 },
+        { "x": 11, "y": 1 },
+        { "x": 0, "y": 2 },
+        { "x": 1, "y": 2 },
+        { "x": 2, "y": 2 },
+        { "x": 3, "y": 2 },
+        { "x": 4, "y": 2 },
+        { "x": 5, "y": 2 },
+        { "x": 6, "y": 2 },
+        { "x": 7, "y": 2 },
+        { "x": 8, "y": 2 },
+        { "x": 9, "y": 2 },
+        { "x": 10, "y": 2 },
+        { "x": 11, "y": 2 },
+        { "x": 0, "y": 3 },
+        { "x": 1, "y": 3 },
+        { "x": 2, "y": 3 },
+        { "x": 3, "y": 3 },
+        { "x": 4, "y": 3, "w": 2 },
+        { "x": 6, "y": 3 },
+        { "x": 7, "y": 3 },
+        { "x": 8, "y": 3 },
+        { "x": 9, "y": 3 },
+        { "x": 10, "y": 3 },
+        { "x": 11, "y": 3 }
+      ]
+    },
+    "LAYOUT_planck_1x2uR": {
+      "layout": [
+        { "x": 0, "y": 0 },
+        { "x": 1, "y": 0 },
+        { "x": 2, "y": 0 },
+        { "x": 3, "y": 0 },
+        { "x": 4, "y": 0 },
+        { "x": 5, "y": 0 },
+        { "x": 6, "y": 0 },
+        { "x": 7, "y": 0 },
+        { "x": 8, "y": 0 },
+        { "x": 9, "y": 0 },
+        { "x": 10, "y": 0 },
+        { "x": 11, "y": 0 },
+        { "x": 0, "y": 1 },
+        { "x": 1, "y": 1 },
+        { "x": 2, "y": 1 },
+        { "x": 3, "y": 1 },
+        { "x": 4, "y": 1 },
+        { "x": 5, "y": 1 },
+        { "x": 6, "y": 1 },
+        { "x": 7, "y": 1 },
+        { "x": 8, "y": 1 },
+        { "x": 9, "y": 1 },
+        { "x": 10, "y": 1 },
+        { "x": 11, "y": 1 },
+        { "x": 0, "y": 2 },
+        { "x": 1, "y": 2 },
+        { "x": 2, "y": 2 },
+        { "x": 3, "y": 2 },
+        { "x": 4, "y": 2 },
+        { "x": 5, "y": 2 },
+        { "x": 6, "y": 2 },
+        { "x": 7, "y": 2 },
+        { "x": 8, "y": 2 },
+        { "x": 9, "y": 2 },
+        { "x": 10, "y": 2 },
+        { "x": 11, "y": 2 },
+        { "x": 0, "y": 3 },
+        { "x": 1, "y": 3 },
+        { "x": 2, "y": 3 },
+        { "x": 3, "y": 3 },
+        { "x": 4, "y": 3 },
+        { "x": 5, "y": 3 },
+        { "x": 6, "y": 3, "w": 2 },
+        { "x": 8, "y": 3 },
+        { "x": 9, "y": 3 },
+        { "x": 10, "y": 3 },
+        { "x": 11, "y": 3 }
+      ]
+    },
+    "LAYOUT_planck_2x2u": {
+      "layout": [
+        { "x": 0, "y": 0 },
+        { "x": 1, "y": 0 },
+        { "x": 2, "y": 0 },
+        { "x": 3, "y": 0 },
+        { "x": 4, "y": 0 },
+        { "x": 5, "y": 0 },
+        { "x": 6, "y": 0 },
+        { "x": 7, "y": 0 },
+        { "x": 8, "y": 0 },
+        { "x": 9, "y": 0 },
+        { "x": 10, "y": 0 },
+        { "x": 11, "y": 0 },
+        { "x": 0, "y": 1 },
+        { "x": 1, "y": 1 },
+        { "x": 2, "y": 1 },
+        { "x": 3, "y": 1 },
+        { "x": 4, "y": 1 },
+        { "x": 5, "y": 1 },
+        { "x": 6, "y": 1 },
+        { "x": 7, "y": 1 },
+        { "x": 8, "y": 1 },
+        { "x": 9, "y": 1 },
+        { "x": 10, "y": 1 },
+        { "x": 11, "y": 1 },
+        { "x": 0, "y": 2 },
+        { "x": 1, "y": 2 },
+        { "x": 2, "y": 2 },
+        { "x": 3, "y": 2 },
+        { "x": 4, "y": 2 },
+        { "x": 5, "y": 2 },
+        { "x": 6, "y": 2 },
+        { "x": 7, "y": 2 },
+        { "x": 8, "y": 2 },
+        { "x": 9, "y": 2 },
+        { "x": 10, "y": 2 },
+        { "x": 11, "y": 2 },
+        { "x": 0, "y": 3 },
+        { "x": 1, "y": 3 },
+        { "x": 2, "y": 3 },
+        { "x": 3, "y": 3 },
+        { "x": 4, "y": 3, "w": 2 },
+        { "x": 6, "y": 3, "w": 2 },
+        { "x": 8, "y": 3 },
+        { "x": 9, "y": 3 },
+        { "x": 10, "y": 3 },
+        { "x": 11, "y": 3 }
+      ]
+    }
+  }
+}
diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c
new file mode 100644
index 0000000000..1fb6ba0d42
--- /dev/null
+++ b/keyboards/planck/rev6_drop/matrix.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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 <string.h>
+#include "hal.h"
+#include "timer.h"
+#include "wait.h"
+#include "debug.h"
+#include "matrix.h"
+
+/*
+ *     col: { B11, B10, B2, B1, A7, B0 }
+ *     row: { A10, A9, A8, B15, C13, C14, C15, A2 }
+ */
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_COLS];
+static bool         debouncing      = false;
+static uint16_t     debouncing_time = 0;
+
+__attribute__((weak)) void matrix_init_user(void) {}
+
+__attribute__((weak)) void matrix_scan_user(void) {}
+
+__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
+
+__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
+
+void matrix_init(void) {
+    printf("matrix init\n");
+    // debug_matrix = true;
+
+    // actual matrix setup
+    palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
+    palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
+    palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
+    palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
+    palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
+    palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
+
+    palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN);
+    palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN);
+
+    memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
+    memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
+
+    matrix_init_quantum();
+}
+
+uint8_t matrix_scan(void) {
+    // actual matrix
+    for (int col = 0; col < MATRIX_COLS; col++) {
+        matrix_row_t data = 0;
+
+        // strobe col { B11, B10, B2, B1, A7, B0 }
+        switch (col) {
+            case 0:
+                palSetPad(GPIOB, 11);
+                break;
+            case 1:
+                palSetPad(GPIOB, 10);
+                break;
+            case 2:
+                palSetPad(GPIOB, 2);
+                break;
+            case 3:
+                palSetPad(GPIOB, 1);
+                break;
+            case 4:
+                palSetPad(GPIOA, 7);
+                break;
+            case 5:
+                palSetPad(GPIOB, 0);
+                break;
+        }
+
+        // need wait to settle pin state
+        wait_us(20);
+
+        // read row data { A10, A9, A8, B15, C13, C14, C15, A2 }
+        data = ((palReadPad(GPIOA, 10) << 0) | (palReadPad(GPIOA, 9) << 1) | (palReadPad(GPIOA, 8) << 2) | (palReadPad(GPIOB, 15) << 3) | (palReadPad(GPIOC, 13) << 4) | (palReadPad(GPIOC, 14) << 5) | (palReadPad(GPIOC, 15) << 6) | (palReadPad(GPIOA, 2) << 7));
+
+        // unstrobe  col { B11, B10, B2, B1, A7, B0 }
+        switch (col) {
+            case 0:
+                palClearPad(GPIOB, 11);
+                break;
+            case 1:
+                palClearPad(GPIOB, 10);
+                break;
+            case 2:
+                palClearPad(GPIOB, 2);
+                break;
+            case 3:
+                palClearPad(GPIOB, 1);
+                break;
+            case 4:
+                palClearPad(GPIOA, 7);
+                break;
+            case 5:
+                palClearPad(GPIOB, 0);
+                break;
+        }
+
+        if (matrix_debouncing[col] != data) {
+            matrix_debouncing[col] = data;
+            debouncing             = true;
+            debouncing_time        = timer_read();
+        }
+    }
+
+    if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
+        for (int row = 0; row < MATRIX_ROWS; row++) {
+            matrix[row] = 0;
+            for (int col = 0; col < MATRIX_COLS; col++) {
+                matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
+            }
+        }
+        debouncing = false;
+    }
+
+    matrix_scan_quantum();
+
+    return 1;
+}
+
+bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); }
+
+matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
+
+void matrix_print(void) {
+    printf("\nr/c 01234567\n");
+    for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+        printf("%X0: ", row);
+        matrix_row_t data = matrix_get_row(row);
+        for (int col = 0; col < MATRIX_COLS; col++) {
+            if (data & (1 << col))
+                printf("1");
+            else
+                printf("0");
+        }
+        printf("\n");
+    }
+}
diff --git a/keyboards/planck/rev6_drop/mcuconf.h b/keyboards/planck/rev6_drop/mcuconf.h
new file mode 100644
index 0000000000..31abf13b63
--- /dev/null
+++ b/keyboards/planck/rev6_drop/mcuconf.h
@@ -0,0 +1,39 @@
+/* Copyright 2020 QMK Contributors
+ *
+ * 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 3 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_next "mcuconf.h"
+
+// The SysTick timer from the normal quantum/stm32 uses TIM2 -- the WS2812 pin used
+// on the Planck requires the use of TIM2 to run PWM -- rework which timers are
+// allocated for PWM usage.
+#undef STM32_PWM_USE_TIM2
+#define STM32_PWM_USE_TIM2 TRUE
+
+#undef STM32_DAC_USE_DAC1_CH1
+#define STM32_DAC_USE_DAC1_CH1 TRUE
+#undef STM32_DAC_USE_DAC1_CH2
+#define STM32_DAC_USE_DAC1_CH2 TRUE
+#undef STM32_GPT_USE_TIM6
+#define STM32_GPT_USE_TIM6 TRUE
+#undef STM32_GPT_USE_TIM7
+#define STM32_GPT_USE_TIM7 TRUE
+#undef STM32_GPT_USE_TIM8
+#define STM32_GPT_USE_TIM8 TRUE
+
+// As mentioned above, we need to reallocate the SysTick timer used from
+// TIM2 to TIM3.
+#undef STM32_ST_USE_TIMER
+#define STM32_ST_USE_TIMER 3
diff --git a/keyboards/planck/rev6_drop/readme.md b/keyboards/planck/rev6_drop/readme.md
new file mode 100644
index 0000000000..0ea2619acb
--- /dev/null
+++ b/keyboards/planck/rev6_drop/readme.md
@@ -0,0 +1,13 @@
+# Planck
+
+A compact 40% (12x4) ortholinear keyboard kit made and sold by OLKB and Massdrop. A complete hardware rework of the Planck, sporting a faster and more powerful STM32 ARM Cortex-M4 microcontroller, with support for rotary encoders and three additional layouts. [More info on qmk.fm](http://qmk.fm/planck/)
+
+* Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert)
+* Hardware Supported: Planck PCB rev6
+* Hardware Availability: [OLKB.com](https://olkb.com), [Massdrop](https://www.massdrop.com/buy/planck-mechanical-keyboard?mode=guest_open)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make planck/rev6_drop: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).
diff --git a/keyboards/planck/rev6_drop/rev6_drop.c b/keyboards/planck/rev6_drop/rev6_drop.c
new file mode 100644
index 0000000000..4c41af3806
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rev6_drop.c
@@ -0,0 +1,44 @@
+/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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 "rev6_drop.h"
+
+#ifdef RGB_MATRIX_ENABLE
+// clang-format off
+led_config_t g_led_config = { {
+  // Key Matrix to LED Index
+  { NO_LED, 6,      NO_LED, NO_LED, 5,      NO_LED },
+  { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+  { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0      },
+  { NO_LED, 7,      NO_LED, NO_LED, 2,      NO_LED },
+  { NO_LED, 4,      NO_LED, NO_LED, 3,      NO_LED },
+  { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+  { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+  { NO_LED, 1,      NO_LED, NO_LED, 8,      NO_LED },
+}, {
+  // LED Index to Physical Position
+  {112, 39}, {148, 60}, {206, 53}, {206, 3}, {150, 3}, {74, 3}, {18, 3}, {18, 54}, {77, 60}
+}, {
+  // LED Index to Flag
+  LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL,
+  LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL
+} };
+
+// LED physical location index
+//     6 5 4 3
+//        0
+//     7 8 1 2
+
+#endif
diff --git a/keyboards/planck/rev6_drop/rev6_drop.h b/keyboards/planck/rev6_drop/rev6_drop.h
new file mode 100644
index 0000000000..bc9434a026
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rev6_drop.h
@@ -0,0 +1,108 @@
+/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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
+
+#include "planck.h"
+
+#define LAYOUT_planck_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,    k36,   k37, k38, k39, k3a, k3b \
+) \
+{ \
+    { k00, k01, k02, k03, k04, k05   }, \
+    { k10, k11, k12, k13, k14, k15   }, \
+    { k20, k21, k22, k23, k24, k25   }, \
+    { k30, k31, k32, k39, k3a, k3b   }, \
+    { k06, k07, k08, k09, k0a, k0b   }, \
+    { k16, k17, k18, k19, k1a, k1b   }, \
+    { k26, k27, k28, k29, k2a, k2b   }, \
+    { k36, k37, k38, k33, k34, KC_NO } \
+}
+
+#define LAYOUT_planck_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,   k37,    k38, k39, k3a, k3b \
+) \
+{ \
+    { k00,   k01, k02, k03, k04, k05 }, \
+    { k10,   k11, k12, k13, k14, k15 }, \
+    { k20,   k21, k22, k23, k24, k25 }, \
+    { k30,   k31, k32, k39, k3a, k3b }, \
+    { k06,   k07, k08, k09, k0a, k0b }, \
+    { k16,   k17, k18, k19, k1a, k1b }, \
+    { k26,   k27, k28, k29, k2a, k2b }, \
+    { KC_NO, k37, k38, k33, k34, k35 } \
+}
+
+#define LAYOUT_planck_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,   k35,    k36, k37, k38, k39, k3a, k3b \
+) \
+{ \
+    { k00, k01, k02, k03, k04,   k05 }, \
+    { k10, k11, k12, k13, k14,   k15 }, \
+    { k20, k21, k22, k23, k24,   k25 }, \
+    { k30, k31, k32, k39, k3a,   k3b }, \
+    { k06, k07, k08, k09, k0a,   k0b }, \
+    { k16, k17, k18, k19, k1a,   k1b }, \
+    { k26, k27, k28, k29, k2a,   k2b }, \
+    { k36, k37, k38, k33, KC_NO, k35 } \
+}
+
+#define LAYOUT_planck_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,   k35,      k37,    k38, k39, k3a, k3b \
+) \
+{ \
+    { k00,   k01, k02, k03, k04,   k05 }, \
+    { k10,   k11, k12, k13, k14,   k15 }, \
+    { k20,   k21, k22, k23, k24,   k25 }, \
+    { k30,   k31, k32, k39, k3a,   k3b }, \
+    { k06,   k07, k08, k09, k0a,   k0b }, \
+    { k16,   k17, k18, k19, k1a,   k1b }, \
+    { k26,   k27, k28, k29, k2a,   k2b }, \
+    { KC_NO, k37, k38, k33, KC_NO, k35 } \
+}
+
+#define LAYOUT_ortho_4x12( \
+    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 \
+) \
+{ \
+    { k00, k01, k02, k03, k04, k05 }, \
+    { k10, k11, k12, k13, k14, k15 }, \
+    { k20, k21, k22, k23, k24, k25 }, \
+    { k30, k31, k32, k39, k3a, k3b }, \
+    { k06, k07, k08, k09, k0a, k0b }, \
+    { k16, k17, k18, k19, k1a, k1b }, \
+    { k26, k27, k28, k29, k2a, k2b }, \
+    { k36, k37, k38, k33, k34, k35 } \
+}
+
+
+#define LAYOUT LAYOUT_ortho_4x12
+#define LAYOUT_planck_mit LAYOUT_planck_1x2uC
+#define LAYOUT_planck_grid LAYOUT_ortho_4x12
diff --git a/keyboards/planck/rev6_drop/rules.mk b/keyboards/planck/rev6_drop/rules.mk
new file mode 100644
index 0000000000..c35de3d74b
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rules.mk
@@ -0,0 +1,33 @@
+# MCU name
+MCU = STM32F303
+
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
+# 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 = yes        # Console for debug
+COMMAND_ENABLE = yes        # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes           # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
+AUDIO_ENABLE = yes          # Audio output
+WS2812_DRIVER = pwm
+CUSTOM_MATRIX = yes
+# Do not enable RGB_MATRIX_ENABLE together with RGBLIGHT_ENABLE
+RGB_MATRIX_ENABLE = no
+RGB_MATRIX_DRIVER = WS2812
+ENCODER_ENABLE = yes
+DIP_SWITCH_ENABLE = yes
+
+SRC += matrix.c
+
+LAYOUTS = ortho_4x12 planck_mit
+LAYOUTS_HAS_RGB = no
-- 
cgit v1.2.3


From fa5d21a58ebfe9782225c857ad2e533a0f65d161 Mon Sep 17 00:00:00 2001
From: Jack Humbert <jack.humb@gmail.com>
Date: Sun, 19 Sep 2021 14:43:37 -0400
Subject: [Keyboard] Enables I2C for OLKB rev*_drop boards (#14514)

Co-authored-by: daskygit <32983009+daskygit@users.noreply.github.com>
---
 keyboards/planck/rev6_drop/halconf.h |  1 +
 keyboards/planck/rev6_drop/matrix.c  | 12 ++++++------
 keyboards/planck/rev6_drop/mcuconf.h |  5 +++++
 3 files changed, 12 insertions(+), 6 deletions(-)

(limited to 'keyboards/planck')

diff --git a/keyboards/planck/rev6_drop/halconf.h b/keyboards/planck/rev6_drop/halconf.h
index 48b76d2f44..153eacb212 100644
--- a/keyboards/planck/rev6_drop/halconf.h
+++ b/keyboards/planck/rev6_drop/halconf.h
@@ -18,5 +18,6 @@
 #define HAL_USE_PWM TRUE
 #define HAL_USE_GPT TRUE
 #define HAL_USE_DAC TRUE
+#define HAL_USE_I2C TRUE
 
 #include_next <halconf.h>
diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c
index 1fb6ba0d42..49e115d029 100644
--- a/keyboards/planck/rev6_drop/matrix.c
+++ b/keyboards/planck/rev6_drop/matrix.c
@@ -43,7 +43,7 @@ __attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
 __attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
 
 void matrix_init(void) {
-    printf("matrix init\n");
+    dprintf("matrix init\n");
     // debug_matrix = true;
 
     // actual matrix setup
@@ -151,16 +151,16 @@ bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col));
 matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
 
 void matrix_print(void) {
-    printf("\nr/c 01234567\n");
+    dprintf("\nr/c 01234567\n");
     for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
-        printf("%X0: ", row);
+        dprintf("%X0: ", row);
         matrix_row_t data = matrix_get_row(row);
         for (int col = 0; col < MATRIX_COLS; col++) {
             if (data & (1 << col))
-                printf("1");
+                dprintf("1");
             else
-                printf("0");
+                dprintf("0");
         }
-        printf("\n");
+        dprintf("\n");
     }
 }
diff --git a/keyboards/planck/rev6_drop/mcuconf.h b/keyboards/planck/rev6_drop/mcuconf.h
index 31abf13b63..d7c29fcf65 100644
--- a/keyboards/planck/rev6_drop/mcuconf.h
+++ b/keyboards/planck/rev6_drop/mcuconf.h
@@ -37,3 +37,8 @@
 // TIM2 to TIM3.
 #undef STM32_ST_USE_TIMER
 #define STM32_ST_USE_TIMER 3
+
+// enable i2c 
+#undef STM32_I2C_USE_I2C1
+#define STM32_I2C_USE_I2C1                  TRUE
+
-- 
cgit v1.2.3


From a068b14686507f67c7f0956d3367510bd9041641 Mon Sep 17 00:00:00 2001
From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com>
Date: Sun, 19 Sep 2021 20:53:47 +0200
Subject: [Keymap] Added my own keymap for MIT Planck (#14481)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
---
 keyboards/planck/keymaps/jweickm/config.h  |   69 ++
 keyboards/planck/keymaps/jweickm/keymap.c  | 1131 ++++++++++++++++++++++++++++
 keyboards/planck/keymaps/jweickm/readme.md |  154 ++++
 keyboards/planck/keymaps/jweickm/rules.mk  |    5 +
 4 files changed, 1359 insertions(+)
 create mode 100644 keyboards/planck/keymaps/jweickm/config.h
 create mode 100644 keyboards/planck/keymaps/jweickm/keymap.c
 create mode 100644 keyboards/planck/keymaps/jweickm/readme.md
 create mode 100644 keyboards/planck/keymaps/jweickm/rules.mk

(limited to 'keyboards/planck')

diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h
new file mode 100644
index 0000000000..3b34ddf832
--- /dev/null
+++ b/keyboards/planck/keymaps/jweickm/config.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
+ *
+ * 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
+
+#ifdef AUDIO_ENABLE
+    #define STARTUP_SONG SONG(PLANCK_SOUND)
+    // #define STARTUP_SONG SONG(NO_SOUND)
+
+    #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
+                                  SONG(COLEMAK_SOUND), \
+                                  SONG(DVORAK_SOUND), \
+                                  SONG(WORKMAN_SOUND), \
+                                  SONG(PLOVER_SOUND), \
+                                  SONG(STARTUP_SOUND), \
+                                  SONG(PREONIC_SOUND), \
+                                  SONG(GOODBYE_SOUND), \
+                                }
+#endif
+
+/*
+ * MIDI options
+ */
+
+/* enable basic MIDI features:
+   - MIDI notes can be sent when in Music mode is on
+*/
+
+#define MIDI_BASIC
+
+/* enable advanced MIDI features:
+   - MIDI notes can be added to the keymap
+   - Octave shift and transpose
+   - Virtual sustain, portamento, and modulation wheel
+   - etc.
+*/
+//#define MIDI_ADVANCED
+
+
+// Most tactile encoders have detents every 4 stages
+#define ENCODER_RESOLUTION 4
+
+// settings for HOME ROW MODS
+#define TAPPING_TERM 160 // 200 ms is the default value
+#define TAPPING_TERM_PER_KEY
+//#define PERMISSIVE_HOLD
+#define IGNORE_MOD_TAP_INTERRUPT
+#define TAPPING_FORCE_HOLD_PER_KEY
+
+// settings for LEADER key
+#define LEADER_PER_KEY_TIMING
+#define LEADER_TIMEOUT 250
+#define LEADER_NO_TIMEOUT
+
+#define RGBLIGHT_SLEEP // RGB lighting will switch off when the host goes to sleep
+#define RGBLIGHT_LAYERS
diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c
new file mode 100644
index 0000000000..02138a876c
--- /dev/null
+++ b/keyboards/planck/keymaps/jweickm/keymap.c
@@ -0,0 +1,1131 @@
+/* Copyright 2015-2017 Jack Humbert
+ * Copyright 2021 Jakob Weickmann
+ *
+ 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
+#include "muse.h"
+
+enum planck_layers {
+    _HRWIDECOLEMAK,
+    _HRWIDECOLEMAK_DE,
+    _GAMING,
+    _WIDECOLEMAK,
+    _LOWER,
+    _RAISE,
+    _LOWER_DE,
+    _RAISE_DE,
+    _ADJUST,
+    _NAV,
+    _VIM,
+    _NUM,
+    _MOUSE,
+};
+
+enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN, DE_DOT_RAB, DE_COMM_LAB };
+
+// Tap Dance declarations
+enum tap_dance_codes {
+    TD_PRN,     // round brackets (parentheses)
+    TD_PRN_DE,  // round brackets (parentheses)
+    TD_BRC,     // square brackets
+    TD_BRC_DE,  // square brackets
+    TD_CBR,     // curly brackets
+    TD_CBR_DE,  // curly brackets
+    TD_VIM_GG   // single tap to scroll down, double tap to scroll up
+};
+
+#define LOWER MO(_LOWER)
+#define RAISE MO(_RAISE)
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+    /* _HRWIDECOLEMAK
+     * ,-----------------------------------------------------------------------------------.
+     * |  G-Q |  A-W |  S-F |  C-P |_Num-B|Vol/B+|_Num-J|  C-L |  S-U |  A-Y |  G-/ |   ü  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |   A  |   R  |   S  |   T  |   G  | TAB  |   M  |   N  |   E  |   I  |   O  |   '  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |_Mo-Z |   X  |   C  |   D  |   V  |Vol/B-|   K  |   H  |   ,  |   .  |_Mo-/ |   \  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |C-CAPS| LEAD | BSPC |_L-ESC| LSFT |  _Nav-SPC   |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_HRWIDECOLEMAK] = LAYOUT_planck_grid(
+        LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, 
+        KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, 
+        LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, 
+        LCTL_T(KC_CAPS), KC_LEAD, KC_BSPC, LT(_LOWER, KC_ESC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT)
+    ),
+
+    /* _HRWIDECOLEMAK_DE
+     * same as above, when the PC is set to German layout
+     * ,-----------------------------------------------------------------------------------.
+     * |  G-Q |  A-W |  S-F |  C-P |_Num-B|Vol/B+|_Num-J|  C-L |  S-U |  A-Y |  G-/ |   ü  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |   A  |   R  |   S  |   T  |   G  | TAB  |   M  |   N  |   E  |   I  |   O  |   '  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |_Mo-Z |   X  |   C  |   D  |   V  |Vol/B-|   K  |   H  |   ,  |   .  |_Mo-/ |   \  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |C-CAPS| LEAD | BSPC |_L-ESC| LSFT |  _Nav-SPC   |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid(
+        LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, 
+        KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, 
+        LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, DE_COMM_LAB, DE_DOT_RAB, DE_SLSH_QUST, DE_BSLS, 
+        LCTL_T(KC_CAPS), KC_LEAD, KC_BSPC, LT(_LOWER_DE, KC_ESC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT)
+    ),
+
+    /* _GAMING
+     * ,-----------------------------------------------------------------------------------.
+     * | ESC  |   1  |   2  |   3  |   4  |   5  |   6  |   7  |  F5  |  F8  |  F9  |Vol/B+|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | TAB  |   Q  |   W  |   E  |   R  |   T  |   Y  |   U  |   I  |   O  |   P  |Vol/B-|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | LSFT |   A  |   S  |   D  |   F  |   G  |   H  |   J  |   Z  |   M  |   ;  |_CM-EN|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | LCTL |   C  |   B  |   X  | LALT |    SPACE    | ENT  | RALT | ____ | ____ | !GAME|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_GAMING] = LAYOUT_planck_grid(
+        KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, 
+        KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, 
+        KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, 
+        KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING
+    ),
+
+    /* WIDECOLEMAK
+     * no mod taps
+     * ,-----------------------------------------------------------------------------------.
+     * |   Q  |   W  |   F  |   P  |   B  |Vol/B+|   J  |   L  |   U  |   Y  |   /  |   Ü  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |   A  |   R  |   S  |   T  |   G  | TAB  |   M  |   N  |   E  |   I  |   O  |   '  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |   Z  |   X  |   C  |   D  |   V  |Vol/B-|   K  |   H  |   ,  |   .  |   /  |!CM-EN|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT |  _NAV-SPC   |_R-ENT|S-DEL |C-TAB |_Mo <-|_Mo ->|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_WIDECOLEMAK] = LAYOUT_planck_grid(
+        KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue,
+        KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, 
+        KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, 
+        LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT)
+    ),
+
+    /* _LOWER
+     * ,-----------------------------------------------------------------------------------.
+     * |   !  |   @  |   #  |   $  |   %  |   ~  |   ^  |   &  |   *  |   (  |   )  |   Ö  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   ß  |   _  |   +  |   {  |   }  |   Ä  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 | MPLY |   /  |   \  |   |  |   €  |   è  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |!MOUSE| ____ | ____ | ____ | ____ |     ____    | ____ | Vol- | Vol+ |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_LOWER] = LAYOUT_planck_grid(
+        KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, 
+        KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, 
+        KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, 
+        TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP
+    ),
+
+    /* _LOWER_DE
+     * ,-----------------------------------------------------------------------------------.
+     * |   !  |   @  |   #  |   $  |   %  |   ~  |   ^  |   &  |   *  |   (  |   )  |   Ö  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   ß  |   _  |   +  |   {  |   }  |   Ä  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 | MPLY |   /  |   \  |   |  |   €  |   `  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |!MOUSE| ____ | ____ | ____ | ____ |     ____    | ____ | Vol- | Vol+ |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_LOWER_DE] = LAYOUT_planck_grid(
+        KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), 
+        KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), 
+        KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), RALT(KC_MINS), RALT(KC_NUBS), KC_CURRENCY, KC_PLUS, 
+        TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP
+    ),
+
+    /* _RAISE
+     * ,-----------------------------------------------------------------------------------.
+     * |   1  |   2  |   3  |   4  |   5  |   `  |   6  |   7  |   8  |   9  |   0  |   ö  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   ß  |   -  |   =  |   [  |   ]  |   ä  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 | MPLY |   \  |   ,  |   .  |   /  |   é  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |!MOUSE| ____ | ____ | BSPC | ____ |     ____    | ____ |  |<< | >>|  |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_RAISE] = LAYOUT_planck_grid(
+        KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, 
+        KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, 
+        KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, 
+        TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP
+    ),
+
+    /* _RAISE_DE
+     * ,-----------------------------------------------------------------------------------.
+     * |   1  |   2  |   3  |   4  |   5  |   `  |   6  |   7  |   8  |   9  |   0  |   ö  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |   ß  |   -  |   =  |   [  |   ]  |   ä  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 | MPLY |   \  |   ,  |   .  |   /  |   ´  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |!MOUSE| ____ | ____ | BSPC | ____ |     ____    | ____ |  |<< | >>|  |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_RAISE_DE] = LAYOUT_planck_grid(
+        KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, 
+        KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, 
+        KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, DE_SLSH_QUST, KC_EQL, 
+        TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP
+    ),
+
+    /* _ADJUST
+     * ,-----------------------------------------------------------------------------------.
+     * | A-SFT| RESET| DEBUG|RGBTOG|RGBMOD|RGBHUI|RGBHUD|RGBSAI|RGBSAD|RGBVAI|RGBVAD| DE_SW|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | A-GRV|EEPRST|MU_MOD| AU_ON|AU_OFF|AGNORM|AGSWAP|!HRWCM| !WCM | A-GRV| !LANG| !GAME|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | ____ |MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF| Vol- | MPLY | Vol+ | ____ | ____ |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | ____ | ____ | ____ | ____ | ____ |     ____    | ____ | ____ | ____ | ____ |EEPRST|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_ADJUST] = LAYOUT_planck_grid(
+        LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, 
+        LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, 
+        KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS,
+        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET
+    ),
+
+    /* _NAV
+     * ,-----------------------------------------------------------------------------------.
+     * |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>|  | HOME |  ->  | PGUP | COPY | PASTE| DE_SW|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |C(TAB)|  TAB |  ESC |  ENT |VIM_GG| MPLY |  <-  |   ↓  |   ↑  |  ->  |  END | VIM_O|  
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | XXXX | XXXX | ____ | BSPC | ____ |     ____    |  ENT |  DEL | ____ | ____ | DE_SW|
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_NAV] = LAYOUT_planck_grid(
+        ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, 
+        CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, 
+        KC_LSFT, KC_NO, LSFT(KC_DEL), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), 
+        KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_TRNS, KC_DE_SWITCH
+    ),
+
+    /* _VIM
+     * ,-----------------------------------------------------------------------------------.
+     * |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>|  | HOME |  ->  | PGUP | COPY | PASTE| DE_SW|
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |C(TAB)|  TAB |  ESC |  ENT |VIM_GG| MPLY |  <-  |   ↓  |   ↑  |  ->  |  END | VIM_O|  
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | XXXX | XXXX | !VIM | BSPC | ____ |     ____    |  ENT |  DEL | ____ |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_VIM] = LAYOUT_planck_grid(
+        ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, 
+        CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, 
+        KC_LSFT, KC_NO, LSFT(KC_DEL), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), 
+        KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP
+    ),
+
+    /* _NUM
+     * ,-----------------------------------------------------------------------------------.
+     * |  F1  |  F2  |  F3  |  F4  |  |<< |NUMLCK| >>|  |   7  |   8  |   9  |   -  | ____ |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F5  |  F6  |  F7  |  F8  | Vol+ | MPLY |   *  |   4  |   5  |   6  |   +  |   .  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F9  |  F10 |  F11 |  F12 | Vol- | MUTE |   =  |   1  |   2  |   3  |   /  |   ,  |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | ____ | ____ | ____ | ____ | ____ |     ____    |   0  |   .  |   ,  |   =  | ____ |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_NUM] = LAYOUT_planck_grid(
+        KC_F1, KC_F2,  KC_F3,  KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, 
+        KC_F5, KC_F6,  KC_F7,  KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, 
+        KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, 
+        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS
+    ),
+
+    /* _MOUSE
+     * ,-----------------------------------------------------------------------------------.
+     * | XXXX | XXXX | MBTN4| MBTN5| XXXX | Bri+ | XXXX | MWHL↑|MAUS↑ | MWHL↑| XXXX | XXXX |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * | XXXX | MBTN3| MBTN2| MBTN1| XXXX | MPLY | XXXX |MAUS<-|MAUS↓ |MAUS->| XXXX | XXXX |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |  F9  | XXXX | XXXX | XXXX | XXXX | Bri- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX |
+     * |------+------+------+------+------+------+------+------+------+------+------+------|
+     * |!MOUSE| XXXX | XXXX | ____ | XXXX | MAUS_ACCEL2 | ____ | XXXX | XXXX |   ↓  |   ↑  |
+     * `-----------------------------------------------------------------------------------'
+     */
+    [_MOUSE] = LAYOUT_planck_grid(
+        KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, 
+        KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, 
+        KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, 
+        TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_DOWN, KC_UP
+    )
+
+};
+
+// define the tap dance functions
+void dance_prn(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(KC_LPRN);
+    } else {
+        tap_code16(KC_LPRN);
+        tap_code16(KC_RPRN);
+        tap_code(KC_LEFT);
+    }
+}
+void dance_brc(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code(KC_LBRC);
+    } else {
+        tap_code(KC_LBRC);
+        tap_code(KC_RBRC);
+        tap_code(KC_LEFT);
+    }
+}
+void dance_cbr(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(KC_LCBR);
+    } else {
+        tap_code16(KC_LCBR);
+        tap_code16(KC_RCBR);
+        tap_code(KC_LEFT);
+    }
+}
+void dance_prn_de(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(KC_ASTR);
+    } else {
+        tap_code16(KC_ASTR);
+        tap_code16(KC_LPRN);
+        tap_code(KC_LEFT);
+    }
+}
+void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(RALT(KC_8));
+    } else {
+        tap_code16(RALT(KC_8));
+        tap_code16(RALT(KC_9));
+        tap_code(KC_LEFT);
+    }
+}
+void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(RALT(KC_7));
+    } else {
+        tap_code16(RALT(KC_7));
+        tap_code16(RALT(KC_0));
+        tap_code(KC_LEFT);
+    }
+}
+void vim_gg(qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        tap_code16(LCTL(KC_END));
+    } else {
+        tap_code16(LCTL(KC_HOME));
+    }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+    // declare tap dance actions here
+    [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), [TD_PRN_DE] = ACTION_TAP_DANCE_FN(dance_prn_de), [TD_BRC_DE] = ACTION_TAP_DANCE_FN(dance_brc_de), [TD_CBR_DE] = ACTION_TAP_DANCE_FN(dance_cbr_de), [TD_VIM_GG] = ACTION_TAP_DANCE_FN(vim_gg)};
+
+float thumb_factor  = 0.95;
+float index_factor  = 1.1;
+float middle_factor = 1.2;
+float ring_factor   = 1.25;
+float pinky_factor  = 1.15;
+float td_factor     = 1.4;
+
+// define the per_key_tapping_term
+uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
+    switch (keycode) {
+        // thumb keys
+        case RSFT_T(KC_DEL):
+            return TAPPING_TERM * thumb_factor;
+        case RCTL_T(KC_TAB):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_NAV, KC_LEFT):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_NAV, KC_RIGHT):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_LOWER, KC_BSPC):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_LOWER_DE, KC_BSPC):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_RAISE, KC_ENT):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_RAISE_DE, KC_ENT):
+            return TAPPING_TERM * thumb_factor;
+        case LT(_NAV, KC_SPC):
+            return TAPPING_TERM * 1.0;
+        case LALT_T(KC_ESC):
+            return TAPPING_TERM * thumb_factor;
+
+        // index finger keys
+        case LCTL_T(KC_P):
+            return TAPPING_TERM * index_factor;
+        case RCTL_T(KC_L):
+            return TAPPING_TERM * (index_factor + 0.1);
+        case LT(_NUM, KC_B):
+            return TAPPING_TERM * (index_factor + 0.1);
+        case LT(_NUM, KC_J):
+            return TAPPING_TERM * index_factor;
+
+        // middle finger keys
+        case LSFT_T(KC_F):
+            return TAPPING_TERM * middle_factor;
+        case RSFT_T(KC_U):
+            return TAPPING_TERM * middle_factor;
+
+        // ring finger keys
+        case LALT_T(KC_W):
+            return TAPPING_TERM * ring_factor;
+        case LALT_T(KC_Y):
+            return TAPPING_TERM * ring_factor;
+        case LGUI_T(KC_TAB):
+            return TAPPING_TERM * ring_factor;
+
+        // pinky keys
+        case LGUI_T(KC_Q):
+            return TAPPING_TERM * pinky_factor;
+        case RGUI_T(KC_SCLN):
+            return TAPPING_TERM * pinky_factor;
+        case RGUI_T(KC_LBRC):
+            return TAPPING_TERM * pinky_factor;
+        case LT(_MOUSE, KC_Z):
+            return TAPPING_TERM * pinky_factor;
+        case LT(_MOUSE, KC_SLSH):
+            return TAPPING_TERM * pinky_factor;
+        case LCTL_T(KC_CAPS):
+            return TAPPING_TERM * pinky_factor;
+
+        // tap-dance actions
+        case TD(TD_PRN):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_BRC):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_CBR):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_PRN_DE):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_BRC_DE):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_CBR_DE):
+            return TAPPING_TERM * td_factor;
+        case TD(TD_VIM_GG):
+            return TAPPING_TERM * td_factor;
+
+        default:
+            return TAPPING_TERM;
+    }
+}
+
+// alt tab function setup
+bool is_alt_tab_active = false;
+bool is_ctl_tab_active = false;
+bool de_layout_active  = false;
+
+static uint16_t key_timer;
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+    switch (keycode) {
+        case WIDECOLEMAK:
+            if (record->event.presse