From 356561c438766df09e8b90a81778b2053e319a6a Mon Sep 17 00:00:00 2001
From: Quentin <qlebastard@gmail.com>
Date: Thu, 12 Aug 2021 16:45:42 +0200
Subject: [PATCH] [Keyboard] Add Skeletyl keyboard (#13495)

Co-authored-by: Albert Y <76888457+filterpaper@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
---
 keyboards/bastardkb/skeletyl/config.h         | 57 +++++++++++++++
 keyboards/bastardkb/skeletyl/info.json        | 49 +++++++++++++
 .../skeletyl/keymaps/default/keymap.c         | 70 +++++++++++++++++++
 keyboards/bastardkb/skeletyl/readme.md        | 17 +++++
 keyboards/bastardkb/skeletyl/rules.mk         | 33 +++++++++
 keyboards/bastardkb/skeletyl/skeletyl.c       | 57 +++++++++++++++
 keyboards/bastardkb/skeletyl/skeletyl.h       | 37 ++++++++++
 7 files changed, 320 insertions(+)
 create mode 100644 keyboards/bastardkb/skeletyl/config.h
 create mode 100644 keyboards/bastardkb/skeletyl/info.json
 create mode 100644 keyboards/bastardkb/skeletyl/keymaps/default/keymap.c
 create mode 100644 keyboards/bastardkb/skeletyl/readme.md
 create mode 100644 keyboards/bastardkb/skeletyl/rules.mk
 create mode 100644 keyboards/bastardkb/skeletyl/skeletyl.c
 create mode 100644 keyboards/bastardkb/skeletyl/skeletyl.h

diff --git a/keyboards/bastardkb/skeletyl/config.h b/keyboards/bastardkb/skeletyl/config.h
new file mode 100644
index 0000000000..2431f59df4
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/config.h
@@ -0,0 +1,57 @@
+/* 
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@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 "config_common.h"
+#define VENDOR_ID 0xA8F8
+#define PRODUCT_ID 0x1830
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Bastard Keyboards
+#define PRODUCT Skeletyl
+
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 5
+#define RGBLIGHT_LIMIT_VAL 180
+#define MATRIX_ROW_PINS { B5, F7, F6, B6 }
+#define MATRIX_COL_PINS { E6, C6, B1, B3, B2 }
+
+#define DIODE_DIRECTION ROW2COL
+
+#define RGB_DI_PIN D2
+#define RGBLED_NUM 36
+#define RGBLED_SPLIT { 18, 18 }
+#define RGBLIGHT_ANIMATIONS
+
+#define DEBOUNCE 5
+
+#define SOFT_SERIAL_PIN D0
+
+#define USB_POLLING_INTERVAL_MS 1
+#define MASTER_RIGHT
+
+// RGB matrix support
+#ifdef RGB_MATRIX_ENABLE
+#    define SPLIT_TRANSPORT_MIRROR
+#    define DRIVER_LED_TOTAL 36 // Number of LEDs
+#    define RGB_MATRIX_SPLIT { 18, 18 }
+#    define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50
+#    define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
+#    ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
+#        define RGB_DISABLE_WHEN_USB_SUSPENDED true
+#    endif
+#    define RGB_MATRIX_KEYPRESSES
+#endif
diff --git a/keyboards/bastardkb/skeletyl/info.json b/keyboards/bastardkb/skeletyl/info.json
new file mode 100644
index 0000000000..d7ebf80147
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/info.json
@@ -0,0 +1,49 @@
+{
+    "keyboard_name": "Skeletyl",
+    "url": "https://www.bastardkb.com",
+    "maintainer": "Quentin Lebastard",
+    "width": 17,
+    "height": 4,
+    "layouts": {
+        "LAYOUT_split_3x5_3": {
+            "layout": [
+                {"label":"L00", "x":0, "y":0},
+                {"label":"L01", "x":1, "y":0},
+                {"label":"L02", "x":2, "y":0},
+                {"label":"L03", "x":3, "y":0},
+                {"label":"L04", "x":4, "y":0},
+                {"label":"R00", "x":11, "y":0},
+                {"label":"R01", "x":12, "y":0},
+                {"label":"R02", "x":13, "y":0},
+                {"label":"R03", "x":14, "y":0},
+                {"label":"R04", "x":15, "y":0},
+                {"label":"L10", "x":0, "y":1},
+                {"label":"L11", "x":1, "y":1},
+                {"label":"L12", "x":2, "y":1},
+                {"label":"L13", "x":3, "y":1},
+                {"label":"L14", "x":4, "y":1},
+                {"label":"R10", "x":11, "y":1},
+                {"label":"R11", "x":12, "y":1},
+                {"label":"R12", "x":13, "y":1},
+                {"label":"R13", "x":14, "y":1},
+                {"label":"R14", "x":15, "y":1},
+                {"label":"L20", "x":0, "y":2},
+                {"label":"L21", "x":1, "y":2},
+                {"label":"L22", "x":2, "y":2},
+                {"label":"L23", "x":3, "y":2},
+                {"label":"L24", "x":4, "y":2},
+                {"label":"R20", "x":11, "y":2},
+                {"label":"R21", "x":12, "y":2},
+                {"label":"R22", "x":13, "y":2},
+                {"label":"R23", "x":14, "y":2},
+                {"label":"R24", "x":15, "y":2},
+                {"label":"L33", "x":4, "y":3},
+                {"label":"L34", "x":5, "y":3},
+                {"label":"L31", "x":6, "y":3},
+                {"label":"R33", "x":9, "y":3},
+                {"label":"R34", "x":10, "y":3},
+                {"label":"R31", "x":11, "y":3}
+            ]
+        }
+    }
+}
diff --git a/keyboards/bastardkb/skeletyl/keymaps/default/keymap.c b/keyboards/bastardkb/skeletyl/keymaps/default/keymap.c
new file mode 100644
index 0000000000..56e56d9a43
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/keymaps/default/keymap.c
@@ -0,0 +1,70 @@
+/* 
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@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 QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+  [0] = LAYOUT_split_3x5_3(
+  //,-----------------------------------------------------.                    ,-----------------------------------------------------.
+       KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,                         KC_Y,    KC_U,    KC_I,    KC_O,   KC_P,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      KC_A,    KC_S,    KC_D,    KC_F,    KC_G,                         KC_H,    KC_J,    KC_K,    KC_L, KC_SCLN,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,                         KC_N,    KC_M, KC_COMM,  KC_DOT, KC_SLSH, 
+  //|--------+--------+--------+--------+--------+--------+--------|  |--------+--------+--------+--------+--------+--------+--------|
+                                          KC_LGUI, KC_SPC  ,  MO(1),     MO(2), KC_ENT , KC_RALT
+                                      //`--------------------------'  `--------------------------'
+
+  ),
+
+  [1] = LAYOUT_split_3x5_3(
+  //,-----------------------------------------------------.                    ,-----------------------------------------------------.
+      KC_1,    KC_2,    KC_3,    KC_4,    KC_5,                         KC_6,    KC_7,    KC_8,    KC_9,    KC_0,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                      KC_LEFT, KC_DOWN,   KC_UP,KC_RIGHT, XXXXXXX,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+  //|--------+--------+--------+--------+--------+--------+--------|  |--------+--------+--------+--------+--------+--------+--------|
+                                          KC_LGUI, KC_SPC,  _______,     MO(3), KC_ENT, KC_RALT
+                                      //`--------------------------'  `--------------------------'
+  ),
+
+  [2] = LAYOUT_split_3x5_3(
+  //,-----------------------------------------------------.                    ,-----------------------------------------------------.
+      KC_EXLM,   KC_AT, KC_HASH,  KC_DLR, KC_PERC,                      KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                      KC_MINS,  KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                      KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
+  //|--------+--------+--------+--------+--------+--------+--------|  |--------+--------+--------+--------+--------+--------+--------|
+                                          KC_LGUI,  KC_SPC,  MO(3),     _______, KC_ENT, KC_RALT
+                                      //`--------------------------'  `--------------------------'
+  ),
+
+  [3] = LAYOUT_split_3x5_3(
+  //,-----------------------------------------------------.                    ,-----------------------------------------------------.
+      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX,                      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+  //|--------+--------+--------+--------+--------+--------|                    |--------+--------+--------+--------+--------+--------|
+      RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX,                      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+  //|--------+--------+--------+--------+--------+--------+--------|  |--------+--------+--------+--------+--------+--------+--------|
+                                          KC_LGUI,  KC_SPC, _______,     _______, KC_ENT, KC_RALT
+                                      //`--------------------------'  `--------------------------'
+  )
+};
diff --git a/keyboards/bastardkb/skeletyl/readme.md b/keyboards/bastardkb/skeletyl/readme.md
new file mode 100644
index 0000000000..6c36b58356
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/readme.md
@@ -0,0 +1,17 @@
+# Skeletyl
+
+A very small keyboard made for ergonomic enthusiasts.
+
+* Keyboard Maintainer: [Bastard Keyboards](https://github.com/Bastardkb/)
+* Hardware Supported: elite-C V4
+* Hardware Availability: [Bastardkb.com](https://bastardkb.com/)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make bastardkb/skeletyl:default
+    
+This keyboard is made to be used with the Miryoku layout, do not use the default keymap.
+
+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).
+
+See the [keyboard build instructions](http://docs.bastardkb.com/)
diff --git a/keyboards/bastardkb/skeletyl/rules.mk b/keyboards/bastardkb/skeletyl/rules.mk
new file mode 100644
index 0000000000..1afabf51c3
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/rules.mk
@@ -0,0 +1,33 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
+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
+# 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 = no        # Enable keyboard RGB underglow
+RGB_MATRIX_ENABLE = yes     # Enable keyboard RGB matrix (do not use together with RGBLIGHT_ENABLE)
+RGB_MATRIX_DRIVER = WS2812  # RGB matrix driver support
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+SPLIT_KEYBOARD = yes
+TAP_DANCE_ENABLE = no
+LTO_ENABLE = yes
+
+AUDIO_SUPPORTED = no
+RGB_MATRIX_SUPPORTED = yes
+RGBLIGHT_SUPPORTED = yes
+
+LAYOUTS = split_3x5_3
diff --git a/keyboards/bastardkb/skeletyl/skeletyl.c b/keyboards/bastardkb/skeletyl/skeletyl.c
new file mode 100644
index 0000000000..057465b4a8
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/skeletyl.c
@@ -0,0 +1,57 @@
+/* 
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@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 "skeletyl.h"
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = { {
+    // left
+    {  0,  5,  6, 11, 12 },
+    {  1,  4,  7, 10, 13 },
+    {  2,  3,  8,  9, 14 },
+    { 15, NO_LED, 16, 17, NO_LED },
+    // right
+    { 18, 23, 24, 29, 30 },
+    { 19, 22, 25, 28, 31 },
+    { 20, 21, 26, 27, 32 },
+    { 33, NO_LED, 34, 35, NO_LED }
+}, {
+    // left
+    {   0,   0 }, {   0,  21 }, {   0,  42 }, // col 1
+    {  25,  42 }, {  25,  21 }, {  25,   0 }, // col 2
+    {  50,   0 }, {  50,  21 }, {  50,  42 },
+    {  74,  42 }, {  74,  21 }, {  74,   0 },
+    {  99,   0 }, {  99,  21 }, {  99,  42 },
+    {  50,  64 }, {  74,  64 }, {  99,  64 }, // left thumb cluster
+    // right
+    { 224,   0 }, { 224,  21 }, { 224,  42 }, // col 10
+    { 198,  42 }, { 198,  21 }, { 198,   0 }, // col 9
+    { 174,   0 }, { 174,  21 }, { 174,  42 },
+    { 149,  42 }, { 149,  21 }, { 149,   0 },
+    { 124,   0 }, { 124,  21 }, { 124,  42 },
+    { 174,  64 }, { 149,  64 }, { 124,  64 }  // right thumb cluster
+}, {
+    // left
+    4, 4, 4, 4, 4, 4, 4,
+    4, 4, 4, 4, 4, 4, 4, 4,
+    2, 2, 2,
+    // right
+    4, 4, 4, 4, 4, 4, 4,
+    4, 4, 4, 4, 4, 4, 4, 4,
+    2, 2, 2
+} };
+#endif
diff --git a/keyboards/bastardkb/skeletyl/skeletyl.h b/keyboards/bastardkb/skeletyl/skeletyl.h
new file mode 100644
index 0000000000..36399567ff
--- /dev/null
+++ b/keyboards/bastardkb/skeletyl/skeletyl.h
@@ -0,0 +1,37 @@
+/* 
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@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"
+
+#define LAYOUT_split_3x5_3( \
+	k00, k01, k02, k03, k04,     			k44, k43, k42, k41, k40, \
+	k10, k11, k12, k13, k14,	    		k54, k53, k52, k51, k50, \
+	k20, k21, k22, k23, k24,    			k64, k63, k62, k61, k60, \
+		       k33, k34, k31,		        k71, k74, k73  \
+)\
+{\
+	{ k00, k01, k02, k03, k04 }, \
+	{ k10, k11, k12, k13, k14 }, \
+	{ k20, k21, k22, k23, k24 }, \
+	{ k31, KC_NO, k33, k34, KC_NO }, \
+	{ k40, k41, k42, k43, k44 }, \
+	{ k50, k51, k52, k53, k54 }, \
+	{ k60, k61, k62, k63, k64 }, \
+	{ k71, KC_NO, k73, k74, KC_NO }, \
+}