From 2eeb30cd5ac755fcb8314ec6b39b56412f43baf1 Mon Sep 17 00:00:00 2001
From: Joel Schneider <jmschneider@users.noreply.github.com>
Date: Tue, 29 Sep 2020 00:25:53 -0400
Subject: [PATCH] [Keyboard] Add SiCK-PAD handwired keyboard (#10429)

* Add sick_pad

* Adjust setup for Proton C

* Add readme

* Add info.json

* Make requested changes

* Resolve PR issues
---
 keyboards/handwired/sick_pad/config.h         | 47 +++++++++++++++++++
 keyboards/handwired/sick_pad/info.json        | 34 ++++++++++++++
 .../sick_pad/keymaps/default/keymap.c         | 27 +++++++++++
 keyboards/handwired/sick_pad/readme.md        | 15 ++++++
 keyboards/handwired/sick_pad/rules.mk         | 20 ++++++++
 keyboards/handwired/sick_pad/sick_pad.c       | 17 +++++++
 keyboards/handwired/sick_pad/sick_pad.h       | 33 +++++++++++++
 7 files changed, 193 insertions(+)
 create mode 100644 keyboards/handwired/sick_pad/config.h
 create mode 100644 keyboards/handwired/sick_pad/info.json
 create mode 100644 keyboards/handwired/sick_pad/keymaps/default/keymap.c
 create mode 100644 keyboards/handwired/sick_pad/readme.md
 create mode 100644 keyboards/handwired/sick_pad/rules.mk
 create mode 100644 keyboards/handwired/sick_pad/sick_pad.c
 create mode 100644 keyboards/handwired/sick_pad/sick_pad.h

diff --git a/keyboards/handwired/sick_pad/config.h b/keyboards/handwired/sick_pad/config.h
new file mode 100644
index 0000000000..f431daf38e
--- /dev/null
+++ b/keyboards/handwired/sick_pad/config.h
@@ -0,0 +1,47 @@
+/* Copyright 2020 Joel Schneider
+  *
+  * 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"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID       0xFEED
+#define PRODUCT_ID      0xDA20
+#define DEVICE_VER      0x0001
+#define MANUFACTURER    FedorSosnin
+#define PRODUCT         SiCK-PAD
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 4
+
+/* key matrix pins */
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4 }
+#define MATRIX_COL_PINS { B9, B15, B14, B13 }
+#define UNUSED_PINS
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+/* 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
diff --git a/keyboards/handwired/sick_pad/info.json b/keyboards/handwired/sick_pad/info.json
new file mode 100644
index 0000000000..68ff6b40e8
--- /dev/null
+++ b/keyboards/handwired/sick_pad/info.json
@@ -0,0 +1,34 @@
+{
+    "keyboard_name": "sick_pad",
+    "url": "https://www.thingiverse.com/thing:3682168",
+    "maintainer": "jmschneider",
+    "width": 4,
+    "height": 5,
+    "layouts": {
+        "LAYOUT_numpad_5x4": {
+            "layout": [
+                {"x":0, "y":0},
+                {"x":1, "y":0},
+                {"x":2, "y":0},
+                {"x":3, "y":0},
+
+                {"x":0, "y":1},
+                {"x":1, "y":1},
+                {"x":2, "y":1},
+
+                {"x":0, "y":2},
+                {"x":1, "y":2},
+                {"x":2, "y":2},
+                {"x":3, "y":1, "h":2},
+
+                {"x":0, "y":3},
+                {"x":1, "y":3},
+                {"x":2, "y":3},
+
+                {"x":0, "y":4, "w":2},
+                {"x":2, "y":4},
+                {"x":3, "y":3, "h":2}
+            ]
+        }
+    }
+}
diff --git a/keyboards/handwired/sick_pad/keymaps/default/keymap.c b/keyboards/handwired/sick_pad/keymaps/default/keymap.c
new file mode 100644
index 0000000000..62e599faa3
--- /dev/null
+++ b/keyboards/handwired/sick_pad/keymaps/default/keymap.c
@@ -0,0 +1,27 @@
+/* Copyright 2020 Joel Schneider
+  *
+  * 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_numpad_5x4(
+        KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
+        KC_P7,   KC_P8,   KC_P9,
+        KC_P4,   KC_P5,   KC_P6, KC_PPLS,
+        KC_P1,   KC_P2,   KC_P3,
+                 KC_P0,   KC_PDOT, KC_PENT
+    )
+};
diff --git a/keyboards/handwired/sick_pad/readme.md b/keyboards/handwired/sick_pad/readme.md
new file mode 100644
index 0000000000..5d3879c405
--- /dev/null
+++ b/keyboards/handwired/sick_pad/readme.md
@@ -0,0 +1,15 @@
+# SiCK-PAD
+
+![SiCK-PAD](https://cdn.thingiverse.com/assets/79/f6/22/c5/93/IMG_7816.JPG)
+
+The SiCK-PAD is a custom 3D printed mechanical numpad built from scratch without the price tag often associated with one.
+
+-   Keyboard Maintainer: [jmschneider](https://github.com/jmschneider)
+-   Hardware Supported: QMK Proton C
+-   Hardware Availability: [files to print and documentation](https://www.thingiverse.com/thing:3682168)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make handwired/sick_pad: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/handwired/sick_pad/rules.mk b/keyboards/handwired/sick_pad/rules.mk
new file mode 100644
index 0000000000..bfe731ecce
--- /dev/null
+++ b/keyboards/handwired/sick_pad/rules.mk
@@ -0,0 +1,20 @@
+# MCU name
+MCU = STM32F303
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no       # Mouse keys
+EXTRAKEY_ENABLE = no       # 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 = no            # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
+LAYOUTS = numpad_5x4
diff --git a/keyboards/handwired/sick_pad/sick_pad.c b/keyboards/handwired/sick_pad/sick_pad.c
new file mode 100644
index 0000000000..3464545fef
--- /dev/null
+++ b/keyboards/handwired/sick_pad/sick_pad.c
@@ -0,0 +1,17 @@
+/* Copyright 2020 Joel Schneider
+  *
+  * 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 "sick_pad.h"
diff --git a/keyboards/handwired/sick_pad/sick_pad.h b/keyboards/handwired/sick_pad/sick_pad.h
new file mode 100644
index 0000000000..2fe82388de
--- /dev/null
+++ b/keyboards/handwired/sick_pad/sick_pad.h
@@ -0,0 +1,33 @@
+/* Copyright 2020 Joel Schneider
+  *
+  * 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_numpad_5x4( \
+	K00, K01, K02, K03, \
+	K10, K11, K12,      \
+	K20, K21, K22, K23, \
+	K30, K31, K32,      \
+	     K41, K42, K43  \
+) { \
+	{ K00,   K01,   K02,   K03 }, \
+	{ K10,   K11,   K12,   KC_NO }, \
+	{ K20,   K21,   K22,   K23 }, \
+	{ K30,   K31,   K32,   KC_NO }, \
+	{ KC_NO, K41,   K42,   K43 }  \
+}