From 4d5abe1e74e8306bbef91bee75989d8efe6812d3 Mon Sep 17 00:00:00 2001
From: eason <98533237+EasonQian1@users.noreply.github.com>
Date: Tue, 7 Feb 2023 15:54:10 +0800
Subject: [PATCH] [Keyboard] Add aeroboard (#19087)

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: jack <0x6a73@protonmail.com>
---
 keyboards/eason/aeroboard/aeroboard.c         |  4 +
 keyboards/eason/aeroboard/aeroboard.h         | 30 ++++++
 keyboards/eason/aeroboard/config.h            | 37 ++++++++
 keyboards/eason/aeroboard/halconf.h           |  8 ++
 keyboards/eason/aeroboard/info.json           | 91 +++++++++++++++++++
 .../eason/aeroboard/keymaps/default/keymap.c  | 23 +++++
 .../eason/aeroboard/keymaps/via/keymap.c      | 36 ++++++++
 .../eason/aeroboard/keymaps/via/rules.mk      |  2 +
 keyboards/eason/aeroboard/mcuconf.h           |  9 ++
 keyboards/eason/aeroboard/readme.md           | 22 +++++
 keyboards/eason/aeroboard/rules.mk            | 16 ++++
 11 files changed, 278 insertions(+)
 create mode 100644 keyboards/eason/aeroboard/aeroboard.c
 create mode 100644 keyboards/eason/aeroboard/aeroboard.h
 create mode 100644 keyboards/eason/aeroboard/config.h
 create mode 100644 keyboards/eason/aeroboard/halconf.h
 create mode 100644 keyboards/eason/aeroboard/info.json
 create mode 100644 keyboards/eason/aeroboard/keymaps/default/keymap.c
 create mode 100644 keyboards/eason/aeroboard/keymaps/via/keymap.c
 create mode 100644 keyboards/eason/aeroboard/keymaps/via/rules.mk
 create mode 100644 keyboards/eason/aeroboard/mcuconf.h
 create mode 100644 keyboards/eason/aeroboard/readme.md
 create mode 100644 keyboards/eason/aeroboard/rules.mk

diff --git a/keyboards/eason/aeroboard/aeroboard.c b/keyboards/eason/aeroboard/aeroboard.c
new file mode 100644
index 0000000000..091fcf2fac
--- /dev/null
+++ b/keyboards/eason/aeroboard/aeroboard.c
@@ -0,0 +1,4 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "aeroboard.h"
diff --git a/keyboards/eason/aeroboard/aeroboard.h b/keyboards/eason/aeroboard/aeroboard.h
new file mode 100644
index 0000000000..a623670b2d
--- /dev/null
+++ b/keyboards/eason/aeroboard/aeroboard.h
@@ -0,0 +1,30 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+
+ #pragma once
+
+ #include "quantum.h"
+
+ #define ___ KC_NO
+/* This is a shortcut to help you visually see your layout.
+ *
+ * The first section contains all of the arguments representing the physical
+ * layout of the board and position of the keys.
+ *
+ * The second converts the arguments into a two-dimensional array which
+ * represents the switch matrix.
+ */
+#define LAYOUT( \
+        K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D,K0E,K0F, \
+        K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D,K1E,K1F, \
+        K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C,     K2E,K2F, \
+        K30, K31,      K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D,K3E,K3F, \
+        K40, K41,      K43,      K45,      K47,      K49,      K4B,      K4D,K4E,K4F  \
+) { \
+        { K00,  K01,  K02,  K03,   K04,   K05, K06,   K07,   K08,   K09, K0A, K0B,   K0C,   K0D,K0E,K0F}, \
+        { K10,  K11,  K12,  K13,   K14,   K15, K16,   K17,   K18,   K19, K1A, K1B,   K1C,   K1D,K1E,K1F}, \
+        { K20,  K21,  K22,  K23,   K24,   K25, K26,   K27,   K28,   K29, K2A, K2B,   K2C,   ___,K2E,K2F}, \
+        { K30,  K31,  ___,  K33,   K34,   K35, K36,   K37,   K38,   K39, K3A, K3B,   K3C,   K3D,K3E,K3F}, \
+        { K40,  K41,  ___,  K43,   ___,   K45, ___,   K47,   ___,   K49, ___, K4B,   ___,   K4D,K4E,K4F}  \
+}
diff --git a/keyboards/eason/aeroboard/config.h b/keyboards/eason/aeroboard/config.h
new file mode 100644
index 0000000000..3c23bce9be
--- /dev/null
+++ b/keyboards/eason/aeroboard/config.h
@@ -0,0 +1,37 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define MATRIX_COL_PINS { B9, B8, B7, B6, B5, B4, B3, B11, A15, A10, A9, B14, B13, B12, A5, A4 }
+#define MATRIX_ROW_PINS { B10, B1, B0, A7, A6 }
+#define DIODE_DIRECTION COL2ROW
+
+#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 RGB_DI_PIN B15
+#define RGBLED_NUM 20
+#define WS2812_SPI SPID2
+#define WS2812_SPI_MOSI_PAL_MODE 5
+
+#define FORCE_NKRO
+
+
+/* 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
diff --git a/keyboards/eason/aeroboard/halconf.h b/keyboards/eason/aeroboard/halconf.h
new file mode 100644
index 0000000000..7dda577da1
--- /dev/null
+++ b/keyboards/eason/aeroboard/halconf.h
@@ -0,0 +1,8 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define HAL_USE_SPI TRUE
+
+#include_next <halconf.h>
diff --git a/keyboards/eason/aeroboard/info.json b/keyboards/eason/aeroboard/info.json
new file mode 100644
index 0000000000..498f5da92e
--- /dev/null
+++ b/keyboards/eason/aeroboard/info.json
@@ -0,0 +1,91 @@
+{
+    "keyboard_name": "AeroBoard",
+    "manufacturer": "Eason",
+    "url": "",
+    "maintainer": "Eason",
+    "usb": {
+        "vid": "0x8954",
+        "pid": "0x8870",
+        "device_version": "0.0.1"
+    },
+    "processor": "STM32F103",
+    "bootloader": "stm32duino",
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                {"x": 0, "y": 0},
+                {"x": 1.75, "y": 0},
+                {"x": 2.75, "y": 0},
+                {"x": 3.75, "y": 0},
+                {"x": 4.75, "y": 0},
+                {"x": 5.75, "y": 0},
+                {"x": 6.75, "y": 0},
+                {"x": 7.75, "y": 0},
+                {"x": 8.75, "y": 0},
+                {"x": 9.75, "y": 0},
+                {"x": 10.75, "y": 0},
+                {"x": 11.75, "y": 0},
+                {"x": 12.75, "y": 0},
+                {"x": 13.75, "y": 0},
+                {"x": 14.75, "y": 0, "w": 2},
+                {"x": 16.75, "y": 0},
+                {"x": 0, "y": 1},
+                {"x": 1.75, "y": 1, "w": 1.5},
+                {"x": 3.25, "y": 1},
+                {"x": 4.25, "y": 1},
+                {"x": 5.25, "y": 1},
+                {"x": 6.25, "y": 1},
+                {"x": 7.25, "y": 1},
+                {"x": 8.25, "y": 1},
+                {"x": 9.25, "y": 1},
+                {"x": 10.25, "y": 1},
+                {"x": 11.25, "y": 1},
+                {"x": 12.25, "y": 1},
+                {"x": 13.25, "y": 1},
+                {"x": 14.25, "y": 1},
+                {"x": 15.25, "y": 1, "w": 1.5},
+                {"x": 16.75, "y": 1},
+                {"x": 0, "y": 2},
+                {"x": 1.75, "y": 2, "w": 1.75},
+                {"x": 3.5, "y": 2},
+                {"x": 4.5, "y": 2},
+                {"x": 5.5, "y": 2},
+                {"x": 6.5, "y": 2},
+                {"x": 7.5, "y": 2},
+                {"x": 8.5, "y": 2},
+                {"x": 9.5, "y": 2},
+                {"x": 10.5, "y": 2},
+                {"x": 11.5, "y": 2},
+                {"x": 12.5, "y": 2},
+                {"x": 13.5, "y": 2},
+                {"x": 14.5, "y": 2, "w": 2.25},
+                {"x": 16.75, "y": 2},
+                {"x": 0, "y": 3},
+                {"x": 1.75, "y": 3, "w": 2.25},
+                {"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},
+                {"x": 12, "y": 3},
+                {"x": 13, "y": 3},
+                {"x": 14, "y": 3, "w": 1.75},
+                {"x": 15.75, "y": 3},
+                {"x": 16.75, "y": 3},
+                {"x": 0, "y": 4},
+                {"x": 1.75, "y": 4, "w": 1.5},
+                {"x": 4, "y": 4, "w": 1.5},
+                {"x": 5.5, "y": 4, "w": 3},
+                {"x": 8.5, "y": 4},
+                {"x": 9.5, "y": 4, "w": 3},
+                {"x": 12.5, "y": 4, "w": 1.5},
+                {"x": 14.75, "y": 4},
+                {"x": 15.75, "y": 4},
+                {"x": 16.75, "y": 4}
+           ]
+        }
+    }
+}
diff --git a/keyboards/eason/aeroboard/keymaps/default/keymap.c b/keyboards/eason/aeroboard/keymaps/default/keymap.c
new file mode 100644
index 0000000000..61f2a90364
--- /dev/null
+++ b/keyboards/eason/aeroboard/keymaps/default/keymap.c
@@ -0,0 +1,23 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+ #include QMK_KEYBOARD_H
+
+ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+   [0] = LAYOUT(
+       KC_ESC,  KC_1,    KC_GRV,  KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, KC_DEL,
+       KC_MINS, KC_Q,    KC_TAB,  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_PGUP,
+       KC_PLUS, KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,           KC_ENT, KC_PGDN,
+       MO(1)  , KC_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,   KC_UP,   MO(1),
+       KC_LGUI, KC_LCTL,         KC_LALT,          KC_SPC,           KC_SPC,           KC_SPC,            KC_RALT,          KC_LEFT, KC_DOWN, KC_RGHT
+   ),
+   [1] = LAYOUT(
+       KC_HOME,   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_PSCR,
+       _______, _______,  _______,   KC_UP,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,QK_BOOT,  KC_PAUS,
+       _______, _______,  KC_LEFT, KC_DOWN,  KC_RGHT, _______, _______,  _______, _______, _______, _______, _______, _______,        _______,  KC_INS,
+       _______, _______,           _______,  _______, _______, _______,  _______, _______, _______, _______, _______, KC_MUTE,_______, KC_VOLU, _______,
+       _______, _______,           _______,           _______,           _______,          _______,          _______,         KC_MPRV, KC_VOLD, KC_MNXT
+   ),
+
+ };
diff --git a/keyboards/eason/aeroboard/keymaps/via/keymap.c b/keyboards/eason/aeroboard/keymaps/via/keymap.c
new file mode 100644
index 0000000000..614c3daa02
--- /dev/null
+++ b/keyboards/eason/aeroboard/keymaps/via/keymap.c
@@ -0,0 +1,36 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+ #include QMK_KEYBOARD_H
+
+ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+   [0] = LAYOUT(
+       KC_ESC,  KC_1,    KC_GRV,  KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, KC_DEL,
+       KC_MINS, KC_Q,    KC_TAB,  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_PGUP,
+       KC_PLUS, KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,           KC_ENT, KC_PGDN,
+       MO(1)  , KC_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT,   KC_UP,   MO(1),
+       KC_LGUI, KC_LCTL,         KC_LALT,          KC_SPC,           KC_SPC,           KC_SPC,            KC_RALT,          KC_LEFT, KC_DOWN, KC_RGHT
+   ),
+   [1] = LAYOUT(
+       KC_HOME,   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_PSCR,
+       _______, _______,  _______,   KC_UP,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,QK_BOOT,  KC_PAUS,
+       _______, _______,  KC_LEFT, KC_DOWN,  KC_RGHT, _______, _______,  _______, _______, _______, _______, _______, _______,        _______,  KC_INS,
+       _______, _______,           _______,  _______, _______, _______,  _______, _______, _______, _______, _______, KC_MUTE,_______, KC_VOLU, _______,
+       _______, _______,           _______,           _______,           _______,          _______,          _______,         KC_MPRV, KC_VOLD, KC_MNXT
+   ),
+   [2] = LAYOUT(
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,_______,  _______,
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,_______,  _______,
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,        _______,  _______,
+       _______, _______,           _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______, _______, _______,
+       _______, _______,           _______,           _______,           _______,          _______,          _______,         _______, _______, _______
+   ),
+   [3] = LAYOUT(
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,_______,  _______,
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______,_______,  _______,
+       _______, _______,  _______, _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,        _______,  _______,
+       _______, _______,           _______,  _______, _______, _______,  _______, _______, _______, _______, _______, _______,_______, _______, _______,
+       _______, _______,           _______,           _______,           _______,          _______,          _______,         _______, _______, _______
+   ),
+ };
diff --git a/keyboards/eason/aeroboard/keymaps/via/rules.mk b/keyboards/eason/aeroboard/keymaps/via/rules.mk
new file mode 100644
index 0000000000..36b7ba9cbc
--- /dev/null
+++ b/keyboards/eason/aeroboard/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
diff --git a/keyboards/eason/aeroboard/mcuconf.h b/keyboards/eason/aeroboard/mcuconf.h
new file mode 100644
index 0000000000..bac8fc07c5
--- /dev/null
+++ b/keyboards/eason/aeroboard/mcuconf.h
@@ -0,0 +1,9 @@
+// Copyright 2022 Eason
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <mcuconf.h>
+
+#undef STM32_SPI_USE_SPI2
+#define STM32_SPI_USE_SPI2 TRUE
diff --git a/keyboards/eason/aeroboard/readme.md b/keyboards/eason/aeroboard/readme.md
new file mode 100644
index 0000000000..6fe48adfd3
--- /dev/null
+++ b/keyboards/eason/aeroboard/readme.md
@@ -0,0 +1,22 @@
+# aeroboard
+
+A customizable hotswap 70% keyboard.
+
+* Keyboard Maintainer: [EASON](https://github.com/EasonQian1)
+* Hardware Supported: ab70lite
+* Hardware Availability: [EASON](https://github.com/EasonQian1)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make eason/aeroboard:default
+
+Flashing example for this keyboard:
+
+    make eason/aeroboard:default:flash
+
+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).
+
+## Bootloader Enter the bootloader in 3 ways:
+* **Bootmagic reset**: Hold down Enter in the keyboard then replug
+* **Physical reset button**: Briefly press the button on the back of the PCB
+* **Keycode in layout**: Press the key mapped to `QK_BOOT`
diff --git a/keyboards/eason/aeroboard/rules.mk b/keyboards/eason/aeroboard/rules.mk
new file mode 100644
index 0000000000..edc3e666c4
--- /dev/null
+++ b/keyboards/eason/aeroboard/rules.mk
@@ -0,0 +1,16 @@
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = no       # 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
+SLEEP_LED_ENABLE = yes
+WS2812_DRIVER = spi
+# Enter lower-power sleep mode when on the ChibiOS idle thread
+OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE