From d30bf44a60f7495034e98746b6e414d3ada77de1 Mon Sep 17 00:00:00 2001
From: 4pplet <mail@4pplet.com>
Date: Thu, 8 Dec 2022 17:07:54 +0100
Subject: [PATCH] Add AEKISO60 rev B (#19074)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: 4pplet <4pplet@protonmail.com>
Co-authored-by: 4pplet <stefan.ess@gmail.com>
---
 keyboards/4pplet/aekiso60/readme.md       | 10 ++-
 keyboards/4pplet/aekiso60/rev_a/readme.md | 20 ++++++
 keyboards/4pplet/aekiso60/rev_b/config.h  | 57 +++++++++++++++
 keyboards/4pplet/aekiso60/rev_b/info.json | 85 +++++++++++++++++++++++
 keyboards/4pplet/aekiso60/rev_b/readme.md | 21 ++++++
 keyboards/4pplet/aekiso60/rev_b/rev_b.c   | 19 +++++
 keyboards/4pplet/aekiso60/rev_b/rev_b.h   | 48 +++++++++++++
 keyboards/4pplet/aekiso60/rev_b/rules.mk  | 24 +++++++
 8 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 keyboards/4pplet/aekiso60/rev_a/readme.md
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/config.h
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/info.json
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/readme.md
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/rev_b.c
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/rev_b.h
 create mode 100644 keyboards/4pplet/aekiso60/rev_b/rules.mk

diff --git a/keyboards/4pplet/aekiso60/readme.md b/keyboards/4pplet/aekiso60/readme.md
index 42c3d3421d..1791ef5f6c 100644
--- a/keyboards/4pplet/aekiso60/readme.md
+++ b/keyboards/4pplet/aekiso60/readme.md
@@ -9,6 +9,12 @@ More info: https://geekhack.org/index.php?topic=103627.0
 
 Make example for this keyboard (after setting up your build environment):
 
-    make 4pplet/aekiso60/rev_a:default
+    make 4pplet/aekiso60/rev_b: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).
\ No newline at end of file
+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).
+
+How to enter bootloader (DFU):
+* Tap the physical reset button or short the reset-header (labled RESET) on tha back of the PCB for keyboard to enter DFU. When in DFU, it's ready to flash the firmware.
+
+Alternative option if the firmware is already pre-flashed:
+* Unplug your keyboard, hold down the Spacebar and B at the same time, plug in your keyboard and wait a second before releasing the keys. The keyboard will enter DFU and is ready to flash the firmware.
diff --git a/keyboards/4pplet/aekiso60/rev_a/readme.md b/keyboards/4pplet/aekiso60/rev_a/readme.md
new file mode 100644
index 0000000000..8f26b165c4
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_a/readme.md
@@ -0,0 +1,20 @@
+# AEKISO60
+
+A 60% PCB enabling use of ISO AEK keycaps and ALPS switches
+
+More info: https://geekhack.org/index.php?topic=103627.0
+
+* Keyboard Maintainer: [4pplet](https://github.com/4pplet)
+* Hardware Supported: AEKISO60 Rev A
+
+Make example for this keyboard (after setting up your build environment):
+
+    make 4pplet/aekiso60/rev_a: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).
+
+How to enter bootloader (DFU):
+* Tap the physical reset button or short the reset-header (labled RESET) on tha back of the PCB for keyboard to enter DFU. When in DFU, it's ready to flash the firmware.
+
+Alternative option if the firmware is already pre-flashed:
+* Unplug your keyboard, hold down the Spacebar and B at the same time, plug in your keyboard and wait a second before releasing the keys. The keyboard will enter DFU and is ready to flash the firmware.
diff --git a/keyboards/4pplet/aekiso60/rev_b/config.h b/keyboards/4pplet/aekiso60/rev_b/config.h
new file mode 100644
index 0000000000..0278c9b2b9
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/config.h
@@ -0,0 +1,57 @@
+/*
+Copyright 2022 Stefan Sundin "4pplet" <mail@4pplet.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 "config_common.h"
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 14
+// ROWS: Top to bottom, COLS: Left to right
+
+#define MATRIX_ROW_PINS {B15,A9,B7,A1,A2}
+#define MATRIX_COL_PINS {A3,A4,F1,F0,C15,C14,C13,B9,B8,B6,B5,B4,B3,A15}
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+#define QMK_ESC_OUTPUT A3 // usually COL
+#define QMK_ESC_INPUT B14 // usually ROW
+
+#define RGBLED_NUM 12
+#define WS2812_EXTERNAL_PULLUP
+#define RGB_DI_PIN A8
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#define RGBLIGHT_EFFECT_SNAKE
+#define RGBLIGHT_EFFECT_KNIGHT
+#define RGBLIGHT_EFFECT_CHRISTMAS
+#define RGBLIGHT_EFFECT_STATIC_GRADIENT
+#define RGBLIGHT_EFFECT_RGB_TEST
+#define RGBLIGHT_EFFECT_ALTERNATING
+#define RGBLIGHT_EFFECT_TWINKLE
+
+#define LED_CAPS_LOCK_PIN A10
+
+#define BACKLIGHT_LEVELS 5
diff --git a/keyboards/4pplet/aekiso60/rev_b/info.json b/keyboards/4pplet/aekiso60/rev_b/info.json
new file mode 100644
index 0000000000..948c6f6515
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/info.json
@@ -0,0 +1,85 @@
+{
+    "keyboard_name": "AEKISO60 Rev B",
+    "manufacturer": "4pplet",
+    "url": "",
+    "maintainer": "4pplet",
+    "usb": {
+        "vid": "0x4444",
+        "pid": "0x0011",
+        "device_version": "0.0.2"
+    },
+    "layouts": {
+        "LAYOUT_all": {
+            "layout": [
+                {"x":0, "y":0, "w":1.25},
+                {"x":1.25, "y":0},
+                {"x":2.25, "y":0},
+                {"x":3.25, "y":0},
+                {"x":4.25, "y":0},
+                {"x":5.25, "y":0},
+                {"x":6.25, "y":0},
+                {"x":7.25, "y":0},
+                {"x":8.25, "y":0},
+                {"x":9.25, "y":0},
+                {"x":10.25, "y":0},
+                {"x":11.25, "y":0},
+                {"x":12.25, "y":0},
+                {"x":13.25, "y":0, "w":1.75},
+
+                {"x":0, "y":1, "w":1.75},
+                {"x":1.75, "y":1},
+                {"x":2.75, "y":1},
+                {"x":3.75, "y":1},
+                {"x":4.75, "y":1},
+                {"x":5.75, "y":1},
+                {"x":6.75, "y":1},
+                {"x":7.75, "y":1},
+                {"x":8.75, "y":1},
+                {"x":9.75, "y":1},
+                {"x":10.75, "y":1},
+                {"x":11.75, "y":1},
+                {"x":12.75, "y":1},
+
+                {"x":0, "y":2, "w":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":12, "y":2},
+                {"x":13, "y":2},
+                {"x":14, "y":1, "h":2},
+
+                {"x":0, "y":3, "w":1.5},
+                {"x":1.5, "y":3},
+                {"x":2.5, "y":3},
+                {"x":3.5, "y":3},
+                {"x":4.5, "y":3},
+                {"x":5.5, "y":3},
+                {"x":6.5, "y":3},
+                {"x":7.5, "y":3},
+                {"x":8.5, "y":3},
+                {"x":9.5, "y":3},
+                {"x":10.5, "y":3},
+                {"x":11.5, "y":3},
+                {"x":12.5, "y":3, "w":1.5},
+                {"x":14, "y":3},
+
+                {"x":0, "y":4, "w":1.5},
+                {"x":1.5, "y":4, "w":1.25},
+                {"x":2.75, "y":4, "w":1.5},
+                {"x":4.25, "y":4, "w":2.75},
+                {"x":7, "y":4},
+                {"x":8, "y":4, "w":2.75},
+                {"x":10.75, "y":4, "w":1.5},
+                {"x":12.25, "y":4, "w":1.25},
+                {"x":13.5, "y":4, "w":1.5}
+            ]
+        }
+    }
+}
diff --git a/keyboards/4pplet/aekiso60/rev_b/readme.md b/keyboards/4pplet/aekiso60/rev_b/readme.md
new file mode 100644
index 0000000000..e90bd0c5fc
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/readme.md
@@ -0,0 +1,21 @@
+# AEKISO60
+
+A 60% PCB enabling use of ISO AEK keycaps and ALPS switches
+
+More info: https://geekhack.org/index.php?topic=103627.0
+
+* Keyboard Maintainer: [4pplet](https://github.com/4pplet)
+* Hardware Supported: AEKISO60
+
+Make example for this keyboard (after setting up your build environment):
+
+    make 4pplet/aekiso60/rev_a:default
+    make 4pplet/aekiso60/rev_b: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).
+
+How to enter bootloader (DFU):
+* Tap the physical reset button or short the reset-header (labled RESET) on tha back of the PCB for keyboard to enter DFU. When in DFU, it's ready to flash the firmware.
+
+Alternative option if the firmware is already pre-flashed:
+* Unplug your keyboard, hold down the Spacebar and B at the same time, plug in your keyboard and wait a second before releasing the keys. The keyboard will enter DFU and is ready to flash the firmware.
diff --git a/keyboards/4pplet/aekiso60/rev_b/rev_b.c b/keyboards/4pplet/aekiso60/rev_b/rev_b.c
new file mode 100644
index 0000000000..4928bbc23a
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/rev_b.c
@@ -0,0 +1,19 @@
+/*
+Copyright 2022 Stefan Sundin "4pplet" <4pplet@protonmail.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 "rev_b.h"
+
+
diff --git a/keyboards/4pplet/aekiso60/rev_b/rev_b.h b/keyboards/4pplet/aekiso60/rev_b/rev_b.h
new file mode 100644
index 0000000000..64320025e3
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/rev_b.h
@@ -0,0 +1,48 @@
+/*
+Copyright 2022 Stefan Sundin "4pplet" <4pplet@protonmail.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"
+
+/* LAYOUT_all
+ * ┌────┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬──────┐
+ * │00  │01 │02 │03 │04 │05 │06 │07 │08 │09 │0a │0b │0c │0d    │
+ * ├────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤
+ * │10    │11 │12 │13 │14 │15 │16 │17 │18 │19 │1a │1b │1c │    │
+ * ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐1d │
+ * │20     │21 │22 │23 │24 │25 │26 │27 │28 │29 │2a │2b │2c │   │
+ * ├─────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┤
+ * │30   │31 │32 │33 │34 │35 │36 │37 │38 │39 │3a │3b │3c   │3d │
+ * ├─────┼───┴┬──┴──┬┴───┴───┴─┬─┴─┬─┴───┴───┴┬──┴──┬┴───┬─┴───┤
+ * │40   │41  │43   │44        │45 │46        │48   │4a  │4b   │
+ * └─────┴────┴─────┴──────────┴───┴──────────┴─────┴────┴─────┘
+ */
+#define LAYOUT_all( \
+    k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \
+    k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c,      \
+    k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k1d, \
+    k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \
+    k40, k41, k43,      k44,      k45,      k46,           k48, k4a, k4b  \
+) \
+{ \
+    {k00, k01, k02,   k03, k04, k05, k06, k07,   k08, k09,   k0a, k0b, k0c,     k0d},  \
+    {k10, k11, k12,   k13, k14, k15, k16, k17,   k18, k19,   k1a, k1b, k1c,     k1d},  \
+    {k20, k21, k22,   k23, k24, k25, k26, k27,   k28, k29,   k2a, k2b, k2c,     KC_NO},\
+    {k30, k31, k32,   k33, k34, k35, k36, k37,   k38, k39,   k3a, k3b, k3c,     k3d},  \
+    {k40, k41, KC_NO, k43, k44, k45, k46, KC_NO, k48, KC_NO, k4a, k4b, KC_NO,   KC_NO} \
+}
diff --git a/keyboards/4pplet/aekiso60/rev_b/rules.mk b/keyboards/4pplet/aekiso60/rev_b/rules.mk
new file mode 100644
index 0000000000..8dc60fa527
--- /dev/null
+++ b/keyboards/4pplet/aekiso60/rev_b/rules.mk
@@ -0,0 +1,24 @@
+# MCU name
+MCU = STM32F072
+
+# 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 = no         # Console for debug
+COMMAND_ENABLE = no         # Commands for debug and configuration
+NKRO_ENABLE = yes            # Enable N-Key Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes        # Enable keyboard RGB underglow
+AUDIO_ENABLE = no           # Audio output
+
+# Wildcard to allow APM32 MCU
+DFU_SUFFIX_ARGS = -p FFFF -v FFFF
+
+# Enter lower-power sleep mode when on the ChibiOS idle thread
+OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE